Added code to support refreshing display based on changes made by another user
This commit is contained in:
@@ -449,7 +449,7 @@ namespace VEPROMS
|
||||
{
|
||||
log4net.Appender.FileAppender fApp = (log4net.Appender.FileAppender)iApp;
|
||||
string folderPath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
|
||||
fApp.File = folderPath + @"\VEPROMS\" + NewFilename;
|
||||
fApp.File = folderPath + @"\VEPROMS\" + (Volian.Base.Library.VlnSettings.GetCommand("U","") + "_").TrimStart("_".ToCharArray()) + NewFilename;
|
||||
ErrorLogFileName = fApp.File;
|
||||
fApp.ActivateOptions();
|
||||
return true; // Appender found and name changed to NewFilename
|
||||
@@ -847,6 +847,7 @@ namespace VEPROMS
|
||||
|
||||
private SessionInfo MySessionInfo;
|
||||
private System.Threading.Timer MyActivityTimer;
|
||||
private System.Threading.Timer MyRefreshTimer;
|
||||
private DevComponents.DotNetBar.ButtonItem btnManageSecurity;
|
||||
private DevComponents.DotNetBar.ButtonItem btnResetSecurity;
|
||||
private DevComponents.DotNetBar.ButtonItem btnAdministrativeTools;
|
||||
@@ -855,17 +856,52 @@ namespace VEPROMS
|
||||
{
|
||||
get { return _MyCloseTabList; }
|
||||
}
|
||||
private int myCounterPingSession = 0;
|
||||
private int myCounterRefreshChanged = 0;
|
||||
private void PingSession(Object obj)
|
||||
{
|
||||
myCounterPingSession++;
|
||||
if (myCounterPingSession > 10)
|
||||
{
|
||||
_MyLog.InfoFormat("Ping Session at: {0} with LastChanged of: {1}", DateTime.Now.ToString("yyyyMMdd HHmmssnnn"), MySessionInfo.LastChanged);
|
||||
myCounterPingSession = 0;
|
||||
}
|
||||
MySemaphore.WaitOne();
|
||||
List<int> myList = MySessionInfo.PingSession();
|
||||
foreach (DisplayTabItem dti in tc.MyBar.Items)
|
||||
{
|
||||
if (!myList.Contains(dti.OwnerID))
|
||||
MyCloseTabList.PushDTI(dti);
|
||||
}
|
||||
MySemaphore.Release();
|
||||
}
|
||||
private void RefreshChanged(Object obj)
|
||||
{
|
||||
myCounterRefreshChanged++;
|
||||
if (myCounterRefreshChanged > 10)
|
||||
{
|
||||
_MyLog.InfoFormat("RefreshChanged at: {0} with LastChanged of: {1}", DateTime.Now.ToString("yyyyMMdd HHmmssnnn"), MySessionInfo.LastChanged);
|
||||
myCounterRefreshChanged = 0;
|
||||
}
|
||||
MySemaphore.WaitOne();
|
||||
string lastChanged = string.Empty;
|
||||
foreach (int id in MySessionInfo.ChangedContents.Keys)
|
||||
{
|
||||
using (Content c = Content.Get(id))
|
||||
{
|
||||
_MyLog.InfoFormat("Text of contentid: {0} is {1}", id, c.Text);
|
||||
ContentInfo.Refresh(c);
|
||||
lastChanged = MySessionInfo.ChangedContents[id];
|
||||
_MyLog.InfoFormat("Refreshing contentid: {0} with LastChanged of {1}", id, lastChanged);
|
||||
}
|
||||
}
|
||||
MySessionInfo.ChangedContents.Clear();
|
||||
if(lastChanged != string.Empty)
|
||||
MySessionInfo.LastChanged = lastChanged;
|
||||
MySemaphore.Release();
|
||||
}
|
||||
public Timer tmrCloseTabItems;
|
||||
|
||||
public System.Threading.Semaphore MySemaphore = new System.Threading.Semaphore(1, 1);
|
||||
private void frmVEPROMS_Load(object sender, EventArgs e)
|
||||
{
|
||||
InitializeSecurity();
|
||||
@@ -922,11 +958,15 @@ namespace VEPROMS
|
||||
tv.MySessionInfo = MySessionInfo;
|
||||
System.Threading.AutoResetEvent autoEvent = new System.Threading.AutoResetEvent(false);
|
||||
//System.Threading.TimerCallback timerDelegate = new System.Threading.TimerCallback(MySessionInfo.PingSession);
|
||||
System.Threading.TimerCallback timerDelegate = new System.Threading.TimerCallback(this.PingSession);
|
||||
|
||||
if (!System.Diagnostics.Process.GetCurrentProcess().ProcessName.ToLower().EndsWith("vshost"))
|
||||
//MyActivityTimer = new System.Threading.Timer(timerDelegate, autoEvent, 30000, 30000);
|
||||
//System.Diagnostics.Process xyzzy = System.Diagnostics.Process.GetCurrentProcess();
|
||||
if(!System.Diagnostics.Debugger.IsAttached)
|
||||
{
|
||||
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);
|
||||
MyRefreshTimer = new System.Threading.Timer(timerRefresh, autoEvent, 10000, 10000);
|
||||
}
|
||||
|
||||
//string debugMode = ConfigurationManager.AppSettings["Debug"];
|
||||
//VlnSettings.DebugMode = bool.Parse(debugMode); // set debug for the Volian.Controls.Library
|
||||
@@ -2220,8 +2260,7 @@ namespace VEPROMS
|
||||
{
|
||||
if (args.MyEditItem.MyItemInfo.IsSection || args.MyEditItem.MyItemInfo.IsProcedure)
|
||||
{
|
||||
infotabRO.Visible = false;
|
||||
infotabTransition.Visible = args.MyEditItem.MyItemInfo.ActiveFormat.PlantFormat.FormatData.TransData.AllowTransitionFromSection;
|
||||
infotabRO.Visible = infotabTransition.Visible = false;
|
||||
infotabTags.Visible = false;
|
||||
displayTags.Visible = false;
|
||||
}
|
||||
@@ -2779,9 +2818,9 @@ namespace VEPROMS
|
||||
{
|
||||
if (tc.SelectedDisplayTabItem != null && tc.SelectedDisplayTabItem.MyStepTabPanel.SelectedEditItem != null)
|
||||
{
|
||||
frmPropGrid pg = new frmPropGrid(tc.SelectedDisplayTabItem.MyStepTabPanel.SelectedEditItem, "EditItem");
|
||||
pg.Show();
|
||||
}
|
||||
frmPropGrid pg = new frmPropGrid(tc.SelectedDisplayTabItem.MyStepTabPanel.SelectedEditItem, "EditItem");
|
||||
pg.Show();
|
||||
}
|
||||
else
|
||||
MessageBox.Show("Select Item First", "Item not selected", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
|
||||
}
|
||||
|
Reference in New Issue
Block a user