Added a new timer to fix a screen refresh issue with newly created steps that follow a template or were pasted via the Copy Step function.
This commit is contained in:
parent
1cb12b6fdc
commit
e3244fc59e
@ -19,7 +19,6 @@ using Volian.Controls.Library;
|
||||
using DescriptiveEnum;
|
||||
using Volian.Base.Library;
|
||||
using Volian.Print.Library;
|
||||
|
||||
[assembly: log4net.Config.XmlConfigurator(Watch = true)]
|
||||
|
||||
namespace VEPROMS
|
||||
@ -212,7 +211,6 @@ namespace VEPROMS
|
||||
VEPROMS.CSLA.Library.Database.ConnectionName = "VEPROMS_LOCAL";
|
||||
}
|
||||
InitializeComponent();
|
||||
|
||||
bottomProgBar.ValueChanged += new EventHandler(bottomProgBar_ValueChanged);
|
||||
|
||||
// When creating an XY Plot, a System.Drawing.Graphics is needed and it requires a form. Use the main
|
||||
@ -968,13 +966,47 @@ namespace VEPROMS
|
||||
return ((FolderConfig)jj_vetn.VEObject.MyConfig).Title; // get the panel heading
|
||||
}
|
||||
|
||||
private Timer _RefreshTimer;
|
||||
|
||||
public Timer RefreshTimer
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_RefreshTimer == null)
|
||||
{
|
||||
_RefreshTimer = new Timer();
|
||||
_RefreshTimer.Interval = 20000; //
|
||||
_RefreshTimer.Enabled = true;
|
||||
_RefreshTimer.Tick += _RefreshTimer_Tick;
|
||||
}
|
||||
return _RefreshTimer;
|
||||
}
|
||||
}
|
||||
private bool _RefreshTimerActive = false;
|
||||
|
||||
public bool RefreshTimerActive
|
||||
{
|
||||
get { return _RefreshTimerActive; }
|
||||
set { _RefreshTimerActive = value; }
|
||||
}
|
||||
void _RefreshTimer_Tick(object sender, EventArgs e)
|
||||
{
|
||||
_MyLog.DebugFormat("_RefreshTimer_Tick {0}", RefreshTimerActive);
|
||||
if (RefreshTimerActive)
|
||||
{
|
||||
RefreshTimerActive = false;
|
||||
RefreshChanged(this);
|
||||
}
|
||||
}
|
||||
|
||||
private void btnStepRTF_Click(object sender, System.EventArgs e)
|
||||
{
|
||||
// Only simulate Threaded Timer Ping if in the debugger
|
||||
if (System.Diagnostics.Process.GetCurrentProcess().ProcessName.ToLower().EndsWith("vshost"))
|
||||
{
|
||||
PingSession(null);
|
||||
RefreshChanged(null);
|
||||
StartRefreshChanged(null);
|
||||
//RefreshChanged(null);
|
||||
//if (tc.MyStepRTB != null)
|
||||
//{
|
||||
// StepConfig sc = new StepConfig(tc.MyStepRTB.MyItemInfo.MyContent.Config);
|
||||
@ -1015,6 +1047,7 @@ namespace VEPROMS
|
||||
WindowsFormsSynchronizationContext mUIContext = new WindowsFormsSynchronizationContext();
|
||||
public void MyFindNodeAndExpand(object obj)
|
||||
{
|
||||
if (tv == null || tv.SelectedNode == null) return;
|
||||
IVEDrillDownReadOnly veObj1 = ((tv.SelectedNode as VETreeNode).VEObject as IVEDrillDownReadOnly);
|
||||
int id = (int)obj;
|
||||
ItemInfo ii = ItemInfo.Get(id);
|
||||
@ -1034,19 +1067,30 @@ namespace VEPROMS
|
||||
if (tnNew != null) tv.SelectedNode = tnNew;
|
||||
}
|
||||
}
|
||||
private void StartRefreshChanged(Object obj)
|
||||
{
|
||||
_MyLog.Debug("StartRefreshChanged");
|
||||
//if (SkipRefresh) return;
|
||||
MySemaphore.WaitOne();
|
||||
RefreshTimerActive = true;
|
||||
MySemaphore.Release();
|
||||
}
|
||||
private void RefreshChanged(Object obj)
|
||||
{
|
||||
if (SkipRefresh) return;
|
||||
MySemaphore.WaitOne();
|
||||
//if (SkipRefresh) return;
|
||||
//MySemaphore.WaitOne();
|
||||
Int64 lastChanged = 0;
|
||||
|
||||
try
|
||||
{
|
||||
Int64 lastChanged = 0;
|
||||
//Int64 lastChanged = 0;
|
||||
if (MySessionInfo.ChangedItems.Count > 0)
|
||||
{
|
||||
foreach (int id in MySessionInfo.ChangedItems.Keys)
|
||||
{
|
||||
if (ItemInfo.IsInCache(id))
|
||||
mUIContext.Post(MyFindNodeAndExpand, id);
|
||||
//mUIContext.Post(MyFindNodeAndExpand, id);
|
||||
MyFindNodeAndExpand(id);
|
||||
}
|
||||
}
|
||||
if (MySessionInfo.ChangedContents.Count > 0)
|
||||
@ -1077,7 +1121,8 @@ namespace VEPROMS
|
||||
catch
|
||||
{
|
||||
}
|
||||
MySemaphore.Release();
|
||||
//MySemaphore.Release();
|
||||
//_MyLog.DebugFormat("{0},{1:X},{2:X},{3:X}", DateTime.Now.ToLongTimeString(), lastChanged, MySessionInfo.LastContentChange, MySessionInfo.LastChangedInt64);
|
||||
}
|
||||
private int TotalCount(TreeNodeCollection tns)
|
||||
{
|
||||
@ -1169,7 +1214,8 @@ namespace VEPROMS
|
||||
System.Threading.TimerCallback timerDelegate = new System.Threading.TimerCallback(this.PingSession);
|
||||
MyActivityTimer = new System.Threading.Timer(timerDelegate, autoEvent, 10000, 10000);
|
||||
System.Threading.Thread.Sleep(5000);
|
||||
System.Threading.TimerCallback timerRefresh = new System.Threading.TimerCallback(this.RefreshChanged);
|
||||
System.Threading.TimerCallback timerRefresh = new System.Threading.TimerCallback(this.StartRefreshChanged);
|
||||
RefreshTimer.Enabled = true;
|
||||
MyRefreshTimer = new System.Threading.Timer(timerRefresh, autoEvent, 10000, 10000);
|
||||
}
|
||||
|
||||
@ -2093,6 +2139,7 @@ namespace VEPROMS
|
||||
private bool _ExpandingTree=false;
|
||||
private void tv_BeforeExpand(object sender, TreeViewCancelEventArgs e)
|
||||
{
|
||||
//_MyLog.DebugFormat("tv_BeforeExpand \n{0}",Volian.Base.Library.vlnStackTrace.StackToStringLocal(2,10));
|
||||
_ExpandingTree = true;
|
||||
VETreeNode tn = ((VETreeNode)e.Node);
|
||||
tn.LoadingChildrenDone += new VETreeNodeEvent(tn_LoadingChildrenDone);
|
||||
@ -2314,6 +2361,7 @@ namespace VEPROMS
|
||||
/// <param name="args"></param>
|
||||
void tn_LoadingChildrenMax(object sender, VETreeNodeEventArgs args)
|
||||
{
|
||||
//_MyLog.DebugFormat("tn_LoadingChildrenMax \n{0}", Volian.Base.Library.vlnStackTrace.StackToStringLocal(2, 10));
|
||||
ProgBarMax = args.Value;
|
||||
ProgBarText = "Loading...";
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user