Added new feature to keep Background Document and Deviation Documents in Sync as the user moves through the procedure.

Added manual ping on btnStepRTF.  This is for testing Ping logic when running in debug (visual Studio)
Changed security to allow SetAdministrator to perform some Admin functions.
Support multiple windows by VersionID.
This commit is contained in:
Rich 2015-09-12 15:43:07 +00:00
parent ba94c537cc
commit 8280b4976f
3 changed files with 160 additions and 30 deletions

View File

@ -42,6 +42,8 @@ namespace VEPROMS
this.btnGeneral = new DevComponents.DotNetBar.ButtonX();
this.tcSysOpts = new DevComponents.DotNetBar.TabControl();
this.tabControlPanel3 = new DevComponents.DotNetBar.TabControlPanel();
this.groupPanel8 = new DevComponents.DotNetBar.Controls.GroupPanel();
this.cbEnhancedDocumentSync = new DevComponents.DotNetBar.Controls.CheckBoxX();
this.groupPanel7 = new DevComponents.DotNetBar.Controls.GroupPanel();
this.cbPastePlainText = new DevComponents.DotNetBar.Controls.CheckBoxX();
this.cbPasteNoReturns = new DevComponents.DotNetBar.Controls.CheckBoxX();
@ -69,6 +71,7 @@ namespace VEPROMS
((System.ComponentModel.ISupportInitialize)(this.tcSysOpts)).BeginInit();
this.tcSysOpts.SuspendLayout();
this.tabControlPanel3.SuspendLayout();
this.groupPanel8.SuspendLayout();
this.groupPanel7.SuspendLayout();
this.groupPanel6.SuspendLayout();
this.groupPanel5.SuspendLayout();
@ -277,6 +280,7 @@ namespace VEPROMS
//
// tabControlPanel3
//
this.tabControlPanel3.Controls.Add(this.groupPanel8);
this.tabControlPanel3.Controls.Add(this.groupPanel7);
this.tabControlPanel3.Controls.Add(this.groupPanel6);
this.tabControlPanel3.Controls.Add(this.groupPanel5);
@ -299,6 +303,53 @@ namespace VEPROMS
this.tabControlPanel3.TabItem = this.tiIntrFaceStngs;
this.tabControlPanel3.ThemeAware = true;
//
// groupPanel8
//
this.groupPanel8.BackColor = System.Drawing.Color.Transparent;
this.groupPanel8.CanvasColor = System.Drawing.SystemColors.Control;
this.groupPanel8.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.Office2007;
this.groupPanel8.Controls.Add(this.cbEnhancedDocumentSync);
this.groupPanel8.Location = new System.Drawing.Point(223, 300);
this.groupPanel8.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.groupPanel8.Name = "groupPanel8";
this.groupPanel8.Size = new System.Drawing.Size(169, 100);
this.groupPanel8.Style.BackColor2SchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground2;
this.groupPanel8.Style.BackColorGradientAngle = 90;
this.groupPanel8.Style.BackColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground;
this.groupPanel8.Style.BorderBottom = DevComponents.DotNetBar.eStyleBorderType.Solid;
this.groupPanel8.Style.BorderBottomWidth = 1;
this.groupPanel8.Style.BorderColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder;
this.groupPanel8.Style.BorderLeft = DevComponents.DotNetBar.eStyleBorderType.Solid;
this.groupPanel8.Style.BorderLeftWidth = 1;
this.groupPanel8.Style.BorderRight = DevComponents.DotNetBar.eStyleBorderType.Solid;
this.groupPanel8.Style.BorderRightWidth = 1;
this.groupPanel8.Style.BorderTop = DevComponents.DotNetBar.eStyleBorderType.Solid;
this.groupPanel8.Style.BorderTopWidth = 1;
this.groupPanel8.Style.CornerDiameter = 4;
this.groupPanel8.Style.CornerType = DevComponents.DotNetBar.eCornerType.Rounded;
this.groupPanel8.Style.TextAlignment = DevComponents.DotNetBar.eStyleTextAlignment.Center;
this.groupPanel8.Style.TextColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelText;
this.groupPanel8.Style.TextLineAlignment = DevComponents.DotNetBar.eStyleTextAlignment.Near;
this.groupPanel8.StyleMouseDown.CornerType = DevComponents.DotNetBar.eCornerType.Square;
this.groupPanel8.StyleMouseOver.CornerType = DevComponents.DotNetBar.eCornerType.Square;
this.groupPanel8.TabIndex = 9;
this.groupPanel8.Text = "Enhanced Documents";
//
// cbEnhancedDocumentSync
//
this.cbEnhancedDocumentSync.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square;
this.cbEnhancedDocumentSync.Checked = true;
this.cbEnhancedDocumentSync.CheckState = System.Windows.Forms.CheckState.Checked;
this.cbEnhancedDocumentSync.CheckValue = "Y";
this.cbEnhancedDocumentSync.Font = new System.Drawing.Font("Microsoft Sans Serif", 7.8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.cbEnhancedDocumentSync.Location = new System.Drawing.Point(10, 10);
this.cbEnhancedDocumentSync.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.cbEnhancedDocumentSync.Name = "cbEnhancedDocumentSync";
this.cbEnhancedDocumentSync.Size = new System.Drawing.Size(123, 23);
this.cbEnhancedDocumentSync.TabIndex = 9;
this.cbEnhancedDocumentSync.Text = "Sync Navigation";
this.cbEnhancedDocumentSync.CheckedChanged += cbEnhancedDocumentSync_CheckedChanged;
//
// groupPanel7
//
this.groupPanel7.BackColor = System.Drawing.Color.Transparent;
@ -799,6 +850,7 @@ namespace VEPROMS
}
#endregion
private DevComponents.DotNetBar.ButtonX btnCancel;
@ -835,6 +887,8 @@ namespace VEPROMS
private DevComponents.DotNetBar.Controls.GroupPanel groupPanel6;
private DevComponents.DotNetBar.Controls.GroupPanel groupPanel7;
private DevComponents.DotNetBar.Controls.CheckBoxX cbTVExpand;
private DevComponents.DotNetBar.Controls.GroupPanel groupPanel8;
private DevComponents.DotNetBar.Controls.CheckBoxX cbEnhancedDocumentSync;

View File

@ -59,6 +59,14 @@ namespace VEPROMS
cbTVExpand.Checked = Settings.Default.SaveTreeviewExpanded;
cbPasteNoReturns.Checked = Settings.Default.PasteNoReturns;
cbPastePlainText.Checked = Settings.Default.PastePlainText;
cbEnhancedDocumentSync.Checked = Settings.Default.SyncEnhancedDocuments;
}
private void cbEnhancedDocumentSync_CheckedChanged(object sender, System.EventArgs e)
{
if (!_initializing)
{
Settings.Default.SyncEnhancedDocuments = cbEnhancedDocumentSync.Checked;
}
}
private void cbPastePlainText_CheckedChanged(object sender, EventArgs e)
{

View File

@ -236,6 +236,8 @@ namespace VEPROMS
throw new Exception("Could not set PROMSBaseFormat");
if ((Database.LastDatabase ?? "") != (Database.SelectedDatabase ?? ""))
{
if(Properties.Settings.Default.VersionWindows != null)
Properties.Settings.Default.VersionWindows.Clear();
Properties.Settings.Default.MRIList = null;
Properties.Settings.Default.DefaultDB = Database.SelectedDatabase;
Properties.Settings.Default.Save();
@ -877,6 +879,8 @@ namespace VEPROMS
Settings.Default.Location = this.Location;
Settings.Default.Size = this.Size;
}
if(this.MyVersionWindowList != null)
Settings.Default.VersionWindows = this.MyVersionWindowList.ToSettings();
Settings.Default.WindowState = this.WindowState;
Settings.Default.QATItems = ribbonControl1.QatLayout;
SaveMRU();
@ -912,21 +916,24 @@ namespace VEPROMS
private void btnStepRTF_Click(object sender, System.EventArgs e)
{
MessageBox.Show("No implementation code");
//PingSession(null);
//if (tc.MyStepRTB != null)
//{
// StepConfig sc = new StepConfig(tc.MyStepRTB.MyItemInfo.MyContent.Config);
// if (sc.Step_SourceToBackground != null)
// OpenMyItem(sc.Step_SourceToBackground);
// if(sc.Step_BackgroundToSource != null)
// OpenMyItem(sc.Step_BackgroundToSource);
// Only simulate Threaded Timer Ping if in the debugger
if (System.Diagnostics.Process.GetCurrentProcess().ProcessName.ToLower().EndsWith("vshost"))
{
PingSession(null);
RefreshChanged(null);
//if (tc.MyStepRTB != null)
//{
// StepConfig sc = new StepConfig(tc.MyStepRTB.MyItemInfo.MyContent.Config);
// if (sc.Step_SourceToBackground != null)
// OpenMyItem(sc.Step_SourceToBackground);
// if(sc.Step_BackgroundToSource != null)
// OpenMyItem(sc.Step_BackgroundToSource);
//frmStepRTF frm = new frmStepRTF();
//frm.MyStepRTB = tc.MyStepRTB;
//frm.Show();
//}
//}
}
}
private SessionInfo MySessionInfo;
@ -983,30 +990,30 @@ namespace VEPROMS
if (MySessionInfo.ChangedItems.Count > 0)
{
foreach (int id in MySessionInfo.ChangedItems.Keys)
{
{
if (ItemInfo.IsInCache(id))
mUIContext.Post(MyFindNodeAndExpand, id);
}
}
}
if (MySessionInfo.ChangedContents.Count > 0)
foreach (int id in MySessionInfo.ChangedContents.Keys)
{
if (ContentInfo.IsInCache(id))
foreach (int id in MySessionInfo.ChangedContents.Keys)
{
ContentInfo ci = ContentInfo.Get(id);
//if (ci.LastChangedInt64 > MySessionInfo.LastChangedInt64)
if (MySessionInfo.LastContentChange >= ci.LastChangedInt64)
if (ContentInfo.IsInCache(id))
{
using (Content c = Content.Get(id))
{
ContentInfo.Refresh(c);
}
}
}
ContentInfo ci = ContentInfo.Get(id);
//if (ci.LastChangedInt64 > MySessionInfo.LastChangedInt64)
if (MySessionInfo.LastContentChange >= ci.LastChangedInt64)
{
using (Content c = Content.Get(id))
{
ContentInfo.Refresh(c);
}
}
}
lastChanged = MySessionInfo.ChangedContents[id];
}
MySessionInfo.ChangedItems.Clear();
MySessionInfo.ChangedContents.Clear();
MySessionInfo.ChangedContents.Clear();
if (lastChanged > 0)
{
MySessionInfo.LastContentChange = lastChanged;
@ -1034,6 +1041,7 @@ namespace VEPROMS
}
return true;
}
public VersionWindowList MyVersionWindowList;
public ContentInfo ci1;
public ContentInfo ci2;
public ContentInfo ci3;
@ -1082,13 +1090,14 @@ namespace VEPROMS
btnManageSecurity.Visible = isVisible;
btnUpdateFormats.Visible = isVisible;
btnResetSecurity.Visible = isVisible;
btnAdministrativeTools.Visible = isVisible;
btnAdministrativeTools.Visible = isVisible || HasSetAdministrator(ui);
tmrCloseTabItems = new Timer();
tmrCloseTabItems.Interval = 100;
tmrCloseTabItems.Tick += new EventHandler(tmrCloseTabItems_Tick);
tmrCloseTabItems.Enabled = true;
MySessionInfo = SessionInfo.BeginSession(Environment.MachineName, System.Diagnostics.Process.GetCurrentProcess().Id);
this.LastContentChange = MySessionInfo.LastContentChange;
_MyLog.WarnFormat("Original last content change {0}", this.LastContentChange);
RefreshLastChange();
if (MySessionInfo == null)
{
@ -1141,6 +1150,9 @@ namespace VEPROMS
tv.SelectedNode.Expand();
SetCaption(tv.SelectedNode as VETreeNode);
}
//get version windows settings
MyVersionWindowList = VersionWindowList.GetVersionWindowList(Properties.Settings.Default.VersionWindows);
tc.SyncEnhancedDocuments = Properties.Settings.Default.SyncEnhancedDocuments;
// Assign the Procedure Panel's title (heading)
epProcedures.TitleText = getProcedurePanelHeading();// get the panel heading
// if the procedure panel is expanded, make sure we enable the splitter so the user can resize the panel
@ -1158,6 +1170,7 @@ namespace VEPROMS
tc.Leave += new EventHandler(tc_Leave);
tc.StatusChanged += new DisplayTabControlStatusEvent(tc_StatusChanged);
tc.ToggleRibbonExpanded += new DisplayTabControlEvent(tc_ToggleRibbonExpanded);
tc.OpenEnhancedDocument += tc_OpenEnhancedDocument;
this.Deactivate += new EventHandler(frmVEPROMS_Deactivate);
if (VlnSettings.DemoMode) StepRTB.MyFontFamily = GetFamily("Bookman Old Style");
displaySearch1.Enter += new EventHandler(displaySearch1_Enter);
@ -1188,6 +1201,60 @@ namespace VEPROMS
//}
// RHM20150506 Multiline ItemID TextBox
this.txtSearch.Text = Volian.Base.Library.VlnSettings.GetCommand("ItemIDs", "").Replace(",","\r\n");
}
//public bool IsEnhancedDocumentOpen(ItemInfo ii)
//{
// if (tc.dicEnhancedDocuments.ContainsKey(ii.MyProcedure))
// return true;
// return false;
//}
void tc_OpenEnhancedDocument(object sender, ItemSelectedChangedEventArgs args)
{
if (!tc.dicEnhancedDocuments.ContainsKey(args.MyItemInfo.MyProcedure.MyDocVersion))
{
frmEnhanced frm = new frmEnhanced(args.MyItemInfo);
foreach(VersionWindow vw in MyVersionWindowList)
if (vw.VersionID == args.MyItemInfo.MyProcedure.MyDocVersion.VersionID)
{
frm.SetDesktopBounds(vw.MyRectangle.Left, vw.MyRectangle.Top, vw.MyRectangle.Width, vw.MyRectangle.Height);
break;
}
frm.Move += frmEnhancedDocumentResize;
frm.Resize += frmEnhancedDocumentResize;
frm.MySessionInfo = MySessionInfo;
tc.dicEnhancedDocuments.Add(args.MyItemInfo.MyProcedure.MyDocVersion, frm);
frm.FormClosed += frm_FormClosed;
frm.Show(this);
}
else
{
frmEnhanced frm = tc.dicEnhancedDocuments[args.MyItemInfo.MyProcedure.MyDocVersion];
frm.MyItemInfo = args.MyItemInfo;
frm.OpenItem();
}
}
void frmEnhancedDocumentResize(object sender, EventArgs e)
{
frmEnhanced frm = sender as frmEnhanced;
RectangleConverter rc = new RectangleConverter();
string str = string.Format("{0}~{1}", frm.MyItemInfo.MyProcedure.MyDocVersion.VersionID, rc.ConvertToString(frm.DesktopBounds));
MyVersionWindowList.Add(new VersionWindow(str));
}
void frm_FormClosed(object sender, FormClosedEventArgs e)
{
tc.dicEnhancedDocuments.Remove((sender as frmEnhanced).MyItemInfo.MyProcedure.MyDocVersion);
}
private bool HasSetAdministrator(UserInfo ui)
{
DocVersionInfoList dvil = DocVersionInfoList.Get();
foreach (DocVersionInfo dvi in dvil)
if (ui.IsSetAdministrator(dvi))
return true;
return false;
}
// RHM20150507 Table Scrunch
private TableScrunching _DefaultScrunchingRules = TableScrunching.Phase1 | TableScrunching.Phase5 | TableScrunching.Phase2 | TableScrunching.Phase3 | TableScrunching.Phase4 | TableScrunching.Phase5 | TableScrunching.Phase6 | TableScrunching.Phase7 | TableScrunching.Phase8;
@ -1474,7 +1541,7 @@ namespace VEPROMS
- Harrys PC- Harry-7100
- Caitlin- Caitlin-PC
*/
if ("|VOLIAN0|JCB2-HP|WINDOWS7-RHM|PAUL-PC|MICHELLE-PC|WIN-O4QLPEH7JKH|HARRY-7100|CAITLIN-PC|".Contains("|" + Environment.UserDomainName.ToUpper() + "|"))
if ("|VOLIAN0|JCB2-HP|BODINE-64|WINDOWS7-RHM|PAUL-PC|MICHELLE-PC|WIN-O4QLPEH7JKH|HARRY-7100|CAITLIN-PC|".Contains("|" + Environment.UserDomainName.ToUpper() + "|"))
{
Random rnd = new Random(DateTime.Now.Year + DateTime.Now.DayOfYear * 1000);
MessageBox.Show(this, GetSecurityKey(), "Today's Security Key");
@ -2328,6 +2395,7 @@ namespace VEPROMS
VeSysOpts.ShowDialog();
StepTabRibbon.PasteNoReturnsSetting = Properties.Settings.Default.PasteNoReturns;
StepTabRibbon.PastePlainTextSetting = Properties.Settings.Default.PastePlainText;
tc.SyncEnhancedDocuments = Properties.Settings.Default.SyncEnhancedDocuments;
}
/// <summary>
/// Exit button on the dialog that appears when the V icon is clicked (top left of application window)
@ -2670,8 +2738,8 @@ namespace VEPROMS
}
if (ctrlAnnotationDetails.Enabled && epAnnotations.Enabled)
{
ctrlAnnotationDetails.UpdateAnnotationGrid(_CurrentItem);
AnnotationPanelView();
ctrlAnnotationDetails.UpdateAnnotationGrid(_CurrentItem);
AnnotationPanelView();
}
btnPrint.Enabled = (_CurrentItem != null);
}