diff --git a/PROMS/AdjustBuildRevision/Program.cs b/PROMS/AdjustBuildRevision/Program.cs
index 773f3aaf..b2a41b3c 100644
--- a/PROMS/AdjustBuildRevision/Program.cs
+++ b/PROMS/AdjustBuildRevision/Program.cs
@@ -1,6 +1,4 @@
using System;
-using System.Collections.Generic;
-using System.Text;
using System.IO;
using System.Text.RegularExpressions;
using System.Windows.Forms;
@@ -35,31 +33,7 @@ namespace AdjustBuildRevision
outline = Regex.Replace(line, @"([0-9]*)\.([0-9]*)\.([0-9]*)\.([0-9]*)""\)", DateTime.Now.ToString("2.4.yyMM.dHH") + "\")");
else
outline = Regex.Replace(line, @"([0-9]*)\.([0-9]*)\.([0-9]*)\.([0-9]*)""\)", DateTime.Now.ToString("2.3.yyMM.dHH") + "\")");
- // if (outline != line)
- // {
- // Console.WriteLine("Before: '{0}'", line);
- // Console.WriteLine("After: '{0}'", outline);
- // lines[i] = outline;
- // changed = true;
- // }
- // else
- // {
- // Console.WriteLine("No change: '{0}'", line);
- // }
- // }
- //}
- //if (changed)
- //{
- // if (!fi.IsReadOnly) fi.IsReadOnly = false;
- // StreamWriter sw = fi.CreateText();
- // foreach (string line in lines)
- // sw.WriteLine(line);
- // sw.Close();
- // string line = lines[i];
- // string outline = line;
- // if (line.Contains("AssemblyVersion") || line.Contains("AssemblyFileVersion"))
- // {
- //outline = Regex.Replace(line, @"([0-9]*)\.([0-9]*)\.([0-9]*)\.([0-9]*)""\)", DateTime.Now.ToString("1.1.yyMM.dHH") + "\")");
+
if (outline != line)
{
Console.WriteLine("Before: '{0}'", line);
@@ -84,7 +58,7 @@ namespace AdjustBuildRevision
}
else
{
- MessageBox.Show("File " + fi.FullName + " does not exist");
+ MessageBox.Show($"File {fi.FullName} does not exist");
}
}
catch (Exception ex)
@@ -93,10 +67,6 @@ namespace AdjustBuildRevision
}
}
- //private static DateTime GetLatestDateTime(string path)
- //{
- // return GetLatestDateTime(new DirectoryInfo(path));
- //}
private static DateTime GetLatestDateTime(DirectoryInfo di, DateTime dtCheck)
{
DateTime dtMax = dtCheck;
@@ -104,24 +74,14 @@ namespace AdjustBuildRevision
foreach(FileInfo myFile in myFiles)
{
DateTime dt = myFile.LastWriteTime;
- //if (dt > dtCheck)
- //{
- //Console.WriteLine("\"File\"\t\"{0}\"\t\"{1}\"\t{2}\t{3}",myFile.FullName,dt.ToString("1.1.yyMM.dHH"),dt,dtCheck);
- if(dtMax < dt) dtMax = dt;
- //}
+ if(dtMax < dt) dtMax = dt;
}
DirectoryInfo[] myFolders = di.GetDirectories();
foreach (DirectoryInfo diChild in myFolders)
{
DateTime dtChild = GetLatestDateTime(diChild,dtCheck);
- //if (dtChild > dtCheck)
- //{
- //Console.WriteLine("\"SubFolder\"\t\"{0}\"\t\"{1}\"\t{2}\t{3}", diChild.FullName, dtChild.ToString("1.1.yyMM.dHH"),dtChild,dtCheck);
- if(dtChild > dtMax) dtMax = dtChild;
- //}
+ if(dtChild > dtMax) dtMax = dtChild;
}
- //if(dtMax > dtCheck)
- // Console.WriteLine("\"Folder\"\t\"{0}\"\t\"{1}\"", di.FullName, dtMax.ToString("1.1.yyMM.dHH"));
return dtMax;
}
}
diff --git a/PROMS/DropDownPanel/Controls/DropDownPanel.cs b/PROMS/DropDownPanel/Controls/DropDownPanel.cs
index 49646260..660c8f85 100644
--- a/PROMS/DropDownPanel/Controls/DropDownPanel.cs
+++ b/PROMS/DropDownPanel/Controls/DropDownPanel.cs
@@ -1,6 +1,5 @@
using System;
using System.ComponentModel;
-using System.Diagnostics;
using System.Drawing;
using System.Windows.Forms;
@@ -15,7 +14,7 @@ namespace AT.STO.UI.Win
{
#region Private Variable Declarations
private IDropDownAware _dropDownControl = null;
- private DropDownWindowHelper _dropDownHelper = null;
+ private readonly DropDownWindowHelper _dropDownHelper = null;
private Form _owner = null;
#endregion
#region Constructor / Destructor
@@ -47,7 +46,7 @@ namespace AT.STO.UI.Win
///
protected override void OnHandleCreated(EventArgs e)
{
- _owner = this.FindForm();
+ _owner = FindForm();
_dropDownHelper.ReleaseHandle();
if (_owner != null)
@@ -66,8 +65,8 @@ namespace AT.STO.UI.Win
{
base.OnResize(e);
combo.Location = new Point(0, 0);
- combo.Width = this.ClientRectangle.Width;
- this.Height = combo.Height;
+ combo.Width = ClientRectangle.Width;
+ Height = combo.Height;
}
#endregion
#region Event Handler
@@ -96,7 +95,7 @@ namespace AT.STO.UI.Win
else
{
_dropDownHelper.CloseDropDown();
- this.Focus();
+ Focus();
}
}
@@ -115,7 +114,7 @@ namespace AT.STO.UI.Win
private void DropDownHelper_DropDownCancel(object sender, DropDownCancelEventArgs e)
{
- if (this.Bounds.Contains(Parent.PointToClient(e.CursorLocation)))
+ if (Bounds.Contains(Parent.PointToClient(e.CursorLocation)))
{
e.Cancel = true;
}
@@ -137,31 +136,22 @@ namespace AT.STO.UI.Win
{
SetValue(e.Value as ILookupItem);
}
-
- if (this.FinishEditing != null)
- {
- this.FinishEditing(this, e);
- }
-
- _dropDownControl.FinishEditing -= new DropDownValueChangedEventHandler(DropDown_FinishEditing);
+
+ FinishEditing?.Invoke(this, e);
+
+ _dropDownControl.FinishEditing -= new DropDownValueChangedEventHandler(DropDown_FinishEditing);
_dropDownControl.ValueChanged -= new DropDownValueChangedEventHandler(DropDown_ValueChanged);
_dropDownHelper.CloseDropDown();
}
-
- private void DropDown_ValueChanged(object sender, DropDownValueChangedEventArgs e)
- {
- if (this.ValueChanged != null)
- {
- this.ValueChanged(this, e);
- }
- }
- #endregion
- #region Public Properties
- ///
- /// Get or set the control (has to implement IDropDownAware) that is to
- /// be displayed as the dropdown portion of the combobox.
- ///
- [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+
+ private void DropDown_ValueChanged(object sender, DropDownValueChangedEventArgs e) => ValueChanged?.Invoke(this, e);
+ #endregion
+ #region Public Properties
+ ///
+ /// Get or set the control (has to implement IDropDownAware) that is to
+ /// be displayed as the dropdown portion of the combobox.
+ ///
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public IDropDownAware DropDownControl
{
get { return _dropDownControl; }
@@ -169,24 +159,21 @@ namespace AT.STO.UI.Win
{
_dropDownControl = value;
- this.Controls.Add(_dropDownControl as Control);
+ Controls.Add(_dropDownControl as Control);
}
}
- #endregion
- #region Public Methods
- public override string ToString()
- {
- return this.Name;
- }
- #endregion
- #region Private Methods
- ///
- /// Calculate an acceptable position of the DropDownForm even in a
- /// multi screen environment.
- ///
- ///
- ///
- private Point GetDropDownPosition(DropDownForm DropDown)
+ #endregion
+ #region Public Methods
+ public override string ToString() => Name;
+ #endregion
+ #region Private Methods
+ ///
+ /// Calculate an acceptable position of the DropDownForm even in a
+ /// multi screen environment.
+ ///
+ ///
+ ///
+ private Point GetDropDownPosition(DropDownForm DropDown)
{
Point lt = Parent.PointToScreen(new Point(Left, Top));
Point rb = Parent.PointToScreen(new Point(Right, Bottom));
diff --git a/PROMS/DropDownPanel/Events/Events.cs b/PROMS/DropDownPanel/Events/Events.cs
index e5659774..3abc20ee 100644
--- a/PROMS/DropDownPanel/Events/Events.cs
+++ b/PROMS/DropDownPanel/Events/Events.cs
@@ -35,10 +35,9 @@ namespace AT.STO.UI.Win
///
public class DropDownCancelEventArgs : EventArgs
{
- #region Private Variable Declarations
- private bool _cancel = false;
- private Point _cursorLocation;
- private Form _dropDown = null;
+ #region Private Variable Declarations
+ private Point _cursorLocation;
+ private readonly Form _dropDown = null;
#endregion
#region Constructor / Destructor
///
@@ -51,36 +50,26 @@ namespace AT.STO.UI.Win
{
_dropDown = DropDown;
_cursorLocation = CursorLocation;
- _cancel = false;
- }
- #endregion
- #region Public Properties
- ///
- ///
- ///
- public bool Cancel
- {
- get { return _cancel; }
- set { _cancel = value; }
+ Cancel = false;
}
+ #endregion
+ #region Public Properties
+ ///
+ ///
+ ///
+ public bool Cancel { get; set; } = false;
- ///
- ///
- ///
- public Point CursorLocation
- {
- get { return _cursorLocation; }
- }
+ ///
+ ///
+ ///
+ public Point CursorLocation => _cursorLocation;
- ///
- ///
- ///
- public Form DropDown
- {
- get { return _dropDown; }
- }
- #endregion
- }
+ ///
+ ///
+ ///
+ public Form DropDown => _dropDown;
+ #endregion
+ }
///
/// Contains event information for a event.
@@ -91,64 +80,50 @@ namespace AT.STO.UI.Win
public class DropDownClosedEventArgs : EventArgs
{
#region Private Variable Declarations
- private Form _dropDown = null;
- #endregion
- #region Constructor / Destructor
- ///
- /// Constructs a new instance of this class for the specified
- /// popup form.
- ///
- /// DropDown Form which is being closed.
- public DropDownClosedEventArgs(Form DropDown)
- {
- _dropDown = DropDown;
- }
- #endregion
- #region Public Properties
- ///
- /// Gets the dropdown form which is being closed.
- ///
- public Form DropDown
- {
- get { return _dropDown; }
- }
- #endregion
- }
+ private readonly Form _dropDown = null;
+ #endregion
+ #region Constructor / Destructor
+ ///
+ /// Constructs a new instance of this class for the specified
+ /// popup form.
+ ///
+ /// DropDown Form which is being closed.
+ public DropDownClosedEventArgs(Form DropDown) => _dropDown = DropDown;
+ #endregion
+ #region Public Properties
+ ///
+ /// Gets the dropdown form which is being closed.
+ ///
+ public Form DropDown => _dropDown;
+ #endregion
+ }
///
/// Contains event information for DropDownValueChangedEventHandler.
///
public class DropDownValueChangedEventArgs : EventArgs
{
- #region Private Variable Declarations
- private object _value = null;
- #endregion
- #region Constructor / Destructor
- ///
- /// Default Constructor
- ///
- public DropDownValueChangedEventArgs()
+ #region Private Variable Declarations
+ #endregion
+ #region Constructor / Destructor
+ ///
+ /// Default Constructor
+ ///
+ public DropDownValueChangedEventArgs()
{
}
-
- ///
- /// Initialization with the control's value.
- ///
- ///
- public DropDownValueChangedEventArgs(object Value)
- {
- _value = Value;
- }
- #endregion
- #region Public Properties
- ///
- /// Gets or sets the control's value.
- ///
- public object Value
- {
- get { return _value; }
- set { _value = value; }
- }
- #endregion
- }
+
+ ///
+ /// Initialization with the control's value.
+ ///
+ ///
+ public DropDownValueChangedEventArgs(object Value) => this.Value = Value;
+ #endregion
+ #region Public Properties
+ ///
+ /// Gets or sets the control's value.
+ ///
+ public object Value { get; set; } = null;
+ #endregion
+ }
}
diff --git a/PROMS/DropDownPanel/Forms/DropDownForm.cs b/PROMS/DropDownPanel/Forms/DropDownForm.cs
index c6923a15..4916bf2f 100644
--- a/PROMS/DropDownPanel/Forms/DropDownForm.cs
+++ b/PROMS/DropDownPanel/Forms/DropDownForm.cs
@@ -13,22 +13,19 @@ namespace AT.STO.UI.Win
internal partial class DropDownForm : Form, IDropDownAware
{
#region Private Variable Declaration
- private IDropDownAware _control = null;
- #endregion
- #region Constructor / Destructor
- ///
- /// Default Constructor
- ///
- public DropDownForm()
- {
- InitializeComponent();
- }
+ private readonly IDropDownAware _control = null;
+ #endregion
+ #region Constructor / Destructor
+ ///
+ /// Default Constructor
+ ///
+ public DropDownForm() => InitializeComponent();
- ///
- /// Constructor to initialize the for with the control to display.
- ///
- /// The control to display.
- public DropDownForm(IDropDownAware Ctrl) : this()
+ ///
+ /// Constructor to initialize the for with the control to display.
+ ///
+ /// The control to display.
+ public DropDownForm(IDropDownAware Ctrl) : this()
{
if (Ctrl != null)
{
@@ -41,7 +38,7 @@ namespace AT.STO.UI.Win
#region Form Events
protected override void OnClosing(CancelEventArgs e)
{
- this.Controls.Remove(_control as Control);
+ Controls.Remove(_control as Control);
base.OnClosing(e);
}
@@ -58,29 +55,20 @@ namespace AT.STO.UI.Win
#region Event Handler
private void Ctrl_FinishEditing(object sender, DropDownValueChangedEventArgs e)
{
- if (this.FinishEditing != null)
- {
- this.FinishEditing(this, e);
- }
+ FinishEditing?.Invoke(this, e);
- _control.FinishEditing -= new DropDownValueChangedEventHandler(Ctrl_FinishEditing);
+ _control.FinishEditing -= new DropDownValueChangedEventHandler(Ctrl_FinishEditing);
_control.ValueChanged -= new DropDownValueChangedEventHandler(Ctrl_ValueChanged);
}
-
- private void Ctrl_ValueChanged(object sender, DropDownValueChangedEventArgs e)
- {
- if (this.ValueChanged != null)
- {
- this.ValueChanged(this, e);
- }
- }
- #endregion
- #region IDropDownAware Implementation
- ///
- /// Fired either on OK, Cancel or a click outside the control to indicate
- /// that the user has finished editing.
- ///
- public event DropDownValueChangedEventHandler FinishEditing;
+
+ private void Ctrl_ValueChanged(object sender, DropDownValueChangedEventArgs e) => ValueChanged?.Invoke(this, e);
+ #endregion
+ #region IDropDownAware Implementation
+ ///
+ /// Fired either on OK, Cancel or a click outside the control to indicate
+ /// that the user has finished editing.
+ ///
+ public event DropDownValueChangedEventHandler FinishEditing;
///
/// Fired on any change of the controls's value during the editing process.
@@ -100,15 +88,15 @@ namespace AT.STO.UI.Win
private void InitializeControl(Control Ctrl)
{
Size size = Ctrl.Size;
- Size inner = this.ClientRectangle.Size;
- Size outer = this.Size;
+ Size inner = ClientRectangle.Size;
+ Size outer = Size;
int gap = outer.Width - inner.Width;
size.Width += gap;
size.Height += gap;
- this.Size = size;
- this.Controls.Add(Ctrl);
+ Size = size;
+ Controls.Add(Ctrl);
Ctrl.Location = new Point(0, 0);
Ctrl.Visible = true;
Ctrl.Invalidate();
diff --git a/PROMS/DropDownPanel/Helper/DropDownMessageFilter.cs b/PROMS/DropDownPanel/Helper/DropDownMessageFilter.cs
index cca60462..d0ad764d 100644
--- a/PROMS/DropDownPanel/Helper/DropDownMessageFilter.cs
+++ b/PROMS/DropDownPanel/Helper/DropDownMessageFilter.cs
@@ -1,4 +1,3 @@
-using System;
using System.Drawing;
using System.Windows.Forms;
@@ -21,59 +20,48 @@ namespace AT.STO.UI.Win
private const int WM_NCLBUTTONDOWN = 0x0A1;
private const int WM_NCRBUTTONDOWN = 0x0A4;
private const int WM_NCMBUTTONDOWN = 0x0A7;
- #endregion
- #region Private Variable Declarations
- private Form _dropDown = null;
- private DropDownWindowHelper _owner = null;
+ #endregion
+ #region Private Variable Declarations
+ private readonly DropDownWindowHelper _owner = null;
#endregion
#region Event Declarations
public event DropDownCancelEventHandler DropDownCancel;
- #endregion
- #region Constructor / Destructor
- ///
- /// Constructs a new instance of this class and sets the owning
- /// object.
- ///
- /// The object
- /// which owns this class.
- public DropDownMessageFilter(DropDownWindowHelper Owner)
- {
- _owner = Owner;
- }
- #endregion
- #region Public Properties
- ///
- /// Gets/sets the dropdown form which is being displayed.
- ///
- public Form DropDown
- {
- get { return _dropDown; }
- set { _dropDown = value; }
- }
- #endregion
- #region Private Methods
- private void OnMouseDown()
+ #endregion
+ #region Constructor / Destructor
+ ///
+ /// Constructs a new instance of this class and sets the owning
+ /// object.
+ ///
+ /// The object
+ /// which owns this class.
+ public DropDownMessageFilter(DropDownWindowHelper Owner) => _owner = Owner;
+ #endregion
+ #region Public Properties
+ ///
+ /// Gets/sets the dropdown form which is being displayed.
+ ///
+ public Form DropDown { get; set; } = null;
+ #endregion
+ #region Private Methods
+ private void OnMouseDown()
{
Point cursorPos = Cursor.Position; // Get the cursor location
- if (!_dropDown.Bounds.Contains(cursorPos)) // Check if it is within the popup form
+ if (!DropDown.Bounds.Contains(cursorPos)) // Check if it is within the popup form
{
- OnDropDownCancel(new DropDownCancelEventArgs(_dropDown, cursorPos)); // If not, then call to see if it should be closed
+ OnDropDownCancel(new DropDownCancelEventArgs(DropDown, cursorPos)); // If not, then call to see if it should be closed
}
}
#endregion
#region DropDownCancelEvent Implementation
protected virtual void OnDropDownCancel(DropDownCancelEventArgs e)
{
- if (this.DropDownCancel != null)
- {
- this.DropDownCancel(this, e);
- }
+ DropDownCancel?.Invoke(this, e);
- if (!e.Cancel)
+ if (!e.Cancel)
{
_owner.CloseDropDown();
- _dropDown = null; // Clear reference for GC
+ DropDown = null; // Clear reference for GC
}
}
#endregion
@@ -90,7 +78,7 @@ namespace AT.STO.UI.Win
/// This implementation always returns false.
public bool PreFilterMessage(ref Message m)
{
- if (_dropDown != null)
+ if (DropDown != null)
{
switch (m.Msg)
{
diff --git a/PROMS/DropDownPanel/Helper/DropDownWindowHelper.cs b/PROMS/DropDownPanel/Helper/DropDownWindowHelper.cs
index e3eb0308..2f291045 100644
--- a/PROMS/DropDownPanel/Helper/DropDownWindowHelper.cs
+++ b/PROMS/DropDownPanel/Helper/DropDownWindowHelper.cs
@@ -1,6 +1,5 @@
using System;
using System.Drawing;
-using System.Runtime.InteropServices;
using System.Windows.Forms;
namespace AT.STO.UI.Win
@@ -22,7 +21,7 @@ namespace AT.STO.UI.Win
private Form _dropDown = null;
private bool _dropDownShowing = false;
- private DropDownMessageFilter _filter = null;
+ private readonly DropDownMessageFilter _filter = null;
private Form _owner = null;
private bool _skipClose = false;
#endregion
@@ -42,31 +41,25 @@ namespace AT.STO.UI.Win
_filter.DropDownCancel -= new DropDownCancelEventHandler(Popup_Cancel);
_filter.DropDownCancel += new DropDownCancelEventHandler(Popup_Cancel);
}
- #endregion
- #region Event Handler
- private void Popup_Cancel(object sender, DropDownCancelEventArgs e)
- {
- OnDropDownCancel(e);
- }
+ #endregion
+ #region Event Handler
+ private void Popup_Cancel(object sender, DropDownCancelEventArgs e) => OnDropDownCancel(e);
- ///
- /// Responds to the
- /// event from the popup form.
- ///
- /// Popup form that has been closed.
- /// Not used.
- private void Popup_Closed(object sender, EventArgs e)
- {
- CloseDropDown();
- }
-
- ///
- /// Subclasses the owning form's existing Window Procedure to enables the
- /// title bar to remain active when a popup is show, and to detect if
- /// the user clicks onto another application whilst the popup is visible.
- ///
- /// Window Procedure Message
- protected override void WndProc(ref Message m)
+ ///
+ /// Responds to the
+ /// event from the popup form.
+ ///
+ /// Popup form that has been closed.
+ /// Not used.
+ private void Popup_Closed(object sender, EventArgs e) => CloseDropDown();
+
+ ///
+ /// Subclasses the owning form's existing Window Procedure to enables the
+ /// title bar to remain active when a popup is show, and to detect if
+ /// the user clicks onto another application whilst the popup is visible.
+ ///
+ /// Window Procedure Message
+ protected override void WndProc(ref Message m)
{
base.WndProc(ref m);
@@ -76,7 +69,7 @@ namespace AT.STO.UI.Win
{
if (((int)m.WParam) == 0) // Check if the title bar will made inactive:
{ // Note it's no good to try and consume this message; if you try to do that you'll end up with windows
- UIApiCalls.SendMessage(this.Handle, UIApiCalls.WM_NCACTIVATE, 1, IntPtr.Zero); // If so reactivate it.
+ UIApiCalls.SendMessage(Handle, UIApiCalls.WM_NCACTIVATE, 1, IntPtr.Zero); // If so reactivate it.
}
}
else if (m.Msg == UIApiCalls.WM_ACTIVATEAPP)
@@ -84,7 +77,7 @@ namespace AT.STO.UI.Win
if ((int)m.WParam == 0) // Check if the application is being deactivated.
{
CloseDropDown(); // It is so cancel the popup:
- UIApiCalls.PostMessage(this.Handle, UIApiCalls.WM_NCACTIVATE, 0, IntPtr.Zero); // And put the title bar into the inactive state:
+ UIApiCalls.PostMessage(Handle, UIApiCalls.WM_NCACTIVATE, 0, IntPtr.Zero); // And put the title bar into the inactive state:
}
}
}
@@ -168,22 +161,19 @@ namespace AT.STO.UI.Win
_owner = null;
}
}
- #endregion
- #region Public Properties
- ///
- /// Indicator weither the DropDown is showing.
- ///
- public bool DropDownShowing
+ #endregion
+ #region Public Properties
+ ///
+ /// Indicator weither the DropDown is showing.
+ ///
+ public bool DropDownShowing => _dropDownShowing;
+ #endregion
+ #region Event Implementation
+ protected virtual void OnDropDownCancel(DropDownCancelEventArgs e)
{
- get { return _dropDownShowing; }
- }
- #endregion
- #region Event Implementation
- protected virtual void OnDropDownCancel(DropDownCancelEventArgs e)
- {
- if (this.DropDownCancel != null)
+ if (DropDownCancel != null)
{
- this.DropDownCancel(this, e);
+ DropDownCancel(this, e);
if (!e.Cancel)
{
@@ -191,14 +181,8 @@ namespace AT.STO.UI.Win
}
}
}
-
- protected virtual void OnPDropDownClosed(DropDownClosedEventArgs e)
- {
- if (this.DropDownClosed != null)
- {
- this.DropDownClosed(this, e);
- }
- }
- #endregion
- }
+
+ protected virtual void OnPDropDownClosed(DropDownClosedEventArgs e) => DropDownClosed?.Invoke(this, e);
+ #endregion
+ }
}
diff --git a/PROMS/DropDownPanel/Interfaces/IDropDownAware.cs b/PROMS/DropDownPanel/Interfaces/IDropDownAware.cs
index 94874f2b..b5dd43ab 100644
--- a/PROMS/DropDownPanel/Interfaces/IDropDownAware.cs
+++ b/PROMS/DropDownPanel/Interfaces/IDropDownAware.cs
@@ -1,5 +1,3 @@
-using System;
-
namespace AT.STO.UI.Win
{
///
diff --git a/PROMS/DropDownPanel/Interfaces/ILookupItem.cs b/PROMS/DropDownPanel/Interfaces/ILookupItem.cs
index b3181e2a..7470b14a 100644
--- a/PROMS/DropDownPanel/Interfaces/ILookupItem.cs
+++ b/PROMS/DropDownPanel/Interfaces/ILookupItem.cs
@@ -1,5 +1,3 @@
-using System;
-
namespace AT.STO.UI.Win
{
public interface ILookupItem where T: struct
diff --git a/PROMS/FlexableMessageBox/FlexibleMessageBox.cs b/PROMS/FlexableMessageBox/FlexibleMessageBox.cs
index 535b983a..1eb8b401 100644
--- a/PROMS/FlexableMessageBox/FlexibleMessageBox.cs
+++ b/PROMS/FlexableMessageBox/FlexibleMessageBox.cs
@@ -1,8 +1,6 @@
using System;
using System.Diagnostics;
using System.Drawing;
-using System.Globalization;
-//using System.Linq;
using System.Windows.Forms;
@@ -121,10 +119,7 @@ namespace JR.Utils.GUI.Forms
///
/// The text.
/// The dialog result.
- public static DialogResult Show(string text)
- {
- return FlexibleMessageBoxForm.Show(null, text, string.Empty, MessageBoxButtons.OK, MessageBoxIcon.None, MessageBoxDefaultButton.Button1);
- }
+ public static DialogResult Show(string text) => FlexibleMessageBoxForm.Show(null, text, string.Empty, MessageBoxButtons.OK, MessageBoxIcon.None, MessageBoxDefaultButton.Button1);
///
/// Shows the specified message box.
@@ -132,10 +127,7 @@ namespace JR.Utils.GUI.Forms
/// The owner.
/// The text.
/// The dialog result.
- public static DialogResult Show(IWin32Window owner, string text)
- {
- return FlexibleMessageBoxForm.Show(owner, text, string.Empty, MessageBoxButtons.OK, MessageBoxIcon.None, MessageBoxDefaultButton.Button1);
- }
+ public static DialogResult Show(IWin32Window owner, string text) => FlexibleMessageBoxForm.Show(owner, text, string.Empty, MessageBoxButtons.OK, MessageBoxIcon.None, MessageBoxDefaultButton.Button1);
///
/// Shows the specified message box.
@@ -143,10 +135,7 @@ namespace JR.Utils.GUI.Forms
/// The text.
/// The caption.
/// The dialog result.
- public static DialogResult Show(string text, string caption)
- {
- return FlexibleMessageBoxForm.Show(null, text, caption, MessageBoxButtons.OK, MessageBoxIcon.None, MessageBoxDefaultButton.Button1);
- }
+ public static DialogResult Show(string text, string caption) => FlexibleMessageBoxForm.Show(null, text, caption, MessageBoxButtons.OK, MessageBoxIcon.None, MessageBoxDefaultButton.Button1);
///
/// Shows the specified message box.
@@ -155,10 +144,7 @@ namespace JR.Utils.GUI.Forms
/// The text.
/// The caption.
/// The dialog result.
- public static DialogResult Show(IWin32Window owner, string text, string caption)
- {
- return FlexibleMessageBoxForm.Show(owner, text, caption, MessageBoxButtons.OK, MessageBoxIcon.None, MessageBoxDefaultButton.Button1);
- }
+ public static DialogResult Show(IWin32Window owner, string text, string caption) => FlexibleMessageBoxForm.Show(owner, text, caption, MessageBoxButtons.OK, MessageBoxIcon.None, MessageBoxDefaultButton.Button1);
///
/// Shows the specified message box.
@@ -167,10 +153,7 @@ namespace JR.Utils.GUI.Forms
/// The caption.
/// The buttons.
/// The dialog result.
- public static DialogResult Show(string text, string caption, MessageBoxButtons buttons)
- {
- return FlexibleMessageBoxForm.Show(null, text, caption, buttons, MessageBoxIcon.None, MessageBoxDefaultButton.Button1);
- }
+ public static DialogResult Show(string text, string caption, MessageBoxButtons buttons) => FlexibleMessageBoxForm.Show(null, text, caption, buttons, MessageBoxIcon.None, MessageBoxDefaultButton.Button1);
///
/// Shows the specified message box.
@@ -180,10 +163,7 @@ namespace JR.Utils.GUI.Forms
/// The caption.
/// The buttons.
/// The dialog result.
- public static DialogResult Show(IWin32Window owner, string text, string caption, MessageBoxButtons buttons)
- {
- return FlexibleMessageBoxForm.Show(owner, text, caption, buttons, MessageBoxIcon.None, MessageBoxDefaultButton.Button1);
- }
+ public static DialogResult Show(IWin32Window owner, string text, string caption, MessageBoxButtons buttons) => FlexibleMessageBoxForm.Show(owner, text, caption, buttons, MessageBoxIcon.None, MessageBoxDefaultButton.Button1);
///
/// Shows the specified message box.
@@ -193,10 +173,7 @@ namespace JR.Utils.GUI.Forms
/// The buttons.
/// The icon.
///
- public static DialogResult Show(string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon)
- {
- return FlexibleMessageBoxForm.Show(null, text, caption, buttons, icon, MessageBoxDefaultButton.Button1);
- }
+ public static DialogResult Show(string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon) => FlexibleMessageBoxForm.Show(null, text, caption, buttons, icon, MessageBoxDefaultButton.Button1);
///
/// Shows the specified message box.
@@ -207,10 +184,7 @@ namespace JR.Utils.GUI.Forms
/// The buttons.
/// The icon.
/// The dialog result.
- public static DialogResult Show(IWin32Window owner, string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon)
- {
- return FlexibleMessageBoxForm.Show(owner, text, caption, buttons, icon, MessageBoxDefaultButton.Button1);
- }
+ public static DialogResult Show(IWin32Window owner, string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon) => FlexibleMessageBoxForm.Show(owner, text, caption, buttons, icon, MessageBoxDefaultButton.Button1);
///
/// Shows the specified message box.
@@ -221,10 +195,7 @@ namespace JR.Utils.GUI.Forms
/// The icon.
/// The default button.
/// The dialog result.
- public static DialogResult Show(string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon, MessageBoxDefaultButton defaultButton)
- {
- return FlexibleMessageBoxForm.Show(null, text, caption, buttons, icon, defaultButton);
- }
+ public static DialogResult Show(string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon, MessageBoxDefaultButton defaultButton) => FlexibleMessageBoxForm.Show(null, text, caption, buttons, icon, defaultButton);
///
/// Shows the specified message box.
@@ -236,10 +207,7 @@ namespace JR.Utils.GUI.Forms
/// The icon.
/// The default button.
/// The dialog result.
- public static DialogResult Show(IWin32Window owner, string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon, MessageBoxDefaultButton defaultButton)
- {
- return FlexibleMessageBoxForm.Show(owner, text, caption, buttons, icon, defaultButton);
- }
+ public static DialogResult Show(IWin32Window owner, string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon, MessageBoxDefaultButton defaultButton) => FlexibleMessageBoxForm.Show(owner, text, caption, buttons, icon, defaultButton);
///
/// Shows the specified message box.
@@ -251,10 +219,8 @@ namespace JR.Utils.GUI.Forms
/// The icon.
/// The default button.
/// The dialog result.
- public static DialogResult ShowCustom(IWin32Window owner, string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon)
- {
- return FlexibleMessageBoxForm.ShowCustom(null, text, caption, buttons, icon);
- }
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE0060:Remove unused parameter", Justification = "Keeping owner for legacy reasons")]
+ public static DialogResult ShowCustom(IWin32Window owner, string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon) => FlexibleMessageBoxForm.ShowCustom(null, text, caption, buttons, icon);
#endregion
@@ -341,7 +307,7 @@ namespace JR.Utils.GUI.Forms
this.richTextBoxMessage.TabIndex = 0;
this.richTextBoxMessage.TabStop = false;
this.richTextBoxMessage.Text = "";
- this.richTextBoxMessage.LinkClicked += new System.Windows.Forms.LinkClickedEventHandler(this.richTextBoxMessage_LinkClicked);
+ this.richTextBoxMessage.LinkClicked += new System.Windows.Forms.LinkClickedEventHandler(this.RichTextBoxMessage_LinkClicked);
//
// panel1
//
@@ -431,8 +397,8 @@ namespace JR.Utils.GUI.Forms
#region Private constants
//These separators are used for the "copy to clipboard" standard operation, triggered by Ctrl + C (behavior and clipboard format is like in a standard MessageBox)
- private static readonly String STANDARD_MESSAGEBOX_SEPARATOR_LINES = "---------------------------\n";
- private static readonly String STANDARD_MESSAGEBOX_SEPARATOR_SPACES = " ";
+ private static readonly string STANDARD_MESSAGEBOX_SEPARATOR_LINES = "---------------------------\n";
+ private static readonly string STANDARD_MESSAGEBOX_SEPARATOR_SPACES = " ";
//These are the possible buttons (in a standard MessageBox)
private enum ButtonID { OK = 0, CANCEL, YES, NO, ABORT, RETRY, IGNORE, OVERWRITE, RENAME };
@@ -440,10 +406,10 @@ namespace JR.Utils.GUI.Forms
//These are the buttons texts for different languages.
//If you want to add a new language, add it here and in the GetButtonText-Function
private enum TwoLetterISOLanguageID { en, de, es, it };
- private static readonly String[] BUTTON_TEXTS_ENGLISH_EN = { "OK", "Cancel", "&Yes", "&No", "&Abort", "&Retry", "&Ignore", "&Overwrite", "&Rename" }; //Note: This is also the fallback language
- private static readonly String[] BUTTON_TEXTS_GERMAN_DE = { "OK", "Abbrechen", "&Ja", "&Nein", "&Abbrechen", "&Wiederholen", "&Ignorieren", "&Overwrite", "&Rename" };
- private static readonly String[] BUTTON_TEXTS_SPANISH_ES = { "Aceptar", "Cancelar", "&SÃ", "&No", "&Abortar", "&Reintentar", "&Ignorar", "&Overwrite", "&Rename" };
- private static readonly String[] BUTTON_TEXTS_ITALIAN_IT = { "OK", "Annulla", "&Sì", "&No", "&Interrompi", "&Riprova", "&Ignora", "&Overwrite", "&Rename" };
+ private static readonly string[] BUTTON_TEXTS_ENGLISH_EN = { "OK", "Cancel", "&Yes", "&No", "&Abort", "&Retry", "&Ignore", "&Overwrite", "&Rename" }; //Note: This is also the fallback language
+ private static readonly string[] BUTTON_TEXTS_GERMAN_DE = { "OK", "Abbrechen", "&Ja", "&Nein", "&Abbrechen", "&Wiederholen", "&Ignorieren", "&Overwrite", "&Rename" };
+ private static readonly string[] BUTTON_TEXTS_SPANISH_ES = { "Aceptar", "Cancelar", "&SÃ", "&No", "&Abortar", "&Reintentar", "&Ignorar", "&Overwrite", "&Rename" };
+ private static readonly string[] BUTTON_TEXTS_ITALIAN_IT = { "OK", "Annulla", "&Sì", "&No", "&Interrompi", "&Riprova", "&Ignora", "&Overwrite", "&Rename" };
#endregion
@@ -451,7 +417,7 @@ namespace JR.Utils.GUI.Forms
private MessageBoxDefaultButton defaultButton;
private int visibleButtonsCount;
- private TwoLetterISOLanguageID languageID = TwoLetterISOLanguageID.en;
+ private readonly TwoLetterISOLanguageID languageID = TwoLetterISOLanguageID.en;
#endregion
@@ -758,9 +724,9 @@ namespace JR.Utils.GUI.Forms
/// The instance containing the event data.
private void FlexibleMessageBoxForm_Shown(object sender, EventArgs e)
{
- int buttonIndexToFocus = 1;
Button buttonToFocus;
+ int buttonIndexToFocus;
//Set the default button...
switch (this.defaultButton)
{
@@ -799,7 +765,7 @@ namespace JR.Utils.GUI.Forms
///
/// The source of the event.
/// The instance containing the event data.
- private void richTextBoxMessage_LinkClicked(object sender, LinkClickedEventArgs e)
+ private void RichTextBoxMessage_LinkClicked(object sender, LinkClickedEventArgs e)
{
try
{
@@ -877,12 +843,14 @@ namespace JR.Utils.GUI.Forms
public static DialogResult Show(IWin32Window owner, string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon, MessageBoxDefaultButton defaultButton)
{
//Create a new instance of the FlexibleMessageBox form
- var flexibleMessageBoxForm = new FlexibleMessageBoxForm();
- flexibleMessageBoxForm.ShowInTaskbar = false;
+ var flexibleMessageBoxForm = new FlexibleMessageBoxForm
+ {
+ ShowInTaskbar = false,
- //Bind the caption and the message text
- flexibleMessageBoxForm.CaptionText = caption;
- flexibleMessageBoxForm.MessageText = text;
+ //Bind the caption and the message text
+ CaptionText = caption,
+ MessageText = text
+ };
flexibleMessageBoxForm.FlexibleMessageBoxFormBindingSource.DataSource = flexibleMessageBoxForm;
//Set the buttons visibilities and texts. Also set a default button.
@@ -914,15 +882,18 @@ namespace JR.Utils.GUI.Forms
/// The icon.
/// The default button.
/// The dialog result.
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE0060:Remove unused parameter", Justification = "Keeping buttons for legacy reasons")]
public static DialogResult ShowCustom(IWin32Window owner, string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon)
{
//Create a new instance of the FlexibleMessageBox form
- var flexibleMessageBoxForm = new FlexibleMessageBoxForm();
- flexibleMessageBoxForm.ShowInTaskbar = false;
+ var flexibleMessageBoxForm = new FlexibleMessageBoxForm
+ {
+ ShowInTaskbar = false,
- //Bind the caption and the message text
- flexibleMessageBoxForm.CaptionText = caption;
- flexibleMessageBoxForm.MessageText = text;
+ //Bind the caption and the message text
+ CaptionText = caption,
+ MessageText = text
+ };
flexibleMessageBoxForm.FlexibleMessageBoxFormBindingSource.DataSource = flexibleMessageBoxForm;
//Set the buttons visibilities and texts. Also set a default button.
diff --git a/PROMS/Formats/Formats.csproj b/PROMS/Formats/Formats.csproj
index c73a80c5..63e75909 100644
--- a/PROMS/Formats/Formats.csproj
+++ b/PROMS/Formats/Formats.csproj
@@ -66,6 +66,7 @@
frmFormatCopy.cs
+
diff --git a/PROMS/Formats/GlobalSuppressions.cs b/PROMS/Formats/GlobalSuppressions.cs
new file mode 100644
index 00000000..046248af
--- /dev/null
+++ b/PROMS/Formats/GlobalSuppressions.cs
@@ -0,0 +1,8 @@
+// This file is used by Code Analysis to maintain SuppressMessage
+// attributes that are applied to this project.
+// Project-level suppressions either have no target or are given
+// a specific target and scoped to a namespace, type, member, etc.
+
+using System.Diagnostics.CodeAnalysis;
+
+[assembly: SuppressMessage("Style", "IDE1006:Naming Styles", Justification = "Not modifying Naming Styles")]
diff --git a/PROMS/Formats/Program.cs b/PROMS/Formats/Program.cs
index ecbbfc91..59ba4f28 100644
--- a/PROMS/Formats/Program.cs
+++ b/PROMS/Formats/Program.cs
@@ -1,5 +1,4 @@
using System;
-using System.Collections.Generic;
using System.Windows.Forms;
namespace Formats
diff --git a/PROMS/Formats/frmFormatCopy.cs b/PROMS/Formats/frmFormatCopy.cs
index be941c3e..e5f3d7fe 100644
--- a/PROMS/Formats/frmFormatCopy.cs
+++ b/PROMS/Formats/frmFormatCopy.cs
@@ -1,9 +1,4 @@
using System;
-using System.Collections.Generic;
-using System.ComponentModel;
-using System.Data;
-using System.Drawing;
-using System.Text;
using System.IO;
using System.Windows.Forms;
@@ -28,7 +23,7 @@ namespace Formats
txbxPROMSFormatsPath.Text = savedFormatPath;
else
{
- string curFolder = Environment.CurrentDirectory; // C:\development/PROMS/Formats/bin/debug
+ string curFolder = Environment.CurrentDirectory; // .../PROMS/Formats/bin/debug
int idx = curFolder.ToUpper().IndexOf(@"\PROMS\");
txbxPROMSFormatsPath.Text = curFolder.Substring(0, idx);
}
@@ -40,9 +35,8 @@ namespace Formats
DirectoryInfo di = new DirectoryInfo(path);
if (di.Exists == false) //return;
{
- DialogResult dlgrslt = DialogResult.No;
- dlgrslt = MessageBox.Show(string.Format("{0} does not exist. Create it?", path), "Create Folder?", MessageBoxButtons.YesNo);
- if (dlgrslt == DialogResult.Yes)
+ DialogResult dlgrslt = MessageBox.Show(string.Format("{0} does not exist. Create it?", path), "Create Folder?", MessageBoxButtons.YesNo);
+ if (dlgrslt == DialogResult.Yes)
{
di.Create();
di.CreateSubdirectory("fmtall");
@@ -86,10 +80,11 @@ namespace Formats
private void btnBrowse_Click(object sender, EventArgs e)
{
- FolderBrowserDialog fbd = new FolderBrowserDialog();
-
- fbd.SelectedPath = txbxPROMSFormatsPath.Text;
- if (fbd.ShowDialog() == DialogResult.OK)
+ FolderBrowserDialog fbd = new FolderBrowserDialog
+ {
+ SelectedPath = txbxPROMSFormatsPath.Text
+ };
+ if (fbd.ShowDialog() == DialogResult.OK)
{
if (Directory.Exists(fbd.SelectedPath)) txbxPROMSFormatsPath.Text = fbd.SelectedPath + @"\";
}
@@ -116,9 +111,9 @@ namespace Formats
if (!txbxPROMSFormatsPath.Text.EndsWith(@"\")) txbxPROMSFormatsPath.Text += @"\";
// There should be a "fmtall" and "genmacall" folder in the delelopment project folder
- // ex: C:\development\PROMS\Formats\fmtall and C:\development\PROMS\Formats\genmacall
- string destFmtallPath = txbxPROMSFormatsPath.Text + @"fmtall\";
- string destGenmacallPath = txbxPROMSFormatsPath.Text + @"genmacall\";
+ // ex: ...\PROMS\Formats\fmtall and ...\PROMS\Formats\genmacall
+ string destFmtallPath = $@"{txbxPROMSFormatsPath.Text}fmtall\";
+ string destGenmacallPath = $@"{txbxPROMSFormatsPath.Text}genmacall\";
string srcFmtallPath = @"..\..\"; // up to levels from startup path
// clear the destination fmtall and genmacall folders
@@ -156,14 +151,10 @@ namespace Formats
}
Properties.Settings.Default.FormatPath = txbxPROMSFormatsPath.Text.Substring(0,txbxPROMSFormatsPath.Text.Length-1); // save the copy format path minus the ending backslash
Properties.Settings.Default.Save();
- //if(MessageBox.Show("Do you want to end the Format Copier?","Formats Copied.", MessageBoxButtons.YesNo, MessageBoxIcon.Question)== DialogResult.Yes)
- Application.Exit();
- }
-
- private void buttonX2_Click(object sender, EventArgs e)
- {
Application.Exit();
}
- }
+ private void buttonX2_Click(object sender, EventArgs e) => Application.Exit();
+
+ }
}
\ No newline at end of file
diff --git a/PROMS/LBWordLibrary/GlobalSuppressions.cs b/PROMS/LBWordLibrary/GlobalSuppressions.cs
new file mode 100644
index 00000000..046248af
--- /dev/null
+++ b/PROMS/LBWordLibrary/GlobalSuppressions.cs
@@ -0,0 +1,8 @@
+// This file is used by Code Analysis to maintain SuppressMessage
+// attributes that are applied to this project.
+// Project-level suppressions either have no target or are given
+// a specific target and scoped to a namespace, type, member, etc.
+
+using System.Diagnostics.CodeAnalysis;
+
+[assembly: SuppressMessage("Style", "IDE1006:Naming Styles", Justification = "Not modifying Naming Styles")]
diff --git a/PROMS/LBWordLibrary/LBComObject.cs b/PROMS/LBWordLibrary/LBComObject.cs
index 8bc36189..e73e8dd0 100644
--- a/PROMS/LBWordLibrary/LBComObject.cs
+++ b/PROMS/LBWordLibrary/LBComObject.cs
@@ -1,64 +1,46 @@
using System;
-using System.Collections.Generic;
-using System.Text;
using System.Reflection;
+using System.Windows.Forms.VisualStyles;
namespace LBWordLibrary
{
public abstract partial class LBComObject
{
- private Object _Item;
- internal Object Item
+ private object _Item;
+ internal object Item
{
get { return _Item; }
set
{
_Item = value;
- if (value != null) _MyType = _Item.GetType();
+ if (value != null) MyType = _Item.GetType();
}
}
- private Type _MyType;
- public Type MyType
- {
- get { return _MyType; }
- set { _MyType = value; }
- }
- protected LBComObject() { }
+
+ public Type MyType { get; set; }
+ protected LBComObject() { }
protected LBComObject(string ProgID)
{
Type objClassType;
objClassType = Type.GetTypeFromProgID(ProgID);
Item = Activator.CreateInstance(objClassType);
}
- protected LBComObject(Object item)
- {
- Item = item;
- }
- private Object DoInvokeMember(string name, Object[] parameters, BindingFlags bf, Binder b)
+ protected LBComObject(object item) => Item = item;
+ private object DoInvokeMember(string name, object[] parameters, BindingFlags bf, Binder b)
{
try
{
- return _MyType.InvokeMember(name, bf, b, _Item, parameters);
+ return MyType.InvokeMember(name, bf, b, _Item, parameters);
}
catch (Exception ex)
{
- throw new Exception(string.Format("LBComObject.DoInvokeMember {0}.{1}", _MyType.Name, name), ex);
+ throw new Exception(string.Format("LBComObject.DoInvokeMember {0}.{1}", MyType.Name, name), ex);
}
- return null;
}
- protected void SetProperty(string propertyName, params Object[] parameters)
- {
- DoInvokeMember(propertyName, parameters, BindingFlags.SetProperty, null);
- }
- protected Object GetProperty(string propertyName)
- {
- return DoInvokeMember(propertyName, null, BindingFlags.GetProperty, null);
- }
- protected Object GetProperty(string propertyName, params Object[] parameters)
- {
- return DoInvokeMember(propertyName, parameters, BindingFlags.GetProperty, null);
- }
- protected Object InvokeMethod(string methodName, params Object[] parameters)
+ protected void SetProperty(string propertyName, params object[] parameters) => DoInvokeMember(propertyName, parameters, BindingFlags.SetProperty, null);
+ protected object GetProperty(string propertyName) => DoInvokeMember(propertyName, null, BindingFlags.GetProperty, null);
+ protected object GetProperty(string propertyName, params object[] parameters) => DoInvokeMember(propertyName, parameters, BindingFlags.GetProperty, null);
+ protected object InvokeMethod(string methodName, params object[] parameters)
{
if (parameters != null)
FixParameters(parameters);
@@ -71,150 +53,79 @@ namespace LBWordLibrary
if (parameters[i] is LBComObject)
parameters[i] = (parameters[i] as LBComObject).Item;
}
- protected Object InvokeMethod(string methodName)
- {
- return InvokeMethod(methodName, null);
- }
- }
+ protected object InvokeMethod(string methodName) => InvokeMethod(methodName, null);
+ }
public class LBComObjectList : LBComObject
where TList : LBComObjectList
where TItem : LBComObject, new()
{
- //public new(Object item):base(item){}
public TItem Add()
{
- TItem tmp = new TItem();
- tmp.Item = InvokeMethod("Add");
- return tmp;
+ TItem tmp = new TItem
+ {
+ Item = InvokeMethod("Add")
+ };
+ return tmp;
}
- // C2019-021 RHM 5/15/2019 Added newe methods and properties for Import Word Content
- // Get each item in a collection
- public Object this[int item]
- {
- get
- {
- return InvokeMethod("Item", item);// Use Item Method to get an entry from an object list
- }
- }
- }
+ // C2019-021 RHM 5/15/2019 Added newe methods and properties for Import Word Content
+ // Get each item in a collection
+ public object this[int item] => InvokeMethod("Item", item);// Use Item Method to get an entry from an object list
+ }
public partial class LBApplicationClass : LBComObject
{
public LBApplicationClass() : base("Word.Application") { }
- public LBApplicationClass(Object item) : base(item) { }
- public Boolean Visible
+ public LBApplicationClass(object item) : base(item) { }
+ public bool Visible
{
- get { return (GetProperty("Visible") as Boolean? ?? false); }
+ get { return (GetProperty("Visible") as bool? ?? false); }
set { SetProperty("Visible", value); }
}
- public LBDocuments Documents
- {
- get { return new LBDocuments(GetProperty("Documents")); }
- }
- public LBSelection Selection
- {
- get { return new LBSelection(GetProperty("Selection")); }
- }
- public LBDocumentClass ActiveDocument
- {
- get { return new LBDocumentClass(GetProperty("ActiveDocument")); }
- }
- public LBWindow ActiveWindow
- {
- get { return new LBWindow(GetProperty("ActiveWindow")); }
- }
- public String Version
- {
- get { return (GetProperty("Version").ToString()); }
- }
- public String ActivePrinter
+ public LBDocuments Documents => new LBDocuments(GetProperty("Documents"));
+ public LBSelection Selection => new LBSelection(GetProperty("Selection"));
+ public LBDocumentClass ActiveDocument => new LBDocumentClass(GetProperty("ActiveDocument"));
+ public LBWindow ActiveWindow => new LBWindow(GetProperty("ActiveWindow"));
+ public string Version => (GetProperty("Version").ToString());
+ public string ActivePrinter
{
get { return (GetProperty("ActivePrinter").ToString()); }
set { SetProperty("ActivePrinter", value); }
}
- public int BackgroundPrintingStatus
- {
- get { return (GetProperty("BackgroundPrintingStatus") as int? ?? 0); }
- }
- public LBWdWindowState WindowState
+ public int BackgroundPrintingStatus => (GetProperty("BackgroundPrintingStatus") as int? ?? 0);
+ public LBWdWindowState WindowState
{
get { return (LBWdWindowState)GetProperty("WindowState"); }
set { SetProperty("WindowState", value); }
}
- public int BackgroundSavingStatus
- {
- get { return (GetProperty("BackgroundSavingStatus") as int? ?? 0); }
- }
- public void Quit()
- {
- InvokeMethod("Quit", Missing.Value, Missing.Value, Missing.Value);
- }
- public void Quit(object SaveChanges, object OriginalFormat, object RouteDocument)
- {
- InvokeMethod("Quit", SaveChanges, OriginalFormat, RouteDocument);
- }
- public void PrintOut()
- {
- InvokeMethod("PrintOut", Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value);
- }
- public void PrintOut(object Background, object Append, object Range, object OutputFileName, object From, object To, object Item, object Copies, object Pages, object PageType, object PrintToFile, object Collate, object FileName, object ActivePrinterMacGX, object ManualDuplexPrint, object PrintZoomColumn, object PrintZoomRow, object PrintZoomPaperWidth, object PrintZoomPaperHeight)
- {
- InvokeMethod("PrintOut", Background, Append, Range, OutputFileName, From, To, Item, Copies, Pages, PageType, PrintToFile, Collate, FileName, ActivePrinterMacGX, ManualDuplexPrint, PrintZoomColumn, PrintZoomRow, PrintZoomPaperWidth, PrintZoomPaperHeight);
- }
- public void Activate()
- {
- InvokeMethod("Activate");
- }
- }
+ public int BackgroundSavingStatus => (GetProperty("BackgroundSavingStatus") as int? ?? 0);
+ public void Quit() => InvokeMethod("Quit", Missing.Value, Missing.Value, Missing.Value);
+ public void Quit(object SaveChanges, object OriginalFormat, object RouteDocument) => InvokeMethod("Quit", SaveChanges, OriginalFormat, RouteDocument);
+ public void PrintOut() => InvokeMethod("PrintOut", Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value);
+ public void PrintOut(object Background, object Append, object Range, object OutputFileName, object From, object To, object Item, object Copies, object Pages, object PageType, object PrintToFile, object Collate, object FileName, object ActivePrinterMacGX, object ManualDuplexPrint, object PrintZoomColumn, object PrintZoomRow, object PrintZoomPaperWidth, object PrintZoomPaperHeight) => InvokeMethod("PrintOut", Background, Append, Range, OutputFileName, From, To, Item, Copies, Pages, PageType, PrintToFile, Collate, FileName, ActivePrinterMacGX, ManualDuplexPrint, PrintZoomColumn, PrintZoomRow, PrintZoomPaperWidth, PrintZoomPaperHeight);
+ public void Activate() => InvokeMethod("Activate");
+ }
public partial class LBDocuments : LBComObjectList /* Collection */
{
- public LBDocuments(Object item)
- {
- Item = item;
- }
- public LBDocumentClass Open(object FileName)
- {
- return new LBDocumentClass(InvokeMethod("Open", FileName, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value));
- }
- public LBDocumentClass Open(object FileName, object ConfirmConversions, object ReadOnly, object AddToRecentFiles, object PasswordDocument, object PasswordTemplate, object Revert, object WritePasswordDocument, object WritePasswordTemplate, object Format, object Encoding, object Visible, object OpenAndRepair, object DocumentDirection, object NoEncodingDialog, object XMLTransform)
- {
- return new LBDocumentClass(InvokeMethod("Open", FileName, ConfirmConversions, ReadOnly, AddToRecentFiles, PasswordDocument, PasswordTemplate, Revert, WritePasswordDocument, WritePasswordTemplate, Format, Encoding, Visible, OpenAndRepair, DocumentDirection, NoEncodingDialog, XMLTransform));
- }
- }
+ public LBDocuments(object item) => Item = item;
+ public LBDocumentClass Open(object FileName) => new LBDocumentClass(InvokeMethod("Open", FileName, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value));
+ public LBDocumentClass Open(object FileName, object ConfirmConversions, object ReadOnly, object AddToRecentFiles, object PasswordDocument, object PasswordTemplate, object Revert, object WritePasswordDocument, object WritePasswordTemplate, object Format, object Encoding, object Visible, object OpenAndRepair, object DocumentDirection, object NoEncodingDialog, object XMLTransform) => new LBDocumentClass(InvokeMethod("Open", FileName, ConfirmConversions, ReadOnly, AddToRecentFiles, PasswordDocument, PasswordTemplate, Revert, WritePasswordDocument, WritePasswordTemplate, Format, Encoding, Visible, OpenAndRepair, DocumentDirection, NoEncodingDialog, XMLTransform));
+ }
public partial class LBSelection : LBComObject
{
public LBSelection() { }
- public LBSelection(Object item) : base(item) { }
- public LBRange Range
- {
- get { return new LBRange(GetProperty("Range")); }
- }
- public LBStyle Style
- {
- get { return new LBStyle(GetProperty("Style")); }
- }
- public LBParagraphFormatClass ParagraphFormat
- {
- get { return new LBParagraphFormatClass(GetProperty("ParagraphFormat")); }
- }
- public String Text
+ public LBSelection(object item) : base(item) { }
+ public LBRange Range => new LBRange(GetProperty("Range"));
+ public LBStyle Style => new LBStyle(GetProperty("Style"));
+ public LBParagraphFormatClass ParagraphFormat => new LBParagraphFormatClass(GetProperty("ParagraphFormat"));
+ public string Text
{
//B2022-083: Support Conditional RO Values
get { return Convert.ToString(GetProperty("Text")); }
set { SetProperty("Text", value); }
}
- public LBWdSelectionType Type
- {
- get { return (LBWdSelectionType)GetProperty("Type"); }
- }
- public LBFind Find
- {
- get { return new LBFind(GetProperty("Find")); }
- }
- public LBFontClass Font
- {
- get { return new LBFontClass(GetProperty("Font")); }
- }
- public int End
+ public LBWdSelectionType Type => (LBWdSelectionType)GetProperty("Type");
+ public LBFind Find => new LBFind(GetProperty("Find"));
+ public LBFontClass Font => new LBFontClass(GetProperty("Font"));
+ public int End
{
get { return (GetProperty("End") as int? ?? 0); }
set { SetProperty("End", value); }
@@ -224,15 +135,9 @@ namespace LBWordLibrary
get { return (GetProperty("Start") as int? ?? 0); }
set { SetProperty("Start", value); }
}
- public LBInlineShapes InlineShapes
- {
- get { return new LBInlineShapes(GetProperty("InlineShapes")); }
- }
- public LBParagraphs Paragraphs
- {
- get { return new LBParagraphs(GetProperty("Paragraphs")); }
- }
- public LBTables Tables
+ public LBInlineShapes InlineShapes => new LBInlineShapes(GetProperty("InlineShapes"));
+ public LBParagraphs Paragraphs => new LBParagraphs(GetProperty("Paragraphs"));
+ public LBTables Tables
{
// C2019-021 RHM 5/15/2019 Added newe methods and properties for Import Word Content
get
@@ -262,227 +167,77 @@ namespace LBWordLibrary
}
}
}
- public LBRows Rows
- {
- get { return new LBRows(GetProperty("Rows")); }
- }
- public void WholeStory()
- {
- InvokeMethod("WholeStory");
- }
- public int MoveStart()
- {
- return InvokeMethod("MoveStart", Missing.Value, Missing.Value) as int? ?? 0;
- }
- public int MoveStart(object Unit, object Count)
- {
- return InvokeMethod("MoveStart", Unit, Count) as int? ?? 0;
- }
- public int MoveEnd()
- {
- return InvokeMethod("MoveEnd", Missing.Value, Missing.Value) as int? ?? 0;
- }
- public int MoveEnd(object Unit, object Count)
- {
- return InvokeMethod("MoveEnd", Unit, Count) as int? ?? 0;
- }
- public void Copy()
- {
- InvokeMethod("Copy");
- }
- public int EndKey()
- {
- return InvokeMethod("EndKey", Missing.Value, Missing.Value) as int? ?? 0;
- }
- public int EndKey(object Unit, object Extend)
- {
- return InvokeMethod("EndKey", Unit, Extend) as int? ?? 0;
- }
- public void TypeText(string Text)
- {
- InvokeMethod("TypeText", Text);
- }
- public int EndOf()
- {
- return InvokeMethod("EndOf", Missing.Value, Missing.Value) as int? ?? 0;
- }
- public int EndOf(object Unit, object Extend)
- {
- return InvokeMethod("EndOf", Unit, Extend) as int? ?? 0;
- }
- public LBRange GoTo()
- {
- return new LBRange(InvokeMethod("GoTo", Missing.Value, Missing.Value, Missing.Value, Missing.Value));
- }
- public LBRange GoTo(object What, object Which, object Count, object Name)
- {
- return new LBRange(InvokeMethod("GoTo", What, Which, Count, Name));
- }
- public void InsertSymbol(int CharacterNumber)
- {
- InvokeMethod("InsertSymbol", CharacterNumber, Missing.Value, Missing.Value, Missing.Value);
- }
- public void InsertSymbol(int CharacterNumber, object Font, object Unicode, object Bias)
- {
- InvokeMethod("InsertSymbol", CharacterNumber, Font, Unicode, Bias);
- }
- public int MoveRight()
- {
- return InvokeMethod("MoveRight", Missing.Value, Missing.Value, Missing.Value) as int? ?? 0;
- }
- public int MoveRight(object Unit, object Count, object Extend)
- {
- return InvokeMethod("MoveRight", Unit, Count, Extend) as int? ?? 0;
- }
- public int MoveLeft()
- {
- return InvokeMethod("MoveLeft", Missing.Value, Missing.Value, Missing.Value) as int? ?? 0;
- }
- public int MoveLeft(object Unit, object Count, object Extend)
- {
- return InvokeMethod("MoveLeft", Unit, Count, Extend) as int? ?? 0;
- }
- public void SelectCell()
- {
- InvokeMethod("SelectCell");
- }
- public void SelectRow()
- {
- InvokeMethod("SelectRow");
- }
- public void SelectColumn()
- {
- InvokeMethod("SelectColumn");
- }
- public void TypeParagraph()
- {
- InvokeMethod("TypeParagraph");
- }
- public void TypeBackspace()
- {
- InvokeMethod("TypeBackspace");
- }
- public int MoveDown()
- {
- return InvokeMethod("MoveDown", Missing.Value, Missing.Value, Missing.Value) as int? ?? 0;
- }
- public int MoveDown(object Unit, object Count, object Extend)
- {
- return InvokeMethod("MoveDown", Unit, Count, Extend) as int? ?? 0;
- }
- public int MoveUp()
- {
- return InvokeMethod("MoveUp", Missing.Value, Missing.Value, Missing.Value) as int? ?? 0;
- }
- public int MoveUp(object Unit, object Count, object Extend)
- {
- return InvokeMethod("MoveUp", Unit, Count, Extend) as int? ?? 0;
- }
- }
+ public LBRows Rows => new LBRows(GetProperty("Rows"));
+ public void WholeStory() => InvokeMethod("WholeStory");
+ public int MoveStart() => InvokeMethod("MoveStart", Missing.Value, Missing.Value) as int? ?? 0;
+ public int MoveStart(object Unit, object Count) => InvokeMethod("MoveStart", Unit, Count) as int? ?? 0;
+ public int MoveEnd() => InvokeMethod("MoveEnd", Missing.Value, Missing.Value) as int? ?? 0;
+ public int MoveEnd(object Unit, object Count) => InvokeMethod("MoveEnd", Unit, Count) as int? ?? 0;
+ public void Copy() => InvokeMethod("Copy");
+ public int EndKey() => InvokeMethod("EndKey", Missing.Value, Missing.Value) as int? ?? 0;
+ public int EndKey(object Unit, object Extend) => InvokeMethod("EndKey", Unit, Extend) as int? ?? 0;
+ public void TypeText(string Text) => InvokeMethod("TypeText", Text);
+ public int EndOf() => InvokeMethod("EndOf", Missing.Value, Missing.Value) as int? ?? 0;
+ public int EndOf(object Unit, object Extend) => InvokeMethod("EndOf", Unit, Extend) as int? ?? 0;
+ public LBRange GoTo() => new LBRange(InvokeMethod("GoTo", Missing.Value, Missing.Value, Missing.Value, Missing.Value));
+ public LBRange GoTo(object What, object Which, object Count, object Name) => new LBRange(InvokeMethod("GoTo", What, Which, Count, Name));
+ public void InsertSymbol(int CharacterNumber) => InvokeMethod("InsertSymbol", CharacterNumber, Missing.Value, Missing.Value, Missing.Value);
+ public void InsertSymbol(int CharacterNumber, object Font, object Unicode, object Bias) => InvokeMethod("InsertSymbol", CharacterNumber, Font, Unicode, Bias);
+ public int MoveRight() => InvokeMethod("MoveRight", Missing.Value, Missing.Value, Missing.Value) as int? ?? 0;
+ public int MoveRight(object Unit, object Count, object Extend) => InvokeMethod("MoveRight", Unit, Count, Extend) as int? ?? 0;
+ public int MoveLeft() => InvokeMethod("MoveLeft", Missing.Value, Missing.Value, Missing.Value) as int? ?? 0;
+ public int MoveLeft(object Unit, object Count, object Extend) => InvokeMethod("MoveLeft", Unit, Count, Extend) as int? ?? 0;
+ public void SelectCell() => InvokeMethod("SelectCell");
+ public void SelectRow() => InvokeMethod("SelectRow");
+ public void SelectColumn() => InvokeMethod("SelectColumn");
+ public void TypeParagraph() => InvokeMethod("TypeParagraph");
+ public void TypeBackspace() => InvokeMethod("TypeBackspace");
+ public int MoveDown() => InvokeMethod("MoveDown", Missing.Value, Missing.Value, Missing.Value) as int? ?? 0;
+ public int MoveDown(object Unit, object Count, object Extend) => InvokeMethod("MoveDown", Unit, Count, Extend) as int? ?? 0;
+ public int MoveUp() => InvokeMethod("MoveUp", Missing.Value, Missing.Value, Missing.Value) as int? ?? 0;
+ public int MoveUp(object Unit, object Count, object Extend) => InvokeMethod("MoveUp", Unit, Count, Extend) as int? ?? 0;
+ }
public partial class LBDocumentClass : LBComObject
{
public LBDocumentClass() { }
- public LBDocumentClass(Object item) : base(item) { }
- public LBApplicationClass Application
+ public LBDocumentClass(object item) : base(item) { }
+ public LBApplicationClass Application => new LBApplicationClass(GetProperty("Application"));
+ public int SaveFormat => (GetProperty("SaveFormat") as int? ?? 0);
+ public string FullName => (GetProperty("FullName").ToString());
+ public LBShapes Shapes => new LBShapes(GetProperty("Shapes"));
+ public LBWindow ActiveWindow => new LBWindow(GetProperty("ActiveWindow"));
+ public LBPageSetup PageSetup => new LBPageSetup(GetProperty("PageSetup"));
+ public bool Saved
{
- get { return new LBApplicationClass(GetProperty("Application")); }
- }
- public int SaveFormat
- {
- get { return (GetProperty("SaveFormat") as int? ?? 0); }
- }
- public String FullName
- {
- get { return (GetProperty("FullName").ToString()); }
- }
- public LBShapes Shapes
- {
- get { return new LBShapes(GetProperty("Shapes")); }
- }
- public LBWindow ActiveWindow
- {
- get { return new LBWindow(GetProperty("ActiveWindow")); }
- }
- public LBPageSetup PageSetup
- {
- get { return new LBPageSetup(GetProperty("PageSetup")); }
- }
- public Boolean Saved
- {
- get { return (GetProperty("Saved") as Boolean? ?? false); }
+ get { return (GetProperty("Saved") as bool? ?? false); }
set { SetProperty("Saved", value); }
}
- public LBTables Tables
- {
- get { return new LBTables(GetProperty("Tables")); }
- }
- public float DefaultTabStop
+ public LBTables Tables => new LBTables(GetProperty("Tables"));
+ public float DefaultTabStop
{
get { return (GetProperty("DefaultTabStop") as float? ?? 0); }
set { SetProperty("DefaultTabStop", value); }
}
- public void SaveAs2000()
- {
- InvokeMethod("SaveAs2000", Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value);
- }
- public void SaveAs2000(object FileName, object FileFormat, object LockComments, object Password, object AddToRecentFiles, object WritePassword, object ReadOnlyRecommended, object EmbedTrueTypeFonts, object SaveNativePictureFormat, object SaveFormsData, object SaveAsAOCELetter)
- {
- InvokeMethod("SaveAs2000", FileName, FileFormat, LockComments, Password, AddToRecentFiles, WritePassword, ReadOnlyRecommended, EmbedTrueTypeFonts, SaveNativePictureFormat, SaveFormsData, SaveAsAOCELetter);
- }
- public void SaveAs()
- {
- InvokeMethod("SaveAs", Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value);
- }
- public void SaveAs(object FileName, object FileFormat, object LockComments, object Password, object AddToRecentFiles, object WritePassword, object ReadOnlyRecommended, object EmbedTrueTypeFonts, object SaveNativePictureFormat, object SaveFormsData, object SaveAsAOCELetter, object Encoding, object InsertLineBreaks, object AllowSubstitutions, object LineEnding, object AddBiDiMarks)
- {
- InvokeMethod("SaveAs", FileName, FileFormat, LockComments, Password, AddToRecentFiles, WritePassword, ReadOnlyRecommended, EmbedTrueTypeFonts, SaveNativePictureFormat, SaveFormsData, SaveAsAOCELetter, Encoding, InsertLineBreaks, AllowSubstitutions, LineEnding, AddBiDiMarks);
- }
- public void Close()
- {
- InvokeMethod("Close", Missing.Value, Missing.Value, Missing.Value);
- }
- public void Close(object SaveChanges, object OriginalFormat, object RouteDocument)
- {
- InvokeMethod("Close", SaveChanges, OriginalFormat, RouteDocument);
- }
- public void ExportAsFixedFormat(string OutputFileName, LBWdExportFormat ExportFormat)
- {
- InvokeMethod("ExportAsFixedFormat", OutputFileName, ExportFormat, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value);
- }
- public void ExportAsFixedFormat(string OutputFileName, LBWdExportFormat ExportFormat, Boolean OpenAfterExport, LBWdExportOptimizeFor OptimizeFor, LBWdExportRange Range, int From, int To, LBWdExportItem Item, Boolean IncludeDocProps, Boolean KeepIRM, LBWdExportCreateBookmarks CreateBookmarks, Boolean DocStructureTags, Boolean BitmapMissingFonts, Boolean UseISO19005_1, object FixedFormatExtClassPtr)
- {
- InvokeMethod("ExportAsFixedFormat", OutputFileName, ExportFormat, OpenAfterExport, OptimizeFor, Range, From, To, Item, IncludeDocProps, KeepIRM, CreateBookmarks, DocStructureTags, BitmapMissingFonts, UseISO19005_1, FixedFormatExtClassPtr);
- }
- public LBRange Range()
- {
- return new LBRange(InvokeMethod("Range", Missing.Value, Missing.Value));
- }
- public LBRange Range(object Start, object End)
- {
- return new LBRange(InvokeMethod("Range", Start, End));
- }
- public Boolean Undo()
- {
- return InvokeMethod("Undo", Missing.Value) as Boolean? ?? false;
- }
- public Boolean Undo(object Times)
- {
- return InvokeMethod("Undo", Times) as Boolean? ?? false;
- }
- }
+ public void SaveAs2000() => InvokeMethod("SaveAs2000", Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value);
+ public void SaveAs2000(object FileName, object FileFormat, object LockComments, object Password, object AddToRecentFiles, object WritePassword, object ReadOnlyRecommended, object EmbedTrueTypeFonts, object SaveNativePictureFormat, object SaveFormsData, object SaveAsAOCELetter) => InvokeMethod("SaveAs2000", FileName, FileFormat, LockComments, Password, AddToRecentFiles, WritePassword, ReadOnlyRecommended, EmbedTrueTypeFonts, SaveNativePictureFormat, SaveFormsData, SaveAsAOCELetter);
+ public void SaveAs() => InvokeMethod("SaveAs", Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value);
+ public void SaveAs(object FileName, object FileFormat, object LockComments, object Password, object AddToRecentFiles, object WritePassword, object ReadOnlyRecommended, object EmbedTrueTypeFonts, object SaveNativePictureFormat, object SaveFormsData, object SaveAsAOCELetter, object Encoding, object InsertLineBreaks, object AllowSubstitutions, object LineEnding, object AddBiDiMarks) => InvokeMethod("SaveAs", FileName, FileFormat, LockComments, Password, AddToRecentFiles, WritePassword, ReadOnlyRecommended, EmbedTrueTypeFonts, SaveNativePictureFormat, SaveFormsData, SaveAsAOCELetter, Encoding, InsertLineBreaks, AllowSubstitutions, LineEnding, AddBiDiMarks);
+ public void Close() => InvokeMethod("Close", Missing.Value, Missing.Value, Missing.Value);
+ public void Close(object SaveChanges, object OriginalFormat, object RouteDocument) => InvokeMethod("Close", SaveChanges, OriginalFormat, RouteDocument);
+ public void ExportAsFixedFormat(string OutputFileName, LBWdExportFormat ExportFormat) => InvokeMethod("ExportAsFixedFormat", OutputFileName, ExportFormat, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value);
+ public void ExportAsFixedFormat(string OutputFileName, LBWdExportFormat ExportFormat, bool OpenAfterExport, LBWdExportOptimizeFor OptimizeFor, LBWdExportRange Range, int From, int To, LBWdExportItem Item, bool IncludeDocProps, bool KeepIRM, LBWdExportCreateBookmarks CreateBookmarks, bool DocStructureTags, bool BitmapMissingFonts, bool UseISO19005_1, object FixedFormatExtClassPtr) => InvokeMethod("ExportAsFixedFormat", OutputFileName, ExportFormat, OpenAfterExport, OptimizeFor, Range, From, To, Item, IncludeDocProps, KeepIRM, CreateBookmarks, DocStructureTags, BitmapMissingFonts, UseISO19005_1, FixedFormatExtClassPtr);
+ public LBRange Range() => new LBRange(InvokeMethod("Range", Missing.Value, Missing.Value));
+ public LBRange Range(object Start, object End) => new LBRange(InvokeMethod("Range", Start, End));
+ public bool Undo() => InvokeMethod("Undo", Missing.Value) as bool? ?? false;
+ public bool Undo(object Times) => InvokeMethod("Undo", Times) as bool? ?? false;
+ }
public partial class LBWindow : LBComObject
{
public LBWindow() { }
- public LBWindow(Object item) : base(item) { }
- public LBPane ActivePane
- {
- get { return new LBPane(GetProperty("ActivePane")); }
- }
- public LBView View
- {
- get { return new LBView(GetProperty("View")); }
- }
- }
+ public LBWindow(object item) : base(item) { }
+ public LBPane ActivePane => new LBPane(GetProperty("ActivePane"));
+ public LBView View => new LBView(GetProperty("View"));
+ }
public enum LBWdWindowState
{
wdWindowStateNormal = 0,
@@ -493,78 +248,39 @@ namespace LBWordLibrary
{
public LBRange() { }
- // B2022-088: Find Doc Ro button not working in Word Sections
- public LBFind Find
- {
- get { return new LBFind(GetProperty("Find")); }
- }
+ // B2022-088: Find Doc Ro button not working in Word Sections
+ public LBFind Find => new LBFind(GetProperty("Find"));
- public int MoveStart()
- {
- return InvokeMethod("MoveStart", Missing.Value, Missing.Value) as int? ?? 0;
- }
+ public int MoveStart() => InvokeMethod("MoveStart", Missing.Value, Missing.Value) as int? ?? 0;
- public int MoveStart(object Unit, object Count)
- {
- return InvokeMethod("MoveStart", Unit, Count) as int? ?? 0;
- }
+ public int MoveStart(object Unit, object Count) => InvokeMethod("MoveStart", Unit, Count) as int? ?? 0;
- public int MoveEnd()
- {
- return InvokeMethod("MoveEnd", Missing.Value, Missing.Value) as int? ?? 0;
- }
+ public int MoveEnd() => InvokeMethod("MoveEnd", Missing.Value, Missing.Value) as int? ?? 0;
- public int MoveEnd(object Unit, object Count)
- {
- return InvokeMethod("MoveEnd", Unit, Count) as int? ?? 0;
- }
+ public int MoveEnd(object Unit, object Count) => InvokeMethod("MoveEnd", Unit, Count) as int? ?? 0;
- public void InsertSymbol(int CharacterNumber)
- {
- InvokeMethod("InsertSymbol", CharacterNumber, Missing.Value, Missing.Value, Missing.Value);
- }
+ public void InsertSymbol(int CharacterNumber) => InvokeMethod("InsertSymbol", CharacterNumber, Missing.Value, Missing.Value, Missing.Value);
- public void InsertSymbol(int CharacterNumber, object Font, object Unicode, object Bias)
- {
- InvokeMethod("InsertSymbol", CharacterNumber, Font, Unicode, Bias);
- }
+ public void InsertSymbol(int CharacterNumber, object Font, object Unicode, object Bias) => InvokeMethod("InsertSymbol", CharacterNumber, Font, Unicode, Bias);
- public void TypeText(string Text)
- {
- InvokeMethod("TypeText", Text);
- }
+ public void TypeText(string Text) => InvokeMethod("TypeText", Text);
- public LBRange(Object item) : base(item) { }
- // B2018-028 Word 2016 has a different value for the Vertical Position Relative to the Text Boundary than older version of Word.
- // We now need to calculated the last row of text in the PROMS attachment differently.
- // We now subtract the TopMargin the Page Setup from the Vertical Position Relative to the Page (Lenght in LBObjectExtension.cs)
- public LBPageSetup PageSetup
- {
- get { return new LBPageSetup(GetProperty("PageSetup")); }
- }
- // C2019-021 Added LateBinding for ListFormat
- public LBListFormat ListFormat
- {
- get { return new LBListFormat(GetProperty("ListFormat")); }
- }
- public LBFontClass Font
- {
- get { return new LBFontClass(GetProperty("Font")); }
- }
- public LBWdColorIndex HighlightColorIndex
+ public LBRange(object item) : base(item) { }
+ // B2018-028 Word 2016 has a different value for the Vertical Position Relative to the Text Boundary than older version of Word.
+ // We now need to calculated the last row of text in the PROMS attachment differently.
+ // We now subtract the TopMargin the Page Setup from the Vertical Position Relative to the Page (Lenght in LBObjectExtension.cs)
+ public LBPageSetup PageSetup => new LBPageSetup(GetProperty("PageSetup"));
+ // C2019-021 Added LateBinding for ListFormat
+ public LBListFormat ListFormat => new LBListFormat(GetProperty("ListFormat"));
+ public LBFontClass Font => new LBFontClass(GetProperty("Font"));
+ public LBWdColorIndex HighlightColorIndex
{
get { return (LBWdColorIndex)GetProperty("HighlightColorIndex"); }
set { SetProperty("HighlightColorIndex", value); }
}
- public LBParagraphFormatClass ParagraphFormat
- {
- get { return new LBParagraphFormatClass(GetProperty("ParagraphFormat")); }
- }
- public LBParagraphs Paragraphs
- {
- get { return new LBParagraphs(GetProperty("Paragraphs")); }
- }
- public int End
+ public LBParagraphFormatClass ParagraphFormat => new LBParagraphFormatClass(GetProperty("ParagraphFormat"));
+ public LBParagraphs Paragraphs => new LBParagraphs(GetProperty("Paragraphs"));
+ public int End
{
get { return (GetProperty("End") as int? ?? 0); }
set { SetProperty("End", value); }
@@ -574,25 +290,16 @@ namespace LBWordLibrary
get { return (GetProperty("Start") as int? ?? 0); }
set { SetProperty("Start", value); }
}
- public String Text
+ public string Text
{
get { return (GetProperty("Text").ToString()); }
set { SetProperty("Text", value); }
}
- public LBTables Tables
- {
- get { return new LBTables(GetProperty("Tables")); }
- }
- public LBRows Rows
- {
- get { return new LBRows(GetProperty("Rows")); }
- }
- public LBColumns Columns
- {
- get { return new LBColumns(GetProperty("Columns")); }
- }
- // C2019-021 RHM 5/15/2019 Added newe methods and properties for Import Word Content
- public LBCells Cells
+ public LBTables Tables => new LBTables(GetProperty("Tables"));
+ public LBRows Rows => new LBRows(GetProperty("Rows"));
+ public LBColumns Columns => new LBColumns(GetProperty("Columns"));
+ // C2019-021 RHM 5/15/2019 Added newe methods and properties for Import Word Content
+ public LBCells Cells
{
get
{
@@ -600,29 +307,20 @@ namespace LBWordLibrary
{
return new LBCells(GetProperty("Cells"));
}
- catch(Exception ex)
- {
+ catch (Exception)
+ {
return null;
}
}
}
- public LBRange GoTo()
- {
- return new LBRange(InvokeMethod("GoTo", Missing.Value, Missing.Value, Missing.Value, Missing.Value));
- }
- public LBRange GoTo(object What, object Which, object Count, object Name)
- {
- return new LBRange(InvokeMethod("GoTo", What, Which, Count, Name));
- }
- public LBRange Select()
- {
- return new LBRange(InvokeMethod("Select"));
- }
- }
+ public LBRange GoTo() => new LBRange(InvokeMethod("GoTo", Missing.Value, Missing.Value, Missing.Value, Missing.Value));
+ public LBRange GoTo(object What, object Which, object Count, object Name) => new LBRange(InvokeMethod("GoTo", What, Which, Count, Name));
+ public LBRange Select() => new LBRange(InvokeMethod("Select"));
+ }
public partial class LBParagraphFormatClass : LBComObject
{
public LBParagraphFormatClass() { }
- public LBParagraphFormatClass(Object item) : base(item) { }
+ public LBParagraphFormatClass(object item) : base(item) { }
public LBWdLineSpacing LineSpacingRule
{
get { return (LBWdLineSpacing)GetProperty("LineSpacingRule"); }
@@ -689,14 +387,11 @@ namespace LBWordLibrary
public partial class LBFind : LBComObject
{
public LBFind() { }
- public LBFind(Object item) : base(item) { }
- public LBReplacement Replacement
+ public LBFind(object item) : base(item) { }
+ public LBReplacement Replacement => new LBReplacement(GetProperty("Replacement"));
+ public bool Forward
{
- get { return new LBReplacement(GetProperty("Replacement")); }
- }
- public Boolean Forward
- {
- get { return (GetProperty("Forward") as Boolean? ?? false); }
+ get { return (GetProperty("Forward") as bool? ?? false); }
set { SetProperty("Forward", value); }
}
public LBWdFindWrap Wrap
@@ -704,58 +399,49 @@ namespace LBWordLibrary
get { return (LBWdFindWrap)GetProperty("Wrap"); }
set { SetProperty("Wrap", value); }
}
- public Boolean Format
+ public bool Format
{
- get { return (GetProperty("Format") as Boolean? ?? false); }
+ get { return (GetProperty("Format") as bool? ?? false); }
set { SetProperty("Format", value); }
}
- public Boolean MatchWholeWord
+ public bool MatchWholeWord
{
- get { return (GetProperty("MatchWholeWord") as Boolean? ?? false); }
+ get { return (GetProperty("MatchWholeWord") as bool? ?? false); }
set { SetProperty("MatchWholeWord", value); }
}
- public Boolean MatchWildcards
+ public bool MatchWildcards
{
- get { return (GetProperty("MatchWildcards") as Boolean? ?? false); }
+ get { return (GetProperty("MatchWildcards") as bool? ?? false); }
set { SetProperty("MatchWildcards", value); }
}
- public Boolean MatchSoundsLike
+ public bool MatchSoundsLike
{
- get { return (GetProperty("MatchSoundsLike") as Boolean? ?? false); }
+ get { return (GetProperty("MatchSoundsLike") as bool? ?? false); }
set { SetProperty("MatchSoundsLike", value); }
}
- public Boolean MatchAllWordForms
+ public bool MatchAllWordForms
{
- get { return (GetProperty("MatchAllWordForms") as Boolean? ?? false); }
+ get { return (GetProperty("MatchAllWordForms") as bool? ?? false); }
set { SetProperty("MatchAllWordForms", value); }
}
- public String Text
+ public string Text
{
get { return (GetProperty("Text").ToString()); }
set { SetProperty("Text", value); }
}
- public Boolean MatchCase
+ public bool MatchCase
{
- get { return (GetProperty("MatchCase") as Boolean? ?? false); }
+ get { return (GetProperty("MatchCase") as bool? ?? false); }
set { SetProperty("MatchCase", value); }
}
- public Boolean Execute()
- {
- return InvokeMethod("Execute", Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value) as Boolean? ?? false;
- }
- public Boolean Execute(object FindText, object MatchCase, object MatchWholeWord, object MatchWildcards, object MatchSoundsLike, object MatchAllWordForms, object Forward, object Wrap, object Format, object ReplaceWith, object Replace, object MatchKashida, object MatchDiacritics, object MatchAlefHamza, object MatchControl)
- {
- return InvokeMethod("Execute", FindText, MatchCase, MatchWholeWord, MatchWildcards, MatchSoundsLike, MatchAllWordForms, Forward, Wrap, Format, ReplaceWith, Replace, MatchKashida, MatchDiacritics, MatchAlefHamza, MatchControl) as Boolean? ?? false;
- }
- public void ClearFormatting()
- {
- InvokeMethod("ClearFormatting");
- }
- }
+ public bool Execute() => InvokeMethod("Execute", Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value) as bool? ?? false;
+ public bool Execute(object FindText, object MatchCase, object MatchWholeWord, object MatchWildcards, object MatchSoundsLike, object MatchAllWordForms, object Forward, object Wrap, object Format, object ReplaceWith, object Replace, object MatchKashida, object MatchDiacritics, object MatchAlefHamza, object MatchControl) => InvokeMethod("Execute", FindText, MatchCase, MatchWholeWord, MatchWildcards, MatchSoundsLike, MatchAllWordForms, Forward, Wrap, Format, ReplaceWith, Replace, MatchKashida, MatchDiacritics, MatchAlefHamza, MatchControl) as bool? ?? false;
+ public void ClearFormatting() => InvokeMethod("ClearFormatting");
+ }
public partial class LBFontClass : LBComObject
{
public LBFontClass() { }
- public LBFontClass(Object item) : base(item) { }
+ public LBFontClass(object item) : base(item) { }
public LBWdColor Color
{
get { return (LBWdColor)GetProperty("Color"); }
@@ -781,7 +467,7 @@ namespace LBWordLibrary
get { return (GetProperty("Size") as float? ?? 0); }
set { SetProperty("Size", value); }
}
- public String Name
+ public string Name
{
get { return (GetProperty("Name").ToString()); }
set { SetProperty("Name", value); }
@@ -837,85 +523,35 @@ namespace LBWordLibrary
}
public partial class LBInlineShapes : LBComObjectList /* Collection */
{
- public LBInlineShapes(Object item)
- {
- Item = item;
- }
- public LBInlineShape AddPicture(string FileName)
- {
- return new LBInlineShape(InvokeMethod("AddPicture", FileName, Missing.Value, Missing.Value, Missing.Value));
- }
- public LBInlineShape AddPicture(string FileName, object LinkToFile, object SaveWithDocument, object Range)
- {
- return new LBInlineShape(InvokeMethod("AddPicture", FileName, LinkToFile, SaveWithDocument, Range));
- }
- }
+ public LBInlineShapes(object item) => Item = item;
+ public LBInlineShape AddPicture(string FileName) => new LBInlineShape(InvokeMethod("AddPicture", FileName, Missing.Value, Missing.Value, Missing.Value));
+ public LBInlineShape AddPicture(string FileName, object LinkToFile, object SaveWithDocument, object Range) => new LBInlineShape(InvokeMethod("AddPicture", FileName, LinkToFile, SaveWithDocument, Range));
+ }
public partial class LBParagraphs : LBComObjectList /* Collection */
{
- // C2019-021 RHM 5/15/2019 Added newe methods and properties for Import Word Content
- public LBParagraph this[int item]
- {
- get // Get a Cell from a List
- {
- return new LBParagraph(base[item]);
- }
- }
- public LBParagraphs(Object item)
- {
- Item = item;
- }
- public int Count
- {
- get { return (GetProperty("Count") as int? ?? 0); }
- }
- public LBParagraph First
- {
- get { return new LBParagraph(GetProperty("First")); }
- }
- public LBParagraph Last
- {
- get { return new LBParagraph(GetProperty("Last")); }
- }
- public System.Object GetEnumerator()
- {
- return InvokeMethod("GetEnumerator");
- }
- }
+ // C2019-021 RHM 5/15/2019 Added newe methods and properties for Import Word Content
+ public new LBParagraph this[int item] => new LBParagraph(base[item]);
+ public LBParagraphs(object item) => Item = item;
+ public int Count => (GetProperty("Count") as int? ?? 0);
+ public LBParagraph First => new LBParagraph(GetProperty("First"));
+ public LBParagraph Last => new LBParagraph(GetProperty("Last"));
+ public object GetEnumerator() => InvokeMethod("GetEnumerator");
+ }
public partial class LBTables : LBComObjectList /* Collection */
{
- public LBTables(Object item)
- {
- Item = item;
- }
- public LBTable Add(LBRange Range, int NumRows, int NumColumns)
- {
- return new LBTable(InvokeMethod("Add", Range, NumRows, NumColumns, Missing.Value, Missing.Value));
- }
- public LBTable Add(LBRange Range, int NumRows, int NumColumns, object DefaultTableBehavior, object AutoFitBehavior)
- {
- return new LBTable(InvokeMethod("Add", Range, NumRows, NumColumns, DefaultTableBehavior, AutoFitBehavior));
- }
- // C2019-021 RHM 5/15/2019 Added newe methods and properties for Import Word Content
- public int Count
- {
- get { return (GetProperty("Count") as int? ?? 0); }
- }
- public LBTable this[int item]
- {
- get
- { // Get a Table from a list
- return new LBTable(base[item]);
- }
- }
+ public LBTables(object item) => Item = item;
+ public LBTable Add(LBRange Range, int NumRows, int NumColumns) => new LBTable(InvokeMethod("Add", Range, NumRows, NumColumns, Missing.Value, Missing.Value));
+ public LBTable Add(LBRange Range, int NumRows, int NumColumns, object DefaultTableBehavior, object AutoFitBehavior) => new LBTable(InvokeMethod("Add", Range, NumRows, NumColumns, DefaultTableBehavior, AutoFitBehavior));
+ // C2019-021 RHM 5/15/2019 Added newe methods and properties for Import Word Content
+ public int Count => (GetProperty("Count") as int? ?? 0);
+ // Get a Table from a list
+ public new LBTable this[int item] => new LBTable(base[item]);
- }
+ }
public partial class LBCells : LBComObjectList /* Collection */
{
- public LBCells(Object item)
- {
- Item = item;
- }
- public LBWdCellVerticalAlignment VerticalAlignment
+ public LBCells(object item) => Item = item;
+ public LBWdCellVerticalAlignment VerticalAlignment
{
get { return (LBWdCellVerticalAlignment)GetProperty("VerticalAlignment"); }
set { SetProperty("VerticalAlignment", value); }
@@ -925,54 +561,27 @@ namespace LBWordLibrary
get { return (GetProperty("Height") as float? ?? 0); }
set { SetProperty("Height", value); }
}
- // C2019-021 RHM 5/15/2019 Added newe methods and properties for Import Word Content
- public int Count
- {
- get { return (GetProperty("Count") as int? ?? 0); }
- }
- public LBBorders Borders
- {
- get { return new LBBorders(GetProperty("Borders")); }
- }
- public System.Object GetEnumerator()
- {
- return InvokeMethod("GetEnumerator");
- }
- public void Merge()
- {
- InvokeMethod("Merge");
- }
- // C2019-021 RHM 5/15/2019 Added newe methods and properties for Import Word Content
- public LBCell this[int item]
- {
- get // Get a Cell from a List
- {
- return new LBCell(base[item]);
- }
- }
+ // C2019-021 RHM 5/15/2019 Added newe methods and properties for Import Word Content
+ public int Count => (GetProperty("Count") as int? ?? 0);
+ public LBBorders Borders => new LBBorders(GetProperty("Borders"));
+ public object GetEnumerator() => InvokeMethod("GetEnumerator");
+ public void Merge() => InvokeMethod("Merge");
+ // C2019-021 RHM 5/15/2019 Added newe methods and properties for Import Word Content
+ public new LBCell this[int item] => new LBCell(base[item]);
- }
+ }
public partial class LBRows : LBComObjectList /* Collection */
{
- public LBRows(Object item)
- {
- Item = item;
- }
- public int HeadingFormat
+ public LBRows(object item) => Item = item;
+ public int HeadingFormat
{
get { return (GetProperty("HeadingFormat") as int? ?? 0); }
set { SetProperty("HeadingFormat", value); }
}
- // C2019-021 RHM 5/15/2019 Added newe methods and properties for Import Word Content
- public int Count
- {
- get { return (GetProperty("Count") as int? ?? 0); }
- }
- public LBRow First
- {
- get { return new LBRow(GetProperty("First")); }
- }
- public int AllowBreakAcrossPages
+ // C2019-021 RHM 5/15/2019 Added newe methods and properties for Import Word Content
+ public int Count => (GetProperty("Count") as int? ?? 0);
+ public LBRow First => new LBRow(GetProperty("First"));
+ public int AllowBreakAcrossPages
{
get { return (GetProperty("AllowBreakAcrossPages") as int? ?? 0); }
set { SetProperty("AllowBreakAcrossPages", value); }
@@ -980,23 +589,14 @@ namespace LBWordLibrary
}
public partial class LBShapes : LBComObjectList /* Collection */
{
- public LBShapes(Object item)
- {
- Item = item;
- }
- public LBShape AddPicture(string FileName)
- {
- return new LBShape(InvokeMethod("AddPicture", FileName, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value));
- }
- public LBShape AddPicture(string FileName, object LinkToFile, object SaveWithDocument, object Left, object Top, object Width, object Height, object Anchor)
- {
- return new LBShape(InvokeMethod("AddPicture", FileName, LinkToFile, SaveWithDocument, Left, Top, Width, Height, Anchor));
- }
- }
+ public LBShapes(object item) => Item = item;
+ public LBShape AddPicture(string FileName) => new LBShape(InvokeMethod("AddPicture", FileName, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value));
+ public LBShape AddPicture(string FileName, object LinkToFile, object SaveWithDocument, object Left, object Top, object Width, object Height, object Anchor) => new LBShape(InvokeMethod("AddPicture", FileName, LinkToFile, SaveWithDocument, Left, Top, Width, Height, Anchor));
+ }
public partial class LBPageSetup : LBComObject
{
public LBPageSetup() { }
- public LBPageSetup(Object item) : base(item) { }
+ public LBPageSetup(object item) : base(item) { }
public float BottomMargin
{
get { return (GetProperty("BottomMargin") as float? ?? 0); }
@@ -1079,28 +679,22 @@ namespace LBWordLibrary
public partial class LBPane : LBComObject
{
public LBPane() { }
- public LBPane(Object item) : base(item) { }
- public LBPages Pages
- {
- get { return new LBPages(GetProperty("Pages")); }
- }
- public LBView View
- {
- get { return new LBView(GetProperty("View")); }
- }
- }
+ public LBPane(object item) : base(item) { }
+ public LBPages Pages => new LBPages(GetProperty("Pages"));
+ public LBView View => new LBView(GetProperty("View"));
+ }
public partial class LBView : LBComObject
{
public LBView() { }
- public LBView(Object item) : base(item) { }
+ public LBView(object item) : base(item) { }
public LBWdViewType Type
{
get { return (LBWdViewType)GetProperty("Type"); }
set { SetProperty("Type", value); }
}
- public Boolean ShowRevisionsAndComments
+ public bool ShowRevisionsAndComments
{
- get { return (GetProperty("ShowRevisionsAndComments") as Boolean? ?? false); }
+ get { return (GetProperty("ShowRevisionsAndComments") as bool? ?? false); }
set { SetProperty("ShowRevisionsAndComments", value); }
}
public LBWdRevisionsView RevisionsView
@@ -1108,11 +702,8 @@ namespace LBWordLibrary
get { return (LBWdRevisionsView)GetProperty("RevisionsView"); }
set { SetProperty("RevisionsView", value); }
}
- public LBZoom Zoom
- {
- get { return new LBZoom(GetProperty("Zoom")); }
- }
- }
+ public LBZoom Zoom => new LBZoom(GetProperty("Zoom"));
+ }
public enum LBWdColorIndex
{
wdNoHighlight = 0,
@@ -1136,35 +727,14 @@ namespace LBWordLibrary
}
public partial class LBColumns : LBComObjectList /* Collection */
{
- public LBColumns(Object item)
- {
- Item = item;
- }
- public LBColumn First
- {
- get { return new LBColumn(GetProperty("First")); }
- }
- public LBColumn Last
- {
- get { return new LBColumn(GetProperty("Last")); }
- }
- public int Count
- {
- get { return (GetProperty("Count") as int? ?? 0); }
- }
- public System.Object GetEnumerator()
- {
- return InvokeMethod("GetEnumerator");
- }
- public LBColumn this[int item]
- {
- get // Get a Column from a List
- {
- return new LBColumn(base[item]);
- }
- }
+ public LBColumns(object item) => Item = item;
+ public LBColumn First => new LBColumn(GetProperty("First"));
+ public LBColumn Last => new LBColumn(GetProperty("Last"));
+ public int Count => (GetProperty("Count") as int? ?? 0);
+ public object GetEnumerator() => InvokeMethod("GetEnumerator");
+ public new LBColumn this[int item] => new LBColumn(base[item]);
- }
+ }
public enum LBWdLineSpacing
{
wdLineSpaceSingle = 0,
@@ -1189,17 +759,14 @@ namespace LBWordLibrary
public partial class LBReplacement : LBComObject
{
public LBReplacement() { }
- public LBReplacement(Object item) : base(item) { }
- public String Text
+ public LBReplacement(object item) : base(item) { }
+ public string Text
{
get { return (GetProperty("Text").ToString()); }
set { SetProperty("Text", value); }
}
- public void ClearFormatting()
- {
- InvokeMethod("ClearFormatting");
- }
- }
+ public void ClearFormatting() => InvokeMethod("ClearFormatting");
+ }
public enum LBWdFindWrap
{
wdFindStop = 0,
@@ -1293,7 +860,7 @@ namespace LBWordLibrary
public partial class LBInlineShape : LBComObject
{
public LBInlineShape() { }
- public LBInlineShape(Object item) : base(item) { }
+ public LBInlineShape(object item) : base(item) { }
public float Height
{
get { return (GetProperty("Height") as float? ?? 0); }
@@ -1308,30 +875,18 @@ namespace LBWordLibrary
public partial class LBParagraph : LBComObject
{
public LBParagraph() { }
- public LBParagraph(Object item) : base(item) { }
- public LBRange Range
- {
- get { return new LBRange(GetProperty("Range")); }
- }
- }
+ public LBParagraph(object item) : base(item) { }
+ public LBRange Range => new LBRange(GetProperty("Range"));
+ }
public partial class LBTable : LBComObject
{
public LBTable() { }
- public LBTable(Object item) : base(item) { }
- // C2019-021 RHM 5/15/2019 Added newe methods and properties for Import Word Content
- public LBRange Range
- {
- get { return new LBRange(GetProperty("Range")); }
- }
- public LBColumns Columns
- {
- get { return new LBColumns(GetProperty("Columns")); }
- }
- public LBRows Rows
- {
- get { return new LBRows(GetProperty("Rows")); }
- }
- public float TopPadding
+ public LBTable(object item) : base(item) { }
+ // C2019-021 RHM 5/15/2019 Added newe methods and properties for Import Word Content
+ public LBRange Range => new LBRange(GetProperty("Range"));
+ public LBColumns Columns => new LBColumns(GetProperty("Columns"));
+ public LBRows Rows => new LBRows(GetProperty("Rows"));
+ public float TopPadding
{
get { return (GetProperty("TopPadding") as float? ?? 0); }
set { SetProperty("TopPadding", value); }
@@ -1360,38 +915,26 @@ namespace LBWordLibrary
}
public partial class LBBorders : LBComObjectList /* Collection */
{
- public LBBorders(Object item)
- {
- Item = item;
- }
- public int Count
- {
- get { return (GetProperty("Count") as int? ?? 0); }
- }
- }
+ public LBBorders(object item) => Item = item;
+ public int Count => (GetProperty("Count") as int? ?? 0);
+ }
public partial class LBRow : LBComObject
{
public LBRow() { }
- public LBRow(Object item) : base(item) { }
+ public LBRow(object item) : base(item) { }
public float Height
{
get { return (GetProperty("Height") as float? ?? 0); }
set { SetProperty("Height", value); }
}
- public void Select()
- {
- InvokeMethod("Select");
- }
- }
+ public void Select() => InvokeMethod("Select");
+ }
public partial class LBShape : LBComObject
{
public LBShape() { }
- public LBShape(Object item) : base(item) { }
- public void ConvertToInlineShape()
- {
- InvokeMethod("ConvertToInlineShape");
- }
- public float Height
+ public LBShape(object item) : base(item) { }
+ public void ConvertToInlineShape() => InvokeMethod("ConvertToInlineShape");
+ public float Height
{
get { return (GetProperty("Height") as float? ?? 0); }
set { SetProperty("Height", value); }
@@ -1401,21 +944,8 @@ namespace LBWordLibrary
get { return (GetProperty("Width") as float? ?? 0); }
set { SetProperty("Width", value); }
}
- //public float ScaleHeight
- //{
- // get { return (GetProperty("ScaleHeight") as float? ?? 0); }
- // set { SetProperty("ScaleHeight", value); }
- //}
- //public float ScaleWidth
- //{
- // get { return (GetProperty("ScaleWidth") as float? ?? 0); }
- // set { SetProperty("ScaleWidth", value); }
- //}
- public LBRange Anchor
- {
- get { return new LBRange(GetProperty("Anchor")); }
- }
- public LBMsoTriState LockAspectRatio
+ public LBRange Anchor => new LBRange(GetProperty("Anchor"));
+ public LBMsoTriState LockAspectRatio
{
get { return (LBMsoTriState)GetProperty("LockAspectRatio"); }
set { SetProperty("LockAspectRatio", value); }
@@ -1455,9 +985,9 @@ namespace LBWordLibrary
get { return (GetProperty("LockAnchor") as int? ?? 0); }
set { SetProperty("LockAnchor", value); }
}
- public Boolean LayoutInCell
+ public bool LayoutInCell
{
- get { return (GetProperty("LayoutInCell") as Boolean? ?? false); }
+ get { return (GetProperty("LayoutInCell") as bool? ?? false); }
set { SetProperty("LayoutInCell", value); }
}
}
@@ -1513,15 +1043,9 @@ namespace LBWordLibrary
}
public partial class LBPages : LBComObjectList /* Collection */
{
- public LBPages(Object item)
- {
- Item = item;
- }
- public int Count
- {
- get { return (GetProperty("Count") as int? ?? 0); }
- }
- }
+ public LBPages(object item) => Item = item;
+ public int Count => (GetProperty("Count") as int? ?? 0);
+ }
public enum LBWdViewType
{
wdNormalView = 1,
@@ -1540,7 +1064,7 @@ namespace LBWordLibrary
public partial class LBZoom : LBComObject
{
public LBZoom() { }
- public LBZoom(Object item) : base(item) { }
+ public LBZoom(object item) : base(item) { }
public LBWdPageFit PageFit
{
get { return (LBWdPageFit)GetProperty("PageFit"); }
@@ -1555,29 +1079,17 @@ namespace LBWordLibrary
public partial class LBColumn : LBComObject
{
public LBColumn() { }
- public LBColumn(Object item) : base(item) { }
+ public LBColumn(object item) : base(item) { }
public float Width
{
get { return (GetProperty("Width") as float? ?? 0); }
set { SetProperty("Width", value); }
}
- public int Index
- {
- get { return (GetProperty("Index") as int? ?? 0); }
- }
- public LBColumn Next
- {
- get { return new LBColumn(GetProperty("Next")); }
- }
- public LBColumn Previous
- {
- get { return new LBColumn(GetProperty("Previous")); }
- }
- public void SetWidth(float ColumnWidth, LBWdRulerStyle RulerStyle)
- {
- InvokeMethod("SetWidth", ColumnWidth, RulerStyle);
- }
- }
+ public int Index => (GetProperty("Index") as int? ?? 0);
+ public LBColumn Next => new LBColumn(GetProperty("Next"));
+ public LBColumn Previous => new LBColumn(GetProperty("Previous"));
+ public void SetWidth(float ColumnWidth, LBWdRulerStyle RulerStyle) => InvokeMethod("SetWidth", ColumnWidth, RulerStyle);
+ }
public enum LBWdRelativeHorizontalPosition
{
wdRelativeHorizontalPositionMargin = 0,
@@ -1617,15 +1129,15 @@ namespace LBWordLibrary
public partial class LBBorder : LBComObject
{
public LBBorder() { }
- public LBBorder(Object item) : base(item) { }
+ public LBBorder(object item) : base(item) { }
public LBWdLineStyle LineStyle
{
get { return (LBWdLineStyle)GetProperty("LineStyle"); }
set { SetProperty("LineStyle", value); }
}
- public Boolean Visible
+ public bool Visible
{
- get { return (GetProperty("Visible") as Boolean? ?? false); }
+ get { return (GetProperty("Visible") as bool? ?? false); }
set { SetProperty("Visible", value); }
}
}
@@ -1671,29 +1183,14 @@ namespace LBWordLibrary
public partial class LBCell : LBComObject
{
public LBCell() { }
- public LBCell(Object item) : base(item) { }
- // C2019-021 RHM 5/15/2019 Added newe methods and properties for Import Word Content
- public LBRange Range
- {
- get { return new LBRange(GetProperty("Range")); }
- }
- public LBColumn Column
- {
- get { return new LBColumn(GetProperty("Column")); }
- }
- public LBCell Next
- {
- get { return new LBCell(GetProperty("Next")); }
- }
- public LBCell Previous
- {
- get { return new LBCell(GetProperty("Previous")); }
- }
- public LBRow Row
- {
- get { return new LBRow(GetProperty("Row")); }
- }
- public LBWdCellVerticalAlignment VerticalAlignment
+ public LBCell(object item) : base(item) { }
+ // C2019-021 RHM 5/15/2019 Added newe methods and properties for Import Word Content
+ public LBRange Range => new LBRange(GetProperty("Range"));
+ public LBColumn Column => new LBColumn(GetProperty("Column"));
+ public LBCell Next => new LBCell(GetProperty("Next"));
+ public LBCell Previous => new LBCell(GetProperty("Previous"));
+ public LBRow Row => new LBRow(GetProperty("Row"));
+ public LBWdCellVerticalAlignment VerticalAlignment
{
get { return (LBWdCellVerticalAlignment)GetProperty("VerticalAlignment"); }
set { SetProperty("VerticalAlignment", value); }
@@ -1708,24 +1205,12 @@ namespace LBWordLibrary
get { return (GetProperty("Height") as float? ?? 0); }
set { SetProperty("Height", value); }
}
- // C2019-021 RHM 5/15/2019 Added newe methods and properties for Import Word Content
- public int RowIndex
- {
- get { return (GetProperty("RowIndex") as int? ?? 0); }
- }
- public int ColumnIndex
- {
- get { return (GetProperty("ColumnIndex") as int? ?? 0); }
- }
- public LBTables Tables
- {
- get { return new LBTables(GetProperty("Tables")); }
- }
- public void SetWidth(float ColumnWidth, LBWdRulerStyle RulerStyle)
- {
- InvokeMethod("SetWidth", ColumnWidth, RulerStyle);
- }
- }
+ // C2019-021 RHM 5/15/2019 Added newe methods and properties for Import Word Content
+ public int RowIndex => (GetProperty("RowIndex") as int? ?? 0);
+ public int ColumnIndex => (GetProperty("ColumnIndex") as int? ?? 0);
+ public LBTables Tables => new LBTables(GetProperty("Tables"));
+ public void SetWidth(float ColumnWidth, LBWdRulerStyle RulerStyle) => InvokeMethod("SetWidth", ColumnWidth, RulerStyle);
+ }
public enum LBWdSaveFormat
{
wdFormatDocument = 0,
@@ -1785,31 +1270,16 @@ namespace LBWordLibrary
public partial class LBPage : LBComObject
{
public LBPage() { }
- public LBPage(Object item) : base(item) { }
- public int Height
- {
- get { return (GetProperty("Height") as int? ?? 0); }
- }
- public int Left
- {
- get { return (GetProperty("Left") as int? ?? 0); }
- }
- public LBRectangles Rectangles
- {
- get { return new LBRectangles(GetProperty("Rectangles")); }
- }
- public int Top
- {
- get { return (GetProperty("Top") as int? ?? 0); }
- }
- public int Width
- {
- get { return (GetProperty("Width") as int? ?? 0); }
- }
- }
+ public LBPage(object item) : base(item) { }
+ public int Height => (GetProperty("Height") as int? ?? 0);
+ public int Left => (GetProperty("Left") as int? ?? 0);
+ public LBRectangles Rectangles => new LBRectangles(GetProperty("Rectangles"));
+ public int Top => (GetProperty("Top") as int? ?? 0);
+ public int Width => (GetProperty("Width") as int? ?? 0);
+ }
public partial class LBRectangles : LBComObjectList /* Collection */
{
- public LBRectangles(Object item)
+ public LBRectangles(object item)
{
Item = item;
}
@@ -1821,36 +1291,21 @@ namespace LBWordLibrary
public partial class LBRectangle : LBComObject
{
public LBRectangle() { }
- public LBRectangle(Object item) : base(item) { }
- public LBLines Lines
- {
- get { return new LBLines(GetProperty("Lines")); }
- }
- }
+ public LBRectangle(object item) : base(item) { }
+ public LBLines Lines => new LBLines(GetProperty("Lines"));
+ }
public partial class LBLines : LBComObjectList /* Collection */
{
- public LBLines(Object item)
- {
- Item = item;
- }
- public int Count
- {
- get { return (GetProperty("Count") as int? ?? 0); }
- }
- }
+ public LBLines(object item) => Item = item;
+ public int Count => (GetProperty("Count") as int? ?? 0);
+ }
public partial class LBLine : LBComObject
{
public LBLine() { }
- public LBLine(Object item) : base(item) { }
- public int Top
- {
- get { return (GetProperty("Top") as int? ?? 0); }
- }
- public int Height
- {
- get { return (GetProperty("Height") as int? ?? 0); }
- }
- }
+ public LBLine(object item) : base(item) { }
+ public int Top => (GetProperty("Top") as int? ?? 0);
+ public int Height => (GetProperty("Height") as int? ?? 0);
+ }
public enum LBWdMovementType
{
wdMove = 0,
@@ -1905,54 +1360,29 @@ namespace LBWordLibrary
public partial class LBPictureFormat : LBComObject
{
public LBPictureFormat() { }
- public LBPictureFormat(Object item) : base(item) { }
+ public LBPictureFormat(object item) : base(item) { }
}
public partial class LBStyle : LBComObject
{
public LBStyle() { }
- public LBStyle(Object item) : base(item) { }
- public String NameLocal
+ public LBStyle(object item) : base(item) { }
+ public string NameLocal
{
get { return (GetProperty("NameLocal").ToString()); }
set { SetProperty("NameLocal", value); }
}
- public int ListLevelNumber
- {
- get { return (GetProperty("ListLevelNumber") as int? ?? 0); }
- }
- }
+ public int ListLevelNumber => (GetProperty("ListLevelNumber") as int? ?? 0);
+ }
// C2019-021 Added new object type LBListFormat
public partial class LBListFormat : LBComObject
{
public LBListFormat() { }
- public LBListFormat(Object item) : base(item) { }
- public String NameLocal
+ public LBListFormat(object item) : base(item) { }
+ public string NameLocal
{
get { return (GetProperty("NameLocal").ToString()); }
set { SetProperty("NameLocal", value); }
}
- public string ListString
- {
- get { return (GetProperty("ListString").ToString()); }
- }
- }
- // public partial class LBStyles : LBComObjectList /* Collection */
-// {
-// public LBStyles(Object item)
-// {
-// Item = item;
-// }
-// public int Count
-// {
-// get { return (GetProperty("Count") as int? ?? 0); }
-// }
-// public LBStyle Item
-// {
-// get { return new LBStyle(GetProperty("Item")); }
-// }
-// public System.Object GetEnumerator()
-// {
-// return InvokeMethod("GetEnumerator");
-// }
-// }
+ public string ListString => (GetProperty("ListString").ToString());
+ }
}
diff --git a/PROMS/LBWordLibrary/LBObjectExtension.cs b/PROMS/LBWordLibrary/LBObjectExtension.cs
index 8af4c527..93d44e07 100644
--- a/PROMS/LBWordLibrary/LBObjectExtension.cs
+++ b/PROMS/LBWordLibrary/LBObjectExtension.cs
@@ -1,654 +1,519 @@
+using Microsoft.Win32;
+using Read64bitRegistryFrom32bitApp;
using System;
using System.Collections.Generic;
-using System.Text;
using System.Reflection;
-using Microsoft.Win32;
-using System.Windows.Forms;
+using System.Text;
using System.Text.RegularExpressions;
-using Read64bitRegistryFrom32bitApp;
+using System.Windows.Forms;
namespace LBWordLibrary
{
- public partial class LBApplicationClass : LBComObject
- {
- private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
- ///
- /// This gives the option of specifying Background = false to print in the foreground.
- ///
- /// boolean BackGround
- /// If true - document will be printed in the background
- /// If false - document will be printed in the foreground
- public void PrintOut(Boolean Background)
- {
- InvokeMethod("PrintOut", Background, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value);
- }
- public void Quit(bool save)
- {
- InvokeMethod("Quit", save, Missing.Value, Missing.Value);
- }
- public bool VolianPDFInstalled
- {
- get
- {
- foreach (string printer in System.Drawing.Printing.PrinterSettings.InstalledPrinters)
- if (printer == "VolianPDF Writer") return true;
- return false;
- }
- }
- private static bool? _WordPDFExporterInstalled = null;
- public static bool WordPDFExporterInstalled
- {
- get
- {
- if (_WordPDFExporterInstalled == null)
- {
- // this is to determine if ExportAsFixedFormat was installed in MSOffice
- // This key only worked for Vista
- //RegistryKey key = Registry.ClassesRoot.OpenSubKey(@"Installer\Components\12B306B24E250DD428FC7016B6FB4BD8");
- // This key works for Windows Vista and Windows 7
- try
- {
- string keyPath = @"SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Components\0E5C161912A2A6C4C93C76678926C56C";
- bool validKey = RegistryWOW6432.CheckRegKey64Valid(RegHive.HKEY_LOCAL_MACHINE, keyPath);
- _WordPDFExporterInstalled = validKey;
- if(!validKey)
- _MyLog.WarnFormat("MSWord2007 PDF Export Registry Key Missing");
- //RegistryKey key = Registry.LocalMachine.OpenSubKey(keyPath, RegistryKeyPermissionCheck.ReadSubTree);
- //if (key == null)
- //{
- // RegistryKey localMachine64 = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry64);
- // key = localMachine64.OpenSubKey(keystring, RegistryKeyPermissionCheck.ReadSubTree);
- //}
- //if (key != null)
- //{
- // key.Close();
- // _WordPDFExporterInstalled = true;
- // return (bool) _WordPDFExporterInstalled;
- //}
- //_WordPDFExporterInstalled = FindEXP_PDF();
- return (bool) _WordPDFExporterInstalled;
- }
- catch (Exception ex)
- {
- _MyLog.WarnFormat("MSWord2007 PDF Export Registry Key Failure {0} - {1}", ex.GetType().Name, ex.Message);
- _WordPDFExporterInstalled = false;
- return (bool) _WordPDFExporterInstalled;
- }
+ public partial class LBApplicationClass : LBComObject
+ {
+ private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
+ ///
+ /// This gives the option of specifying Background = false to print in the foreground.
+ ///
+ /// boolean BackGround
+ /// If true - document will be printed in the background
+ /// If false - document will be printed in the foreground
+ public void PrintOut(bool Background) => InvokeMethod("PrintOut", Background, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value);
+ public void Quit(bool save) => InvokeMethod("Quit", save, Missing.Value, Missing.Value);
+ public bool VolianPDFInstalled
+ {
+ get
+ {
+ foreach (string printer in System.Drawing.Printing.PrinterSettings.InstalledPrinters)
+ if (printer == "VolianPDF Writer") return true;
+ return false;
+ }
+ }
+ private static bool? _WordPDFExporterInstalled = null;
+ public static bool WordPDFExporterInstalled
+ {
+ get
+ {
+ if (_WordPDFExporterInstalled == null)
+ {
+ // this is to determine if ExportAsFixedFormat was installed in MSOffice
+ // This key only worked for Vista
+ //RegistryKey key = Registry.ClassesRoot.OpenSubKey(@"Installer\Components\12B306B24E250DD428FC7016B6FB4BD8");
+ // This key works for Windows Vista and Windows 7
+ try
+ {
+ string keyPath = @"SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Components\0E5C161912A2A6C4C93C76678926C56C";
+ bool validKey = RegistryWOW6432.CheckRegKey64Valid(RegHive.HKEY_LOCAL_MACHINE, keyPath);
+ _WordPDFExporterInstalled = validKey;
+ if (!validKey)
+ _MyLog.WarnFormat("MSWord2007 PDF Export Registry Key Missing");
+
+ return (bool)_WordPDFExporterInstalled;
+ }
+ catch (Exception ex)
+ {
+ _MyLog.WarnFormat("MSWord2007 PDF Export Registry Key Failure {0} - {1}", ex.GetType().Name, ex.Message);
+ _WordPDFExporterInstalled = false;
+ return (bool)_WordPDFExporterInstalled;
+ }
- }
- return (bool) _WordPDFExporterInstalled;
- }
- }
- private static bool FindEXP_PDF()
- {
- bool retval = false;
- DateTime dtStart = DateTime.Now;
- try
- {
- //string keystr = @"SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Components\0E5C161912A2A6C4C93C76678926C56C";
- RegistryKey key = null;
- string keystr = @"SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Components";
- while (key == null && keystr != "")
- {
- key = Registry.LocalMachine.OpenSubKey(keystr, RegistryKeyPermissionCheck.ReadSubTree);
- keystr = keystr.Substring(0, keystr.LastIndexOf("\\"));
- }
- if (FindKeys(key, "EXP_PDF.DLL"))
- retval = true;
- }
- catch (Exception ex)
- {
- AddKeyFound(string.Format("{0} - {1}", ex.GetType().Name, ex.Message));
- }
- finally
- {
- DateTime dtEnd = DateTime.Now;
- TimeSpan ts = TimeSpan.FromTicks(dtEnd.Ticks - dtStart.Ticks);
- AddKeyFound(string.Format("{0} Seconds", ts.TotalSeconds));
- }
- return retval;
- }
- private static bool FindKeys(RegistryKey key, string find)
- {
- string[] keyNames = key.GetSubKeyNames();
- foreach (string keyName in keyNames)
- {
- using (RegistryKey subKey = key.OpenSubKey(keyName, RegistryKeyPermissionCheck.ReadSubTree))
- {
- if (FindKeys(subKey, find)) return true;
- }
- }
- if (FindNames(key, find)) return true;
- return false;
- }
- private static bool FindNames(RegistryKey key, string find)
- {
- string[] names = key.GetValueNames();
- foreach (string name in names)
- {
- if (FindNames(key, name, find)) return true;
- }
- return false;
- }
- private static bool FindNames(RegistryKey key, string name, string find)
- {
- RegistryValueKind kind = key.GetValueKind(name);
- if (kind == RegistryValueKind.String)
- {
- string val = (string)key.GetValue(name);
- if (val.Contains(find))
- {
- AddKeyFound(string.Format("'{0}'\r\n Value {1} = '{2}'", key.ToString(), name, val));
- return true;
- }
- }
- return false;
- }
- private static void AddKeyFound(string str)
- {
- _MyLog.WarnFormat("RegistryKeySearch: {0}",str);
- }
- private bool CanCreatePDFFile(string pdfFileName)
- {
- System.IO.FileInfo file = new System.IO.FileInfo(pdfFileName);
- if (!file.Exists) return true;
- try
- {
- file.Delete();
- return true;
- }
- catch (System.IO.IOException exio)
- {
- if (exio.Message.StartsWith("The process cannot access the file")) return false;
- throw new Exception(string.Format("Cannot Delete PDF file {0}", pdfFileName), exio);
- }
- catch (Exception ex)
- {
- throw new Exception(string.Format("Cannot Delete PDF file {0}", pdfFileName), ex);
- }
- }
- private string AvailableFileName(string pdfFileName)
- {
- if (CanCreatePDFFile(pdfFileName)) return pdfFileName;
- string prefix = pdfFileName.Replace(".pdf", "");
- for (int i = 1; i < 1000; i++)
- {
- string newname = string.Format("{0}_{1:000}.PDF", prefix, i);
- if (CanCreatePDFFile(newname)) return newname;
- }
- throw new Exception("Cannot find a name to use");
- }
- public string CreatePDF(string pdfFileName, bool openPDF,int DebugStatus)
- {
- pdfFileName = CreatePDF(pdfFileName, DebugStatus);
- if (openPDF) OpenPDF(pdfFileName);
- return pdfFileName;
- }
- static List _AcrobatProcesses=new List();
- private static void OpenPDF(string pdfFileName)
- {
- _AcrobatProcesses.Add(System.Diagnostics.Process.Start(pdfFileName));
- }
- public static void ClosePDFs()
- {
- foreach(System.Diagnostics.Process proc in _AcrobatProcesses)
- if (!proc.HasExited)
- KillAndWait(proc);
- }
- private static void KillAndWait(System.Diagnostics.Process proc)
- {
- Console.WriteLine("{0:s.ffff} Killing Adobe", DateTime.Now);
- DateTime tStart = DateTime.Now;
- proc.Kill();
- DateTime tEnd = DateTime.Now.AddMilliseconds(100);
- while (DateTime.Now < tEnd)
- {
- Application.DoEvents();
- }
- Console.WriteLine("{0:yyyy-MM-dd HH:mm:ss.ffff} {1:yyyy-MM-dd HH:mm:ss.ffff} {2}", DateTime.Now, proc.ExitTime
- ,TimeSpan.FromTicks(proc.ExitTime.Ticks - tStart.Ticks).TotalMilliseconds);
- }
- public string CreatePDF(string pdfFileName, int DebugStatus)
- {
- pdfFileName = AvailableFileName(pdfFileName);
- if (((int)Convert.ToSingle(Version)) > 12)
- return CreatePDF2007(pdfFileName, DebugStatus);
- if (((int)Convert.ToSingle(Version)) == 12 && WordPDFExporterInstalled)
- {
- //_MyLog.WarnFormat("Word PDF Exporter Installed - MSWord Version = '{0}'" , Version);
- return CreatePDF2007(pdfFileName, DebugStatus);
- }
- if (VolianPDFInstalled)
- {
- _MyLog.WarnFormat("Using VolianPDFWriter - MSWord Version = '{0}'", Version);
- return CreatePDF2003BG(pdfFileName);
- }
- //else // Force PDF Export
- //{
- // _MyLog.WarnFormat("Force PDF Export for Michelle - MSWord Version = '{0}'", Version);
- // return CreatePDF2007(pdfFileName, DebugStatus);
- throw new Exception("No PDF Writer support installed for MS Word sections");
- //}
- }
- public string CreatePDF2003FG(string pdfFileName, bool openPDF)
- {
- pdfFileName = CreatePDF2003FG(pdfFileName);
- if (openPDF) OpenPDF(pdfFileName);
- return pdfFileName;
- }
- public string CreatePDF2003FG(string pdfFileName)
- {
- pdfFileName = AvailableFileName(pdfFileName);
- if (!VolianPDFInstalled)
- throw new Exception("VolianPDF Writer is not installed properly");
- try
- {
- string printer = ActivePrinter;
- RegistryKey key = Registry.CurrentUser.CreateSubKey(@"Software\VolianPDF Writer");
- key.SetValue("OutputFile", pdfFileName, RegistryValueKind.String);
- key.SetValue("BypassSaveAs", "1", RegistryValueKind.String);
- key.Close();
- ActivePrinter = "VolianPDF Writer";
- PrintOut(false);
- ActivePrinter = printer;
- Registry.CurrentUser.DeleteSubKeyTree(@"Software\VolianPDF Writer");
- return pdfFileName;
- }
- catch (Exception ex)
- {
- throw new Exception("Error creating PDF - LBApplicationClass.CreatePDF2003FG", ex);
- }
- }
- public string CreatePDF2003BG(string pdfFileName, bool openPDF)
- {
- pdfFileName = CreatePDF2003BG(pdfFileName);
- if (openPDF) OpenPDF(pdfFileName);
- return pdfFileName;
- }
- public string CreatePDF2003BG(string pdfFileName)
- {
- pdfFileName = AvailableFileName(pdfFileName);
- if (!VolianPDFInstalled)
- throw new Exception("VolianPDF Writer is not installed properly");
- try
- {
- string printer = ActivePrinter;
- RegistryKey key = Registry.CurrentUser.CreateSubKey(@"Software\VolianPDF Writer");
- key.SetValue("OutputFile", pdfFileName, RegistryValueKind.String);
- key.SetValue("BypassSaveAs", "1", RegistryValueKind.String);
- key.Close();
- ActivePrinter = "VolianPDF Writer";
- PrintOut(true);
- do
- {
- // Console.WriteLine("Background Printing Status = {0}", _MyApp.BackgroundPrintingStatus);
- Application.DoEvents();
- } while (BackgroundPrintingStatus == 1);
- ActivePrinter = printer;
- Registry.CurrentUser.DeleteSubKeyTree(@"Software\VolianPDF Writer");
- return pdfFileName;
- }
- catch (Exception ex)
- {
- throw new Exception("Error creating PDF - LBApplicationClass.CreatePDF2003BG", ex);
- }
- }
- public string CreatePDF2007(string pdfFileName, bool openPDF, int DebugStatus)
- {
- pdfFileName = CreatePDF2007(pdfFileName, DebugStatus);
- if (openPDF) OpenPDF(pdfFileName);
- return pdfFileName;
- }
- public string CreatePDF2007(string pdfFileName,int DebugStatus)
- {
- pdfFileName = AvailableFileName(pdfFileName);
- // Removed to support MSWord 2010 and beyond.
- //if (!WordPDFExporterInstalled)
- // throw new Exception("MS Word PDF Exporter is not installed");
- try
- {
- ActiveDocument.ExportAsFixedFormat(pdfFileName, LBWdExportFormat.wdExportFormatPDF, DebugStatus);
- return pdfFileName;
- }
- catch (Exception ex)
- {
- throw new Exception("Error creating PDF - LBApplicationClass.CreatePDF2007", ex);
- }
- }
- }
- public partial class LBDocuments
- {
- public LBDocumentClass Open(string fileName, Boolean addToRecentFiles)
- {
- return Open(fileName, Missing.Value, Missing.Value, addToRecentFiles);
- }
- private LBDocumentClass Open(params object[] myParams)
- {
- return new LBDocumentClass(InvokeMethod("Open", myParams));
- }
- }
- public partial class LBDocumentClass : LBComObject
- {
- public void ExportAsFixedFormat(string OutputFileName, LBWdExportFormat ExportFormat, int DebugStatus)
- {
- // iso 19005-1 compliant (PDF/A) [UseISO19005_1] should be set to false. for compare print
- // iso 19005-1 compliant (PDF/A) [UseISO19005_1] should be set to true for production print
- InvokeMethod("ExportAsFixedFormat", OutputFileName, ExportFormat, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, DebugStatus == 0, Missing.Value);
- }
- private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
- public void SaveAs2000(string fileName)
- {
- if (fileName.ToUpper().EndsWith("DOC"))
- SaveAs2000(fileName, LBWdSaveFormat.wdFormatDocument);
- else if (fileName.ToUpper().EndsWith("RTF"))
- SaveAs2000(fileName, LBWdSaveFormat.wdFormatRTF);
- else
- SaveAs2000(fileName);
- }
- public void SaveAs2000(params object[] myParams)
- {
- InvokeMethod("SaveAs2000", myParams);
- }
- public void SaveAs(string fileName)
- {
- if (fileName.ToUpper().EndsWith("DOC"))
- SaveAs2(fileName, LBWdSaveFormat.wdFormatDocument, Missing.Value, Missing.Value, false);
- else if (fileName.ToUpper().EndsWith("RTF"))
- SaveAs2(fileName, LBWdSaveFormat.wdFormatRTF, Missing.Value, Missing.Value, false);
- else if (fileName.ToUpper().EndsWith("TXT"))
- SaveAs2(fileName, LBWdSaveFormat.wdFormatDOSText, Missing.Value, Missing.Value, false);
- else if (fileName.ToUpper().EndsWith("DOCX"))
- SaveAs2(fileName, LBWdSaveFormat.wdFormatXMLDocument, Missing.Value, Missing.Value, false);
- else
- SaveAs2(fileName, Missing.Value, Missing.Value, Missing.Value, false);
- }
- public void SaveAs2(params object[] myParams)
- {
- InvokeMethod("SaveAs", myParams);
- }
- public void SaveAs(string fileName, LBWdSaveFormat format)
- {
- SaveAs2(fileName, format, Missing.Value, Missing.Value, false);
- }
- public LBRange Range(int Start, int End)
- {
- return new LBRange(InvokeMethod("Range", Start, End));
- }
- ///
- /// Length is Pages and Partial Pages
- /// The integral part is the number of full pages
- /// The decimal part is the size of the last page divided by 7200
- /// (the first two digits should be the number of inches)
- ///
- public float Length
- {
- get
- {
- ActiveWindow.ActivePane.View.Type = LBWdViewType.wdPrintView;
- ActiveWindow.View.Type = LBWdViewType.wdPrintView;
- LBPages myPages = ActiveWindow.ActivePane.Pages;// Start with pages
- float retval = (float)myPages.Count - 1;
- LBRange myRange = Range();
-
- myRange = myRange.GoTo(LBWdGoToItem.wdGoToPercent, LBWdGoToDirection.wdGoToAbsolute, 0);
- float mytop = myRange.PageSetup.TopMargin;
+ }
+ return (bool)_WordPDFExporterInstalled;
+ }
+ }
+
+ private static bool FindKeys(RegistryKey key, string find)
+ {
+ string[] keyNames = key.GetSubKeyNames();
+ foreach (string keyName in keyNames)
+ {
+ using (RegistryKey subKey = key.OpenSubKey(keyName, RegistryKeyPermissionCheck.ReadSubTree))
+ {
+ if (FindKeys(subKey, find)) return true;
+ }
+ }
+ if (FindNames(key, find)) return true;
+ return false;
+ }
+ private static bool FindNames(RegistryKey key, string find)
+ {
+ string[] names = key.GetValueNames();
+ foreach (string name in names)
+ {
+ if (FindNames(key, name, find)) return true;
+ }
+ return false;
+ }
+ private static bool FindNames(RegistryKey key, string name, string find)
+ {
+ RegistryValueKind kind = key.GetValueKind(name);
+ if (kind == RegistryValueKind.String)
+ {
+ string val = (string)key.GetValue(name);
+ if (val.Contains(find))
+ {
+ AddKeyFound(string.Format("'{0}'\r\n Value {1} = '{2}'", key.ToString(), name, val));
+ return true;
+ }
+ }
+ return false;
+ }
+ private static void AddKeyFound(string str) => _MyLog.WarnFormat("RegistryKeySearch: {0}", str);
+ private bool CanCreatePDFFile(string pdfFileName)
+ {
+ System.IO.FileInfo file = new System.IO.FileInfo(pdfFileName);
+ if (!file.Exists) return true;
+ try
+ {
+ file.Delete();
+ return true;
+ }
+ catch (System.IO.IOException exio)
+ {
+ if (exio.Message.StartsWith("The process cannot access the file")) return false;
+ throw new Exception(string.Format("Cannot Delete PDF file {0}", pdfFileName), exio);
+ }
+ catch (Exception ex)
+ {
+ throw new Exception(string.Format("Cannot Delete PDF file {0}", pdfFileName), ex);
+ }
+ }
+ private string AvailableFileName(string pdfFileName)
+ {
+ if (CanCreatePDFFile(pdfFileName)) return pdfFileName;
+ string prefix = pdfFileName.Replace(".pdf", "");
+ for (int i = 1; i < 1000; i++)
+ {
+ string newname = string.Format("{0}_{1:000}.PDF", prefix, i);
+ if (CanCreatePDFFile(newname)) return newname;
+ }
+ throw new Exception("Cannot find a name to use");
+ }
+ public string CreatePDF(string pdfFileName, bool openPDF, int DebugStatus)
+ {
+ pdfFileName = CreatePDF(pdfFileName, DebugStatus);
+ if (openPDF) OpenPDF(pdfFileName);
+ return pdfFileName;
+ }
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE0044:Add readonly modifier", Justification = "Keeping Collections Not ReadOnly")]
+ static List _AcrobatProcesses = new List();
+ private static void OpenPDF(string pdfFileName) => _AcrobatProcesses.Add(System.Diagnostics.Process.Start(pdfFileName));
+ public static void ClosePDFs()
+ {
+ foreach (System.Diagnostics.Process proc in _AcrobatProcesses)
+ if (!proc.HasExited)
+ KillAndWait(proc);
+ }
+ private static void KillAndWait(System.Diagnostics.Process proc)
+ {
+ Console.WriteLine("{0:s.ffff} Killing Adobe", DateTime.Now);
+ DateTime tStart = DateTime.Now;
+ proc.Kill();
+ DateTime tEnd = DateTime.Now.AddMilliseconds(100);
+ while (DateTime.Now < tEnd)
+ {
+ Application.DoEvents();
+ }
+ Console.WriteLine("{0:yyyy-MM-dd HH:mm:ss.ffff} {1:yyyy-MM-dd HH:mm:ss.ffff} {2}", DateTime.Now, proc.ExitTime
+ , TimeSpan.FromTicks(proc.ExitTime.Ticks - tStart.Ticks).TotalMilliseconds);
+ }
+ public string CreatePDF(string pdfFileName, int DebugStatus)
+ {
+ pdfFileName = AvailableFileName(pdfFileName);
+ if (((int)Convert.ToSingle(Version)) > 12)
+ return CreatePDF2007(pdfFileName, DebugStatus);
+ if (((int)Convert.ToSingle(Version)) == 12 && WordPDFExporterInstalled)
+ {
+ //_MyLog.WarnFormat("Word PDF Exporter Installed - MSWord Version = '{0}'" , Version);
+ return CreatePDF2007(pdfFileName, DebugStatus);
+ }
+ if (VolianPDFInstalled)
+ {
+ _MyLog.WarnFormat("Using VolianPDFWriter - MSWord Version = '{0}'", Version);
+ return CreatePDF2003BG(pdfFileName);
+ }
+ throw new Exception("No PDF Writer support installed for MS Word sections");
+ }
+ public string CreatePDF2003FG(string pdfFileName, bool openPDF)
+ {
+ pdfFileName = CreatePDF2003FG(pdfFileName);
+ if (openPDF) OpenPDF(pdfFileName);
+ return pdfFileName;
+ }
+ public string CreatePDF2003FG(string pdfFileName)
+ {
+ pdfFileName = AvailableFileName(pdfFileName);
+ if (!VolianPDFInstalled)
+ throw new Exception("VolianPDF Writer is not installed properly");
+ try
+ {
+ string printer = ActivePrinter;
+ RegistryKey key = Registry.CurrentUser.CreateSubKey(@"Software\VolianPDF Writer");
+ key.SetValue("OutputFile", pdfFileName, RegistryValueKind.String);
+ key.SetValue("BypassSaveAs", "1", RegistryValueKind.String);
+ key.Close();
+ ActivePrinter = "VolianPDF Writer";
+ PrintOut(false);
+ ActivePrinter = printer;
+ Registry.CurrentUser.DeleteSubKeyTree(@"Software\VolianPDF Writer");
+ return pdfFileName;
+ }
+ catch (Exception ex)
+ {
+ throw new Exception("Error creating PDF - LBApplicationClass.CreatePDF2003FG", ex);
+ }
+ }
+ public string CreatePDF2003BG(string pdfFileName, bool openPDF)
+ {
+ pdfFileName = CreatePDF2003BG(pdfFileName);
+ if (openPDF) OpenPDF(pdfFileName);
+ return pdfFileName;
+ }
+ public string CreatePDF2003BG(string pdfFileName)
+ {
+ pdfFileName = AvailableFileName(pdfFileName);
+ if (!VolianPDFInstalled)
+ throw new Exception("VolianPDF Writer is not installed properly");
+ try
+ {
+ string printer = ActivePrinter;
+ RegistryKey key = Registry.CurrentUser.CreateSubKey(@"Software\VolianPDF Writer");
+ key.SetValue("OutputFile", pdfFileName, RegistryValueKind.String);
+ key.SetValue("BypassSaveAs", "1", RegistryValueKind.String);
+ key.Close();
+ ActivePrinter = "VolianPDF Writer";
+ PrintOut(true);
+ do
+ {
+ // Console.WriteLine("Background Printing Status = {0}", _MyApp.BackgroundPrintingStatus);
+ Application.DoEvents();
+ } while (BackgroundPrintingStatus == 1);
+ ActivePrinter = printer;
+ Registry.CurrentUser.DeleteSubKeyTree(@"Software\VolianPDF Writer");
+ return pdfFileName;
+ }
+ catch (Exception ex)
+ {
+ throw new Exception("Error creating PDF - LBApplicationClass.CreatePDF2003BG", ex);
+ }
+ }
+ public string CreatePDF2007(string pdfFileName, bool openPDF, int DebugStatus)
+ {
+ pdfFileName = CreatePDF2007(pdfFileName, DebugStatus);
+ if (openPDF) OpenPDF(pdfFileName);
+ return pdfFileName;
+ }
+ public string CreatePDF2007(string pdfFileName, int DebugStatus)
+ {
+ pdfFileName = AvailableFileName(pdfFileName);
+ try
+ {
+ ActiveDocument.ExportAsFixedFormat(pdfFileName, LBWdExportFormat.wdExportFormatPDF, DebugStatus);
+ return pdfFileName;
+ }
+ catch (Exception ex)
+ {
+ throw new Exception("Error creating PDF - LBApplicationClass.CreatePDF2007", ex);
+ }
+ }
+ }
+ public partial class LBDocuments
+ {
+ public LBDocumentClass Open(string fileName, bool addToRecentFiles) => Open(fileName, Missing.Value, Missing.Value, addToRecentFiles);
+ private LBDocumentClass Open(params object[] myParams) => new LBDocumentClass(InvokeMethod("Open", myParams));
+ }
+ public partial class LBDocumentClass : LBComObject
+ {
+ public void ExportAsFixedFormat(string OutputFileName, LBWdExportFormat ExportFormat, int DebugStatus)
+ {
+ // iso 19005-1 compliant (PDF/A) [UseISO19005_1] should be set to false. for compare print
+ // iso 19005-1 compliant (PDF/A) [UseISO19005_1] should be set to true for production print
+ InvokeMethod("ExportAsFixedFormat", OutputFileName, ExportFormat, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, DebugStatus == 0, Missing.Value);
+ }
+ private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
+ public void SaveAs2000(string fileName)
+ {
+ if (fileName.ToUpper().EndsWith("DOC"))
+ SaveAs2000(fileName, LBWdSaveFormat.wdFormatDocument);
+ else if (fileName.ToUpper().EndsWith("RTF"))
+ SaveAs2000(fileName, LBWdSaveFormat.wdFormatRTF);
+ else
+ SaveAs2000(fileName);
+ }
+ public void SaveAs2000(params object[] myParams) => InvokeMethod("SaveAs2000", myParams);
+ public void SaveAs(string fileName)
+ {
+ if (fileName.ToUpper().EndsWith("DOC"))
+ SaveAs2(fileName, LBWdSaveFormat.wdFormatDocument, Missing.Value, Missing.Value, false);
+ else if (fileName.ToUpper().EndsWith("RTF"))
+ SaveAs2(fileName, LBWdSaveFormat.wdFormatRTF, Missing.Value, Missing.Value, false);
+ else if (fileName.ToUpper().EndsWith("TXT"))
+ SaveAs2(fileName, LBWdSaveFormat.wdFormatDOSText, Missing.Value, Missing.Value, false);
+ else if (fileName.ToUpper().EndsWith("DOCX"))
+ SaveAs2(fileName, LBWdSaveFormat.wdFormatXMLDocument, Missing.Value, Missing.Value, false);
+ else
+ SaveAs2(fileName, Missing.Value, Missing.Value, Missing.Value, false);
+ }
+ public void SaveAs2(params object[] myParams) => InvokeMethod("SaveAs", myParams);
+ public void SaveAs(string fileName, LBWdSaveFormat format) => SaveAs2(fileName, format, Missing.Value, Missing.Value, false);
+ public LBRange Range(int Start, int End) => new LBRange(InvokeMethod("Range", Start, End));
+ ///
+ /// Length is Pages and Partial Pages
+ /// The integral part is the number of full pages
+ /// The decimal part is the size of the last page divided by 7200
+ /// (the first two digits should be the number of inches)
+ ///
+ public float Length
+ {
+ get
+ {
+ ActiveWindow.ActivePane.View.Type = LBWdViewType.wdPrintView;
+ ActiveWindow.View.Type = LBWdViewType.wdPrintView;
+ LBPages myPages = ActiveWindow.ActivePane.Pages;// Start with pages
+ float retval = (float)myPages.Count - 1;
+ LBRange myRange = Range();
+
+ myRange = myRange.GoTo(LBWdGoToItem.wdGoToPercent, LBWdGoToDirection.wdGoToAbsolute, 0);
+ float mytop = myRange.PageSetup.TopMargin;
myRange = myRange.GoTo(LBWdGoToItem.wdGoToPercent, LBWdGoToDirection.wdGoToLast, 100);
- //float partial = (float) myRange.get_Information(LBWdInformation.wdVerticalPositionRelativeToTextBoundary);
- // B2018-028 Word 2016 has a different value for the Vertical Position Relative to the Text Boundary than older version of Word.
- // We now need to calculated the last row of text in the PROMS attachment differently.
- // We now subtract the TopMargin the Page Setup from the Vertical Position Relative to the Page
- // this works with older versions of MS Word as well.
- float partial = (float)myRange.get_Information(LBWdInformation.wdVerticalPositionRelativeToPage) - mytop;
- partial += myRange.Font.Size;
- retval += partial / 7200;
- return retval;
- }
- }
- public string Ascii
- {
- get
- {
- LBRange myRange = Range();
- myRange = myRange.GoTo(LBWdGoToItem.wdGoToPercent, LBWdGoToDirection.wdGoToLast, 100);
- myRange.Start = 0;
- return ReplaceSymbolCharacters(GetRangeText(myRange));
- }
- }
- private static string[] SymbolFontName = { "VolianDraw", "WingDings", "VESymb", "VESymbFix", "Symbol" };
- private static bool IsSymbolFont(string fontName)
- {
- foreach (string symbolFont in SymbolFontName)
- if (fontName.ToUpper().StartsWith(symbolFont.ToUpper()))
- return true;
- return false;
- }
-
- ///
- /// Checks to see if the document contains symbol characters
- ///
- ///
- public bool HasSymbolCharacters
- {
- get
- {
- LBRange myRange = Range();
- myRange = myRange.GoTo(LBWdGoToItem.wdGoToPercent, LBWdGoToDirection.wdGoToLast, 100);
- myRange.Start = 0;
- int end = myRange.End;
- string myText = GetRangeText(myRange);
- //return _RegFindSymbol.IsMatch(myText);
- MatchCollection problems = _RegFindSymbol.Matches(myText);
- int offset = 0;
- foreach (Match problem in problems)
- {
- myRange.Start = problem.Index + offset;
- myRange.End = problem.Index + problem.Length + offset;
- int newOffset = FindRangeOffset(myRange, problem, offset, end);
- if (IsSymbolFont(myRange.Font.Name))
- {
- Console.WriteLine("Font '{0}' has Symbols", myRange.Font.Name);
- //return true;
- }
- else
- return true;
- offset = newOffset;
- }
- return false;
- }
- }
- Regex _RegFindSymbol = new Regex("[\\uF020-\\uF07F]+");
+ float partial = (float)myRange.get_Information(LBWdInformation.wdVerticalPositionRelativeToPage) - mytop;
+ partial += myRange.Font.Size;
+ retval += partial / 7200;
+ return retval;
+ }
+ }
+ public string Ascii
+ {
+ get
+ {
+ LBRange myRange = Range();
+ myRange = myRange.GoTo(LBWdGoToItem.wdGoToPercent, LBWdGoToDirection.wdGoToLast, 100);
+ myRange.Start = 0;
+ return ReplaceSymbolCharacters(GetRangeText(myRange));
+ }
+ }
+ private static readonly string[] SymbolFontName = { "VolianDraw", "WingDings", "VESymb", "VESymbFix", "Symbol" };
+ private static bool IsSymbolFont(string fontName)
+ {
+ foreach (string symbolFont in SymbolFontName)
+ if (fontName.ToUpper().StartsWith(symbolFont.ToUpper()))
+ return true;
+ return false;
+ }
- ///
- /// Get the Range Text with error handling. myRange.Text sometimes will get a null reference exception.
- ///
- ///
- ///
- internal static string GetRangeText(LBRange myRange)
- {
- string text="";
- try
- {
- if (myRange.Start == myRange.End)// If Start and End equal return an empty string.
- text = "";
- else
- text = myRange.Text;
- }
- catch (Exception ex)
- {
- Console.WriteLine("GetRangeText {0} - {1}", ex.GetType().Name, ex.Message);
- }
- return text;
- }
- ///
- /// Looks for the problem string and adjusts the range as necessary
- ///
- ///
- ///
- ///
- ///
- ///
- private int FindRangeOffset(LBRange myRange, Match problem, int offset, int end)
- {
- // try to find the string
- string text = GetRangeText(myRange);
- if (text != problem.Value)
- {
- // Get the entire text starting at the offset of the first match
- myRange.Start = problem.Index + offset;
- myRange.End = end;
- text = GetRangeText(myRange);
- while (!text.StartsWith(problem.Value))
- {
- int newStart = text.IndexOf(problem.Value);// Find the string if it is not at the beginning
- myRange.Start += myRange.Start == newStart ? newStart + 1 : newStart; // adjust the starting location
- text = GetRangeText(myRange);// get the text to check
- }
- myRange.End = myRange.Start + problem.Length; // assume that the end should be the start plus the length
- text = GetRangeText(myRange);
- while (text.Length < problem.Length) // If the result is too short increase the length
- {
- myRange.End += (problem.Length - text.Length);
- text = GetRangeText(myRange);
- }
- }
- return myRange.Start - problem.Index;
- }
- ///
- /// ReplaceSymbolCharacters processes the string returned and changes any symbols (0xF0??) to normal characters
- ///
- ///
- ///
- private static string ReplaceSymbolCharacters(string str)
- {
- StringBuilder results = new StringBuilder();
- foreach (char c in str)
- {
- if ((c & 0xFF00) == 0xF000)
- results.Append((char)(c & 0xFF));
- else
- results.Append((char)(c));
- }
- return results.ToString();
- }
- ///
- /// Close the document
- ///
- /// Save Changes
- public void Close(bool SaveChanges)
- {
- InvokeMethod("Close", SaveChanges, Missing.Value, Missing.Value);
- }
- }
- public partial class LBFind
- {
- public void ReplaceAll()
- {
- this.Execute(Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value,
- Missing.Value, Missing.Value, Missing.Value, Missing.Value, LBWdReplace.wdReplaceAll, Missing.Value,
- Missing.Value, Missing.Value, Missing.Value);
- }
- }
- public partial class LBFontClass : LBComObject
- {
- public int TextColor
- {
- get { return (int)GetProperty("Color"); }
- set { SetProperty("Color", value); }
- }
- }
- public partial class LBRange : LBComObject
- {
- public Object get_Information(LBWdInformation info)
- {
- return GetProperty("Information", info);
- }
- public LBRange GoTo(LBWdGoToItem What, LBWdGoToDirection Which, int Count)
- {
- return new LBRange(InvokeMethod("GoTo", What, Which, Count, Missing.Value));
- }
- }
- public partial class LBSelection : LBComObject
- {
- public Object get_Information(LBWdInformation info)
- {
- return GetProperty("Information", info);
- }
- public int MoveStart(LBWdUnits Unit, int Count)
- {
- return InvokeMethod("MoveStart", Unit, Count) as int? ?? 0;
- }
- public int MoveEnd(LBWdUnits Unit, int Count)
- {
- return InvokeMethod("MoveEnd", Unit, Count) as int? ?? 0;
- }
- public int EndKey(LBWdUnits Unit, bool Extend)
- {
- return InvokeMethod("EndKey", Unit, Extend) as int? ?? 0;
- }
- public bool LastWasUpper
- {
- get
- {
- LBRange myRange = Range;
- int start = myRange.Start - 1;
- while (start >= 0)
- {
- myRange.Start = start;
- myRange.End = start + 1;
- string previous = LBDocumentClass.GetRangeText(myRange);
- if (Regex.IsMatch(previous, "[A-Z]")) return true;
- if (Regex.IsMatch(previous, "[a-z]")) return false;
- start = start - 1;
- }
- return false;
- }
- }
- }
- public partial class LBInlineShapes : LBComObjectList /* Collection */
- {
- public LBInlineShape AddPicture(string FileName, LBRange Range)
- {
- return new LBInlineShape(InvokeMethod("AddPicture", FileName, false, true, Range));
- }
- }
- public partial class LBShapes : LBComObjectList /* Collection */
- {
- public LBShape AddPicture(string FileName, float Left, float Top, LBRange Anchor)
- {
- return new LBShape(InvokeMethod("AddPicture", FileName, false, true, Left, Top, Missing.Value, Missing.Value, Anchor));
- }
- public LBShape AddPicture(string FileName, float Left, float Top)
- {
- return new LBShape(InvokeMethod("AddPicture", FileName, false, true, Left, Top, Missing.Value, Missing.Value, Missing.Value));
- }
- }
- public enum LBMsoTriState
- {
- msoCTrue = 1,
- msoFalse = 0,
- msoTriStateMixed = -2,
- msoTriStateToggle = -3,
- msoTrue = -1
- }
- //public partial class ProcessKiller
- //{
- // System.Diagnostics.Process _MyProcess;
- // private bool _Exited = false;
- // public ProcessKiller(System.Diagnostics.Process myProcess)
- // {
- // _MyProcess = myProcess;
- // _MyProcess.Exited += new EventHandler(_MyProcess_Exited);
- // _MyProcess.Kill();
- // DateTime next = DateTime.Now.AddMilliseconds(200);
- // while (DateTime.Now < next)
- // Application.DoEvents();
- // while (!_Exited)
- // Application.DoEvents();
- // }
- // void _MyProcess_Exited(object sender, EventArgs e)
- // {
- // Console.WriteLine("Exited");
- // _Exited = true;
- // }
- //}
+ ///
+ /// Checks to see if the document contains symbol characters
+ ///
+ ///
+ public bool HasSymbolCharacters
+ {
+ get
+ {
+ LBRange myRange = Range();
+ myRange = myRange.GoTo(LBWdGoToItem.wdGoToPercent, LBWdGoToDirection.wdGoToLast, 100);
+ myRange.Start = 0;
+ int end = myRange.End;
+ string myText = GetRangeText(myRange);
+ MatchCollection problems = _RegFindSymbol.Matches(myText);
+ int offset = 0;
+ foreach (Match problem in problems)
+ {
+ myRange.Start = problem.Index + offset;
+ myRange.End = problem.Index + problem.Length + offset;
+ int newOffset = FindRangeOffset(myRange, problem, offset, end);
+ if (IsSymbolFont(myRange.Font.Name))
+ {
+ Console.WriteLine("Font '{0}' has Symbols", myRange.Font.Name);
+ }
+ else
+ return true;
+ offset = newOffset;
+ }
+ return false;
+ }
+ }
+ readonly Regex _RegFindSymbol = new Regex("[\\uF020-\\uF07F]+");
+
+ ///
+ /// Get the Range Text with error handling. myRange.Text sometimes will get a null reference exception.
+ ///
+ ///
+ ///
+ internal static string GetRangeText(LBRange myRange)
+ {
+ string text = "";
+ try
+ {
+ if (myRange.Start == myRange.End)// If Start and End equal return an empty string.
+ text = "";
+ else
+ text = myRange.Text;
+ }
+ catch (Exception ex)
+ {
+ Console.WriteLine("GetRangeText {0} - {1}", ex.GetType().Name, ex.Message);
+ }
+ return text;
+ }
+ ///
+ /// Looks for the problem string and adjusts the range as necessary
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ private int FindRangeOffset(LBRange myRange, Match problem, int offset, int end)
+ {
+ // try to find the string
+ string text = GetRangeText(myRange);
+ if (text != problem.Value)
+ {
+ // Get the entire text starting at the offset of the first match
+ myRange.Start = problem.Index + offset;
+ myRange.End = end;
+ text = GetRangeText(myRange);
+ while (!text.StartsWith(problem.Value))
+ {
+ int newStart = text.IndexOf(problem.Value);// Find the string if it is not at the beginning
+ myRange.Start += myRange.Start == newStart ? newStart + 1 : newStart; // adjust the starting location
+ text = GetRangeText(myRange);// get the text to check
+ }
+ myRange.End = myRange.Start + problem.Length; // assume that the end should be the start plus the length
+ text = GetRangeText(myRange);
+ while (text.Length < problem.Length) // If the result is too short increase the length
+ {
+ myRange.End += (problem.Length - text.Length);
+ text = GetRangeText(myRange);
+ }
+ }
+ return myRange.Start - problem.Index;
+ }
+ ///
+ /// ReplaceSymbolCharacters processes the string returned and changes any symbols (0xF0??) to normal characters
+ ///
+ ///
+ ///
+ private static string ReplaceSymbolCharacters(string str)
+ {
+ StringBuilder results = new StringBuilder();
+ foreach (char c in str)
+ {
+ if ((c & 0xFF00) == 0xF000)
+ results.Append((char)(c & 0xFF));
+ else
+ results.Append((char)(c));
+ }
+ return results.ToString();
+ }
+ ///
+ /// Close the document
+ ///
+ /// Save Changes
+ public void Close(bool SaveChanges) => InvokeMethod("Close", SaveChanges, Missing.Value, Missing.Value);
+ }
+ public partial class LBFind
+ {
+ public void ReplaceAll()
+ {
+ this.Execute(Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value,
+ Missing.Value, Missing.Value, Missing.Value, Missing.Value, LBWdReplace.wdReplaceAll, Missing.Value,
+ Missing.Value, Missing.Value, Missing.Value);
+ }
+ }
+ public partial class LBFontClass : LBComObject
+ {
+ public int TextColor
+ {
+ get { return (int)GetProperty("Color"); }
+ set { SetProperty("Color", value); }
+ }
+ }
+ public partial class LBRange : LBComObject
+ {
+ public object get_Information(LBWdInformation info) => GetProperty("Information", info);
+ public LBRange GoTo(LBWdGoToItem What, LBWdGoToDirection Which, int Count) => new LBRange(InvokeMethod("GoTo", What, Which, Count, Missing.Value));
+ }
+ public partial class LBSelection : LBComObject
+ {
+ public object get_Information(LBWdInformation info) => GetProperty("Information", info);
+ public int MoveStart(LBWdUnits Unit, int Count) => InvokeMethod("MoveStart", Unit, Count) as int? ?? 0;
+ public int MoveEnd(LBWdUnits Unit, int Count) => InvokeMethod("MoveEnd", Unit, Count) as int? ?? 0;
+ public int EndKey(LBWdUnits Unit, bool Extend) => InvokeMethod("EndKey", Unit, Extend) as int? ?? 0;
+ public bool LastWasUpper
+ {
+ get
+ {
+ LBRange myRange = Range;
+ int start = myRange.Start - 1;
+ while (start >= 0)
+ {
+ myRange.Start = start;
+ myRange.End = start + 1;
+ string previous = LBDocumentClass.GetRangeText(myRange);
+ if (Regex.IsMatch(previous, "[A-Z]")) return true;
+ if (Regex.IsMatch(previous, "[a-z]")) return false;
+ start--;
+ }
+ return false;
+ }
+ }
+ }
+ public partial class LBInlineShapes : LBComObjectList /* Collection */
+ {
+ public LBInlineShape AddPicture(string FileName, LBRange Range) => new LBInlineShape(InvokeMethod("AddPicture", FileName, false, true, Range));
+ }
+ public partial class LBShapes : LBComObjectList /* Collection */
+ {
+ public LBShape AddPicture(string FileName, float Left, float Top, LBRange Anchor) => new LBShape(InvokeMethod("AddPicture", FileName, false, true, Left, Top, Missing.Value, Missing.Value, Anchor));
+ public LBShape AddPicture(string FileName, float Left, float Top) => new LBShape(InvokeMethod("AddPicture", FileName, false, true, Left, Top, Missing.Value, Missing.Value, Missing.Value));
+ }
+ public enum LBMsoTriState
+ {
+ msoCTrue = 1,
+ msoFalse = 0,
+ msoTriStateMixed = -2,
+ msoTriStateToggle = -3,
+ msoTrue = -1
+ }
}
diff --git a/PROMS/LBWordLibrary/LBWordLibrary.csproj b/PROMS/LBWordLibrary/LBWordLibrary.csproj
index 8164fb19..577c35e5 100644
--- a/PROMS/LBWordLibrary/LBWordLibrary.csproj
+++ b/PROMS/LBWordLibrary/LBWordLibrary.csproj
@@ -79,6 +79,7 @@
+
diff --git a/PROMS/LBWordLibrary/OutlookLBComObject.cs b/PROMS/LBWordLibrary/OutlookLBComObject.cs
index c459dcdc..ac2bdacc 100644
--- a/PROMS/LBWordLibrary/OutlookLBComObject.cs
+++ b/PROMS/LBWordLibrary/OutlookLBComObject.cs
@@ -1,64 +1,45 @@
using System;
-using System.Collections.Generic;
-using System.Text;
using System.Reflection;
namespace LBOutlookLibrary
{
public abstract partial class LBComObject
{
- private Object _Item;
- internal Object Item
+ private object _Item;
+ internal object Item
{
get { return _Item; }
set
{
_Item = value;
- if (value != null) _MyType = _Item.GetType();
+ if (value != null) MyType = _Item.GetType();
}
}
- private Type _MyType;
- public Type MyType
- {
- get { return _MyType; }
- set { _MyType = value; }
- }
- protected LBComObject() { }
+
+ public Type MyType { get; set; }
+ protected LBComObject() { }
protected LBComObject(string ProgID)
{
Type objClassType;
objClassType = Type.GetTypeFromProgID(ProgID);
Item = Activator.CreateInstance(objClassType);
}
- protected LBComObject(Object item)
- {
- Item = item;
- }
- private Object DoInvokeMember(string name, Object[] parameters, BindingFlags bf, Binder b)
+ protected LBComObject(object item) => Item = item;
+ private object DoInvokeMember(string name, object[] parameters, BindingFlags bf, Binder b)
{
try
{
- return _MyType.InvokeMember(name, bf, b, _Item, parameters);
+ return MyType.InvokeMember(name, bf, b, _Item, parameters);
}
catch (Exception ex)
{
- throw new Exception(string.Format("LBComObject.DoInvokeMember {0}.{1}", _MyType.Name, name), ex);
+ throw new Exception(string.Format("LBComObject.DoInvokeMember {0}.{1}", MyType.Name, name), ex);
}
- return null;
}
- protected void SetProperty(string propertyName, params Object[] parameters)
- {
- DoInvokeMember(propertyName, parameters, BindingFlags.SetProperty, null);
- }
- protected Object GetProperty(string propertyName)
- {
- return DoInvokeMember(propertyName, null, BindingFlags.GetProperty, null);
- }
- protected Object GetProperty(string propertyName, params Object[] parameters)
- {
- return DoInvokeMember(propertyName, parameters, BindingFlags.GetProperty, null);
- }
- protected Object InvokeMethod(string methodName, params Object[] parameters)
+ protected void SetProperty(string propertyName, params object[] parameters) => DoInvokeMember(propertyName, parameters, BindingFlags.SetProperty, null);
+ protected object GetProperty(string propertyName) => DoInvokeMember(propertyName, null, BindingFlags.GetProperty, null);
+ protected object GetProperty(string propertyName, params object[] parameters) => DoInvokeMember(propertyName, parameters, BindingFlags.GetProperty, null);
+ protected object InvokeMethod(string methodName, params object[] parameters)
{
if (parameters != null)
FixParameters(parameters);
@@ -71,45 +52,15 @@ namespace LBOutlookLibrary
if (parameters[i] is LBComObject)
parameters[i] = (parameters[i] as LBComObject).Item;
}
- protected Object InvokeMethod(string methodName)
- {
- return InvokeMethod(methodName, null);
- }
- }
- public class LBComObjectList : LBComObject
- where TList : LBComObjectList
- where TItem : LBComObject, new()
- {
- //public new(Object item):base(item){}
- public TItem Add()
- {
- TItem tmp = new TItem();
- tmp.Item = InvokeMethod("Add");
- return tmp;
- }
- //public TItem this[int item]
- //{
- // get
- // {
- // TItem tmp = new TItem();
- // tmp.Item = GetProperty("Item", item);
- // return tmp;
- // }
- //}
- }
+ protected object InvokeMethod(string methodName) => InvokeMethod(methodName, null);
+ }
public partial class LBApplicationClass : LBComObject
{
public LBApplicationClass() : base("Outlook.Application") { }
- public LBApplicationClass(Object item) : base(item) { }
- public System.Object CreateItem(LBOlItemType ItemType)
- {
- return InvokeMethod("CreateItem", ItemType);
- }
- public void Quit()
- {
- InvokeMethod("Quit");
- }
- }
+ public LBApplicationClass(object item) : base(item) { }
+ public object CreateItem(LBOlItemType ItemType) => InvokeMethod("CreateItem", ItemType);
+ public void Quit() => InvokeMethod("Quit");
+ }
public enum LBOlItemType
{
olMailItem = 0,
@@ -124,13 +75,13 @@ namespace LBOutlookLibrary
public partial class LBMailItem : LBComObject
{
public LBMailItem() { }
- public LBMailItem(Object item) : base(item) { }
+ public LBMailItem(object item) : base(item) { }
}
public partial class LBMailItemClass : LBComObject
{
public LBMailItemClass() { }
- public LBMailItemClass(Object item) : base(item) { }
- public String Body
+ public LBMailItemClass(object item) : base(item) { }
+ public string Body
{
get { return (GetProperty("Body").ToString()); }
set { SetProperty("Body", value); }
@@ -140,29 +91,20 @@ namespace LBOutlookLibrary
get { return (LBOlBodyFormat)GetProperty("BodyFormat"); }
set { SetProperty("BodyFormat", value); }
}
- public LBAttachments Attachments
- {
- get { return new LBAttachments(GetProperty("Attachments")); }
- }
- public String Subject
+ public LBAttachments Attachments => new LBAttachments(GetProperty("Attachments"));
+ public string Subject
{
get { return (GetProperty("Subject").ToString()); }
set { SetProperty("Subject", value); }
}
- public LBRecipients Recipients
- {
- get { return new LBRecipients(GetProperty("Recipients")); }
- }
- public String To
+ public LBRecipients Recipients => new LBRecipients(GetProperty("Recipients"));
+ public string To
{
get { return (GetProperty("To").ToString()); }
set { SetProperty("To", value); }
}
- public void Send()
- {
- InvokeMethod("Send");
- }
- }
+ public void Send() => InvokeMethod("Send");
+ }
public enum LBOlBodyFormat
{
olFormatUnspecified = 0,
@@ -173,79 +115,40 @@ namespace LBOutlookLibrary
public partial class LBAttachments : LBComObject
{
public LBAttachments() { }
- public LBAttachments(Object item) : base(item) { }
- public int Count
- {
- get { return (GetProperty("Count") as int? ?? 0); }
- }
- public LBAttachment Item
- {
- get { return new LBAttachment(GetProperty("Item")); }
- }
- public LBAttachment Add(object Source)
- {
- return new LBAttachment(InvokeMethod("Add", Source, Missing.Value, Missing.Value, Missing.Value));
- }
- public LBAttachment Add(object Source, object Type, object Position, object DisplayName)
+ public LBAttachments(object item) : base(item) { }
+ public int Count => (GetProperty("Count") as int? ?? 0);
+ public new LBAttachment Item => new LBAttachment(GetProperty("Item"));
+ public LBAttachment Add(object Source) => new LBAttachment(InvokeMethod("Add", Source, Missing.Value, Missing.Value, Missing.Value));
+ public LBAttachment Add(object Source, object Type, object Position, object DisplayName)
{
return new LBAttachment(InvokeMethod("Add", Source, Type, Position, DisplayName));
}
- public void Remove(int Index)
- {
- InvokeMethod("Remove", Index);
- }
- }
+ public void Remove(int Index) => InvokeMethod("Remove", Index);
+ }
public partial class LBRecipients : LBComObject
{
public LBRecipients() { }
- public LBRecipients(Object item) : base(item) { }
- public int Count
- {
- get { return (GetProperty("Count") as int? ?? 0); }
- }
- public LBRecipient Item
- {
- get { return new LBRecipient(GetProperty("Item")); }
- }
- public LBRecipient Add(string Name)
- {
- return new LBRecipient(InvokeMethod("Add", Name));
- }
- public void Remove(int Index)
- {
- InvokeMethod("Remove", Index);
- }
- public Boolean ResolveAll()
- {
- return InvokeMethod("ResolveAll") as Boolean? ?? false;
- }
- }
+ public LBRecipients(object item) : base(item) { }
+ public int Count => (GetProperty("Count") as int? ?? 0);
+ public new LBRecipient Item => new LBRecipient(GetProperty("Item"));
+ public LBRecipient Add(string Name) => new LBRecipient(InvokeMethod("Add", Name));
+ public void Remove(int Index) => InvokeMethod("Remove", Index);
+ public bool ResolveAll() => InvokeMethod("ResolveAll") as bool? ?? false;
+ }
public partial class LBAttachment : LBComObject
{
public LBAttachment() { }
- public LBAttachment(Object item) : base(item) { }
- public LBOlAttachmentType Type
- {
- get { return (LBOlAttachmentType)GetProperty("Type"); }
- }
- }
+ public LBAttachment(object item) : base(item) { }
+ public LBOlAttachmentType Type => (LBOlAttachmentType)GetProperty("Type");
+ }
public partial class LBRecipient : LBComObject
{
public LBRecipient() { }
- public LBRecipient(Object item) : base(item) { }
- public String Address
- {
- get { return (GetProperty("Address").ToString()); }
- }
- public String Name
- {
- get { return (GetProperty("Name").ToString()); }
- }
- public Boolean Resolve()
- {
- return InvokeMethod("Resolve") as Boolean? ?? false;
- }
- }
+ public LBRecipient(object item) : base(item) { }
+ public string Address => (GetProperty("Address").ToString());
+ public string Name => (GetProperty("Name").ToString());
+ public bool Resolve() => InvokeMethod("Resolve") as bool? ?? false;
+ }
public enum LBOlAttachmentType
{
olByValue = 1,
diff --git a/PROMS/LBWordLibrary/OutlookLBComObjectExt.cs b/PROMS/LBWordLibrary/OutlookLBComObjectExt.cs
index 20bd38c1..4cfda7fe 100644
--- a/PROMS/LBWordLibrary/OutlookLBComObjectExt.cs
+++ b/PROMS/LBWordLibrary/OutlookLBComObjectExt.cs
@@ -1,21 +1,13 @@
using System;
-using System.Collections.Generic;
-using System.Text;
namespace LBOutlookLibrary
{
public partial class LBApplicationClass
{
- public LBMailItemClass CreateMailItem()
- {
- return new LBMailItemClass(CreateItem(LBOlItemType.olMailItem));
- }
- }
+ public LBMailItemClass CreateMailItem() => new LBMailItemClass(CreateItem(LBOlItemType.olMailItem));
+ }
public partial class LBMailItemClass
{
- public void AddAttachment(string filename)
- {
- Attachments.Add(filename, LBOlAttachmentType.olByValue, Type.Missing, Type.Missing);
- }
- }
+ public void AddAttachment(string filename) => Attachments.Add(filename, LBOlAttachmentType.olByValue, Type.Missing, Type.Missing);
+ }
}
diff --git a/PROMS/LBWordLibrary/RegHive.cs b/PROMS/LBWordLibrary/RegHive.cs
index f4bb27b0..cd0a5991 100644
--- a/PROMS/LBWordLibrary/RegHive.cs
+++ b/PROMS/LBWordLibrary/RegHive.cs
@@ -49,19 +49,13 @@ namespace Read64bitRegistryFrom32bitApp
ref uint lpType,
System.Text.StringBuilder lpData,
ref uint lpcbData);
- #endregion
- #endregion
+ #endregion
+ #endregion
- #region Functions
- static public string GetRegKey64Value(UIntPtr inHive, String inKeyName, String inPropertyName)
- {
- return GetRegKey64Value(inHive, inKeyName, RegSAM.WOW64_64Key, inPropertyName);
- }
- static public string GetRegKey32Value(UIntPtr inHive, String inKeyName, String inPropertyName)
- {
- return GetRegKey64Value(inHive, inKeyName, RegSAM.WOW64_32Key, inPropertyName);
- }
- static public string GetRegKey64Value(UIntPtr inHive, String inKeyName, RegSAM in32or64key, String inPropertyName)
+ #region Functions
+ static public string GetRegKey64Value(UIntPtr inHive, string inKeyName, string inPropertyName) => GetRegKey64Value(inHive, inKeyName, RegSAM.WOW64_64Key, inPropertyName);
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE0060:Remove unused parameter", Justification = "inHive kept to match dll signature")]
+ static public string GetRegKey64Value(UIntPtr inHive, string inKeyName, RegSAM in32or64key, string inPropertyName)
{
int hkey = 0;
try
@@ -80,15 +74,10 @@ namespace Read64bitRegistryFrom32bitApp
if (0 != hkey) RegCloseKey(hkey);
}
}
- static public bool CheckRegKey64Valid(UIntPtr inHive, String inKeyName)
- {
- return CheckRegKey64Valid(inHive, inKeyName, RegSAM.WOW64_64Key);
- }
- static public bool GetRegKey32Valid(UIntPtr inHive, String inKeyName)
- {
- return CheckRegKey64Valid(inHive, inKeyName, RegSAM.WOW64_32Key);
- }
- static public bool CheckRegKey64Valid(UIntPtr inHive, String inKeyName, RegSAM in32or64key)
+ static public bool CheckRegKey64Valid(UIntPtr inHive, string inKeyName) => CheckRegKey64Valid(inHive, inKeyName, RegSAM.WOW64_64Key);
+ static public bool GetRegKey32Valid(UIntPtr inHive, string inKeyName) => CheckRegKey64Valid(inHive, inKeyName, RegSAM.WOW64_32Key);
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE0060:Remove unused parameter", Justification = "inHive kept to match dll signature")]
+ static public bool CheckRegKey64Valid(UIntPtr inHive, string inKeyName, RegSAM in32or64key)
{
int hkey = 0;
try
@@ -103,8 +92,5 @@ namespace Read64bitRegistryFrom32bitApp
}
}
#endregion
-
- #region Enums
- #endregion
}
}
\ No newline at end of file
diff --git a/PROMS/ReferencedObjects/LibSource/RODBInterface/SqlRODB.cs b/PROMS/ReferencedObjects/LibSource/RODBInterface/SqlRODB.cs
index fb03f1d2..8c654004 100644
--- a/PROMS/ReferencedObjects/LibSource/RODBInterface/SqlRODB.cs
+++ b/PROMS/ReferencedObjects/LibSource/RODBInterface/SqlRODB.cs
@@ -50,7 +50,7 @@ namespace RODBInterface
SqlConnection cn = new SqlConnection(SqlConnectionStr);
try
{
- cn.Open();
+ if (cn.State == System.Data.ConnectionState.Closed) cn.Open();
if (OnlyConnectOnce && ROAPP_SqlConnectionOnce == null) ROAPP_SqlConnectionOnce = cn;
return cn;
}
diff --git a/PROMS/ReferencedObjects/LibSource/VlnStatus/StatusBarFrm.cs b/PROMS/ReferencedObjects/LibSource/VlnStatus/StatusBarFrm.cs
index 6828458b..580fc949 100644
--- a/PROMS/ReferencedObjects/LibSource/VlnStatus/StatusBarFrm.cs
+++ b/PROMS/ReferencedObjects/LibSource/VlnStatus/StatusBarFrm.cs
@@ -19,11 +19,6 @@
*********************************************************************************************/
using System;
-using System.Drawing;
-using System.Collections;
-using System.ComponentModel;
-using System.Windows.Forms;
-//using ROProfiler; //don't forget to add VlnProfiler to the reference list
namespace VlnStatus
{
@@ -35,11 +30,6 @@ namespace VlnStatus
private System.Windows.Forms.ProgressBar progressBar1;
private System.Windows.Forms.Label lblBar;
private System.Windows.Forms.Label StatMsg;
-// private string strLblLast="";
- ///
- /// Required designer variable.
- ///
- private System.ComponentModel.Container components = null;
public StatusBarFrm()
{
@@ -61,21 +51,6 @@ namespace VlnStatus
Text = StatusBoxTitle;
}
- ///
- /// Clean up any resources being used.
- ///
- protected override void Dispose( bool disposing )
- {
- if( disposing )
- {
- if(components != null)
- {
- components.Dispose();
- }
- }
- base.Dispose( disposing );
- }
-
#region Windows Form Designer generated code
///
/// Required method for Designer support - do not modify
@@ -190,14 +165,6 @@ namespace VlnStatus
{
lblBar.Text = (Math.Round((decimal)(progressBar1.Value * 100) / progressBar1.Maximum)).ToString();
lblBar.Text += "% Complete";
-// if( lblBar.Text != strLblLast)
-// {
-// Profiler.Start("UpdateLabel");
- lblBar.Refresh();
-// lblBar.Update();
-// Profiler.End("UpdateLabel");
-// }
-// strLblLast = lblBar.Text;
}
public string StatusMessage
@@ -209,10 +176,7 @@ namespace VlnStatus
set
{
StatMsg.Text = value;
-// Profiler.Start("StatusMessage");
StatMsg.Refresh();
-// StatMsg.Update();
-// Profiler.End("StatusMessage");
}
}
diff --git a/PROMS/ReferencedObjects/LibSource/VlnStatus/StatusMessageFrm.cs b/PROMS/ReferencedObjects/LibSource/VlnStatus/StatusMessageFrm.cs
index 386d145c..c983a868 100644
--- a/PROMS/ReferencedObjects/LibSource/VlnStatus/StatusMessageFrm.cs
+++ b/PROMS/ReferencedObjects/LibSource/VlnStatus/StatusMessageFrm.cs
@@ -17,12 +17,6 @@
* Added overbounds check
*********************************************************************************************/
-using System;
-using System.Drawing;
-using System.Collections;
-using System.ComponentModel;
-using System.Windows.Forms;
-
namespace VlnStatus
{
///
@@ -31,10 +25,6 @@ namespace VlnStatus
public class StatusMessageFrm : System.Windows.Forms.Form
{
private System.Windows.Forms.Label lblStatMsg;
- ///
- /// Required designer variable.
- ///
- private System.ComponentModel.Container components = null;
public StatusMessageFrm()
{
@@ -54,21 +44,6 @@ namespace VlnStatus
Text = StatTitle;
}
- ///
- /// Clean up any resources being used.
- ///
- protected override void Dispose( bool disposing )
- {
- if( disposing )
- {
- if(components != null)
- {
- components.Dispose();
- }
- }
- base.Dispose( disposing );
- }
-
#region Windows Form Designer generated code
///
/// Required method for Designer support - do not modify
diff --git a/PROMS/ReferencedObjects/LibSource/VlnStatus/VlnStatusBar.cs b/PROMS/ReferencedObjects/LibSource/VlnStatus/VlnStatusBar.cs
index a7a4e2cd..ac47b954 100644
--- a/PROMS/ReferencedObjects/LibSource/VlnStatus/VlnStatusBar.cs
+++ b/PROMS/ReferencedObjects/LibSource/VlnStatus/VlnStatusBar.cs
@@ -33,7 +33,7 @@ namespace VlnStatus
///
public class VlnStatusBar
{
- StatusBarFrm StatBar;
+ readonly StatusBarFrm StatBar;
private int Cnt;
// Create a status window with the default title of "Status"
@@ -53,8 +53,6 @@ namespace VlnStatus
// Increament the the status bar by the passed in value.
public void PerformStep(int val)
{
-// StatBar.Value = val;
-// Cnt = val;
BarValue = val;
StatBar.PerformStep();
}
@@ -62,7 +60,6 @@ namespace VlnStatus
// Increament the the status bar by one
public void PerformStep()
{
-// StatBar.Value = StatBar.Value + 1;
Cnt++;
BarValue = Cnt;
StatBar.PerformStep();
diff --git a/PROMS/ReferencedObjects/LibSource/VlnStatus/VlnStatusMessage.cs b/PROMS/ReferencedObjects/LibSource/VlnStatus/VlnStatusMessage.cs
index e0221ee8..ff26ca8c 100644
--- a/PROMS/ReferencedObjects/LibSource/VlnStatus/VlnStatusMessage.cs
+++ b/PROMS/ReferencedObjects/LibSource/VlnStatus/VlnStatusMessage.cs
@@ -13,8 +13,6 @@
* Added overbounds check
*********************************************************************************************/
-using System;
-
namespace VlnStatus
{
///
@@ -28,7 +26,7 @@ namespace VlnStatus
///
public class VlnStatusMessage
{
- StatusMessageFrm StatusMessageBox;
+ readonly StatusMessageFrm StatusMessageBox;
// Create a status window with the default title of "Status"
public VlnStatusMessage()
diff --git a/PROMS/RoAccessToSql/GlobalSuppressions.cs b/PROMS/RoAccessToSql/GlobalSuppressions.cs
new file mode 100644
index 00000000..6c4a515e
--- /dev/null
+++ b/PROMS/RoAccessToSql/GlobalSuppressions.cs
@@ -0,0 +1,8 @@
+// This file is used by Code Analysis to maintain SuppressMessage
+// attributes that are applied to this project.
+// Project-level suppressions either have no target or are given
+// a specific target and scoped to a namespace, type, member, etc.
+
+using System.Diagnostics.CodeAnalysis;
+
+[assembly: SuppressMessage("Style", "IDE1006:Naming Styles", Justification = "Not modifying Naming Styles")]
\ No newline at end of file
diff --git a/PROMS/RoAccessToSql/Program.cs b/PROMS/RoAccessToSql/Program.cs
index 20a37fc6..e73cb61f 100644
--- a/PROMS/RoAccessToSql/Program.cs
+++ b/PROMS/RoAccessToSql/Program.cs
@@ -1,7 +1,4 @@
using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Threading.Tasks;
using System.Windows.Forms;
namespace RoAccessToSql
diff --git a/PROMS/RoAccessToSql/RoAccessToSql.cs b/PROMS/RoAccessToSql/RoAccessToSql.cs
index afe5a3ae..a44589c1 100644
--- a/PROMS/RoAccessToSql/RoAccessToSql.cs
+++ b/PROMS/RoAccessToSql/RoAccessToSql.cs
@@ -1,16 +1,10 @@
using System;
using System.Collections.Generic;
-using System.ComponentModel;
using System.Data;
using System.IO;
-using System.Drawing;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
using System.Windows.Forms;
using System.Data.SqlClient;
using System.Data.OleDb;
-using Volian.Base.Library;
[assembly: log4net.Config.XmlConfigurator(Watch = true)]
@@ -33,25 +27,11 @@ namespace RoAccessToSql
public partial class RoAccessToSql : Form
{
private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
- private string _MSAccessPath = null;
- public string MSAccessPath
- {
- get { return _MSAccessPath; }
- set { _MSAccessPath = value; }
- }
- private string _SqlServerName = null;
- public string SqlServerName
- {
- get { return _SqlServerName; }
- set { _SqlServerName = value; }
- }
- private string _SqlDatabaseName = null;
- public string SqlDatabaseName
- {
- get { return _SqlDatabaseName; }
- set { _SqlDatabaseName = value; }
- }
- bool _Initializing = false;
+
+ public string MSAccessPath { get; set; } = null;
+ public string SqlServerName { get; set; } = null;
+ public string SqlDatabaseName { get; set; } = null;
+ readonly bool _Initializing = false;
public RoAccessToSql(string[] args)
{
@@ -66,7 +46,7 @@ namespace RoAccessToSql
}
else if (parm.StartsWith("/sqldb="))
{
- SqlDatabaseName = parm.Substring(7) + "_RO";
+ SqlDatabaseName = $"{parm.Substring(7)}_RO";
}
else if (parm.StartsWith("/server="))
{
@@ -92,7 +72,7 @@ namespace RoAccessToSql
if (UserInRoEditor()) this.Close();
tbSqlDbName.Text = SqlDatabaseName;
_TmpFileForConnectStr = Path.GetTempPath();
- _TmpFileForConnectStr = _TmpFileForConnectStr + @"\PromsConnect.txt";
+ _TmpFileForConnectStr += @"\PromsConnect.txt";
File.Delete(_TmpFileForConnectStr);
_Initializing = false;
}
@@ -100,10 +80,10 @@ namespace RoAccessToSql
private bool UserInRoEditor()
{
FileInfo fiown = null;
- FileStream fsown = null;
- // The following code was taken from the roeditor. It uses the 'RoEditor.own' file to assure that
- // no one is in the roeditor. This file is located in the microsoft access database directory.
- try
+ FileStream fsown;
+ // The following code was taken from the roeditor. It uses the 'RoEditor.own' file to assure that
+ // no one is in the roeditor. This file is located in the microsoft access database directory.
+ try
{
string filename = MSAccessPath + @"\RoEditor.own";
fiown = new FileInfo(filename);
@@ -119,7 +99,7 @@ namespace RoAccessToSql
fsown = fiown.Open(FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
TextReader tr1 = new StreamReader(fsown);
string who1 = tr1.ReadToEnd();
- MessageBox.Show(ex.Message + "\r\n\r\n" + who1, "RO Editor In Use", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
+ MessageBox.Show($"{ex.Message}\r\n\r\n{who1}", "RO Editor In Use", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
}
fsown = fiown.Open(FileMode.OpenOrCreate, FileAccess.Read, FileShare.ReadWrite);
TextReader tr = new StreamReader(fsown);
@@ -142,8 +122,8 @@ namespace RoAccessToSql
tw.WriteLine("Current User: {0}, Date and Time Started: {1}", Environment.UserName.ToUpper(), DateTime.Now.ToString("MM/dd/yyyy @ hh:mm"));
tw.Flush();
}
- catch (IOException ex)
- {
+ catch (IOException)
+ {
fsown = fiown.Open(FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
TextReader tr = new StreamReader(fsown);
string who = tr.ReadToEnd();
@@ -154,25 +134,20 @@ namespace RoAccessToSql
}
return false;
}
- static string _ErrorLogFileName;
- public static string ErrorLogFileName
- {
- get { return _ErrorLogFileName; }
- set { _ErrorLogFileName = value; }
- }
- // make error log file name (uses same logic as proms error log)
- static bool ChangeLogFileName(string AppenderName, string NewFilename)
+
+ public static string ErrorLogFileName { get; set; }
+ // make error log file name (uses same logic as proms error log)
+ static bool ChangeLogFileName(string AppenderName, string NewFilename)
{
log4net.Repository.ILoggerRepository RootRep;
RootRep = log4net.LogManager.GetRepository();
foreach (log4net.Appender.IAppender iApp in RootRep.GetAppenders())
{
if (iApp.Name.CompareTo(AppenderName) == 0
- && iApp is log4net.Appender.FileAppender)
- {
- log4net.Appender.FileAppender fApp = (log4net.Appender.FileAppender)iApp;
+ && iApp is log4net.Appender.FileAppender fApp)
+ {
string folderPath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
- fApp.File = folderPath + @"\VEPROMS\" + (Volian.Base.Library.VlnSettings.GetCommand("prefix", "") + "_").TrimStart("_".ToCharArray()) + NewFilename;
+ fApp.File = $@"{folderPath}\VEPROMS\{($"{Volian.Base.Library.VlnSettings.GetCommand("prefix", "")}_").TrimStart("_".ToCharArray())}{NewFilename}";
ErrorLogFileName = fApp.File;
fApp.ActivateOptions();
return true;
@@ -189,7 +164,7 @@ namespace RoAccessToSql
if (Directory.Exists(fbd.SelectedPath))
tbAccessPath.Text = fbd.SelectedPath;
else
- MessageBox.Show("Path doesn't exist " + tbAccessPath.Text);
+ MessageBox.Show($"Path doesn't exist {tbAccessPath.Text}");
}
}
// Convert the data
@@ -212,7 +187,7 @@ namespace RoAccessToSql
{
DateTime dtSunday = DateTime.Now.AddDays(-((int)DateTime.Now.DayOfWeek));
- ChangeLogFileName("LogFileAppender", SqlDatabaseName + " " + dtSunday.ToString("yyyyMMdd") + " ErrorLog.txt");
+ ChangeLogFileName("LogFileAppender", $"{SqlDatabaseName} {dtSunday:yyyyMMdd} ErrorLog.txt");
_MyLog.InfoFormat("\r\nSession Beginning\r\n<===={0}[SQL:{1:yyMM.ddHH}]====== User: {2}/{3} Started {4} ===============>{5}"
, Application.ProductVersion, RevDate, DateTime.Now, Environment.UserDomainName, Environment.UserName, DateTime.Now.ToString("dddd MMMM d, yyyy h:mm:ss tt"), "");
}
@@ -229,7 +204,7 @@ namespace RoAccessToSql
if (sqlConnection.State == ConnectionState.Open)
{
// now try to open access db:
- string strDatabaseConnectionCommand = "Provider=Microsoft.ACE.OLEDB.12.0;Password=\"\";User ID=Admin;Data Source=" + MSAccessPath + "\\ROMaster.mdb;Mode=Share Deny None;Extended Properties=\"\";Jet OLEDB:System database=\"\";Jet OLEDB:Registry Path=\"\";Jet OLEDB:Database Password=\"\";Jet OLEDB:Engine Type=5;Jet OLEDB:Database Locking Mode=1;Jet OLEDB:Global Partial Bulk Ops=2;Jet OLEDB:Global Bulk Transactions=1;Jet OLEDB:New Database Password=\"\";Jet OLEDB:Create System Database=False;Jet OLEDB:Encrypt Database=False;Jet OLEDB:Don't Copy Locale on Compact=False;Jet OLEDB:Compact Without Replica Repair=False;Jet OLEDB:SFP=False";
+ string strDatabaseConnectionCommand = $"Provider=Microsoft.ACE.OLEDB.12.0;Password=\"\";User ID=Admin;Data Source={MSAccessPath}\\ROMaster.mdb;Mode=Share Deny None;Extended Properties=\"\";Jet OLEDB:System database=\"\";Jet OLEDB:Registry Path=\"\";Jet OLEDB:Database Password=\"\";Jet OLEDB:Engine Type=5;Jet OLEDB:Database Locking Mode=1;Jet OLEDB:Global Partial Bulk Ops=2;Jet OLEDB:Global Bulk Transactions=1;Jet OLEDB:New Database Password=\"\";Jet OLEDB:Create System Database=False;Jet OLEDB:Encrypt Database=False;Jet OLEDB:Don't Copy Locale on Compact=False;Jet OLEDB:Compact Without Replica Repair=False;Jet OLEDB:SFP=False";
using (OleDbConnection accessConnection = new OleDbConnection(strDatabaseConnectionCommand))
{
try
@@ -251,13 +226,13 @@ namespace RoAccessToSql
}
else
{
- _MyLog.Error("SQL Connection is not open. Check connection string: " + tbSqlDbName.Text);
- MessageBox.Show("Check connection string: " + tbSqlDbName.Text, "SQL Connection is not open.");
+ _MyLog.Error($"SQL Connection is not open. Check connection string: {tbSqlDbName.Text}");
+ MessageBox.Show($"Check connection string: {tbSqlDbName.Text}", "SQL Connection is not open.");
}
}
catch (SqlException ex)
{
- _MyLog.Error("SQL Connection is not open. Check connection string: " + tbSqlDbName.Text);
+ _MyLog.Error($"SQL Connection is not open. Check connection string: {tbSqlDbName.Text}");
MessageBox.Show(ex.Message, "Unknown error when migrating RO data from MS Access to SQL");
}
}
@@ -274,11 +249,10 @@ namespace RoAccessToSql
lastTimeDbs = ProgressBarUpdate(pBarDbs, null, 0, 1, 0, 0, lastTimeDbs, false);
lastTimeRos = ProgressBarUpdate(pBarROs, null, 0, maxCntRo, 0, 0, lastTimeRos, false);
lastTimeDbs = ProgressBarUpdate(pBarDbs, "ROMaster Table", 0, 5, 0, 1, lastTimeDbs, false);
- OleDbDataReader reader = null;
- OleDbCommand command = new OleDbCommand("select * from ROMaster", accessConnection);
- reader = command.ExecuteReader();
- // Do access's romaster table first so that the list of other tables to process is found. While doing this, migrate this table's data.
- int cntRo = 0;
+ OleDbCommand command = new OleDbCommand("select * from ROMaster", accessConnection);
+ OleDbDataReader reader = command.ExecuteReader();
+ // Do access's romaster table first so that the list of other tables to process is found. While doing this, migrate this table's data.
+ int cntRo = 0;
int cntDb = 0;
int maxCntDb = 0;
while (reader.Read()) // reading from Access Database
@@ -303,13 +277,12 @@ namespace RoAccessToSql
maxCntDb++;
}
}
- lastTimeRos = ProgressBarUpdate(pBarROs, "ROMaster", 0, maxCntRo, maxCntRo, 1, lastTimeRos, true);
+ ProgressBarUpdate(pBarROs, "ROMaster", 0, maxCntRo, maxCntRo, 1, lastTimeRos, true);
lastTimeDbs = ProgressBarUpdate(pBarDbs, null, 0, maxCntDb, 0, 0, lastTimeDbs, false);
reader.Close();
- reader = null;
-
- // now migrate all the tables that were found
- foreach (string tableName in allTables)
+
+ // now migrate all the tables that were found
+ foreach (string tableName in allTables)
{
lastTimeRos = DateTime.Now;
cntRo = 0;
@@ -318,7 +291,7 @@ namespace RoAccessToSql
lastTimeRos = ProgressBarUpdate(pBarROs, null, 0, maxCntRo, 0, 0, lastTimeRos, true);
lastTimeDbs = ProgressBarUpdate(pBarDbs, allTablesText[cntDb], 0, maxCntDb, cntDb, 1, lastTimeDbs, false);
command = null;
- command = new OleDbCommand("select * from " + tableName, accessConnection);
+ command = new OleDbCommand($"select * from {tableName}", accessConnection);
reader = command.ExecuteReader();
while (reader.Read()) // read all of the records from the current access table
{
@@ -338,7 +311,7 @@ namespace RoAccessToSql
reader = null;
lastTimeRos = ProgressBarUpdate(pBarROs, tableName, 0, maxCntRo, maxCntRo, 1, lastTimeRos, false);
}
- lastTimeDbs = ProgressBarUpdate(pBarDbs, allTablesText[maxCntDb - 1], 0, maxCntDb, maxCntDb, 1, lastTimeDbs, false);
+ ProgressBarUpdate(pBarDbs, allTablesText[maxCntDb - 1], 0, maxCntDb, maxCntDb, 1, lastTimeDbs, false);
pBarDbs.Text = "Referenced Object Tables Migration Completed";
pBarROs.Text = "Referenced Objects Migration Completed";
btnConvert.Enabled = false;
@@ -357,7 +330,7 @@ namespace RoAccessToSql
string dt = string.Format("{0:yyyyMMddHHmmss}", System.DateTime.Now);
string strInsert = "INSERT INTO ROMaster (RecID, RecType, ModDateTime, Info) ";
// note that '8' for rectype flags database converted:
- strInsert = strInsert + " VALUES ('09999999', 8, '" + dt + "', '" + _SqlConnectStr + "');";
+ strInsert = $"{strInsert} VALUES ('09999999', 8, '{dt}', '{_SqlConnectStr}');";
OleDbCommand command = new OleDbCommand(strInsert, accessConnection);
reader = command.ExecuteReader();
if (reader.Read()) return;
@@ -367,7 +340,7 @@ namespace RoAccessToSql
MessageBox.Show(e.Message, "Error on insert to flag migration completed");
}
}
- private string _TmpFileForConnectStr = null;
+ private readonly string _TmpFileForConnectStr = null;
private void WriteSqlPathToTempFile()
{
System.IO.File.WriteAllText(_TmpFileForConnectStr, _SqlConnectStr);
@@ -375,13 +348,12 @@ namespace RoAccessToSql
// the following is used to update the progress bars, it finds how many records are in a table.
private int GetRecordCountForTable(string tableName, OleDbConnection accessConnection)
{
- OleDbDataReader reader = null;
- int retcnt = 100;
+ int retcnt = 100;
try
{
- OleDbCommand command = new OleDbCommand("SELECT COUNT (RecID) as cnt FROM " + tableName, accessConnection);
- reader = command.ExecuteReader();
- if (reader.Read())
+ OleDbCommand command = new OleDbCommand($"SELECT COUNT (RecID) as cnt FROM {tableName}", accessConnection);
+ OleDbDataReader reader = command.ExecuteReader();
+ if (reader.Read())
{
retcnt = reader.GetInt32(0);
}
@@ -393,7 +365,8 @@ namespace RoAccessToSql
}
return retcnt;
}
- DateTime ProgressBarUpdate(DevComponents.DotNetBar.Controls.ProgressBarX pbi, string msg, int min, int max, int progress, int flag, DateTime lastUpdateDisplay, bool doTimeCheck)
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE0060:Remove unused parameter", Justification = "Keeping min for Debugging")]
+ DateTime ProgressBarUpdate(DevComponents.DotNetBar.Controls.ProgressBarX pbi, string msg, int min, int max, int progress, int flag, DateTime lastUpdateDisplay, bool doTimeCheck)
{
if (flag == 0) // setup
pbi.Maximum = max;
@@ -412,11 +385,13 @@ namespace RoAccessToSql
{
try
{
- SqlCommand command = new SqlCommand();
- command.Connection = sqlConnection;
- command.CommandType = CommandType.StoredProcedure;
- command.CommandText = "insertAllRectypes";
- command.Parameters.AddWithValue("@RecType", RecType);
+ SqlCommand command = new SqlCommand
+ {
+ Connection = sqlConnection,
+ CommandType = CommandType.StoredProcedure,
+ CommandText = "insertAllRectypes"
+ };
+ command.Parameters.AddWithValue("@RecType", RecType);
if (AccPageID == null || AccPageID == "")
command.Parameters.AddWithValue("@AccPageID", string.Empty);
else
@@ -428,9 +403,8 @@ namespace RoAccessToSql
command.Parameters.AddWithValue("@ModDateTime", ModDateTime);
using (SqlDataReader reader = command.ExecuteReader())
{
- bool success = true;
- }
- command = null;
+ }
+ command = null;
}
catch (Exception ex)
{
@@ -438,32 +412,15 @@ namespace RoAccessToSql
_MyLog.Error(msg, ex);
}
}
- private void btnExit_Click(object sender, EventArgs e)
- {
- this.Close();
- }
- // the user selected the button to test the sql connection string
- private void btnTestConnect_Click(object sender, EventArgs e)
- {
- TestConnection(true);
- }
- // the RevDate & RevDescription are found in a stored procedure, vesp_GetSQLCodeRevision, in the sql database. These get updated each
- // time a revision is made to the sql database using ROFixes.sql script.
- private static DateTime _RevDate = DateTime.MinValue;
- public static DateTime RevDate
- {
- get { return _RevDate; }
- set { _RevDate = value; }
- }
- private static string _RevDescription = "Unknown";
- public static string RevDescription
- {
- get { return _RevDescription; }
- set { _RevDescription = value; }
- }
- // This is called to test the sql connection, either from the button when pressed by user, or from the convert button, before
- // the conversion is done. See below for what is checked
- private bool TestConnection(bool notifyUser)
+ private void btnExit_Click(object sender, EventArgs e) => this.Close();
+ // the user selected the button to test the sql connection string
+ private void btnTestConnect_Click(object sender, EventArgs e) => TestConnection(true);
+
+ public static DateTime RevDate { get; set; } = DateTime.MinValue;
+ public static string RevDescription { get; set; } = "Unknown";
+ // This is called to test the sql connection, either from the button when pressed by user, or from the convert button, before
+ // the conversion is done. See below for what is checked
+ private bool TestConnection(bool notifyUser)
{
// The following conditions must be true in order to migrate the ro data to sql. Only the first condition can be
// tested in this executable since the roall database is interfaced to by the roeditor & the program that migrates the data.
@@ -485,12 +442,14 @@ namespace RoAccessToSql
connection.Open();
if (connection.State == ConnectionState.Open)
{
- // now see if there is an roall table
- SqlCommand command = new SqlCommand();
- command.Connection = connection;
- command.CommandType = CommandType.Text;
- command.CommandText = "(SELECT count(*) FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[ROALL]') AND type in (N'U'))";
- using (SqlDataReader reader = command.ExecuteReader())
+ // now see if there is an roall table
+ SqlCommand command = new SqlCommand
+ {
+ Connection = connection,
+ CommandType = CommandType.Text,
+ CommandText = "(SELECT count(*) FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[ROALL]') AND type in (N'U'))"
+ };
+ using (SqlDataReader reader = command.ExecuteReader())
{
if (reader.Read())
{
@@ -509,11 +468,13 @@ namespace RoAccessToSql
{
// now see if there are stored procedures:
command = null; // reset command
- command = new SqlCommand();
- command.Connection = connection;
- command.CommandType = CommandType.Text;
- command.CommandText = "(SELECT count(*) FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[deleteByROTable]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1)";
- using (SqlDataReader reader = command.ExecuteReader())
+ command = new SqlCommand
+ {
+ Connection = connection,
+ CommandType = CommandType.Text,
+ CommandText = "(SELECT count(*) FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[deleteByROTable]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1)"
+ };
+ using (SqlDataReader reader = command.ExecuteReader())
{
if (reader.Read())
{
@@ -533,11 +494,13 @@ namespace RoAccessToSql
{
// now test that the roall table is empty:
command = null; // reset command
- command = new SqlCommand();
- command.Connection = connection;
- command.CommandType = CommandType.Text;
- command.CommandText = "SELECT count(*) FROM roall";
- using (SqlDataReader reader = command.ExecuteReader())
+ command = new SqlCommand
+ {
+ Connection = connection,
+ CommandType = CommandType.Text,
+ CommandText = "SELECT count(*) FROM roall"
+ };
+ using (SqlDataReader reader = command.ExecuteReader())
{
if (reader.Read())
{
@@ -557,16 +520,18 @@ namespace RoAccessToSql
{
// now test that the database version is ok
command = null; // reset command
- command = new SqlCommand();
- command.Connection = connection;
- command.CommandType = CommandType.StoredProcedure;
- command.CommandText = "vesp_GetSQLCodeRevision";
- using (SqlDataReader reader = command.ExecuteReader())
+ command = new SqlCommand
+ {
+ Connection = connection,
+ CommandType = CommandType.StoredProcedure,
+ CommandText = "vesp_GetSQLCodeRevision"
+ };
+ using (SqlDataReader reader = command.ExecuteReader())
{
if (reader.Read())
{
- _RevDate = reader.GetDateTime(0);
- _RevDescription = reader.GetString(1);
+ RevDate = reader.GetDateTime(0);
+ RevDescription = reader.GetString(1);
dbsuc = true;
}
else
@@ -582,13 +547,13 @@ namespace RoAccessToSql
}
catch (SqlException ex)
{
- if (notifyUser) MessageBox.Show("Connection failed: " + ex, "Connection Failed");
+ if (notifyUser) MessageBox.Show($"Connection failed: {ex}", "Connection Failed");
}
}
}
catch (Exception ex)
{
- if (notifyUser) MessageBox.Show("Connection failed: " + ex, "Connection Failed");
+ if (notifyUser) MessageBox.Show($"Connection failed: {ex}", "Connection Failed");
}
if (notifyUser && success) MessageBox.Show("You have been successfully connected to the database!", "Connection Succeeded");
diff --git a/PROMS/RoAccessToSql/RoAccessToSql.csproj b/PROMS/RoAccessToSql/RoAccessToSql.csproj
index d956be8a..99b22330 100644
--- a/PROMS/RoAccessToSql/RoAccessToSql.csproj
+++ b/PROMS/RoAccessToSql/RoAccessToSql.csproj
@@ -66,6 +66,7 @@
+
Form
diff --git a/PROMS/TablePicker/TablePicker.cs b/PROMS/TablePicker/TablePicker.cs
index 92369edb..551cb53d 100644
--- a/PROMS/TablePicker/TablePicker.cs
+++ b/PROMS/TablePicker/TablePicker.cs
@@ -1,7 +1,4 @@
-using System;
using System.Drawing;
-using System.Collections;
-using System.ComponentModel;
using System.Windows.Forms;
namespace Accentra.Controls
@@ -11,11 +8,6 @@ namespace Accentra.Controls
///
public class TablePicker : System.Windows.Forms.Form
{
- ///
- /// Required designer variable.
- ///
- private System.ComponentModel.Container components = null;
-
public TablePicker()
{
// Activates double buffering
@@ -29,21 +21,6 @@ namespace Accentra.Controls
InitializeComponent();
}
- ///
- /// Clean up any resources being used.
- ///
- protected override void Dispose( bool disposing )
- {
- if( disposing )
- {
- if(components != null)
- {
- components.Dispose();
- }
- }
- base.Dispose( disposing );
- }
-
#region Windows Form Designer generated code
///
/// Required method for Designer support - do not modify
@@ -75,82 +52,41 @@ namespace Accentra.Controls
}
#endregion
- private Pen BeigePen = new Pen(Color.Beige, 1);
- private Brush BeigeBrush = System.Drawing.Brushes.Beige;
- private Brush GrayBrush = System.Drawing.Brushes.Gray;
- private Brush BlackBrush = System.Drawing.Brushes.Black;
- private Brush WhiteBrush = System.Drawing.Brushes.White;
+ private readonly Brush BlackBrush = System.Drawing.Brushes.Black;
+ private readonly Brush WhiteBrush = System.Drawing.Brushes.White;
- private Brush Jbrush = System.Drawing.Brushes.LightBlue;
- //private Brush Jbrush = System.Drawing.Brushes.LightSteelBlue;
- //private Brush Jbrush = System.Drawing.Brushes.SteelBlue;
- //private Brush Jbrush = System.Drawing.Brushes.PowderBlue;
+ private readonly Brush Jbrush = System.Drawing.Brushes.LightBlue;
- private Pen BorderPen = new Pen(SystemColors.ControlDark);
- private Pen BluePen = new Pen(Color.SlateGray, 1);
+ private readonly Pen BorderPen = new Pen(SystemColors.ControlDark);
+ private readonly Pen BluePen = new Pen(Color.SlateGray, 1);
private string DispText = "Esc to Cancel"; // Display text
- private int DispHeight = 40;//20; // Display ("Table 1x1", "Cancel")
- private Font DispFont = new Font("Tahoma", 8.25F);
- private int SquareX = 20; // Width of squares
- private int SquareY = 20; // Height of squares
+ private readonly int DispHeight = 40; // Display ("Table 1x1", "Cancel")
+ private readonly Font DispFont = new Font("Tahoma", 8.25F);
+ private readonly int SquareX = 20; // Width of squares
+ private readonly int SquareY = 20; // Height of squares
private int SquareQX = 3; // Number of visible squares (X)
private int SquareQY = 3; // Number of visible squares (Y)
private int SelQX = 1; // Number of selected squares (x)
private int SelQY = 1; // Number of selected squares (y)
- private bool bHiding = false;
- private bool bCancel = true; // Determines whether to Cancel
+ public int MaxRows { get; set; } = -1;
- // Added my Volian 4/27/11
- private int _MaxRows = -1;
+ public int MaxCols { get; set; } = -1;
- public int MaxRows
- {
- get { return _MaxRows; }
- set { _MaxRows = value; }
- }
- private int _MaxCols = -1;
+ ///
+ /// Returns the number of columns, or the horizontal / X count,
+ /// of the selection.
+ ///
+ public int SelectedColumns => SelQX;
- public int MaxCols
- {
- get { return _MaxCols; }
- set { _MaxCols = value; }
- }
+ ///
+ /// Returns the number of rows, or the vertical / Y count,
+ /// of the selection.
+ ///
+ public int SelectedRows => SelQY;
- ///
- /// Similar to
- /// == ,
- /// but is used as a state value before the form
- /// is hidden and cancellation is finalized.
- ///
- public bool Cancel {
- get {
- return bCancel;
- }
- }
-
- ///
- /// Returns the number of columns, or the horizontal / X count,
- /// of the selection.
- ///
- public int SelectedColumns {
- get {
- return SelQX;
- }
- }
-
- ///
- /// Returns the number of rows, or the vertical / Y count,
- /// of the selection.
- ///
- public int SelectedRows {
- get {
- return SelQY;
- }
- }
-
- private void TablePicker_Paint(object sender, System.Windows.Forms.PaintEventArgs e) {
+ private void TablePicker_Paint(object sender, System.Windows.Forms.PaintEventArgs e) {
Graphics g = e.Graphics;
// First, increment the number of visible squares if the
@@ -162,8 +98,8 @@ namespace Accentra.Controls
if (SquareQX < 7) SquareQX = 7;
if (SquareQY < 5) SquareQY = 5;
- if (_MaxRows > 0 && SquareQY > _MaxRows) SquareQY = _MaxRows;
- if (_MaxCols > 0 && SquareQX > _MaxCols) SquareQX = _MaxCols;
+ if (MaxRows > 0 && SquareQY > MaxRows) SquareQY = MaxRows;
+ if (MaxCols > 0 && SquareQX > MaxCols) SquareQX = MaxCols;
// Second, expand the dimensions of this form according to the
// number of visible squares.
@@ -177,14 +113,7 @@ namespace Accentra.Controls
// the text is left-justified, only the Y (vertical) position
// is calculated.
int dispY = ((SquareY - 1) * SquareQY) + SquareQY + 4;
- //if (this.Cancel) {
- // DispText = "Esc Key to Cancel";
- //} else {
- // DispText = SelQX.ToString() + " by " + SelQY.ToString() + " Table";
- //}
- //DispText = SelQX.ToString() + " by " + SelQY.ToString() + " Table\nEsc Key to Cancel";
- //DispText = SelQY.ToString() + " Row"+((SelQY>1)?"s by ":" by ") + SelQX.ToString() + " Column"+((SelQX>1)?"s\nEsc Key to Cancel":"\nEsc Key to Cancel");
- DispText = SelQY.ToString() + " Row" + ((SelQY > 1) ? "s" : "") + " " + SelQX.ToString() + " Column" + ((SelQX > 1) ? "s" : "")+ "\nEsc to Cancel";
+ DispText = $"{SelQY} Row{((SelQY > 1) ? "s" : "")} {SelQX} Column{((SelQX > 1) ? "s" : "")}\nEsc to Cancel";
g.DrawString(DispText, DispFont, BlackBrush, 3, dispY + 2);
// Draw each of the squares and fill with the default color.
@@ -198,7 +127,6 @@ namespace Accentra.Controls
// Go back and paint the squares with selection colors.
for (int x=0; x
private void TablePicker_Deactivate(object sender, System.EventArgs e) {
- // bCancel = true
- // and DialogResult = DialogResult.Cancel
- // were previously already set in MouseLeave.
-
- //this.Hide();
}
///
@@ -242,42 +165,24 @@ namespace Accentra.Controls
/// escaped (canceling) state.
///
private void TablePicker_MouseLeave(object sender, System.EventArgs e) {
- //if (!bHiding) bCancel = true;
- //this.DialogResult = DialogResult.Cancel;
- //this.Invalidate();
if (this.DialogResult == DialogResult.None)
this.DialogResult = DialogResult.Cancel;
}
- ///
- /// Cancels the prior cancellation caused by MouseLeave.
- ///
- private void TablePicker_MouseEnter(object sender, System.EventArgs e) {
- //bHiding = false;
- //bCancel = false;
- //this.DialogResult = DialogResult.OK;
- this.Invalidate();
- }
+ ///
+ /// Cancels the prior cancellation caused by MouseLeave.
+ ///
+ private void TablePicker_MouseEnter(object sender, System.EventArgs e) => this.Invalidate();
- ///
- /// Detects that the user made a selection by clicking.
- ///
- private void TablePicker_Click(object sender, System.EventArgs e) {
- //bHiding = true; // Not the same as Visible == false
- // // because bHiding suggests that the control
- // // is still "active" (not canceled).
- //this.Hide();
- this.DialogResult = DialogResult.OK;
- }
+ ///
+ /// Detects that the user made a selection by clicking.
+ ///
+ private void TablePicker_Click(object sender, System.EventArgs e) => this.DialogResult = DialogResult.OK;
- private void TablePicker_KeyPress(object sender, KeyPressEventArgs e)
+ private void TablePicker_KeyPress(object sender, KeyPressEventArgs e)
{
if (e.KeyChar == (char)Keys.Escape)
{
- //bHiding = true; // Not the same as Visible == false
- //// because bHiding suggests that the control
- //// is still "active" (not canceled).
- //this.Hide();
this.DialogResult = DialogResult.Cancel;
}
}
diff --git a/PROMS/VEPROMS User Interface/AboutVEPROMS.cs b/PROMS/VEPROMS User Interface/AboutVEPROMS.cs
index 394d7f06..11b9c239 100644
--- a/PROMS/VEPROMS User Interface/AboutVEPROMS.cs
+++ b/PROMS/VEPROMS User Interface/AboutVEPROMS.cs
@@ -1,7 +1,4 @@
using System;
-using System.Collections.Generic;
-using System.ComponentModel;
-using System.Drawing;
using System.Windows.Forms;
using System.Reflection;
using Volian.Controls.Library;
@@ -24,7 +21,7 @@ namespace VEPROMS
string connectionString = Database.VEPROMS_Connection;
Match mServer = Regex.Match(connectionString, ".*Data Source=([^;]*).*");
_SQLServerName = (mServer.Success) ? mServer.Groups[1].Value : "unknown";
- if (_SQLServerName.StartsWith(@".\")) _SQLServerName = @"Local \ " + _SQLServerName.Substring(2);
+ if (_SQLServerName.StartsWith(@".\")) _SQLServerName = $@"Local \ {_SQLServerName.Substring(2)}";
}
return _SQLServerName;
}
@@ -37,7 +34,7 @@ namespace VEPROMS
{
if (_DatabaseName == null)
{
- _DatabaseName = string.Format("{0}[SQL:{1:yyMM.ddHH}]", Database.ActiveDatabase, Database.RevDate);
+ _DatabaseName = $"{Database.ActiveDatabase}[SQL:{Database.RevDate:yyMM.ddHH}]";
}
return _DatabaseName;
}
@@ -55,26 +52,16 @@ namespace VEPROMS
DateTime buildDateTime = new System.IO.FileInfo(Assembly.GetExecutingAssembly().Location).LastWriteTime;
// If the AssemblyConfiguration is "DEMO" then we are running a Demo version
string demoTxt = VlnSettings.DemoMode ? "(Demo)": VlnSettings.DebugMode ? "(Debug)" : "(Production)";
- // C2018-015 made this information static so we can use in meta files
- //string connectionString = Database.VEPROMS_Connection;
- //Match mServer = Regex.Match(connectionString,".*Data Source=([^;]*).*");
- //string server = (mServer.Success)?mServer.Groups[1].Value:"unknown";
- //if (server.StartsWith(@".\")) server = @"Local \ " + server.Substring(2);
- //string databaseName = string.Format("{0}[SQL:{1:yyMM.ddHH}]", Database.ActiveDatabase, Database.RevDate);
- this.Text = String.Format("About {0}", AssemblyTitle + " " + demoTxt);
- this.labelProductName.Text = AssemblyProduct;
- this.labelVersion.Text = String.Format("Version {0}", AssemblyVersion);
- this.labelVersionDateTime.Text = String.Format("Build Date: {0}", buildDateTime.ToString());
- this.labelCopyright.Text = String.Format("Copyright © {0}. All Rights Reserved.", buildDateTime.Year.ToString());
- this.labelCompanyName.Text = AssemblyCompany;
-// this.textBoxDescription.Text = AssemblyDescription;
- this.labelCompanyName.Links[0].LinkData = "Volian Enterprises Inc.";
- this.labelCompanyName.Links.Add(0,23,"www.volian.com");
- //this.labelServer.Text = string.Format("SQL Server: {0}", server);
- this.labelServer.Text = string.Format("SQL Server: {0}", SQLServerName); // C2018-015 use static for this info.
- //if (databaseName == null) databaseName = Regex.Replace(connectionString, "^.*Initial Catalog=([^;]*);.*$", "$1", RegexOptions.IgnoreCase);
- //this.labelDatabase.Text = string.Format("Database: {0}", databaseName);
- this.labelDatabase.Text = string.Format("Database: {0}", DatabaseName); // C2018-015 use static for this info.
+ Text = $"About {AssemblyTitle} {demoTxt}";
+ labelProductName.Text = AssemblyProduct;
+ labelVersion.Text = $"Version {AssemblyVersion}";
+ labelVersionDateTime.Text = $"Build Date: {buildDateTime}";
+ labelCopyright.Text = $"Copyright © {buildDateTime.Year}. All Rights Reserved.";
+ labelCompanyName.Text = AssemblyCompany;
+ labelCompanyName.Links[0].LinkData = "Volian Enterprises Inc.";
+ labelCompanyName.Links.Add(0,23,"www.volian.com");
+ labelServer.Text = $"SQL Server: {SQLServerName}"; // C2018-015 use static for this info.
+ labelDatabase.Text = $"Database: {DatabaseName}"; // C2018-015 use static for this info.
}
#region Assembly Attribute Accessors
@@ -99,24 +86,12 @@ namespace VEPROMS
}
}
- public string AssemblyVersion
- {
- get
- {
- return Assembly.GetExecutingAssembly().GetName().Version.ToString();
- }
- }
+ public string AssemblyVersion => Assembly.GetExecutingAssembly().GetName().Version.ToString();
- // C2018-009 used to print the PROMS version number at the top of each PDF page
- public static string PROMSVersion
- {
- get
- {
- return Assembly.GetExecutingAssembly().GetName().Version.ToString();
- }
- }
+ // C2018-009 used to print the PROMS version number at the top of each PDF page
+ public static string PROMSVersion => Assembly.GetExecutingAssembly().GetName().Version.ToString();
- public string AssemblyDescription
+ public string AssemblyDescription
{
get
{
@@ -162,7 +137,7 @@ namespace VEPROMS
private void labelCompanyName_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{
// Determine which link was clicked within the LinkLabel.
- this.labelCompanyName.Links[0].Visited = true;
+ labelCompanyName.Links[0].Visited = true;
// Display the appropriate link based on the value of the
// LinkData property of the Link object.
@@ -171,18 +146,17 @@ namespace VEPROMS
System.Diagnostics.Process.Start(target); // this should start the default web browser
}
- private void logoPictureBox_Click(object sender, EventArgs e)
- {
- System.Diagnostics.Process.Start(labelCompanyName.Links[0].LinkData as string); // this should start the default web browser
- }
+ private void logoPictureBox_Click(object sender, EventArgs e) => System.Diagnostics.Process.Start(labelCompanyName.Links[0].LinkData as string); // this should start the default web browser
- private void btnViewEULA_Click(object sender, EventArgs e)
+ private void btnViewEULA_Click(object sender, EventArgs e)
{
- string EulaFile = string.Format(@"\{0}", VlnSettings.EULAfile);
+ string EulaFile = $@"\{VlnSettings.EULAfile}";
string strEULA = System.Environment.CurrentDirectory + EulaFile;
- frmViewTextFile ViewFile = new frmViewTextFile(strEULA,RichTextBoxStreamType.PlainText);
- ViewFile.Text = "End-User License Agreement";
- ViewFile.ShowDialog();
+ frmViewTextFile ViewFile = new frmViewTextFile(strEULA, RichTextBoxStreamType.PlainText)
+ {
+ Text = "End-User License Agreement"
+ };
+ ViewFile.ShowDialog();
}
}
diff --git a/PROMS/VEPROMS User Interface/BookMarks.cs b/PROMS/VEPROMS User Interface/BookMarks.cs
deleted file mode 100644
index c27d388f..00000000
--- a/PROMS/VEPROMS User Interface/BookMarks.cs
+++ /dev/null
@@ -1,34 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Text;
-using VEPROMS.CSLA.Library;
-
-namespace VEPROMS
-{
- public class BookMarks
- {
- public string Name;
- public VETreeNode Node;
-
- public BookMarks()
- {
- }
-
- public BookMarks(string n, VETreeNode o)
- {
- Name = n;
- Node = o;
- }
-
- public BookMarks(VETreeNode o)
- {
- Name = o.Text;
- Node = o;
- }
-
- public override string ToString()
- {
- return Name;
- }
- }
-}
diff --git a/PROMS/VEPROMS User Interface/DlgAnnotationsSelect.cs b/PROMS/VEPROMS User Interface/DlgAnnotationsSelect.cs
index c27bba37..a7648b16 100644
--- a/PROMS/VEPROMS User Interface/DlgAnnotationsSelect.cs
+++ b/PROMS/VEPROMS User Interface/DlgAnnotationsSelect.cs
@@ -1,11 +1,6 @@
using System;
-using System.Collections.Generic;
-using System.ComponentModel;
using System.Data;
-using System.Drawing;
using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
using System.Windows.Forms;
using VEPROMS.CSLA.Library;
@@ -14,10 +9,7 @@ namespace VEPROMS
// C2025-027 Annotation Type Filtering
public partial class dlgAnnotationsSelect : Form
{
- public dlgAnnotationsSelect()
- {
- InitializeComponent();
- }
+ public dlgAnnotationsSelect() => InitializeComponent();
public dlgAnnotationsSelect(string userid)
{
@@ -25,30 +17,13 @@ namespace VEPROMS
UserID = userid;
}
- private int _MyItemID;
- public int MyItemID
- {
- get { return _MyItemID; }
- set { _MyItemID = value; }
- }
+ public int MyItemID { get; set; }
+ public string UserID { get; set; }
- private string _UserID;
- public string UserID
- {
- get { return _UserID; }
- set { _UserID = value; }
- }
-
- private void btnSelect_Click(object sender, EventArgs e)
- {
- MoveSelectedItems(lstUnselected, lstSelected);
- }
+ private void btnSelect_Click(object sender, EventArgs e) => MoveSelectedItems(lstUnselected, lstSelected);
// Move selected items to lstUnselected.
- private void btnDeselect_Click(object sender, EventArgs e)
- {
- MoveSelectedItems(lstSelected, lstUnselected);
- }
+ private void btnDeselect_Click(object sender, EventArgs e) => MoveSelectedItems(lstSelected, lstUnselected);
// Move selected items from one ListBox to another.
private void MoveSelectedItems(ListBox lstFrom, ListBox lstTo)
@@ -90,39 +65,21 @@ namespace VEPROMS
}
// Enable and disable buttons.
- private void lst_SelectedIndexChanged(object sender, EventArgs e)
- {
- SetButtonsEditable();
- }
+ private void lst_SelectedIndexChanged(object sender, EventArgs e) => SetButtonsEditable();
// Save selected list to DB.
- private void btnUpdate_Click(object sender, EventArgs e)
- {
- saveChanges();
- }
+ private void btnUpdate_Click(object sender, EventArgs e) => saveChanges();
public class AnnotataionItem
{
- private string _NameStr;
- private int _TypeID;
+ private readonly string _NameStr;
+ private readonly int _TypeID;
public AnnotataionItem(string NameStr, int TypeID)
{
- this._NameStr = NameStr;
- this._TypeID = TypeID;
- }
- public string NameStr
- {
- get
- {
- return _NameStr;
- }
- }
- public int TypeID
- {
- get
- {
- return _TypeID;
- }
+ _NameStr = NameStr;
+ _TypeID = TypeID;
}
+ public string NameStr => _NameStr;
+ public int TypeID => _TypeID;
}
// Enable and disable buttons.
@@ -167,16 +124,16 @@ namespace VEPROMS
if (result == DialogResult.Yes)
{
saveChanges();
- this.Close();
+ Close();
}
else
{
- this.Close();
+ Close();
}
}
else
{
- this.Close();
+ Close();
}
}
diff --git a/PROMS/VEPROMS User Interface/DlgCloseTabsOrExit.cs b/PROMS/VEPROMS User Interface/DlgCloseTabsOrExit.cs
index abbe0ccd..2314696b 100644
--- a/PROMS/VEPROMS User Interface/DlgCloseTabsOrExit.cs
+++ b/PROMS/VEPROMS User Interface/DlgCloseTabsOrExit.cs
@@ -1,12 +1,4 @@
using System;
-using System.Collections.Generic;
-using System.ComponentModel;
-using System.Data;
-using System.Drawing;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using System.Windows.Forms;
namespace VEPROMS
{
@@ -16,19 +8,10 @@ namespace VEPROMS
{
private bool _Cancel = true;
- public bool Cancel
- {
- get { return _Cancel; }
- }
+ public bool Cancel => _Cancel;
- private bool _ExitPROMS;
-
- public bool ExitPROMS
- {
- get { return _ExitPROMS; }
- set { _ExitPROMS = value; }
- }
- public DlgCloseTabsOrExit(bool isMainWindow, bool hasChildWindows)
+ public bool ExitPROMS { get; set; }
+ public DlgCloseTabsOrExit(bool isMainWindow, bool hasChildWindows)
{
InitializeComponent();
if (!isMainWindow)
@@ -46,22 +29,22 @@ namespace VEPROMS
private void BtnClsTab_Click(object sender, EventArgs e)
{
_Cancel = false;
- _ExitPROMS = false;
- this.Hide();
+ ExitPROMS = false;
+ Hide();
}
private void BtnExitPROMS_Click(object sender, EventArgs e)
{
_Cancel = false;
- _ExitPROMS = true;
- this.Hide();
+ ExitPROMS = true;
+ Hide();
}
private void btnCancel_Click(object sender, EventArgs e)
{
_Cancel = true;
- _ExitPROMS = false;
- this.Hide();
+ ExitPROMS = false;
+ Hide();
}
}
}
diff --git a/PROMS/VEPROMS User Interface/DlgPrintProcedure.cs b/PROMS/VEPROMS User Interface/DlgPrintProcedure.cs
index a4f04f9b..20ed61d5 100644
--- a/PROMS/VEPROMS User Interface/DlgPrintProcedure.cs
+++ b/PROMS/VEPROMS User Interface/DlgPrintProcedure.cs
@@ -1,29 +1,21 @@
using System;
using System.Collections.Generic;
-using System.ComponentModel;
-using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.IO;
using VEPROMS.CSLA.Library;
using Volian.Print.Library;
-//using Volian.Controls.Library;
using Volian.Base.Library;
using JR.Utils.GUI.Forms;
+using System.Linq;
namespace VEPROMS
{
public partial class DlgPrintProcedure : DevComponents.DotNetBar.Office2007Form
{
- public bool SaveLinks
- {
- get
- {
- return swtbtnPDFLinks.Value;
- }
- }
- public int RemoveTrailingHardReturnsAndManualPageBreaks
+ public bool SaveLinks => swtbtnPDFLinks.Value;
+ public int RemoveTrailingHardReturnsAndManualPageBreaks
{
get
{
@@ -36,38 +28,19 @@ namespace VEPROMS
return 3;
}
}
- private string _Prefix = ""; // RHM20150506 Multiline ItemID TextBox
- public string Prefix
- {
- get { return _Prefix; }
- set { _Prefix = value; }
- }
- public bool OpenAfterCreate // RHM20150506 Multiline ItemID TextBox
+ // RHM20150506 Multiline ItemID TextBox
+ public string Prefix { get; set; } = "";
+ public bool OpenAfterCreate // RHM20150506 Multiline ItemID TextBox
{
get { return cbxOpenAfterCreate2.Checked; }
set { cbxOpenAfterCreate2.Checked = value; }
}
- private SessionInfo _MySessionInfo;
- public SessionInfo MySessionInfo
- {
- get { return _MySessionInfo; }
- set { _MySessionInfo = value; }
- }
- private bool _Automatic;
- public bool Automatic
- {
- get { return _Automatic; }
- set { _Automatic = value; }
- }
- private int _prtSectID = -1;
- public int PrtSectID
- {
- get { return _prtSectID; }
- set { _prtSectID = value; }
- }
- private bool _OverwritePDF;
- public bool OverwritePDF
+ public SessionInfo MySessionInfo { get; set; }
+ public bool Automatic { get; set; }
+ public int PrtSectID { get; set; } = -1;
+
+ public bool OverwritePDF
{
get { return cbxOverwritePDF2.Checked; }
set { cbxOverwritePDF2.Checked = value; }
@@ -85,18 +58,17 @@ namespace VEPROMS
swtbtnPDFdtPrefixSuffix.Value = swtbtnPDFdtPrefixSuffix.Enabled = _AllowDateTimePrefixSuffix;
}
}
- private DateTime _PrefixSuffixDTS = DateTime.Now; // C2018-033 date/time used for the date/time PDF file prefix and suffix
+ private readonly DateTime _PrefixSuffixDTS = DateTime.Now; // C2018-033 date/time used for the date/time PDF file prefix and suffix
private bool _DateTimePrefixSuffixPrintingAllProcedures = true; // C2018-033 to control adding the Date/Time Prefix/Suffix to PFD name when printing All procedures
private bool _IncludeWordSecTextInMetafile = true; // C2018-023 so that we can turn off including Word attachment text in metafile
private void RunAutomatic()
{
cbxDebugPagination.Checked = true;
cbxDebugText.Checked = true;
- cbxMetaFile.Checked = true; // C2018-004 create meta file for baseline compares
+ cbxMetaFile.Checked = true; // C2018-004 create meta file for baseline compares
_IncludeWordSecTextInMetafile = true;
Application.DoEvents();
string[] parameters = System.Environment.CommandLine.Split(" ".ToCharArray());
- bool ranAuto = false;
foreach (string parameter in parameters)
{
if (parameter.ToUpper() == "/NT")
@@ -111,11 +83,11 @@ namespace VEPROMS
_IncludeWordSecTextInMetafile = false; // C2018-023 turn off putting Word attachment text in the meta file for baseline compares
}
CreatePDFs();
- this.Close();
+ Close();
}
- private DocVersionInfo _DocVersionInfo = null;
- private bool _AllProcedures;
- private DocVersionConfig _DocVersionConfig;
+ private readonly DocVersionInfo _DocVersionInfo = null;
+ private readonly bool _AllProcedures;
+ private readonly DocVersionConfig _DocVersionConfig;
public string RevNum
{
get { return txbRevNum.Text; }
@@ -143,11 +115,8 @@ namespace VEPROMS
return RevNum + "/" + RevDate;
}
}
- public string ProcNum
- {
- get { return MyProcedure.DisplayNumber; }
- }
- public string PDFPath
+ public string ProcNum => MyProcedure.DisplayNumber;
+ public string PDFPath
{
get {// B2018-069 Revert to Temporary for Baseline testing
if (PromsPrinter.BaselineTesting)
@@ -179,7 +148,7 @@ namespace VEPROMS
private bool _CreateButtonClicked = false; // B2020-062 control the toggle of date/time prefix/suffix on pdf file name
public DlgPrintProcedure(DocVersionInfo dvi, bool automatic)
{
- _Automatic = automatic;
+ Automatic = automatic;
InitializeComponent();
_AllProcedures = true;
_DocVersionConfig = dvi.DocVersionConfig;
@@ -201,14 +170,12 @@ namespace VEPROMS
btnCreatePDF.Text = "Create PDFs";
HandleDocVersionSettings();
PrepForAllOrOne(false);
- // don't open all PDFs if doing All Procedures
- //cbxOpenAfterCreate2.Checked = dvi.DocVersionConfig.Print_AlwaysViewPDFAfterCreate;
// C2018-033 added the Prefix / Suffix switch to the expand Additional Settings check
expPrnSetting.Expanded = swtbtnBlankPgsForDuplex.Value || swtbtnChgBar.Value || swtbtnGeneratePlacekeeper.Value || swtbtnPDFLinks.Value || swtbtnPROMSVersion.Value || swtbtnWaterMark.Value || swtbtnPDFdtPrefixSuffix.Value;
}
public DlgPrintProcedure(DocVersionInfo dvi)
{
- _Automatic = false;
+ Automatic = false;
InitializeComponent();
_AllProcedures = true;
_DocVersionConfig = dvi.DocVersionConfig;
@@ -249,21 +216,12 @@ namespace VEPROMS
// C2021-063 make the Generate Alarm Point List text checkbox visable in the format flag is set.
cbxAlmPtTxt.Visible = !oneProcedure && MyProcedure.ActiveFormat.PlantFormat.FormatData.PrintData.ChkBoxToGeneratePointListText;
}
- private string _UnitNumber;
- public string UnitNumber
- {
- get { return _UnitNumber; }
- set { _UnitNumber = value; }
- }
- private int _UnitIndex;
- public int UnitIndex
- {
- get { return _UnitIndex; }
- set { _UnitIndex = value; }
- }
- // C2018-012 - Code Cleanup - redesigned the Print Dialog to include a sliding panel and remplaced check boxes with ON/OFF switches
- public DlgPrintProcedure(ProcedureInfo pi)
+ public string UnitNumber { get; set; }
+ public int UnitIndex { get; set; }
+
+ // C2018-012 - Code Cleanup - redesigned the Print Dialog to include a sliding panel and remplaced check boxes with ON/OFF switches
+ public DlgPrintProcedure(ProcedureInfo pi)
{
InitializeComponent();
_AllProcedures = false;
@@ -354,31 +312,9 @@ namespace VEPROMS
swtbtnWaterMark.Value = false;
else
swtbtnWaterMark.Value = true;
- // Auto Duplexing on/off - Auto duplex was used only by Point Beach formats These buttons were removed from the dialog
- // There was not print coding to support this format flag
- //if ((_MyProcedure.ActiveParent as DocVersionInfo).ActiveFormat.PlantFormat.FormatData.PrintData.AllowDuplex)
- //{
- // lblAutoDuplexing.Visible = true;
- // btnDuplxOff.Visible = true;
- // btnDuplxOn.Visible = true;
- // if (_DocVersionConfig.Print_DisableDuplex)
- // btnDuplxOff.PerformClick();
- // else
- // btnDuplxOn.PerformClick();
- //}
- //else
- //{
- // lblAutoDuplexing.Visible = false;
- // btnDuplxOff.Visible = false;
- // btnDuplxOn.Visible = false;
- //}
SetCompareVisibility();
-
- // default to using OriginalPageBreaks (16bit page breaks) if App.config is set
- // to true:
- //cbxOrPgBrk.Visible = VlnSettings.OriginalPageBreak && VlnSettings.DebugMode;
- cbxOrPgBrk.Visible = false; //per Harry
+ cbxOrPgBrk.Visible = false; //per Harry
cbxOrPgBrk.Checked = false;
}
@@ -416,13 +352,7 @@ namespace VEPROMS
private Timer _MyTimer;
public void SetupForProcedure() // RHM20150506 Multiline ItemID TextBox
{
- if(_DocVersionInfo == null)this.Text = "Create PDF for " + ProcNum;
- // get list of previous pdf files
- // if no previous pdf file, then get path from frmVersionProperties
- // dlgSelectFile.InitialDirectory = pdf path from frmVersionProperties
- //cbxPDF.Text = string.Format(@"{0}\{1}.pdf", _PDFPath, _ProcNum);
- // General 2 settings
- //txbPDFLocation.Text = _PDFPath;
+ if(_DocVersionInfo == null)Text = "Create PDF for " + ProcNum;
BuildPDFFileName();
ProcedureConfig pc = _MyProcedure.MyConfig as ProcedureConfig;
// C2025-033 set which Child procedure is being printed used for PageStyle items
@@ -434,7 +364,7 @@ namespace VEPROMS
if (pc != null)
{
//C2021-062 use the save rev number for all procedures if set, or just use the rev number in the current procedure config
- RevNum = (_NewRevForAllProcs == null) ? pc.Print_Rev : _NewRevForAllProcs;
+ RevNum = _NewRevForAllProcs ?? pc.Print_Rev;
RevDate = pc.Print_RevDate; //== null || pc.Print_RevDate=="" ? DateTime.Today : Convert.ToDateTime(pc.Print_RevDate);
ReviewDate = pc.Print_ReviewDate; // == null ? DateTime.Today : Convert.ToDateTime(pc.Print_ReviewDate);
//Now check the format flags to determine if/how the Rev string should be parsed.
@@ -498,11 +428,6 @@ namespace VEPROMS
else
swtbtnWaterMark.Value = false; // set to None at folder level so set Watermark switch to the off position
- //ppCmbxChgBarPos.DataSource = EnumDetail.Details();
- //ppCmbxChgBarPos.DisplayMember = "Description";
- //ppCmbxChgBarPos.ValueMember = "EValue";
- //ppCmbxChgBarPos.SelectedIndex = (int)MyProcedure.MyDocVersion.DocVersionConfig.Print_ChangeBarLoc;
-
ppCmbxChgBarTxtType.DataSource = EnumDetail.Details();
ppCmbxChgBarTxtType.DisplayMember = "Description";
ppCmbxChgBarTxtType.ValueMember = "EValue";
@@ -515,7 +440,7 @@ namespace VEPROMS
bool usesRevDate = _MyProcedure.ActiveFormat.PlantFormat.FormatData.PrintData.DoRevDate || _MyProcedure.ActiveFormat.PlantFormat.FormatData.PrintData.RevDateWithForwardSlash;
if (_MyProcedure.Sections != null)
{
- foreach (SectionInfo mysection in _MyProcedure.Sections)
+ foreach (SectionInfo mysection in _MyProcedure.Sections.OfType())
hasReviewDate |= mysection.ActiveFormat.PlantFormat.HasPageListToken("{REVIEWDATE}");
}
// Only the New HLP format and the MYA format use this
@@ -535,9 +460,8 @@ namespace VEPROMS
if (MyProcedure == null) return;
string PDFFilePrefix = _DocVersionConfig.Print_PDFFilePrefix;
string PDFFileSuffix = _DocVersionConfig.Print_PDFFileSuffix;
- string PDFFileName = "";
- PDFDTPrefix dtPre = _DocVersionConfig.Print_PDFdtFilePrefix;
- PDFDTSuffix dtSuf = _DocVersionConfig.Print_PDFdtFileSuffix;
+ PDFDTPrefix dtPre = _DocVersionConfig.Print_PDFdtFilePrefix;
+ PDFDTSuffix dtSuf = _DocVersionConfig.Print_PDFdtFileSuffix;
if (dtPre != PDFDTPrefix.None) PDFFilePrefix = ""; // incase user entered prefix text but then selected a date/time (in working draft properties)
if (dtSuf != PDFDTSuffix.None) PDFFileSuffix = ""; // incase user entered suffix text but then selected a date/time (in working draft properties)
// B2020-062 control the toggle of date/time prefix/suffix on pdf file name
@@ -556,19 +480,17 @@ namespace VEPROMS
if (dtSuf != PDFDTSuffix.None)
PDFFileSuffix = "_" + (_PrefixSuffixDTS.ToString(dtSuf.ToString())).Replace("__", " ").Replace("_", "-");
}
- if (ProcNum == string.Empty)
- //txbPDFName.Text = this.UnitNumber + ".pdf";
- PDFFileName = this.UnitNumber;
- else
- //txbPDFName.Text = string.Format("{0}.pdf", _MyProcedure.PDFNumber);
- PDFFileName = string.Format("{0}", _MyProcedure.PDFNumber);
- //if (txbPDFName.Text.StartsWith("*"))
- // txbPDFName.Text = txbPDFName.Text.Replace("*", this.UnitNumber);
- if ((PDFFileName ?? "") == "") PDFFileName = "NoProcNumber";
+ string PDFFileName;
+ if (ProcNum == string.Empty)
+ PDFFileName = UnitNumber;
+ else
+ PDFFileName = string.Format("{0}", _MyProcedure.PDFNumber);
+
+ if ((PDFFileName ?? "") == "") PDFFileName = "NoProcNumber";
if (PDFFileName.StartsWith("*"))
- PDFFileName = PDFFileName.Replace("*", this.UnitNumber);
+ PDFFileName = PDFFileName.Replace("*", UnitNumber);
if (PDFFileName.Contains("?")) PDFFileName = PDFFileName.Replace("?", "_"); // for wcn sys/BM-2xxA??, etc
- txbPDFName.Text = PDFFilePrefix + PDFFileName + PDFFileSuffix + ".pdf";
+ txbPDFName.Text = $"{PDFFilePrefix}{PDFFileName}{PDFFileSuffix}.pdf";
}
// C2018-033 Enable/disable the switch to control whether to add Prefix and/or Suffix to PDF file name
@@ -585,12 +507,9 @@ namespace VEPROMS
swtbtnPDFdtPrefixSuffix.Enabled = hasPrefixSuffix;
}
- private void btnCancel_Click(object sender, EventArgs e)
- {
- this.Close();
- }
+ private void btnCancel_Click(object sender, EventArgs e) => Close();
- private void swtbtnChgBar_ValueChanged(object sender, EventArgs e)
+ private void swtbtnChgBar_ValueChanged(object sender, EventArgs e)
{
// C2019-031 - disable the override change bar grouping when default change bar is set to format default or no change bar
cbxOvrrideDefChgBars.Checked = false; // uncheck the override change bar check box inside the grouping
@@ -714,7 +633,7 @@ namespace VEPROMS
StringBuilder sb = new StringBuilder();
if (MySessionInfo != null)
{
- foreach (ProcedureInfo myProc in _DocVersionInfo.Procedures)
+ foreach (ProcedureInfo myProc in _DocVersionInfo.Procedures.OfType())
{
string message = string.Empty;
if (!MySessionInfo.CanCheckOutItem(myProc.ItemID, CheckOutType.Procedure, ref message))
@@ -742,15 +661,14 @@ namespace VEPROMS
pbPDFsStatus.Maximum = n;
pbPDFsStatus.Visible = true;
VlnSvgPageHelper.CountInApplProcs = 1; // B2021-127: BNPPalr - Auto set of serial #, skip Front Matter as per PAL 11/1/21 (set to 1 not 0)
- this.Text = string.Format("Processing {0}", _DocVersionInfo.MyFolder.Name);
- foreach (ProcedureInfo myProc in _DocVersionInfo.Procedures)
+ Text = string.Format("Processing {0}", _DocVersionInfo.MyFolder.Name);
+ foreach (ProcedureInfo myProc in _DocVersionInfo.Procedures.OfType())
{
string locpdfname = null; // get pdf file name for later merge code
MyProcedure = myProc;
- // C2021-019: Override Watermark Text, 'waterMarkText' will have whatever watermark text should be printed
- ProcedureConfig procConfig = MyProcedure.MyConfig as ProcedureConfig;
- string waterMarkTextOverride = "";
- if (procConfig != null) waterMarkTextOverride = procConfig.GetValue("PSI", "WATERMARKOVERRIDE");
+ // C2021-019: Override Watermark Text, 'waterMarkText' will have whatever watermark text should be printed
+ string waterMarkTextOverride = "";
+ if (MyProcedure.MyConfig is ProcedureConfig procConfig) waterMarkTextOverride = procConfig.GetValue("PSI", "WATERMARKOVERRIDE");
// C2020-002 paper size is now set in the format files - default is Letter
Volian.Print.Library.Rtf2Pdf.PaperSize = myProc.ActiveFormat.PlantFormat.FormatData.PDFPageSize.PaperSize;
if (myProc.Sections != null)
@@ -772,13 +690,6 @@ namespace VEPROMS
pbPDFsStatus.TextVisible = true;
pbPDFsStatus.Text = string.Format("Creating PDF for {0} ({1} of {2})", myProc.DisplayNumber, ++i, n);
pbPDFsStatus.Value = i;
- // this.Text = string.Format("Create PDF for {0} ({1} of {2})", myProc.DisplayNumber, ++i, n);
-
- // B2021-102 we now get this information in frmPDFStatusForm()
- //MyProcedure = ProcedureInfo.GetItemAndChildrenByUnit(MyProcedure.ItemID, 0, MyProcedure.MyDocVersion.DocVersionConfig.SelectedSlave);
- // C2018-015 add the procedure tree path and the procedure number and title to the meta file
- //if (BaselineMetaFile.IsOpen && i == 1) BaselineMetaFile.WriteLine("!! {0}", MyProcedure.SearchDVPath.Replace("\a", " | "));
- //if (BaselineMetaFile.IsOpen) BaselineMetaFile.WriteLine("!! {0} | {1}", MyProcedure.DisplayNumber, MyProcedure.DisplayText);
string myPDFPath = GetMultiunitPDFPath();
_MergedPdfPath = myPDFPath; // If Slave, need its subdirectory/unit path for merging
@@ -814,14 +725,7 @@ namespace VEPROMS
pbPDFsStatus.TextVisible = true;
pbPDFsStatus.Text = string.Format("Creating PDF for {0} ({1} of {2})", myProc.DisplayNumber, ++i, n);
pbPDFsStatus.Value = i;
- // this.Text = string.Format("Create PDF for {0} ({1} of {2})", myProc.DisplayNumber, ++i, n);
-
- // B2021-102 we now get this information in frmPDFStatusForm()
- //MyProcedure = ProcedureInfo.GetItemAndChildrenByUnit(MyProcedure.ItemID, 0, MyProcedure.MyDocVersion.DocVersionConfig.SelectedSlave);
- // C2018-015 add the procedure tree path and the procedure number and title to the meta file
- //if (BaselineMetaFile.IsOpen && i == 1) BaselineMetaFile.WriteLine("!! {0}", MyProcedure.SearchDVPath.Replace("\a", " | "));
- //if (BaselineMetaFile.IsOpen) BaselineMetaFile.WriteLine("!! {0} | {1}", MyProcedure.DisplayNumber, MyProcedure.DisplayText);
-
+
// RHM 20120925 Overlay the bottom of the dialog so that cancel button is covered.
// B2016-249 Output Procedure to folder associated with Parent Child
// B2021-102 put in the using for better memory management
@@ -850,18 +754,9 @@ namespace VEPROMS
pbPDFsStatus.TextVisible = true;
pbPDFsStatus.Text = string.Format("Creating PDF for {0} ({1} of {2})", myProc.DisplayNumber, ++i, n);
pbPDFsStatus.Value = i;
- // this.Text = string.Format("Create PDF for {0} ({1} of {2})", myProc.DisplayNumber, ++i, n);
// RHM 20120925 Overlay the bottom of the dialog so that cancel button is covered.
int profileDepth1 = ProfileTimer.Push(">>>> GetItemAndChildren");
- // B2021-102 we now get this information in frmPDFStatusForm()
- //if (MyProcedure.ActiveFormat.PlantFormat.FormatData.TransData.UseTransitionModifier || MyProcedure.ActiveFormat.PlantFormat.FormatData.TransData.UseSpecificTransitionModifier)
- // MyProcedure = ProcedureInfo.GetItemAndChildrenByUnit(MyProcedure.ItemID, 0, MyProcedure.MyDocVersion.DocVersionConfig.SelectedSlave);
- //else
- // MyProcedure = ProcedureInfo.GetItemAndChildren(MyProcedure.ItemID);
- //// C2018-015 add the procedure tree path and the procedure number and title to the meta file
- //if (BaselineMetaFile.IsOpen && i == 1) BaselineMetaFile.WriteLine("!! {0}", MyProcedure.SearchDVPath.Replace("\a", " | "));
- //if (BaselineMetaFile.IsOpen) BaselineMetaFile.WriteLine("!! {0} | {1}", MyProcedure.DisplayNumber, MyProcedure.DisplayText);
-
+
ProfileTimer.Pop(profileDepth1);
// B2021-102 put in the using for better memory management
// B2016-249 Output Procedure to folder associated with Parent Child
@@ -934,12 +829,12 @@ namespace VEPROMS
private void CreateDebugFiles()
{
if (cbxDebugPagination.Checked)
- Volian.Base.Library.DebugPagination.Open(PDFPath + "\\DebugPagination.txt"); // RHM 20120925 Corrected spelling
+ Volian.Base.Library.DebugPagination.Open($"{PDFPath}\\DebugPagination.txt"); // RHM 20120925 Corrected spelling
if (cbxDebugText.Checked)
- Volian.Base.Library.DebugText.Open(PDFPath + "\\DebugText.txt");
+ Volian.Base.Library.DebugText.Open($"{PDFPath}\\DebugText.txt");
if (cbxMetaFile.Checked) // C2018-004 create meta file for baseline compares
{
- Volian.Base.Library.BaselineMetaFile.Open(PDFPath + "\\DebugMeta.txt");
+ Volian.Base.Library.BaselineMetaFile.Open($"{PDFPath}\\DebugMeta.txt");
// C2018-015 add the PROMS Version, SQL Server, and Database to top of the meta file
Volian.Base.Library.BaselineMetaFile.WriteLine("!! Ver {0} {1} {2}", AboutVEPROMS.PROMSVersion, AboutVEPROMS.SQLServerName, AboutVEPROMS.DatabaseName);
// C2018-023 set as to whether we are going to include the Word attment text in the baseline metafile
@@ -975,7 +870,7 @@ namespace VEPROMS
if (MyProcedure.MyDocVersion.MultiUnitCount > 1)
{
VlnSvgPageHelper.CountInApplProcs = 1;
- foreach (ProcedureInfo pi in MyProcedure.MyDocVersion.Procedures)
+ foreach (ProcedureInfo pi in MyProcedure.MyDocVersion.Procedures.OfType())
{
if (pi.ItemID == MyProcedure.ItemID) break;
bool includeProc = pi.ApplInclude(SelectedSlave);
@@ -991,24 +886,14 @@ namespace VEPROMS
string waterMarkText = (swtbtnWaterMark.Value) ? cbxWaterMark.Text : "None" ; // B2018-124 use text of watermark form drop down list instead of enum value
string watermarkColor = "Blue"; // this is the default watermark color
frmPDFStatusForm.SetUnitWatermark(MyProcedure, ref waterMarkText, ref watermarkColor); //C2022-004 Unit Designator Watermark
- ProcedureConfig procConfig = MyProcedure.MyConfig as ProcedureConfig;
- string waterMarkTextOverride = "";
- if (procConfig != null) waterMarkTextOverride = procConfig.GetValue("PSI", "WATERMARKOVERRIDE"); // C2021-019: override watermark text
+ string waterMarkTextOverride = "";
+ if (MyProcedure.MyConfig is ProcedureConfig procConfig) waterMarkTextOverride = procConfig.GetValue("PSI", "WATERMARKOVERRIDE"); // C2021-019: override watermark text
if (swtbtnWaterMark.Value && waterMarkTextOverride != null && waterMarkTextOverride != "") waterMarkText = waterMarkTextOverride;
// Determine change bar settings. First get from config & then see if override from dialog.
// Also check that format allows override.
ChangeBarDefinition cbd = DetermineChangeBarSettings();
int profileDepth2 = ProfileTimer.Push(">>>> CreatePdf.GetItemAndChildren");
- // B2021-088 moved this if/else to frmPDFStatusForm() so that the Approval logic will have access to this logic
- //if (MyProcedure.MyDocVersion.DocVersionConfig.SelectedSlave > 0 || MyProcedure.ActiveFormat.PlantFormat.FormatData.TransData.UseTransitionModifier || MyProcedure.ActiveFormat.PlantFormat.FormatData.TransData.UseSpecificTransitionModifier)
- // MyProcedure = ProcedureInfo.GetItemAndChildrenByUnit(MyProcedure.ItemID, 0, MyProcedure.MyDocVersion.DocVersionConfig.SelectedSlave);
- //else
- // MyProcedure = ProcedureInfo.GetItemAndChildren(MyProcedure.ItemID);
- // C2018-015 add the procedure tree path and the procedure number and title to the meta file
- //if (BaselineMetaFile.IsOpen) BaselineMetaFile.WriteLine("!! {0}", MyProcedure.SearchDVPath.Replace("\a"," | "));
- //if (BaselineMetaFile.IsOpen) BaselineMetaFile.WriteLine("!! {0} | {1}", MyProcedure.DisplayNumber, MyProcedure.DisplayText);
-
// B2022-088: Find Doc Ro button not working in Word Sections
// Initialize Print Cache
MSWordToPDF.RoPrintCache = new Dictionary();
@@ -1045,7 +930,7 @@ namespace VEPROMS
MyProcedure.MyDocVersion.DocVersionConfig.SelectedSlave = 0;
MyProcedure.SelectedChildToPrint = 0; // B2023-035 reset
- this.Close();
+ Close();
ShowDebugFiles();
ProfileTimer.Pop(profileDepth);
ProfileTimer.ShowTimerTable();
@@ -1121,22 +1006,19 @@ namespace VEPROMS
DoCreatePDF();
}
- public void QPCreatePDF()
- {
- DoCreatePDF();
- }
+ public void QPCreatePDF() => DoCreatePDF();
- private void DoCreatePDF()
+ private void DoCreatePDF()
{
if (_AllProcedures)
{
- this.Cursor = Cursors.WaitCursor;
+ Cursor = Cursors.WaitCursor;
DateTime dtStart = DateTime.Now;
_MultiunitPdfLocation = cbxMultiunitPdfLocation.SelectedItem.ToString();
PromsPrinter.ClearTransPageNumProblems();
CreatePDFs();
PromsPrinter.ReportTransPageNumProblems();
- this.Cursor = Cursors.Default;
+ Cursor = Cursors.Default;
if (_MergedPfd == null)
{
if (VlnSettings.DebugMode)
@@ -1149,7 +1031,7 @@ namespace VEPROMS
{
MessageBox.Show("Completed Successfully", "Print All Procedures", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
- this.Close();
+ Close();
}
}
else
@@ -1158,14 +1040,14 @@ namespace VEPROMS
// B2017-009 If the selected item is null don't add a folder
if (cbxMultiunitPdfLocation.SelectedItem != null)
_MultiunitPdfLocation = cbxMultiunitPdfLocation.SelectedItem.ToString();
- this.Cursor = Cursors.WaitCursor;
+ Cursor = Cursors.WaitCursor;
_CreateButtonClicked = true; // B2020-062 control the toggle of date/time prefix/suffix on pdf file name
CreatePDF();
_CreateButtonClicked = false;
- this.Cursor = Cursors.Default;
+ Cursor = Cursors.Default;
}
}
- private bool _Initializing = false;
+ private readonly bool _Initializing = false;
private void btnPdfLocation_Click(object sender, EventArgs e)
{
@@ -1191,12 +1073,9 @@ namespace VEPROMS
ppTxbxChangeBarUserMsgOne.Enabled = enabled;
ppTxbxChangeBarUserMsgTwo.Enabled = enabled;
}
- private void cbxOvrrideDefChgBars_CheckStateChanged(object sender, EventArgs e)
- {
- SetCustomControls(cbxOvrrideDefChgBars.Checked);
- }
+ private void cbxOvrrideDefChgBars_CheckStateChanged(object sender, EventArgs e) => SetCustomControls(cbxOvrrideDefChgBars.Checked);
- private void rbCustom_Click(object sender, EventArgs e)
+ private void rbCustom_Click(object sender, EventArgs e)
{
SetCustomControls(true);
// Make Custom controls visible
@@ -1218,24 +1097,22 @@ namespace VEPROMS
// B2024-058 Add validation for Revision Date field of the Print dialog
private bool validateDate(TextBox txtDate)
{
- DateTime dDate;
- if (!(txtDate.Text == ""))
- {
-
- if (DateTime.TryParse(txtDate.Text, out dDate))
- {
- return true;
- }
- else
- {
- string txtDate2 = txtDate.Text;
- string message = String.Format("Date {0} in wrong format" + System.Environment.NewLine + "Correct the revision date.", txtDate2);
- string txtTitle = "Invalid Format";
- MessageBox.Show(message, txtTitle);
- return false;
- }
- }
- return true;
+ if (!(txtDate.Text == ""))
+ {
+ if (DateTime.TryParse(txtDate.Text, out _))
+ {
+ return true;
+ }
+ else
+ {
+ string txtDate2 = txtDate.Text;
+ string message = String.Format("Date {0} in wrong format" + System.Environment.NewLine + "Correct the revision date.", txtDate2);
+ string txtTitle = "Invalid Format";
+ MessageBox.Show(message, txtTitle);
+ return false;
+ }
+ }
+ return true;
}
private void txbRevDate_Enter(object sender, EventArgs e)
@@ -1243,8 +1120,6 @@ namespace VEPROMS
txbDate = txbRevDate;
grpDateSelector.Text = "Select Revision Date";
grpDateSelector.Visible = calDateSelector.Visible = true;
- //C2021-007 position the calendar to the current RevDate or if no RevDate, position to today's date
- DateTime dDate;
// B2024-058 Add validation for Revision Date field of the Print dialog
if (!validateDate(txbDate))
{
@@ -1259,17 +1134,16 @@ namespace VEPROMS
private void txbRevDate_Leave(object sender, EventArgs e)
{
if (_Initializing) return;
- if (this.ActiveControl == calDateSelector)
+ if (ActiveControl == calDateSelector)
{
txbRevDate.Focus(); //B2018-059 keep the calendar open until a different field on the print dialog is selected
return;
}
txbDate = null;
grpDateSelector.Visible = calDateSelector.Visible = false;
- // save the RevDate to the procedure's config.
- ProcedureConfig pc = MyProcedure.MyConfig as ProcedureConfig;
- if (pc == null) return;
- pc.Print_RevDate = txbRevDate.Text;
+ // save the RevDate to the procedure's config.
+ if (!(MyProcedure.MyConfig is ProcedureConfig pc)) return;
+ pc.Print_RevDate = txbRevDate.Text;
using (Item itm = Item.Get(MyProcedure.ItemID))
{
itm.MyContent.Config = MyProcedure.MyConfig.ToString();
@@ -1283,10 +1157,9 @@ namespace VEPROMS
if (_Initializing) return;
txbDate = null;
grpDateSelector.Visible = calDateSelector.Visible = false;
- // save the ReviewDate to the procedure's config.
- ProcedureConfig pc = MyProcedure.MyConfig as ProcedureConfig;
- if (pc == null) return;
- pc.Print_ReviewDate = txbReviewDate.Text;
+ // save the ReviewDate to the procedure's config.
+ if (!(MyProcedure.MyConfig is ProcedureConfig pc)) return;
+ pc.Print_ReviewDate = txbReviewDate.Text;
using (Item itm = Item.Get(MyProcedure.ItemID))
{
itm.MyContent.Config = MyProcedure.MyConfig.ToString();
@@ -1326,10 +1199,9 @@ namespace VEPROMS
// C2021-062 used to save rev number information when all procedures are printed or merged
private void SaveRevNumToProcedureConfig(string newrevnum)
{
- // save the RevNum to the procedure's config.
- ProcedureConfig pc = MyProcedure.MyConfig as ProcedureConfig;
- if (pc == null) return;
- pc.Print_Rev = newrevnum;
+ // save the RevNum to the procedure's config.
+ if (!(MyProcedure.MyConfig is ProcedureConfig pc)) return;
+ pc.Print_Rev = newrevnum;
using (Item itm = Item.Get(MyProcedure.ItemID))
{
itm.MyContent.Config = MyProcedure.MyConfig.ToString();
@@ -1341,22 +1213,16 @@ namespace VEPROMS
{
if (expPrnSetting.Expanded)
{
- this.Size = new Size(this.Size.Width + (expPrnSetting.Size.Width - expPrnSetting.TitlePanel.Size.Height), this.Size.Height);
+ Size = new Size(Size.Width + (expPrnSetting.Size.Width - expPrnSetting.TitlePanel.Size.Height), Size.Height);
// B2018-137 set the visability of Generate Placekeeper
swtbtnGeneratePlacekeeper.Visible = lblGeneratePlacekeeper.Visible = ((MyProcedure.ActiveFormat.PlantFormat.FormatData.PurchaseOptions & E_PurchaseOptions.AutoPlacekeeper) == E_PurchaseOptions.AutoPlacekeeper);
}
- //else
- // this.Size = new Size(this.Size.Width-(expPrnSetting.Size.Width-expPrnSetting.TitlePanel.Size.Height), this.Size.Height);
- //Refresh();
}
private void expPrnSetting_ExpandedChanging(object sender, DevComponents.DotNetBar.ExpandedChangeEventArgs e)
- {
+ {
if (expPrnSetting.Expanded)
- //this.Size = new Size(this.Size.Width+(expPrnSetting.Size.Width-expPrnSetting.TitlePanel.Size.Height), this.Size.Height);
- //else
- this.Size = new Size(this.Size.Width-(expPrnSetting.Size.Width-expPrnSetting.TitlePanel.Size.Height), this.Size.Height);
- //Refresh();
+ Size = new Size(Size.Width-(expPrnSetting.Size.Width-expPrnSetting.TitlePanel.Size.Height), Size.Height);
}
@@ -1395,15 +1261,15 @@ namespace VEPROMS
DoCreatePDF(); // create indivitual pdfs
if (_MergedPdfPath != null && _MergedPdfPath != PDFPath) PDFPath = _MergedPfd.Folder = _MergedPdfPath;
// C2021-063 pass in whether to generate Alarm Point List text when a merge is done
- if (!_MergedPfd.DoTheMerge(PromsPrinter.MergedLandscapePages,cbxAlmPtTxt.Checked)) return; // merge them together.
+ if (!_MergedPfd.DoTheMerge(cbxAlmPtTxt.Checked)) return; // merge them together.
// if the property to show the file after printing is set (on the version dialog), display it. Otherwise do a dialog to let user know it's done
if (_DocVersionConfig.Print_MergedPdfsViewAfter)
{
if (_MergedPfd.MergedPdfs != null && _MergedPfd.MergedPdfs.Count > 0)
{
System.Diagnostics.Process sdp = System.Diagnostics.Process.Start(_MergedPfd.MergedFileName);
- if (sdp != null) // B2020-055 if the current .NET version does not recognize the program used to display the PDF, it will return a NULL (ex. Microsoft Edge)
- sdp.WaitForInputIdle();
+ // B2020-055 if the current .NET version does not recognize the program used to display the PDF, it will return a NULL (ex. Microsoft Edge)
+ sdp?.WaitForInputIdle();
}
}
else if (VlnSettings.DebugMode)
@@ -1416,7 +1282,7 @@ namespace VEPROMS
{
FlexibleMessageBox.Show("Completed Successfully", "Print All and Merge Procedures", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
- this.Close();
+ Close();
}
private void cbxAssignRevToAllMergedPrcs_CheckedChanged(object sender, EventArgs e)
@@ -1428,10 +1294,5 @@ namespace VEPROMS
_NewRevForAllProcs = null;
}
-
- //private void cbxDebug_CheckedChanged(object sender, EventArgs e)
- //{
- // cbxCmpPRMSpfd.Visible = cbxDebug.Checked;
- //}
}
}
diff --git a/PROMS/VEPROMS User Interface/GlobalSuppressions.cs b/PROMS/VEPROMS User Interface/GlobalSuppressions.cs
new file mode 100644
index 00000000..046248af
--- /dev/null
+++ b/PROMS/VEPROMS User Interface/GlobalSuppressions.cs
@@ -0,0 +1,8 @@
+// This file is used by Code Analysis to maintain SuppressMessage
+// attributes that are applied to this project.
+// Project-level suppressions either have no target or are given
+// a specific target and scoped to a namespace, type, member, etc.
+
+using System.Diagnostics.CodeAnalysis;
+
+[assembly: SuppressMessage("Style", "IDE1006:Naming Styles", Justification = "Not modifying Naming Styles")]
diff --git a/PROMS/VEPROMS User Interface/Program.cs b/PROMS/VEPROMS User Interface/Program.cs
index f21f5b86..d5b006bf 100644
--- a/PROMS/VEPROMS User Interface/Program.cs
+++ b/PROMS/VEPROMS User Interface/Program.cs
@@ -1,7 +1,5 @@
using System;
-using System.Collections.Generic;
using System.Windows.Forms;
-using Volian.Base.Library;
namespace VEPROMS
{
diff --git a/PROMS/VEPROMS User Interface/ShortcutLists.cs b/PROMS/VEPROMS User Interface/ShortcutLists.cs
index 04d67f85..d789475e 100644
--- a/PROMS/VEPROMS User Interface/ShortcutLists.cs
+++ b/PROMS/VEPROMS User Interface/ShortcutLists.cs
@@ -1,12 +1,5 @@
using System;
-using System.Collections.Generic;
-using System.ComponentModel;
-using System.Data;
-using System.Drawing;
-using System.Text;
-using System.IO;
using System.Windows.Forms;
-using DevComponents.DotNetBar;
namespace VEPROMS
{
diff --git a/PROMS/VEPROMS User Interface/VEPROMS_UI.csproj b/PROMS/VEPROMS User Interface/VEPROMS_UI.csproj
index f9ed6495..1f8bee14 100644
--- a/PROMS/VEPROMS User Interface/VEPROMS_UI.csproj
+++ b/PROMS/VEPROMS User Interface/VEPROMS_UI.csproj
@@ -154,18 +154,12 @@
AboutVEPROMS.cs
-
Form
dlgAnnotationsSelect.cs
-
- True
- True
- dlgAnnotationsSelect.resx
-
Form
@@ -349,6 +343,7 @@
frmVersionsProperties.cs
+
Designer
diff --git a/PROMS/VEPROMS User Interface/VlnWeb.cs b/PROMS/VEPROMS User Interface/VlnWeb.cs
index bccd40cb..08047b69 100644
--- a/PROMS/VEPROMS User Interface/VlnWeb.cs
+++ b/PROMS/VEPROMS User Interface/VlnWeb.cs
@@ -1,9 +1,3 @@
-using System;
-using System.Collections.Generic;
-using System.ComponentModel;
-using System.Data;
-using System.Drawing;
-using System.Text;
using System.Windows.Forms;
namespace VEPROMS
diff --git a/PROMS/VEPROMS User Interface/dlgApproveProcedure.cs b/PROMS/VEPROMS User Interface/dlgApproveProcedure.cs
index fa07de4f..56682572 100644
--- a/PROMS/VEPROMS User Interface/dlgApproveProcedure.cs
+++ b/PROMS/VEPROMS User Interface/dlgApproveProcedure.cs
@@ -1,7 +1,6 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
-using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
@@ -21,11 +20,7 @@ namespace VEPROMS
public partial class dlgApproveProcedure : Form
{
public event DisplayConsistencyReportEvent ConsistencyPrintRequest;
- private void OnConsistencyPrintRequest(ConsistencyReportArgs args)
- {
- if (ConsistencyPrintRequest != null)
- ConsistencyPrintRequest(this, args);
- }
+ private void OnConsistencyPrintRequest(ConsistencyReportArgs args) => ConsistencyPrintRequest?.Invoke(this, args);
private bool CanApprove
{
get { return btnApprove2.Enabled; }
@@ -37,12 +32,8 @@ namespace VEPROMS
tsslStatus.Text = value ? "" : "Need to correct the Rev Numbers marked with Question Marks";
}
}
- private int _ApplicabilityIndex = 0;
- public int ApplicabilityIndex
- {
- get { return _ApplicabilityIndex; }
- set { _ApplicabilityIndex = value; }
- }
+
+ public int ApplicabilityIndex { get; set; } = 0;
private SessionInfo _MySessionInfo;
public SessionInfo MySessionInfo
{
@@ -53,23 +44,19 @@ namespace VEPROMS
_MyApproval.MySessionInfo = _MySessionInfo;
}
}
- private ApprovalInfo _MyApproval;
- private DocVersionInfo _MyDocVersion;
- frmVEPROMS _MyFrmVEPROMS = null;
- public frmVEPROMS MyFrmVEPROMS
- {
- get { return _MyFrmVEPROMS; }
- set { _MyFrmVEPROMS = value; }
- }
- private bool _initializing = false; // C2018-008 redesign of user interface
+ private readonly ApprovalInfo _MyApproval;
+ private readonly DocVersionInfo _MyDocVersion;
+
+ public frmVEPROMS MyFrmVEPROMS { get; set; } = null;
+ private readonly bool _initializing = false; // C2018-008 redesign of user interface
public dlgApproveProcedure(DocVersionInfo myDocVersion, frmVEPROMS myFrmVEPROMS) // approve all procedures
{
MyFrmVEPROMS = myFrmVEPROMS;// Save frmVEPROMS for Import to shutoff SessionPing
_MyApproval = new ApprovalInfo(myFrmVEPROMS);// Save frmVEPROMS for Import to shutoff SessionPing
ApplicabilityIndex = myDocVersion.DocVersionConfig.SelectedSlave;
_MyApproval.SavedSlave = ApplicabilityIndex;
- this.ConsistencyPrintRequest -= new DisplayConsistencyReportEvent(dlgApproveProcedure_ConsistencyPrintRequest);
- this.ConsistencyPrintRequest += new DisplayConsistencyReportEvent(dlgApproveProcedure_ConsistencyPrintRequest);
+ ConsistencyPrintRequest -= new DisplayConsistencyReportEvent(dlgApproveProcedure_ConsistencyPrintRequest);
+ ConsistencyPrintRequest += new DisplayConsistencyReportEvent(dlgApproveProcedure_ConsistencyPrintRequest);
_MyDocVersion = myDocVersion;
_MyDocVersion.ResetProcedures(); // B2021-035: Pasted, modified number and deleted procedures not refreshed so missing from list
InitializeComponent();
@@ -77,7 +64,7 @@ namespace VEPROMS
_MyApproval.StatusUpdated -= new ApprovalStatusChangeEvent(_MyApproval_StatusUpdated);
_MyApproval.StatusUpdated += new ApprovalStatusChangeEvent(_MyApproval_StatusUpdated);
SetupComboBoxes();
- foreach (ProcedureInfo pi in myDocVersion.Procedures)
+ foreach (ProcedureInfo pi in myDocVersion.Procedures.OfType())
{
bool includeProc = pi.ApplInclude(ApplicabilityIndex); // C2021-027: Procedure level PC/PC
if (includeProc)
@@ -98,31 +85,8 @@ namespace VEPROMS
private void FlexGridAddEvents()
{
- //fgProcs.ChangeEdit += new EventHandler(fgProcs_ChangeEdit);
- //Console.WriteLine(fgProcs.ComboBoxEditor.GetType().Name);
- //Console.WriteLine(fgProcs.Editor.GetType().Name);
- //fgProcs.ImeModeChanged += new EventHandler(fgProcs_ImeModeChanged);
- //fgProcs.LeaveEdit += new C1.Win.C1FlexGrid.RowColEventHandler(fgProcs_LeaveEdit);
- //fgProcs.SetupEditor += new C1.Win.C1FlexGrid.RowColEventHandler(fgProcs_SetupEditor);
- //fgProcs.StartEdit += new C1.Win.C1FlexGrid.RowColEventHandler(fgProcs_StartEdit);
- //fgProcs.ValidateEdit += new C1.Win.C1FlexGrid.ValidateEditEventHandler(fgProcs_ValidateEdit);
fgProcs.ComboCloseUp -= new C1.Win.C1FlexGrid.RowColEventHandler(fgProcs_ComboCloseUp);
fgProcs.ComboCloseUp += new C1.Win.C1FlexGrid.RowColEventHandler(fgProcs_ComboCloseUp);
- //fgProcs.MouseDown += new MouseEventHandler(fgProcs_MouseDown);
- //fgProcs.MouseUp += new MouseEventHandler(fgProcs_MouseUp);
- }
-
- void fgProcs_MouseUp(object sender, MouseEventArgs e)
- {
- C1.Win.C1FlexGrid.HitTestInfo hti = fgProcs.HitTest(e.X, e.Y);
- //Console.WriteLine("fgProcs_MouseUp X={0},Y={1},Row={2},Col={3}", e.X, e.Y, hti.Row, hti.Column);
- }
-
- void fgProcs_MouseDown(object sender, MouseEventArgs e)
- {
- C1.Win.C1FlexGrid.HitTestInfo hti = fgProcs.HitTest(e.X, e.Y);
- //Console.WriteLine("fgProcs_MouseDown X={0},Y={1},Row={2},Col={3}", e.X, e.Y, hti.Row, hti.Column);
-
}
void fgProcs_ComboCloseUp(object sender, C1.Win.C1FlexGrid.RowColEventArgs e)
@@ -134,46 +98,6 @@ namespace VEPROMS
//Console.WriteLine("fgProcs_ComboCloseUp row: {0}, col: {1}, val: {2}, etostring: {3}", e.Row, e.Col, fgProcs[e.Row, e.Col], e.ToString());
}
- void fgProcs_ValidateEdit(object sender, C1.Win.C1FlexGrid.ValidateEditEventArgs e)
- {
- //Console.WriteLine("fgProcs_ValidateEdit");
- }
-
- void fgProcs_StartEdit(object sender, C1.Win.C1FlexGrid.RowColEventArgs e)
- {
-
- object val = fgProcs[e.Row, e.Col];
- DateTime dt = (DateTime)val;
- if (dt != null)
- dt = dt.AddHours(1);
- fgProcs[e.Row, e.Col] = dt;
- //Console.WriteLine("fgProcs_StartEdit val: {0}, dt: {1}", val, dt);
- }
-
- void fgProcs_SetupEditor(object sender, C1.Win.C1FlexGrid.RowColEventArgs e)
- {
- //Console.WriteLine("fgProcs_SetupEditor");
- }
-
- void fgProcs_LeaveEdit(object sender, C1.Win.C1FlexGrid.RowColEventArgs e)
- {
- object val = fgProcs[e.Row, e.Col];
- DateTime dt = (DateTime)val;
- if (dt != null && dt.Hour != 0)
- dt = dt.AddHours(-1);
- fgProcs[e.Row, e.Col] = dt;
- //Console.WriteLine("fgProcs_LeaveEdit val: {0}, dt: {1}, mouserow={2}, mousecol={3}", val, dt, fgProcs.MouseRow, fgProcs.MouseCol);
- }
-
- void fgProcs_ImeModeChanged(object sender, EventArgs e)
- {
- //Console.WriteLine("fgProcs_ImeModeChanged");
- }
-
- void fgProcs_ChangeEdit(object sender, EventArgs e)
- {
- //Console.WriteLine("fgProcs_ChangeEdit");
- }
//C2020-036 returns a string of duplicate procedure numbers separated by newlines for use in FlexibleMessageBox
private string dupProcList
{
@@ -183,12 +107,13 @@ namespace VEPROMS
if (dpl.Count > 0)
{
foreach (string pn in dpl)
- rtn += pn + "\n";
+ rtn += $"{pn}\n";
rtn = rtn.TrimEnd('\n');
}
return rtn;
}
}
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE0044:Add readonly modifier", Justification = "Keeping Collections Not ReadOnly")]
private List dpl = new List(); //C2020-036 used to create list duplicate procedure numbers
private bool InitializePanelSelect()
@@ -196,7 +121,7 @@ namespace VEPROMS
if (clbMore.Items.Count == 0)
{
dpl.Clear();
- foreach (ProcedureInfo pi in _MyDocVersion.Procedures)
+ foreach (ProcedureInfo pi in _MyDocVersion.Procedures.OfType())
{
bool includeProc = pi.ApplInclude(ApplicabilityIndex); // C2021-027: Procedure level PC/PC
if (includeProc)
@@ -245,22 +170,22 @@ namespace VEPROMS
lblViewPDF.Enabled = false;
if (_MyApproval.MyProcedures.Count == 1)
{
- this.Text = "Approve " + _MyApproval.MyProcedures[0].ProcInfo.DisplayNumber;
+ Text = "Approve " + _MyApproval.MyProcedures[0].ProcInfo.DisplayNumber;
swtbtViewPDF.Value = false;
swtbtViewPDF.Enabled = true;
lblViewPDF.Enabled = true;
}
else if (_MyApproval.MyProcedures.Count == _MyDocVersion.Procedures.Count)
- this.Text = "Approve All Procedures";
+ Text = "Approve All Procedures";
else
- this.Text = "Approve Selected Procedures";
+ Text = "Approve Selected Procedures";
}
private void InitializePanelApprove()
{
setupLablesAndSwitches(); // C2018-008 redesign of user interface
SetupMyApproval();
}
-
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE0044:Add readonly modifier", Justification = "Keeping Collections Not ReadOnly")]
private Dictionary tmpProcedures = new Dictionary();
private ProcedureInfo GetProcedureInfoByKey(string key)
{
@@ -277,12 +202,13 @@ namespace VEPROMS
return tmpProcedures[GetDisplayNumberOnly(key)];
}
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE0060:Remove unused parameter", Justification = "selectsome Kept for Legacy - To give Constructor a different Signature")]
public dlgApproveProcedure(DocVersionInfo myDocVersion, bool selectSome, frmVEPROMS myFrmVEPROMS) // approve some procedures
{
MyFrmVEPROMS = myFrmVEPROMS;// Save frmVEPROMS for Import to shutoff SessionPing
_MyApproval = new ApprovalInfo(myFrmVEPROMS);// Save frmVEPROMS for Import to shutoff SessionPing
- this.ConsistencyPrintRequest -= new DisplayConsistencyReportEvent(dlgApproveProcedure_ConsistencyPrintRequest);
- this.ConsistencyPrintRequest += new DisplayConsistencyReportEvent(dlgApproveProcedure_ConsistencyPrintRequest);
+ ConsistencyPrintRequest -= new DisplayConsistencyReportEvent(dlgApproveProcedure_ConsistencyPrintRequest);
+ ConsistencyPrintRequest += new DisplayConsistencyReportEvent(dlgApproveProcedure_ConsistencyPrintRequest);
_MyDocVersion = myDocVersion;
_MyDocVersion.ResetProcedures(); // B2021-035: Pasted, modified number and deleted procedures not refreshed so missing from list
InitializeComponent();
@@ -303,8 +229,8 @@ namespace VEPROMS
{
MyFrmVEPROMS = myFrmVEPROMS;// Save frmVEPROMS for Import to shutoff SessionPing
_MyApproval = new ApprovalInfo(myFrmVEPROMS);// Save frmVEPROMS for Import to shutoff SessionPing
- this.ConsistencyPrintRequest -= new DisplayConsistencyReportEvent(dlgApproveProcedure_ConsistencyPrintRequest);
- this.ConsistencyPrintRequest += new DisplayConsistencyReportEvent(dlgApproveProcedure_ConsistencyPrintRequest);
+ ConsistencyPrintRequest -= new DisplayConsistencyReportEvent(dlgApproveProcedure_ConsistencyPrintRequest);
+ ConsistencyPrintRequest += new DisplayConsistencyReportEvent(dlgApproveProcedure_ConsistencyPrintRequest);
_MyDocVersion = myProcedure.MyDocVersion;
_MyDocVersion.ResetProcedures(); // B2021-035: Pasted, modified number and deleted procedures not refreshed so missing from list
ApplicabilityIndex = _MyDocVersion.DocVersionConfig.SelectedSlave; // B2022-033 set the child being approved or workflow so other procedure list can populate
@@ -328,12 +254,7 @@ namespace VEPROMS
}
_initializing = false;
}
- private bool ProcedureSetHasDuplicateProcedureNumbers()
- {
- bool hasDuplicateProcNums = false;
- return hasDuplicateProcNums;
- }
void _MyApproval_StatusUpdated(ApprovalInfo sender, ApprovalMessageArgs e)
{
tsslMsg2.Text = e.MyStatus;
@@ -342,33 +263,16 @@ namespace VEPROMS
private void SetupMyApproval()
{
approvalInfoBindingSource.DataSource = _MyApproval;
- //if(_MyApproval.MyProcedures.Count == 1)
- // lblOldRevNumber.Text = _MyApproval.RevNumber;
- //else if (_MyApproval.MyProcedures.Count > 1)
- // lblMaxRevNumber1.Text = GetMaxRevNumber();
- _MyApproval.RevType = 1; // C2018-008 redesign of user interface //(revTypeBindingSource.Current as RevType).TypeID;
+ _MyApproval.RevType = 1; // C2018-008 redesign of user interface
_MyApproval.RevStage = (stageInfoBindingSource.Current == null) ? 0 : (stageInfoBindingSource.Current as StageInfo).StageID;// C2018-008 redesign of user interface
approvalInfoBindingSource.ResetBindings(false);
approvalProcedureBindingSource.DataSource = _MyApproval.MyProcedures;
approvalProcedureBindingSource.ResetBindings(false);
- //this.ConsistencyPrintRequest -= new DisplayConsistencyReportEvent(dlgApproveProcedure_ConsistencyPrintRequest);
- }
-
- private string GetMaxRevNumber()
- {
- string mrn = string.Empty;
- foreach (ApprovalProcedure ap in _MyApproval.MyProcedures)
- {
- int k = _MyApproval.FancyShmancyRevCompare(mrn, ap.RevNumber);
- if (k < 0)
- mrn = ap.RevNumber;
- }
- return mrn;
}
void dlgApproveProcedure_ConsistencyPrintRequest(object sender, ConsistencyReportArgs args)
{
- foreach (ProcedureInfo pi in args.MyItems)
+ foreach (ProcedureInfo pi in args.MyItems.OfType())
pi.IsSelected = _MyApproval.ProcedureExists(pi);
PDFConsistencyCheckReport rpt = new PDFConsistencyCheckReport(args.ReportName, args.MyItems, args.MyDocVersion); //B2020-020 needed to pass in DocVersion to get paper size from format
rpt.BuildReport();
@@ -389,20 +293,12 @@ namespace VEPROMS
private void btnApprove_Click(object sender, EventArgs e)
{
- this.Cursor = Cursors.WaitCursor;
+ Cursor = Cursors.WaitCursor;
if(!_MyApproval.Approve(new Point(Left,Bottom),cmbRevisionStage2.Text)) // C2021-020 pass in the revision stage name
- this.DialogResult = DialogResult.None;
- this.Cursor = Cursors.Default;
+ DialogResult = DialogResult.None;
+ Cursor = Cursors.Default;
}
- // C2018-008 redesign of user interface
- // -- Note that the Revison Type data source is still connected (revTypeBindingSource) - commented out for documentatin purposes
- //private void cmbRevisionType_SelectedIndexChanged(object sender, EventArgs e)
- //{
- // RevType rt = cmbRevisionType2.SelectedItem as RevType;
- // _MyApproval.RevType = rt.TypeID;
- //}
-
private void cmbRevisionStage_SelectedIndexChanged(object sender, EventArgs e)
{
StageInfo si = cmbRevisionStage2.SelectedItem as StageInfo;
@@ -431,7 +327,6 @@ namespace VEPROMS
SetupComboBoxes();
for (int i = 0; i < clbMore.Items.Count; i++)
{
- string xyz = clbMore.Items[i].ToString();
ProcedureInfo pi = GetProcedureInfoByKey(clbMore.Items[i].ToString());
if (clbMore.GetItemChecked(i))
{
@@ -449,10 +344,7 @@ namespace VEPROMS
RefreshCount(); // B2021-015: select/clear all not populating left panel & count not refreshed.
}
- private void btnCheck_Click(object sender, EventArgs e)
- {
- UpdateClbMore();
- }
+ private void btnCheck_Click(object sender, EventArgs e) => UpdateClbMore();
private ItemInfoList _MyItemInfoList;
private void UpdateClbMore()
@@ -485,7 +377,7 @@ namespace VEPROMS
if (info.Contains(" - ("))
clbMore.Items[i] = info.Substring(0, info.IndexOf(" - ("));
}
- foreach (ProcedureInfo npi in _MyItemInfoList)
+ foreach (ProcedureInfo npi in _MyItemInfoList.OfType())
{
string info = string.Format("{0} - ({1})", npi.DisplayNumber, npi.MyDifferenceReasons);
//checked list box
@@ -506,7 +398,7 @@ namespace VEPROMS
for (int i = 0; i < clbMore.Items.Count; i++)
{
if (!clbMore.Items[i].ToString().Contains(" - ("))
- clbMore.Items[i] = clbMore.Items[i].ToString() + " - (none)";
+ clbMore.Items[i] = $"{clbMore.Items[i]} - (none)";
}
Application.DoEvents();
clbMore.Enabled = btnAll.Enabled = btnClear.Enabled = true;
@@ -523,10 +415,7 @@ namespace VEPROMS
}
}
// B2021-015: select/clear all not populating left panel & count not refreshed.
- private void RefreshCount()
- {
- lblMore.Text = string.Format("{0} Procedures, {1} Selected", clbMore.Items.Count, clbMore.CheckedItems.Count);
- }
+ private void RefreshCount() => lblMore.Text = string.Format("{0} Procedures, {1} Selected", clbMore.Items.Count, clbMore.CheckedItems.Count);
void ItemInfoList_ConsistencyCheckUpdated(object sender, ItemInfoListCCEventArgs args)
{
@@ -572,14 +461,12 @@ namespace VEPROMS
if (clbMore.Items[itemIndex] != null)
{
SuperTooltipInfo stti = sttMore.GetSuperTooltip(clbMore);
- //string headerText = tmpProcedures[xyz].DisplayNumber;
- //string bodyText = tmpProcedures[xyz].MyDifferencesText;
stti.HeaderText = GetProcedureInfoByKey(clbMore.Items[itemIndex].ToString()).DisplayNumber;
stti.BodyText = GetProcedureInfoByKey(clbMore.Items[itemIndex].ToString()).MyDifferencesText;
stti.FooterVisible = false;
using (Graphics g = CreateGraphics())
{
- SizeF sf = g.MeasureString(stti.BodyText, this.Font);
+ SizeF sf = g.MeasureString(stti.BodyText, Font);
stti.CustomSize = new Size(10 + sf.ToSize().Width, 0);
}
sttMore.ShowTooltip(sender);
@@ -611,10 +498,7 @@ namespace VEPROMS
}
- private void btnReportMore_Click(object sender, EventArgs e)
- {
- OnConsistencyPrintRequest(new ConsistencyReportArgs(Volian.Base.Library.VlnSettings.TemporaryFolder + @"\MyConsistency.pdf", _MyItemInfoList, _MyDocVersion)); //B2020-020 needed to pass in DocVersion to get paper size from format
- }
+ private void btnReportMore_Click(object sender, EventArgs e) => OnConsistencyPrintRequest(new ConsistencyReportArgs(Volian.Base.Library.VlnSettings.TemporaryFolder + @"\MyConsistency.pdf", _MyItemInfoList, _MyDocVersion)); //B2020-020 needed to pass in DocVersion to get paper size from format
private void fgProcs_AfterEdit(object sender, C1.Win.C1FlexGrid.RowColEventArgs e)
{
@@ -724,19 +608,16 @@ namespace VEPROMS
private void expAddProcConChk_ExpandedChanged(object sender, ExpandedChangeEventArgs e) // C2018-008 redesign of user interface
{
if (expAddProcConChk.Expanded)
- this.Size = new Size(this.Size.Width + (expAddProcConChk.Size.Width - expAddProcConChk.TitlePanel.Size.Height), this.Size.Height);
+ Size = new Size(Size.Width + (expAddProcConChk.Size.Width - expAddProcConChk.TitlePanel.Size.Height), Size.Height);
}
private void expAddProcConChk_ExpandedChanging(object sender, ExpandedChangeEventArgs e) // C2018-008 redesign of user interface
{
if (expAddProcConChk.Expanded)
- this.Size = new Size(this.Size.Width - (expAddProcConChk.Size.Width - expAddProcConChk.TitlePanel.Size.Height), this.Size.Height);
+ Size = new Size(Size.Width - (expAddProcConChk.Size.Width - expAddProcConChk.TitlePanel.Size.Height), Size.Height);
}
- private void fgProcs_AfterDataRefresh(object sender, ListChangedEventArgs e)
- {
- btnApprove2.Enabled = CanApprove && tsslStatus.Text.Length == 0; // B2016-057 If did un-successful Auto Increament Rev Number, then don't enable Approve (Do Work Flow) button
- }
+ private void fgProcs_AfterDataRefresh(object sender, ListChangedEventArgs e) => btnApprove2.Enabled = CanApprove && tsslStatus.Text.Length == 0; // B2016-057 If did un-successful Auto Increament Rev Number, then don't enable Approve (Do Work Flow) button
// C2020-040 automatically update left panel when tree item in right panel is selected or deselected
private void clbMore_SelectedIndexChanged(object sender, EventArgs e)
@@ -758,18 +639,11 @@ namespace VEPROMS
}
private void clbMore_MouseLeave(object sender, EventArgs e) //C2020-045 - added switch to control if pop-ups are displayed in procedure list
- {
- sttMore.Enabled = true;
- }
+=> sttMore.Enabled = true;
}
public class ApprovalProcedure
{
- private ProcedureInfo _ProcInfo;
- public ProcedureInfo ProcInfo
- {
- get { return _ProcInfo; }
- set { _ProcInfo = value; }
- }
+ public ProcedureInfo ProcInfo { get; set; }
private string _RevNumber;
public string RevNumber
{
@@ -779,37 +653,17 @@ namespace VEPROMS
if (value.Trim() != _RevNumber)
{
_RevNumber = value.Trim();
- //_RevDate = DateTime.Now; // commented out for bug fix B2013-012
}
}
}
- private DateTime _RevDate;
- public DateTime RevDate
- {
- get { return _RevDate; }
- set { _RevDate = value; }
- }
+
+ public DateTime RevDate { get; set; }
// added RevNumAndDate to handle the use use of the DoRevDate flag
// this fixes bug B2013-011 where Today's date would print on the approved procedures (Westinghouse data)
// instead of the the Revision Date assigned to the procedure.
- public string RevNumAndDate
- {
- get
- {
- if (_ProcInfo.ActiveFormat.PlantFormat.FormatData.PrintData.DoRevDate)
- return RevNumber + "/" + RevDate.ToString("M/d/yyyy");
- else
- return RevNumber;
- }
- }
- public string DisplayNumber
- {
- get { return _ProcInfo.DisplayNumber; }
- }
- public override string ToString()
- {
- return string.Format("{0}\t{1}\t{2:M/d/yyyy}", _ProcInfo.DisplayNumber, _RevNumber, _RevDate);
- }
+ public string RevNumAndDate => ProcInfo.ActiveFormat.PlantFormat.FormatData.PrintData.DoRevDate ? $"{RevNumber}/{RevDate:M/d/yyyy}" : RevNumber;
+ public string DisplayNumber => ProcInfo.DisplayNumber;
+ public override string ToString() => string.Format("{0}\t{1}\t{2:M/d/yyyy}", ProcInfo.DisplayNumber, _RevNumber, RevDate);
public ApprovalProcedure(ProcedureInfo proc)
{
proc.ProcedureConfig.SelectedSlave = proc.MyDocVersion.DocVersionConfig.SelectedSlave;
@@ -818,105 +672,42 @@ namespace VEPROMS
string sRevDate = proc.ProcedureConfig.Print_RevDate;
if (sRevDate == string.Empty)
sRevDate = DateTime.Now.ToString("M/d/y");
- DateTime revDate;
- if (!DateTime.TryParse(sRevDate, out revDate)) revDate = DateTime.Now;
+ if (!DateTime.TryParse(sRevDate, out DateTime revDate)) revDate = DateTime.Now;
RevDate = revDate;
}
}
public class ApprovalMessageArgs : EventArgs
{
- public ApprovalMessageArgs(string msg)
- {
- _MyStatus = msg;
- }
- private string _MyStatus;
- public string MyStatus
- {
- get { return _MyStatus; }
- set { _MyStatus = value; }
- }
+ public ApprovalMessageArgs(string msg) => MyStatus = msg;
+
+ public string MyStatus { get; set; }
}
public delegate void ApprovalStatusChangeEvent(ApprovalInfo sender, ApprovalMessageArgs e);
public class ApprovalInfo
{
- frmVEPROMS _MyFrmVEPROMS = null;
- public frmVEPROMS MyFrmVEPROMS
- {
- get { return _MyFrmVEPROMS; }
- set { _MyFrmVEPROMS = value; }
- }
+ public frmVEPROMS MyFrmVEPROMS { get; set; } = null;
public event ApprovalStatusChangeEvent StatusUpdated;
- public void OnStatusUpdated(ApprovalInfo sender, ApprovalMessageArgs e)
- {
- if (StatusUpdated != null)
- StatusUpdated(sender, e);
- }
- private SessionInfo _MySessionInfo;
- public SessionInfo MySessionInfo
- {
- get { return _MySessionInfo; }
- set { _MySessionInfo = value; }
- }
- private int _RevType;
- public int RevType
- {
- get { return _RevType; }
- set { _RevType = value; }
- }
- private string _RevNumber;
- public string RevNumber
- {
- get { return _RevNumber; }
- set { _RevNumber = value; }
- }
- private Nullable _RevDate;
- public Nullable RevDate
+ public void OnStatusUpdated(ApprovalInfo sender, ApprovalMessageArgs e) => StatusUpdated?.Invoke(sender, e);
+
+ public SessionInfo MySessionInfo { get; set; }
+ public int RevType { get; set; }
+ public string RevNumber { get; set; }
+ private DateTime? _RevDate;
+ public DateTime? RevDate
{
get { return _RevDate == null ? _RevDate : _RevDate.Value; }
set { _RevDate = value; }
}
- private int _RevStage;
- public int RevStage
- {
- get { return _RevStage; }
- set { _RevStage = value; }
- }
- private string _RevNote;
- public string RevNote
- {
- get { return _RevNote; }
- set { _RevNote = value; }
- }
- private bool _ViewPDF;
- public bool ViewPDF
- {
- get { return _ViewPDF; }
- set { _ViewPDF = value; }
- }
- private string _MsgNumber;
- public string MsgNumber
- {
- get { return _MsgNumber; }
- set { _MsgNumber = value; }
- }
- private string _MsgDate;
- public string MsgDate
- {
- get { return _MsgDate; }
- set { _MsgDate = value; }
- }
- private bool _CanIncrement;
- public bool CanIncrement
- {
- get { return _CanIncrement; }
- set { _CanIncrement = value; }
- }
+
+ public int RevStage { get; set; }
+ public string RevNote { get; set; }
+ public bool ViewPDF { get; set; }
+ public string MsgNumber { get; set; }
+ public string MsgDate { get; set; }
+ public bool CanIncrement { get; set; }
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE0044:Add readonly modifier", Justification = "Keeping Collections Not ReadOnly")]
private List _MyProcedures;
- public List MyProcedures
- {
- get { return _MyProcedures; }
- //set { _MyProcedures = value; }
- }
+ public List MyProcedures => _MyProcedures;
//B2026-058 - If approving multiple procedures at the same time with a multiunit set and one of the procedures is open, PROMS sometimes loses that it is set for an individual unit.
// this will save the SectedSlave in case a refresh causes it to get lost
@@ -927,10 +718,6 @@ namespace VEPROMS
MyFrmVEPROMS = myFrmVEPROMS;// Save frmVEPROMS for Import to shutoff SessionPing
_MyProcedures = new List();
}
- private static string FormatRev(Match m)
- {
- return "".PadLeft(5 - m.Groups[1].Value.Length, '0') + m.Groups[1].Value;
- }
public void AddProcedure(ProcedureInfo proc)
{
ApprovalProcedure ap = new ApprovalProcedure(proc);
@@ -963,64 +750,11 @@ namespace VEPROMS
public void Refresh()
{
bool ok = true;
- int rv = 0;
foreach (ApprovalProcedure ap in MyProcedures)
{
- ok = ok && int.TryParse(ap.RevNumber, out rv);
+ ok = ok && int.TryParse(ap.RevNumber, out int rv);
}
- _CanIncrement = ok;
- //if (MyProcedures.Count == 1)
- //{
- // ProcedureInfo pi = _MyProcedures[0].ProcInfo;
- // RevNumber = pi.ProcedureConfig.Print_Rev == string.Empty ? "0" : pi.ProcedureConfig.Print_Rev;
- // DateTime revdate = pi.ProcedureConfig.Print_RevDate == string.Empty ? DateTime.Now : DateTime.TryParse(pi.ProcedureConfig.Print_RevDate, out revdate) ? revdate : DateTime.Now;
- // RevDate = revdate;
- // RevNote = string.Empty;
- // ViewPDF = false;
- //}
- //else if (MyProcedures.Count > 1)
- //{
- // Regex myRegEx = new Regex("^([0-9]{1,5})");
- // SortedList printRevs = new SortedList();
- // SortedList printRevDates = new SortedList();
- // string printRev = string.Empty;
- // foreach (ApprovalProcedure pi in MyProcedures)
- // {
- // printRev = myRegEx.Replace(pi.RevNumber, new MatchEvaluator(FormatRev));
- // printRev = printRev == string.Empty ? "0" : printRev;
- // if (printRev != string.Empty)
- // if (!printRevs.ContainsKey(printRev))
- // printRevs.Add(printRev, pi.ProcInfo);
- // if (pi.RevDate != null)
- // if (!printRevDates.ContainsKey(pi.RevDate.ToString()))
- // printRevDates.Add(pi.RevDate.ToString(), pi.ProcInfo);
- // }
- // if (printRevs.Count > 1)
- // {
- // ProcedureInfo pi = printRevs[printRevs.Keys[printRevs.Count - 1]];
- // RevNumber = "*";
- // MsgNumber = "Multiple Revision Numbers found. Enter asterisk (*) to use current revision numbers or plus sign (+) to increment revision numbers";
- // }
- // else if (printRevs.Count == 1)
- // {
- // ProcedureInfo pi = printRevs[printRevs.Keys[printRevs.Count - 1]];
- // RevNumber = pi.ProcedureConfig.Print_Rev;
- // MsgNumber = string.Empty;
- // }
- // if (printRevDates.Count > 1)
- // {
- // RevDate = null;
- // MsgDate = "Multiple Revision Dates found. Use current revision dates or manually assign revision date by selecting a date";
- // }
- // else if (printRevDates.Count == 1)
- // {
- // ProcedureInfo pi = printRevDates[printRevDates.Keys[printRevDates.Count - 1]];
- // RevDate = DateTime.Parse(pi.ProcedureConfig.Print_RevDate);
- // MsgDate = string.Empty;
- // }
- // else if (printRevDates.Count == 0)
- // RevDate = DateTime.Now;
- //}
+ CanIncrement = ok;
}
public void DeleteProcedure(ProcedureInfo pi)
{
@@ -1036,10 +770,7 @@ namespace VEPROMS
Refresh();
}
}
- public bool CanApprove
- {
- get { return _RevType > 0 && _RevNumber != string.Empty && _RevStage > 0; }
- }
+ public bool CanApprove => RevType > 0 && RevNumber != string.Empty && RevStage > 0;
public int FancyShmancyRevCompare(string s1, string s2)
{
if (s1 == s2)
@@ -1164,13 +895,13 @@ namespace VEPROMS
if (MessageBox.Show(sb.ToString(),string.Format("Revert to {0}",nsi.Name),MessageBoxButtons.YesNo,MessageBoxIcon.Stop) == DialogResult.No)
return false;
}
+
+ DialogResult doSumChgDR = FlexibleMessageBox.Show("Do you want to save the Summary of Changes along with the Approved PDF?\r\n\r\nSelecting 'Cancel' will cancel the approval process.", "Create Summary of Changes", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question);// == DialogResult.Yes;
+ if (doSumChgDR == DialogResult.Cancel) return false;
// C2018-007: When performing more than a single procedure approval (approve all or some), only prompt once whether to include
// Summary of Changes (use the following 2 flags, code using them is below)
// C2022-022: Moved the prompt once for Summary of changes out of loop and allow user to cancel, go back to approval dialog
- bool doSumChg = false;
- DialogResult doSumChgDR = FlexibleMessageBox.Show("Do you want to save the Summary of Changes along with the Approved PDF?\r\n\r\nSelecting 'Cancel' will cancel the approval process.", "Create Summary of Changes", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question);// == DialogResult.Yes;
- if (doSumChgDR == DialogResult.Cancel) return false;
- doSumChg = doSumChgDR == DialogResult.Yes;
+ bool doSumChg = doSumChgDR == DialogResult.Yes;
List procsApproved = new List();
foreach (ApprovalProcedure ap in MyProcedures)
{
@@ -1186,9 +917,8 @@ namespace VEPROMS
//B2026-058 - If approving multiple procedures at the same time with a multiunit set and one of the procedures is open, PROMS sometimes loses that it is set for an individual unit.
ap.ProcInfo.MyDocVersion.DocVersionConfig.SelectedSlave = SavedSlave;
}
- procsApproved.Add(ap.ProcInfo.DisplayNumber + " " + ap.ProcInfo.DisplayText);
+ procsApproved.Add($"{ap.ProcInfo.DisplayNumber} {ap.ProcInfo.DisplayText}");
RevisionInfo ric = pi.MyDocVersion.DocVersionConfig.SelectedSlave > 0 ? RevisionInfo.GetCurrentByItemIDandUnitID(pi.ItemID, pi.MyDocVersion.DocVersionConfig.SelectedSlave) : RevisionInfo.GetCurrentByItemID(pi.ItemID);
- // RevisionInfo rip = RevisionInfo.GetPreviousByItemID(pi.ItemID);
DateTime myDTS = pi.DTS; // pi.DTS is date of last approval
string cbDTS = (pi.MyConfig as ProcedureConfig).Print_ChangeBarDate;
// pi.DTS was the field that was used to store the approval date before master/slave code was added. Use ChangeBarDate if it is set - this is set either manually if no approval date (from treeview menu) or
@@ -1203,7 +933,6 @@ namespace VEPROMS
if (ap.RevNumber == ric.RevisionNumber)
{
myDTS = ric.MyConfig.History_StartDate;
- //UpdateProcedureDTS(pi, myDTS);
}
// New approval, i.e. not same revision number, use the date from the latest approved version
else
@@ -1211,26 +940,24 @@ namespace VEPROMS
myDTS = ric.LatestVersion.DTS; // B2019-051: Extra info in Change Summary. Use the last 'approved' (ric.LatestVersion.MyStage.IsApproved==1)
}
}
- Revision revision = null;
+ Revision revision;
if (ap.ProcInfo.MyDocVersion.DocVersionConfig.SelectedSlave > 0)
{
revision = Revision.GetByItemIDAndRevisionNumberAndUnitID(pi.ItemID, ap.RevNumber, ap.ProcInfo.MyDocVersion.DocVersionConfig.SelectedSlave);
if (revision == null) // no revision yet, need to set the StartDate & which slave
{
- RevisionConfig cfg = new RevisionConfig();
- cfg.History_StartDate = myDTS; // if there is a slave, date found from above code
- cfg.Applicability_Index = ap.ProcInfo.MyDocVersion.DocVersionConfig.SelectedSlave;
- //cfg.Save();
+ RevisionConfig cfg = new RevisionConfig
+ {
+ History_StartDate = myDTS, // if there is a slave, date found from above code
+ Applicability_Index = ap.ProcInfo.MyDocVersion.DocVersionConfig.SelectedSlave
+ };
revision = Revision.MakeRevision(pi.ItemID, RevType, ap.RevNumber, ap.RevDate, RevNote, cfg.ToString(), now, Volian.Base.Library.VlnSettings.UserID);
- // revision.MyConfig.History_StartDate = pi.DTS;
- // revision.MyConfig.Save();
- // revision = revision.Save();
}
else if (revision.Notes != RevNote || revision.RevisionDate != ap.RevDate)
{
//C2016-036 - Inform the user that an existing approved version will be replaced
//C2022-016 - Improve/clarify the dialog message
- if (MessageBox.Show("Replace Existing Revision " + ap.RevNumber + "?\r\n\r\nTo create a new revision, click Cancel then change\r\nthe Rev. Number.", "Replace Existing", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.Cancel)
+ if (MessageBox.Show($"Replace Existing Revision {ap.RevNumber}?\r\n\r\nTo create a new revision, click Cancel then change\r\nthe Rev. Number.", "Replace Existing", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.Cancel)
return false;
revision.Notes = RevNote;
revision.RevisionDate = ap.RevDate;
@@ -1245,19 +972,17 @@ namespace VEPROMS
// went wrong, the revision could be created but not the version. Added the count check below.
if (revision == null || revision.RevisionVersionCount==0) // no revision yet, need to set the StartDate. If there is a revision, it uses the revision date as the startdate
{
- RevisionConfig cfg = new RevisionConfig();
- cfg.History_StartDate = pi.DTS; // todo: this should probably be myDTS, found during fix of B2019-051.
- //cfg.Save();
+ RevisionConfig cfg = new RevisionConfig
+ {
+ History_StartDate = pi.DTS // todo: this should probably be myDTS, found during fix of B2019-051.
+ };
revision = Revision.MakeRevision(pi.ItemID, RevType, ap.RevNumber, ap.RevDate, RevNote, cfg.ToString(), now, Volian.Base.Library.VlnSettings.UserID);
- // revision.MyConfig.History_StartDate = pi.DTS;
- // revision.MyConfig.Save();
- // revision = revision.Save();
}
else if (revision.Notes != RevNote || revision.RevisionDate != ap.RevDate)
{
//C2016-036 - Inform the user that an existing approved version will be replaced
//C2022-016 - Improve/clarify the dialog message
- if (MessageBox.Show("Replace Existing Revision " + ap.RevNumber + "?\r\n\r\nTo create a new revision, click Cancel then change\r\nthe Rev. Number.", "Replace Existing", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.Cancel)
+ if (MessageBox.Show($"Replace Existing Revision {ap.RevNumber}?\r\n\r\nTo create a new revision, click Cancel then change\r\nthe Rev. Number.", "Replace Existing", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.Cancel)
return false;
revision.Notes = RevNote;
revision.RevisionDate = ap.RevDate;
@@ -1268,10 +993,7 @@ namespace VEPROMS
//B2017-149 Allow the user to choose if they want the Summary of Changes report created during the approval process
if (doSumChg) summaryBuf = CreateSummary(ref pi, summaryPDF, myDTS);
DateTime currentDTS = now;
- Check check = Check.MakeCheck(revision, Stage.GetJustStage(RevStage), RevisionInfo.BuildRevisionChecks(pi), currentDTS, VlnSettings.UserID);
- //make pdf with promsprinter and get byte stream
- // Moved to end so that Item and Content are saved at the same time
- //UpdateProcedureConfig(pi, ap.RevNumber, ap.RevDate, myDTS);
+ _ = Check.MakeCheck(revision, Stage.GetJustStage(RevStage), RevisionInfo.BuildRevisionChecks(pi), currentDTS, VlnSettings.UserID);
string watermarkColor = "Blue"; // this is the default watermark color
string waterMark = Stage.GetJustStage(RevStage).IsApproved > 0 ? null : Stage.GetJustStage(RevStage).Name;
// C2022-004 - BNPP if doing an approval stage, and the format file uses the UseUnitWatermarkOnApproved format flag ()
@@ -1281,39 +1003,14 @@ namespace VEPROMS
waterMark = "Unit Designator";
frmPDFStatusForm.SetUnitWatermark(MyProcedures[0].ProcInfo, ref waterMark, ref watermarkColor);
}
- //ProcedureInfo myproc = pi;
- //frmPDFStatusForm frm = new frmPDFStatusForm(myproc, ap.RevNumber, /* revdate change: ap.RevDate.ToString("MM/dd/yyyy") ,*/ waterMark, false, false, ViewPDF, true, VlnSettings.TemporaryFolder, new ChangeBarDefinition(pi.MyDocVersion.MyConfig as DocVersionConfig, pi.ActiveFormat), pdfTmp, location);
- //myproc.ChangeBarDate = myDTS;
frmPDFStatusForm frm = new frmPDFStatusForm(pi, ap.RevNumAndDate, /* revdate change: ap.RevDate.ToString("MM/dd/yyyy") ,*/ waterMark, false, false, ViewPDF, true, VlnSettings.TemporaryFolder, new ChangeBarDefinition(pi.MyDocVersion.MyConfig as DocVersionConfig, pi.ActiveFormat), pdfTmp, location, pi.MyDocVersion.DocVersionConfig.Print_AddBlankPagesWhenUsingDuplexFoldouts, true, "", false, 0, false,
- MyProcedures.Count > (MyProcedures[0].ProcInfo.MyDocVersion.Procedures.Count / 4), pi.MyDocVersion.DocVersionConfig.Print_DuplexBlankPageText, null, watermarkColor); // C2019-004: Allow user to define duplex lank page text at the docversion level
- frm.AllowAllWatermarks = true;
- frm.CloseWhenDone = !ViewPDF;
- frm.DocReplace = new Dictionary(); // will hold the Word Attachments with resolved ROs
+ MyProcedures.Count > (MyProcedures[0].ProcInfo.MyDocVersion.Procedures.Count / 4), pi.MyDocVersion.DocVersionConfig.Print_DuplexBlankPageText, null, watermarkColor)
+ {
+ AllowAllWatermarks = true,
+ CloseWhenDone = !ViewPDF,
+ DocReplace = new Dictionary() // will hold the Word Attachments with resolved ROs
+ }; // C2019-004: Allow user to define duplex lank page text at the docversion level
frm.ShowDialog();
- //if (ap.ProcInfo.MyDocVersion.DocVersionConfig.SelectedSlave > 0)
- //{
- // using (ProcedureInfo myproc = ProcedureInfo.GetItemAndChildrenByUnit(pi.ItemID, 0, ap.ProcInfo.MyDocVersion.DocVersionConfig.SelectedSlave))
- // {
- // //frmPDFStatusForm frm = new frmPDFStatusForm(myproc, ap.RevNumber, /* revdate change: ap.RevDate.ToString("MM/dd/yyyy") ,*/ waterMark, false, false, ViewPDF, true, VlnSettings.TemporaryFolder, new ChangeBarDefinition(pi.MyDocVersion.MyConfig as DocVersionConfig, pi.ActiveFormat), pdfTmp, location);
- // myproc.ChangeBarDate = myDTS;
- // frmPDFStatusForm frm = new frmPDFStatusForm(myproc, ap.RevNumAndDate, /* revdate change: ap.RevDate.ToString("MM/dd/yyyy") ,*/ waterMark, false, false, ViewPDF, true, VlnSettings.TemporaryFolder, new ChangeBarDefinition(pi.MyDocVersion.MyConfig as DocVersionConfig, pi.ActiveFormat), pdfTmp, location);
- // frm.AllowAllWatermarks = true;
- // frm.CloseWhenDone = !ViewPDF;
- // frm.ShowDialog();
- // }
- //}
- //else
- //{
- // using (ProcedureInfo myproc = ProcedureInfo.GetItemAndChildren(pi.ItemID))
- // {
- // //frmPDFStatusForm frm = new frmPDFStatusForm(myproc, ap.RevNumber, /* revdate change: ap.RevDate.ToString("MM/dd/yyyy") ,*/ waterMark, false, false, ViewPDF, true, VlnSettings.TemporaryFolder, new ChangeBarDefinition(pi.MyDocVersion.MyConfig as DocVersionConfig, pi.ActiveFormat), pdfTmp, location);
- // myproc.ChangeBarDate = myDTS;
- // frmPDFStatusForm frm = new frmPDFStatusForm(myproc, ap.RevNumAndDate, /* revdate change: ap.RevDate.ToString("MM/dd/yyyy") ,*/ waterMark, false, false, ViewPDF, true, VlnSettings.TemporaryFolder, new ChangeBarDefinition(pi.MyDocVersion.MyConfig as DocVersionConfig, pi.ActiveFormat), pdfTmp, location);
- // frm.AllowAllWatermarks = true;
- // frm.CloseWhenDone = !ViewPDF;
- // frm.ShowDialog();
- // }
- //}
FileInfo pdfFile = new FileInfo(pdfPath);
FileStream fs = pdfFile.Open(FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
byte[] buf = new byte[pdfFile.Length];
@@ -1333,8 +1030,10 @@ namespace VEPROMS
return false;
}
- dlgExportImport dlg = new dlgExportImport("Export", pi, MyFrmVEPROMS, (selectedSlave)); // "true tell export to convert ROs and Transitions to text
- dlg.DocReplace = frm.DocReplace; // this tells approval to prepare an export file with resolved transitions and ROs, word sections are saved with resolved ROs during approval PDF creation and saved in DocReplace
+ dlgExportImport dlg = new dlgExportImport("Export", pi, MyFrmVEPROMS, (selectedSlave))
+ {
+ DocReplace = frm.DocReplace // this tells approval to prepare an export file with resolved transitions and ROs, word sections are saved with resolved ROs during approval PDF creation and saved in DocReplace
+ }; // "true tell export to convert ROs and Transitions to text
System.Xml.XmlDocument xd = new System.Xml.XmlDocument();
dlg.ExportItem(xd, pi, "procedure");
frm.DocReplace = dlg.DocReplace = null;
@@ -1376,21 +1075,20 @@ namespace VEPROMS
}
else
UpdateProcedureConfig(pi, ap.RevNumber, ap.RevDate, myDTS, selectedSlave);
- //UpdateProcedureDTS(pi, DateTime.Now);
pi.MyDocVersion.DocVersionConfig.SelectedSlave = selectedSlave;
}
// C2019-019: Put out a complete message when approval is done.
// C2020-024 Display a more descriptive end message
if (procsApproved.Count > 0)
{
- string msg = "";
+ string msg;
if (procsApproved.Count == (MyProcedures[0]).ProcInfo.MyDocVersion.Procedures.Count)
msg = "All Procedures were Approved.";
else
{
msg = "The following procedures were approved:\n";
foreach (string prc in procsApproved)
- msg += "\n" + prc;
+ msg += $"\n{prc}";
}
FlexibleMessageBox.Show( msg, "Approve Procedure(s)", MessageBoxButtons.OK);
}
@@ -1434,7 +1132,7 @@ namespace VEPROMS
{
while (!(ex is System.Data.SqlClient.SqlException) && ex.InnerException != null)
ex = ex.InnerException;
- MessageBox.Show(ex.Message +"\r\n\r\nApproval will continue without the Summary of Change Report", ex.GetType().Name + " while trying to create Summary of Changes." , MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
+ MessageBox.Show(ex.Message +"\r\n\r\nApproval will continue without the Summary of Change Report", $"{ex.GetType().Name} while trying to create Summary of Changes.", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
return null;
}
}
@@ -1456,7 +1154,7 @@ namespace VEPROMS
StringBuilder sb = new StringBuilder();
sb.AppendLine("Could not create");
sb.AppendLine();
- sb.AppendLine(pdfFile + ".");
+ sb.AppendLine($"{pdfFile}.");
sb.AppendLine();
sb.AppendLine("If it is open, close it then press the OK button.");
if (cntr >= 3) // after two tries offer additional troubleshooting information
@@ -1471,18 +1169,9 @@ namespace VEPROMS
return true;
}
- private void UpdateProcedureDTS(ProcedureInfo pi, DateTime dts)
- {
- using (Item itm = Item.Get(pi.ItemID))
- {
- itm.DTS = dts;
- itm.Save();
- }
- }
private void UpdateProcedureConfig(ProcedureInfo procedureInfo, string revNumber, DateTime revDate, DateTime dts, int selectedSlave)
{
- ProcedureConfig pc = procedureInfo.MyConfig as ProcedureConfig;
- if (pc == null) return;
+ if (!(procedureInfo.MyConfig is ProcedureConfig pc)) return;
pc.SelectedSlave = selectedSlave;
pc.Print_Rev = revNumber;
@@ -1492,7 +1181,6 @@ namespace VEPROMS
using (Item itm = Item.Get(procedureInfo.ItemID))
{
itm.MyContent.Config = pc.ToString();
- //itm.DTS = dts;
itm.UserID = Volian.Base.Library.VlnSettings.UserID;
itm.Save();
@@ -1515,22 +1203,12 @@ namespace VEPROMS
}
public class RevType
{
- private int _TypeID;
- public int TypeID
- {
- get { return _TypeID; }
- set { _TypeID = value; }
- }
- private string _TypeName;
- public string TypeName
- {
- get { return _TypeName; }
- set { _TypeName = value; }
- }
+ public int TypeID { get; set; }
+ public string TypeName { get; set; }
public RevType(int i, string s)
{
- _TypeID = i;
- _TypeName = s;
+ TypeID = i;
+ TypeName = s;
}
}
public class RevTypes : List
@@ -1539,29 +1217,14 @@ namespace VEPROMS
public delegate void DisplayConsistencyReportEvent(object sender, ConsistencyReportArgs args);
public class ConsistencyReportArgs : EventArgs
{
- private string _ReportName;
- public string ReportName
- {
- get { return _ReportName; }
- set { _ReportName = value; }
- }
- private ItemInfoList _MyItems;
- public ItemInfoList MyItems
- {
- get { return _MyItems; }
- set { _MyItems = value; }
- }
- private DocVersionInfo _MyDocVersion;
- public DocVersionInfo MyDocVersion
- {
- get { return _MyDocVersion; }
- set { _MyDocVersion = value; }
- }
+ public string ReportName { get; set; }
+ public ItemInfoList MyItems { get; set; }
+ public DocVersionInfo MyDocVersion { get; set; }
public ConsistencyReportArgs(string reportName, ItemInfoList myItems, DocVersionInfo myDocVerion)
{
- _ReportName = reportName;
- _MyItems = myItems;
- _MyDocVersion = myDocVerion; //B2020-020 needed to pass in DocVersion to get paper size from format
+ ReportName = reportName;
+ MyItems = myItems;
+ MyDocVersion = myDocVerion; //B2020-020 needed to pass in DocVersion to get paper size from format
}
}
}
diff --git a/PROMS/VEPROMS User Interface/dlgCheckOpenTabs.cs b/PROMS/VEPROMS User Interface/dlgCheckOpenTabs.cs
index e4632efd..9596e70b 100644
--- a/PROMS/VEPROMS User Interface/dlgCheckOpenTabs.cs
+++ b/PROMS/VEPROMS User Interface/dlgCheckOpenTabs.cs
@@ -1,11 +1,4 @@
using System;
-using System.Collections.Generic;
-using System.ComponentModel;
-using System.Data;
-using System.Drawing;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
using System.Windows.Forms;
namespace VEPROMS
@@ -21,8 +14,8 @@ namespace VEPROMS
private void btnTabs_Click(object sender, EventArgs e)
{
- Remember = this.cbRemember.Checked;
- this.Close();
+ Remember = cbRemember.Checked;
+ Close();
}
}
}
diff --git a/PROMS/VEPROMS User Interface/dlgCheckedOutProcedure.cs b/PROMS/VEPROMS User Interface/dlgCheckedOutProcedure.cs
index f8ae9089..64ad38d4 100644
--- a/PROMS/VEPROMS User Interface/dlgCheckedOutProcedure.cs
+++ b/PROMS/VEPROMS User Interface/dlgCheckedOutProcedure.cs
@@ -1,8 +1,4 @@
using System;
-using System.Collections.Generic;
-using System.ComponentModel;
-using System.Data;
-using System.Drawing;
using System.Text;
using System.Windows.Forms;
using VEPROMS.CSLA.Library;
@@ -23,36 +19,22 @@ namespace VEPROMS
_MySessionInfo = SessionInfo.Get(_MyOwnerInfo.SessionID);
_MyUserInfo = ui;
}
- private ProcedureInfo _MyProcedureInfo;
- public ProcedureInfo MyProcedureInfo
- {
- get { return _MyProcedureInfo; }
- }
- private SectionInfo _MySectionInfo;
- public SectionInfo MySectionInfo
- {
- get { return _MySectionInfo; }
- }
- private OwnerInfo _MyOwnerInfo;
- public OwnerInfo MyOwnerInfo
- {
- get { return _MyOwnerInfo; }
- }
- private SessionInfo _MySessionInfo;
- public SessionInfo MySessionInfo
- {
- get { return _MySessionInfo; }
- }
- private UserInfo _MyUserInfo;
- public UserInfo MyUserInfo
- {
- get { return _MyUserInfo; }
- }
- StringBuilder sb = new StringBuilder();
+ private readonly ProcedureInfo _MyProcedureInfo;
+ public ProcedureInfo MyProcedureInfo => _MyProcedureInfo;
+ private readonly SectionInfo _MySectionInfo;
+ public SectionInfo MySectionInfo => _MySectionInfo;
+ private readonly OwnerInfo _MyOwnerInfo;
+ public OwnerInfo MyOwnerInfo => _MyOwnerInfo;
+ private readonly SessionInfo _MySessionInfo;
+ public SessionInfo MySessionInfo => _MySessionInfo;
+ private readonly UserInfo _MyUserInfo;
+ public UserInfo MyUserInfo => _MyUserInfo;
+
private void dlgCheckedOutProcedure_Load(object sender, EventArgs e)
{
- if (MyProcedureInfo != null)
+ StringBuilder sb = new StringBuilder();
+ if (MyProcedureInfo != null)
sb.AppendLine(string.Format("The procedure {0} - {1}", MyProcedureInfo.DisplayNumber, MyProcedureInfo.DisplayText));
else
sb.AppendLine(string.Format("The document {0}", MySectionInfo.DisplayText));
@@ -74,7 +56,8 @@ namespace VEPROMS
private void btnForce_Click(object sender, EventArgs e)
{
- MySessionInfo.CheckInItem(MyOwnerInfo.OwnerID);
+ StringBuilder sb = new StringBuilder();
+ MySessionInfo.CheckInItem(MyOwnerInfo.OwnerID);
sb.AppendLine();
sb.AppendLine("Forced Check In has been completed");
lblInfo.Text = sb.ToString();
diff --git a/PROMS/VEPROMS User Interface/dlgExportImport.cs b/PROMS/VEPROMS User Interface/dlgExportImport.cs
index 1d5208e3..6da3ab4e 100644
--- a/PROMS/VEPROMS User Interface/dlgExportImport.cs
+++ b/PROMS/VEPROMS User Interface/dlgExportImport.cs
@@ -1,9 +1,7 @@
using System;
using System.Collections.Generic;
-using System.Text;
using System.Windows.Forms;
using VEPROMS.CSLA.Library;
-using Volian.Controls.Library;
using Volian.Base.Library;
using System.Xml;
using System.IO;
@@ -20,14 +18,9 @@ namespace VEPROMS
{
#region Log4Net
private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
- #endregion
- frmVEPROMS _MyFrmVEPROMS = null;// Save frmVEPROMS for Import to shutoff SessionPing
- public frmVEPROMS MyFrmVEPROMS
- {
- get { return _MyFrmVEPROMS; }
- set { _MyFrmVEPROMS = value; }
- }
- private bool _ConvertROsToTextDuringImport = false;
+ #endregion
+ public frmVEPROMS MyFrmVEPROMS { get; set; } = null;
+ private bool _ConvertROsToTextDuringImport = false;
private bool _ConvertROsAndTransitionsToText = false; // set to true when Approval creates an Export file
protected bool _ExportBothConvertedandNot = false; // set to true when Electronic Procedure export
@@ -40,32 +33,18 @@ namespace VEPROMS
//this will hold if a specific unit was selected
readonly protected int _UnitIndex;
- private ItemInfo _ExternalTransitionItem = null;
- public ItemInfo ExternalTransitionItem
- {
- get { return _ExternalTransitionItem; }
- set { _ExternalTransitionItem = value; }
- }
- private Dictionary floatFoldout;
+ public ItemInfo ExternalTransitionItem { get; set; } = null;
+ private Dictionary floatFoldout;
private Dictionary importedFormat;
private Dictionary existingFormat;
- private Dictionary renamedUCFFormatName; // if format is renamed, this is its new name so references to it can be made
- private Dictionary renamedUCFFormatId; // if format is renamed, this is its old->new formatid
private int oldRODbID;
private int newRODbID;
private FolderInfo _MyNewFolder;
- public FolderInfo MyNewFolder
- {
- get { return _MyNewFolder; }
- }
- private ProcedureInfo _MyNewProcedure;
- public ProcedureInfo MyNewProcedure
- {
- get { return _MyNewProcedure; }
- set { _MyNewProcedure = value; }
- }
- private string PEIPath;
- private string _MyMode;
+ public FolderInfo MyNewFolder => _MyNewFolder;
+
+ public ProcedureInfo MyNewProcedure { get; set; }
+ private string PEIPath;
+ private readonly string _MyMode;
protected FolderInfo MyFolder = null;
protected DocVersionInfo MyDocVersion = null;
protected ProcedureInfo MyProcedure = null;
@@ -81,7 +60,7 @@ namespace VEPROMS
_MyMode = mode;
MyFolder = folderInfo;
InitializeComponent();
- this.Text = mode + " Dialog for " + folderInfo.Name;
+ Text = $"{mode} Dialog for {folderInfo.Name}";
_UnitIndex = unitIndex;
if (_UnitIndex > 0)
@@ -103,9 +82,9 @@ namespace VEPROMS
MyDocVersion = docVersionInfo;
InitializeComponent();
if (mode.ToUpper().Contains("FORMAT"))
- this.Text = mode;
+ Text = mode;
else
- this.Text = mode + " Dialog for " + docVersionInfo.Name + " of " + docVersionInfo.MyFolder.Name;
+ Text = $"{mode} Dialog for {docVersionInfo.Name} of {docVersionInfo.MyFolder.Name}";
_UnitIndex = unitIndex;
if (_UnitIndex > 0)
@@ -124,7 +103,7 @@ namespace VEPROMS
_MyMode = mode;
MyProcedure = procedureInfo;
InitializeComponent();
- this.Text = mode + " Dialog for " + procedureInfo.DisplayNumber;
+ Text = $"{mode} Dialog for {procedureInfo.DisplayNumber}";
_UnitIndex = unitIndex;
if (_UnitIndex > 0)
@@ -173,7 +152,7 @@ namespace VEPROMS
ofd.InitialDirectory = PEIPath;
pnlImport.BringToFront();
}
- this.Height = this.Height / formsize;
+ Height /= formsize;
}
private void btnExport_Click(object sender, EventArgs e)
{
@@ -220,19 +199,19 @@ namespace VEPROMS
string msg = "Finished Exporting:\n\n";
if (_MyMode.ToUpper().Contains("FORMAT"))
{
- this.Cursor = Cursors.WaitCursor;
+ Cursor = Cursors.WaitCursor;
MyStart = DateTime.Now;
btnDoExport.Enabled = false;
lblExportStatus.Text = "Performing Export of UC Formats";
SaveExportUCF();
TimeSpan elapsed = DateTime.Now.Subtract(MyStart);
- lblExportStatus.Text = "Format Export Completed in " + elapsed.ToString();
- this.Cursor = Cursors.Default;
+ lblExportStatus.Text = $"Format Export Completed in {elapsed}";
+ Cursor = Cursors.Default;
}
else if (MyFolder != null)
{
- this.Cursor = Cursors.WaitCursor;
+ Cursor = Cursors.WaitCursor;
MyStart = DateTime.Now;
btnDoExport.Enabled = false;
lblExportStatus.Text = "Performing Export";
@@ -240,7 +219,7 @@ namespace VEPROMS
TimeSpan elapsed = DateTime.Now.Subtract(MyStart);
lblExportStatus.Text = "Export Completed in " + elapsed.ToString();
- this.Cursor = Cursors.Default;
+ Cursor = Cursors.Default;
msg += MyFolder.Name;
}
else if (MyProcedure != null)
@@ -281,7 +260,7 @@ namespace VEPROMS
}
- this.Cursor = Cursors.WaitCursor;
+ Cursor = Cursors.WaitCursor;
MyStart = DateTime.Now;
btnDoExport.Enabled = false;
lblExportStatus.Text = "Performing Export";
@@ -294,7 +273,7 @@ namespace VEPROMS
xd.Save(fileLocation);
TimeSpan elapsed = DateTime.Now.Subtract(MyStart);
lblExportStatus.Text = "Export Completed in " + elapsed.ToString();
- this.Cursor = Cursors.Default;
+ Cursor = Cursors.Default;
}
// added message to user when export of a procedure or procedure set has completed
if (successfullExport)
@@ -338,7 +317,7 @@ namespace VEPROMS
bool isImported = false;
bool canceledPressed = false;
btnImport.Enabled = false;
- this.Cursor = Cursors.WaitCursor;
+ Cursor = Cursors.WaitCursor;
MyStart = DateTime.Now;
btnDoImport.Enabled = false;
lblImportStatus.Text = "Performing Import";
@@ -350,13 +329,13 @@ namespace VEPROMS
{
TurnChangeManagerOff.Execute();
MyFrmVEPROMS.DisablePing = true;// Turn-off SessionPing
- bool result = TryToImportUCFs(ref isImported, ref canceledPressed);
+ bool result = TryToImportUCFs(ref isImported);
MyFrmVEPROMS.DisablePing = false;// Turn-on SessionPing
TurnChangeManagerOn.Execute();
if (!result) // B2019-006: let user know there was an error during import:
{
MessageBox.Show("Error occurred during import. Format(s) not imported.");
- this.Cursor = Cursors.Default;
+ Cursor = Cursors.Default;
btnCloseImport.Enabled = true;
return;
}
@@ -400,7 +379,7 @@ namespace VEPROMS
if (isImported)
{
TimeSpan elapsed = DateTime.Now.Subtract(MyStart);
- lblImportStatus.Text = "Import Completed in " + elapsed.ToString();
+ lblImportStatus.Text = $"Import Completed in {elapsed}";
}
else
{
@@ -408,7 +387,7 @@ namespace VEPROMS
btnDoImport.Enabled = true;
}
}
- this.Cursor = Cursors.Default;
+ Cursor = Cursors.Default;
btnCloseImport.Enabled = true;
if (isImported)
{
@@ -436,7 +415,7 @@ namespace VEPROMS
}
}
- private bool TryToImportUCFs(ref bool isImported, ref bool canceledPressed)
+ private bool TryToImportUCFs(ref bool isImported)
{
try
{
@@ -450,7 +429,7 @@ namespace VEPROMS
if (nl == null || nl.Count == 0) // B2019-014: Check contents of import file for compatible operation
{
MessageBox.Show("A Procedure export file can only be imported from the Tree View.", "Import Failed", MessageBoxButtons.OK);
- this.Close();
+ Close();
isImported = false;
return false;
}
@@ -504,7 +483,7 @@ namespace VEPROMS
{
MessageBox.Show(ex.StackTrace, ex.Message, MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
_MyLog.Warn("Failed during UC Formats Import", ex);
- this.Close();
+ Close();
isImported = false;
return false;
}
@@ -519,7 +498,7 @@ namespace VEPROMS
{
MessageBox.Show(ex.StackTrace, ex.Message, MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
_MyLog.Warn("Failed during Procedure Import", ex);
- this.Close();
+ Close();
return false;
}
}
@@ -528,11 +507,9 @@ namespace VEPROMS
private bool _ImportingApprovedExportFile = false;
private bool ImportingApprovedExport(string fnAndPath)
{
- bool rtnval = false;
- int idx = fnAndPath.LastIndexOf("//") + 1;
+ int idx = fnAndPath.LastIndexOf("//") + 1;
string tmp = fnAndPath.Substring(idx);
- rtnval = tmp.ToUpper().Contains("APPROVED_REV_");
- return rtnval;
+ return tmp.ToUpper().Contains("APPROVED_REV_");
}
private bool ImportProcedure(ref bool isImported, ref bool canceledPressed)
{
@@ -544,15 +521,17 @@ namespace VEPROMS
if (ucf != null)
{
MessageBox.Show("A User Control of Format export file can only be imported from Administration on the V-Button.", "Import Failed", MessageBoxButtons.OK);
- this.Cursor = Cursors.Default;
- this.btnImport.Enabled = true; // allow user to select a different export file to import
- this.btnCloseImport.Enabled = true; // allow user to close import dialog
+ Cursor = Cursors.Default;
+ btnImport.Enabled = true; // allow user to select a different export file to import
+ btnCloseImport.Enabled = true; // allow user to close import dialog
return false;
}
string rofolderpath = xd.DocumentElement.Attributes.GetNamedItem("rofolderpath").InnerText;
int rodbid = int.Parse(xd.DocumentElement.Attributes.GetNamedItem("rodbid").InnerText);
- int rofstid = int.Parse(xd.DocumentElement.Attributes.GetNamedItem("rofstid").InnerText);
- if (MyDocVersion.DocVersionAssociationCount > 0)
+#pragma warning disable IDE0059 // Unnecessary assignment of a value - rofstid for Debugging/future use
+ int rofstid = int.Parse(xd.DocumentElement.Attributes.GetNamedItem("rofstid").InnerText);
+#pragma warning restore IDE0059 // Unnecessary assignment of a value
+ if (MyDocVersion.DocVersionAssociationCount > 0)
{
// use current ROPath
MyRODb = RODb.GetJustRoDb(MyDocVersion.DocVersionAssociations[0].MyROFst.MyRODb.RODbID);
@@ -560,15 +539,17 @@ namespace VEPROMS
// then ask if we should import using the current workingdraft RO Path, convert the ROs to text, or cancel the import
if (MyRODb.FolderPath != rofolderpath && !_ImportingApprovedExportFile) //B2020-095 don't display dialog if importing approved procedure export file
{
- dlgImpHowToHandleROs dlg = new dlgImpHowToHandleROs();
- dlg.ImportedROFolder = rofolderpath;
- dlg.WorkingDraftROFolder = MyRODb.FolderPath;
- dlg.ShowDialog(this);
+ dlgImpHowToHandleROs dlg = new dlgImpHowToHandleROs
+ {
+ ImportedROFolder = rofolderpath,
+ WorkingDraftROFolder = MyRODb.FolderPath
+ };
+ dlg.ShowDialog(this);
if (dlg.CancelImport)
{
- this.Cursor = Cursors.Default;
- this.btnImport.Enabled = true; // allow user to select a different export file to import
- this.btnDoImport.Enabled = true; // allow user to change mind and perform the import
+ Cursor = Cursors.Default;
+ btnImport.Enabled = true; // allow user to select a different export file to import
+ btnDoImport.Enabled = true; // allow user to change mind and perform the import
return false; // Return False to Indicate that the Import did not succeed
}
_ConvertROsToTextDuringImport = dlg.ConvertROsToText;
@@ -612,16 +593,18 @@ namespace VEPROMS
if (localROPaths.Count == 0)
{
MessageBox.Show("There has been no RO folder defined for this database.\r\n\r\nIn order to import a procedure, you need to assign a RO folder path.\r\n\r\nImport process will terminate.");
- this.Cursor = Cursors.Default;
+ Cursor = Cursors.Default;
return false;// Return False to Indicate that the Import did not succeed
}
else
{
- this.Cursor = Cursors.Default;
- dlgPickROFolder dlg = new dlgPickROFolder();
- dlg.ImportedROFolder = rofolderpath;
- dlg.LocalROFolders = localROPaths;
- dlg.ShowDialog(this);
+ Cursor = Cursors.Default;
+ dlgPickROFolder dlg = new dlgPickROFolder
+ {
+ ImportedROFolder = rofolderpath,
+ LocalROFolders = localROPaths
+ };
+ dlg.ShowDialog(this);
if ((dlg.SelectedROFolder ?? string.Empty) != string.Empty) // B2015-216 If the return value is null treat it like an empty string
{
MyRODb = RODb.GetByFolderPath(dlg.SelectedROFolder);
@@ -645,7 +628,7 @@ namespace VEPROMS
else
{
MessageBox.Show("Since you did not pick an existing RO folder defined for this database, the import process will terminate.");
- this.Close();// Close the Import Window
+ Close();// Close the Import Window
return false;// Return False to Indicate that the Import did not succeed
}
}
@@ -655,9 +638,9 @@ namespace VEPROMS
bool didImp = LoadFormats(xd, "procedure/formats/format");
if (!didImp)
{
- this.Cursor = Cursors.Default;
- this.btnImport.Enabled = true; // allow user to select a different export file to import
- this.btnDoImport.Enabled = true; // allow user to change mind and perform the import
+ Cursor = Cursors.Default;
+ btnImport.Enabled = true; // allow user to select a different export file to import
+ btnDoImport.Enabled = true; // allow user to change mind and perform the import
return false; // Return False to Indicate that the Import did not succeed
}
// use resolvedProcNum to determine if procedure is 'unique', i.e. if the procedure number exists
@@ -763,7 +746,7 @@ namespace VEPROMS
ProcedureInfo lastProcedure = null;
foreach (ProcedureInfo pi in MyDocVersion.Procedures.OfType())
lastProcedure = pi;
- _MyNewProcedure = AddProcedure(xd.DocumentElement, MyDocVersion, lastProcedure);
+ MyNewProcedure = AddProcedure(xd.DocumentElement, MyDocVersion, lastProcedure);
//update transitions
AddTransitions(PendingTransitions);
PendingTransitions.Save(fn);
@@ -803,7 +786,7 @@ namespace VEPROMS
}
xd.SelectSingleNode("procedure/content/@number").InnerText = string.Format("Copy({0}) of {1}", count.ToString(), number);
//add imported procedure and copy count
- _MyNewProcedure = AddProcedure(xd.DocumentElement, MyDocVersion, lastProcedure);
+ MyNewProcedure = AddProcedure(xd.DocumentElement, MyDocVersion, lastProcedure);
//update transitions
AddTransitions(PendingTransitions);
FixFloatingFoldouts();
@@ -861,7 +844,7 @@ namespace VEPROMS
return false;
}
//add imported procedure
- _MyNewProcedure = AddProcedure(xd.DocumentElement, MyDocVersion, lastProcedure);
+ MyNewProcedure = AddProcedure(xd.DocumentElement, MyDocVersion, lastProcedure);
//update transitions
AddTransitions(PendingTransitions);
FixFloatingFoldouts();
@@ -884,9 +867,9 @@ namespace VEPROMS
bool didImp = LoadFormats(xd, "folder/formats/format");
if (!didImp)
{
- this.Cursor = Cursors.Default;
- this.btnImport.Enabled = true; // allow user to select a different export file to import
- this.btnDoImport.Enabled = true; // allow user to change mind and perform the import
+ Cursor = Cursors.Default;
+ btnImport.Enabled = true; // allow user to select a different export file to import
+ btnDoImport.Enabled = true; // allow user to change mind and perform the import
return false; // Return False to Indicate that the Import did not succeed
}
string name = xd.DocumentElement.Attributes.GetNamedItem("name").InnerText;
@@ -1004,7 +987,8 @@ namespace VEPROMS
c.Save();
}
}
- Dictionary existingCopyFCName = new Dictionary();
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE0044:Add readonly modifier", Justification = "Keeping Collections Not ReadOnly")]
+ Dictionary existingCopyFCName = new Dictionary();
// note that this is used when importing a folder or a procedure (procedure was added for UCF changes)
private bool LoadFormats(XmlDocument xd, string xmlpath)
{
@@ -1015,21 +999,20 @@ namespace VEPROMS
importedFormat = new Dictionary();
XmlNodeList nl = xd.SelectNodes(xmlpath);
-
- bool conflictingUCFdata = false;
List existingFC = new List();
List importedFC = new List();
List fname = new List();
foreach (XmlNode nd in nl)
{
- string copyOfUCF = null;
- // see if any of the imported formats are 'UCF' formats, i.e. have config data. If they are UCF,
- // see if this is different that what is in the database. If it is, the user needs to decide
- // whether to associate sections with existing UCF format or the new one. All UCF formats will be
- // connected the same way, i.e. existing or new.
- int formatid = int.Parse(nd.Attributes.GetNamedItem("formatid").InnerText);
- string name = nd.Attributes.GetNamedItem("name").InnerText;
+ // see if any of the imported formats are 'UCF' formats, i.e. have config data. If they are UCF,
+ // see if this is different that what is in the database. If it is, the user needs to decide
+ // whether to associate sections with existing UCF format or the new one. All UCF formats will be
+ // connected the same way, i.e. existing or new.
+#pragma warning disable IDE0059 // Unnecessary assignment of a value - formatid for Debugging/future use
+ int formatid = int.Parse(nd.Attributes.GetNamedItem("formatid").InnerText);
+#pragma warning restore IDE0059 // Unnecessary assignment of a value
+ string name = nd.Attributes.GetNamedItem("name").InnerText;
string config = null;
XmlNode cfg = nd.Attributes.GetNamedItem("config");
if (cfg != null) config = cfg.InnerText;
@@ -1038,10 +1021,10 @@ namespace VEPROMS
FormatInfo exFI = FormatInfo.Get(existingFormat[name]);
if (exFI.Config != config && exFI.Config != "" && exFI.Config != null && config != "" && config != null)
{
- // See if there are copies of this UCF format, if so, this may match (have same config) one of those and should
- // use it before stating there is conflicting data.
- copyOfUCF = ContentsOfUCFExists(name, config);
- if (copyOfUCF == null)
+ // See if there are copies of this UCF format, if so, this may match (have same config) one of those and should
+ // use it before stating there is conflicting data.
+ string copyOfUCF = ContentsOfUCFExists(name, config);
+ if (copyOfUCF == null)
{
existingFC.Add(exFI.Config);
importedFC.Add(config);
@@ -1069,15 +1052,16 @@ namespace VEPROMS
if (pnameAttrib != null)
pname = pnameAttrib.InnerText;
if (pname == null) continue;
- string description = null;
- XmlNode descript = nd.Attributes.GetNamedItem("description");
- if (descript != null) description = descript.InnerText;
- string userid = nd.Attributes.GetNamedItem("userid").InnerText;
- DateTime dts = DateTime.Parse(nd.Attributes.GetNamedItem("dts").InnerText);
- // If the format that is being imported exists as a copy (already was imported and a 'Copy x of name' was created) and the imported and
- // existing config match, use the existing (copied) format's name rather than importing it again (the dictionary was set up during
- // the import formats process.
- if (existingCopyFCName.ContainsKey(name)) name = existingCopyFCName[name];
+ XmlNode descript = nd.Attributes.GetNamedItem("description");
+#pragma warning disable IDE0059 // Unnecessary assignment of a value - description, userid, dts for future use
+ string description = descript?.InnerText;
+ string userid = nd.Attributes.GetNamedItem("userid").InnerText;
+ DateTime dts = DateTime.Parse(nd.Attributes.GetNamedItem("dts").InnerText);
+#pragma warning restore IDE0059 // Unnecessary assignment of a value
+ // If the format that is being imported exists as a copy (already was imported and a 'Copy x of name' was created) and the imported and
+ // existing config match, use the existing (copied) format's name rather than importing it again (the dictionary was set up during
+ // the import formats process.
+ if (existingCopyFCName.ContainsKey(name)) name = existingCopyFCName[name];
// compare this imported format to the original in the database.
// If format name exists, or if it has same config data, just use it.
@@ -1098,11 +1082,11 @@ namespace VEPROMS
// parent format will always be in there, if it is a new format, it will be added before the child. Check just in case (no null reference).
if (!existingFormat.ContainsKey(pname)) break;
int pid = existingFormat[pname];
- Format pformat = Format.Get(pid);
+ _ = Format.Get(pid);
- // if the new format doesn't exist, it will be added (after these other checks). Otherwise, handle the
- // various cases listed above:
- if (existingFormat.ContainsKey(name))
+ // if the new format doesn't exist, it will be added (after these other checks). Otherwise, handle the
+ // various cases listed above:
+ if (existingFormat.ContainsKey(name))
{
@@ -1221,7 +1205,6 @@ namespace VEPROMS
{
int oldid = int.Parse(nd.Attributes.GetNamedItem("old").InnerText);
int newid = int.Parse(nd.Attributes.GetNamedItem("new").InnerText);
- //if (!Old2NewContent.ContainsKey(oldid))
Old2NewLibDoc.Add(oldid, newid);
}
File.Delete(fn);
@@ -1362,8 +1345,8 @@ namespace VEPROMS
}
private void ExportFormats(FormatInfoList fil, XmlElement xn, string nodename, bool doElement)
{
- XmlElement xe = null;
- if (doElement) xe = xn.OwnerDocument.CreateElement(nodename);
+ XmlElement xe;
+ if (doElement) xe = xn.OwnerDocument.CreateElement(nodename);
else xe = xn;
foreach (FormatInfo fi in fil)
ExportFormat(xe, fi, "format");
@@ -1489,7 +1472,7 @@ namespace VEPROMS
{
pbExportProcedure.Value = 0;
pbExportProcedure.Maximum = dvi.Procedures.Count;
- lblExportProcedure.Text = pbExportProcedure.Maximum.ToString() + " Procedures";
+ lblExportProcedure.Text = $"{pbExportProcedure.Maximum} Procedures";
foreach (ItemInfo ii in dvi.Procedures)
{
XmlDocument xd = new XmlDocument();
@@ -1641,14 +1624,14 @@ namespace VEPROMS
private void ExportItem(XmlElement xn, ItemInfo ii, string nodename)
{
- /*
+ /*
ItemID
PreviousID
ContentID
DTS
*/
- XmlElement xe = null;
- if (xn.Name == "procedure")
+ XmlElement xe;
+ if (xn.Name == "procedure")
xe = xn;
else
{
@@ -2434,12 +2417,9 @@ namespace VEPROMS
}
}
- private void AddTransitions()
- {
- AddTransitions(PendingTransitions);
- }
+ private void AddTransitions() => AddTransitions(PendingTransitions);
- private void AddTransitions(XmlDocument xd)
+ private void AddTransitions(XmlDocument xd)
{
/*
Content
@@ -2459,7 +2439,7 @@ namespace VEPROMS
type,id,toid,rangeid
*/
XmlNodeList nl = xd.SelectNodes("//transition");
- lblImportStatus.Text = string.Format("Updating {0} Tranistions", nl.Count.ToString());
+ lblImportStatus.Text = $"Updating {nl.Count} Tranistions";
foreach (XmlNode nd in nl)
{
@@ -2522,9 +2502,8 @@ namespace VEPROMS
}
else //transition to existing itemid (external)
{
- bool forceConvertToText = false;
- int transitionid = int.Parse(nd.Attributes.GetNamedItem("transitionid").InnerText);
- int isrange = int.Parse(nd.Attributes.GetNamedItem("isrange").InnerText);
+ int transitionid = int.Parse(nd.Attributes.GetNamedItem("transitionid").InnerText);
+ int isrange = int.Parse(nd.Attributes.GetNamedItem("isrange").InnerText);
string config = nd.Attributes.GetNamedItem("config").InnerText;
string userid = nd.Attributes.GetNamedItem("userid").InnerText;
DateTime dts = DateTime.Parse(nd.Attributes.GetNamedItem("dts").InnerText);
@@ -2538,43 +2517,44 @@ namespace VEPROMS
fromid = Old2NewContent[fromid];
Content cc = Content.Get(fromid);
Transition tt = Transition.MakeTransition(cc, Item.Get(toid), Item.Get(rangeid), isrange, trantype, config, dts, userid);
-
- if (tt.TransitionID < 0)
- {
- forceConvertToText = true;
- _DidProcessTransitions |= cc.FixTransitionText(TransitionInfo.Get(tt.TransitionID), forceConvertToText); // B2017-076 FixTransitionText will tell us if transitions were processed/changed
- cc.Save();
- nd.InnerText = "done";
- }
- else
- {
- transitionid = tt.TransitionID;
- string replacewith;
-
- if (isrange == 0)
- replacewith = string.Format("#Link:Transition:{0} {1} {2}", trantype, transitionid, toid);
- else
- replacewith = string.Format("#Link:TransitionRange:{0} {1} {2} {3}", trantype, transitionid, toid, rangeid);
-
- cc.Text = cc.Text.Replace(lookfor, replacewith);
- if (cc.MyGrid != null && !string.IsNullOrEmpty(cc.MyGrid.Data))
- {
- cc.MyGrid.Data = cc.MyGrid.Data.Replace(lookfor, replacewith);
- }
+ bool forceConvertToText;
+ if (tt.TransitionID < 0)
+ {
+ forceConvertToText = true;
+ _DidProcessTransitions |= cc.FixTransitionText(TransitionInfo.Get(tt.TransitionID), forceConvertToText); // B2017-076 FixTransitionText will tell us if transitions were processed/changed
+ cc.Save();
+ nd.InnerText = "done";
+ }
+ else
+ {
+ transitionid = tt.TransitionID;
+ string replacewith;
- // B2016-176, B2016-197 - external transitions should be converted to text
- forceConvertToText = true;
- _DidProcessTransitions |= cc.FixTransitionText(TransitionInfo.Get(tt.TransitionID), forceConvertToText); // B2017-076 FixTransitionText will tell us if transitions were processed/changed
- // B2017=003 make sure any grid changes are saved.
- // done here because FixTransitionText() could update the transitions in the grid
- if (cc.MyGrid != null && cc.MyGrid.Data != "")
- cc.MyGrid.Save();
- cc.Save();
- nd.InnerText = "done";
- _DidConvertTransitionsToText |= (forceConvertToText && _DidProcessTransitions); // B2016-225 - notify user when transitions are converted to text
- }
- }
+ if (isrange == 0)
+ replacewith = string.Format("#Link:Transition:{0} {1} {2}", trantype, transitionid, toid);
+ else
+ replacewith = string.Format("#Link:TransitionRange:{0} {1} {2} {3}", trantype, transitionid, toid, rangeid);
+
+ cc.Text = cc.Text.Replace(lookfor, replacewith);
+
+ if (cc.MyGrid != null && !string.IsNullOrEmpty(cc.MyGrid.Data))
+ {
+ cc.MyGrid.Data = cc.MyGrid.Data.Replace(lookfor, replacewith);
+ }
+
+ // B2016-176, B2016-197 - external transitions should be converted to text
+ forceConvertToText = true;
+ _DidProcessTransitions |= cc.FixTransitionText(TransitionInfo.Get(tt.TransitionID), forceConvertToText); // B2017-076 FixTransitionText will tell us if transitions were processed/changed
+ // B2017=003 make sure any grid changes are saved.
+ // done here because FixTransitionText() could update the transitions in the grid
+ if (cc.MyGrid != null && cc.MyGrid.Data != "")
+ cc.MyGrid.Save();
+ cc.Save();
+ nd.InnerText = "done";
+ _DidConvertTransitionsToText |= (forceConvertToText && _DidProcessTransitions); // B2016-225 - notify user when transitions are converted to text
+ }
+ }
}
}
}
@@ -2620,7 +2600,6 @@ namespace VEPROMS
if (formatID >= importedFormat.Count) return null; // formatID not found, use default file name
formatName = importedFormat[formatID]; // for backwards compatibility with older export files
}
- if (renamedUCFFormatName != null && renamedUCFFormatName.ContainsKey(formatFileName)) formatName = renamedUCFFormatName[formatName];
formatID = existingFormat[formatName];
return Format.Get(formatID);
}
@@ -2668,9 +2647,11 @@ namespace VEPROMS
MyRODb = AddRODb(xrodb);
ROFst rofst = AddROFst(xrofst);
- DocVersionAssociation dva = dv.DocVersionAssociations.Add(rofst);
+#pragma warning disable IDE0059 // Unnecessary assignment of a value - dva kept for side effect code
+ DocVersionAssociation dva = dv.DocVersionAssociations.Add(rofst);
+#pragma warning restore IDE0059 // Unnecessary assignment of a value
- dv.Save();
+ dv.Save();
}
return DocVersionInfo.Get(dv.VersionID);
@@ -2905,9 +2886,11 @@ namespace VEPROMS
foreach (XmlNode nd in xn.SelectNodes("rousage"))
{
string rousageid = nd.Attributes.GetNamedItem("rousageid").InnerText;
- string roid = nd.Attributes.GetNamedItem("roid").InnerText;
+#pragma warning disable IDE0059 // Unnecessary assignment of a value - roid for Debugging/future use
+ string roid = nd.Attributes.GetNamedItem("roid").InnerText;
+#pragma warning restore IDE0059 // Unnecessary assignment of a value
- string findLink = @"";
+ string findLink = @"";
content.Text = content.Text.Replace("\v0 \v Close();
- private void btnCloseImport_Click(object sender, EventArgs e)
- {
- this.Close();
- }
+ private void btnCloseImport_Click(object sender, EventArgs e) => Close();
- //unset the unit (SelectedSlave)
- private void RemoveUnit_OnClose(object sender, EventArgs e)
+ //unset the unit (SelectedSlave)
+ private void RemoveUnit_OnClose(object sender, EventArgs e)
{
if (MyProcedure != null)
{
diff --git a/PROMS/VEPROMS User Interface/dlgExportImportEP.cs b/PROMS/VEPROMS User Interface/dlgExportImportEP.cs
index 5730bbe5..9ef6e26a 100644
--- a/PROMS/VEPROMS User Interface/dlgExportImportEP.cs
+++ b/PROMS/VEPROMS User Interface/dlgExportImportEP.cs
@@ -19,7 +19,7 @@ namespace VEPROMS
private readonly AnnotationTypeInfo _AnnotationType;
private readonly string multiseparator = ",";
- private static Regex _ROAccPageTokenPattern = new Regex("[<][^<>-]+-[^<>]+[>]");
+ private static readonly Regex _ROAccPageTokenPattern = new Regex("[<][^<>-]+-[^<>]+[>]");
public dlgExportImportEP(string mode, FolderInfo folderInfo, frmVEPROMS myFrmVEPROMS, int annotationTypeId, int unitIndex = 0) : base(mode, folderInfo, myFrmVEPROMS, ( unitIndex))
{
@@ -261,10 +261,8 @@ namespace VEPROMS
{
string rodbpath = rodb.FolderPath;
- string rocval = roc.value;
- if (rocval == null) rocval = Array.Find(roc.children, x => x.value.Contains('.')).value;
-
- if (rocval == null) return "";
+ string rocval = roc.value ?? Array.Find(roc.children, x => x.value.Contains('.')).value;
+ if (rocval == null) return "";
string imgname;
if (isMulti)
{
diff --git a/PROMS/VEPROMS User Interface/dlgImpHowToHandleROs.cs b/PROMS/VEPROMS User Interface/dlgImpHowToHandleROs.cs
index 4c50eb09..7a7f5310 100644
--- a/PROMS/VEPROMS User Interface/dlgImpHowToHandleROs.cs
+++ b/PROMS/VEPROMS User Interface/dlgImpHowToHandleROs.cs
@@ -1,54 +1,23 @@
using System;
-using System.Collections.Generic;
-using System.ComponentModel;
-using System.Data;
-using System.Drawing;
-using System.Linq;
-using System.Text;
using System.Windows.Forms;
namespace VEPROMS
{
public partial class dlgImpHowToHandleROs : Form
{
- private string _ImportedROFolder;
- public string ImportedROFolder
- {
- get { return _ImportedROFolder; }
- set { _ImportedROFolder = value; }
- }
- private string _WorkingDraftROFolder;
- public string WorkingDraftROFolder
- {
- get { return _WorkingDraftROFolder; }
- set { _WorkingDraftROFolder = value; }
- }
- private bool _CancelImport = true; // default to truen in case the dialog is closed with the red X in the upper right corner
- public bool CancelImport
- {
- get { return _CancelImport; }
- }
- private bool _ConvertROsToText = false;
- public bool ConvertROsToText
- {
- get { return _ConvertROsToText; }
- }
- public dlgImpHowToHandleROs()
- {
- InitializeComponent();
- }
+ public string ImportedROFolder { get; set; }
+ public string WorkingDraftROFolder { get; set; }
+ private bool _CancelImport = true; // default to truen in case the dialog is closed with the red X in the upper right corner
+ public bool CancelImport => _CancelImport;
+ private bool _ConvertROsToText = false;
+ public bool ConvertROsToText => _ConvertROsToText;
+ public dlgImpHowToHandleROs() => InitializeComponent();
- private void dlgImpHowToHandleROs_Load(object sender, EventArgs e)
- {
- rtbROPathInfo.Text = string.Format("The current Working Draft RO folder path is:\n\n {0}\n\nThe procedure you are trying to import is from a database that has the RO folder path:\n\n {1}\n\nSelect from the options below on how to handle the RO values when importing this procedure.", _WorkingDraftROFolder, _ImportedROFolder);
- }
+ private void dlgImpHowToHandleROs_Load(object sender, EventArgs e) => rtbROPathInfo.Text = string.Format("The current Working Draft RO folder path is:\n\n {0}\n\nThe procedure you are trying to import is from a database that has the RO folder path:\n\n {1}\n\nSelect from the options below on how to handle the RO values when importing this procedure.", WorkingDraftROFolder, ImportedROFolder);
- private void btnUseCurrentROs_Click(object sender, EventArgs e)
- {
- _ConvertROsToText = _CancelImport = false;
- }
+ private void btnUseCurrentROs_Click(object sender, EventArgs e) => _ConvertROsToText = _CancelImport = false;
- private void btnROsToText_Click(object sender, EventArgs e)
+ private void btnROsToText_Click(object sender, EventArgs e)
{
_CancelImport = false;
_ConvertROsToText = true;
@@ -60,9 +29,6 @@ namespace VEPROMS
_ConvertROsToText = false;
}
- private void dlgImpHowToHandleROs_Resize(object sender, EventArgs e)
- {
- rtbROPathInfo.Refresh();
- }
- }
+ private void dlgImpHowToHandleROs_Resize(object sender, EventArgs e) => rtbROPathInfo.Refresh();
+ }
}
diff --git a/PROMS/VEPROMS User Interface/dlgMSWordMessage.cs b/PROMS/VEPROMS User Interface/dlgMSWordMessage.cs
index 5f26d7f7..103aec33 100644
--- a/PROMS/VEPROMS User Interface/dlgMSWordMessage.cs
+++ b/PROMS/VEPROMS User Interface/dlgMSWordMessage.cs
@@ -1,11 +1,4 @@
using System;
-using System.Collections.Generic;
-using System.ComponentModel;
-using System.Data;
-using System.Drawing;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
using System.Windows.Forms;
using VEPROMS.CSLA.Library;
using Volian.Base.Library;
@@ -38,7 +31,7 @@ namespace VEPROMS
usersettings.SetUserSetting_MSWord_Summary_Prompt(false);
}
- this.Close();
+ Close();
}
}
diff --git a/PROMS/VEPROMS User Interface/dlgManageSecurity.cs b/PROMS/VEPROMS User Interface/dlgManageSecurity.cs
index 83b0a1db..e90a9a8a 100644
--- a/PROMS/VEPROMS User Interface/dlgManageSecurity.cs
+++ b/PROMS/VEPROMS User Interface/dlgManageSecurity.cs
@@ -1,12 +1,7 @@
using System;
using System.Collections.Generic;
-using System.ComponentModel;
-using System.Data;
-using System.Drawing;
-using System.Text;
using System.Windows.Forms;
using VEPROMS.CSLA.Library;
-using Volian.Base.Library;
using Volian.Controls.Library;
using System.Linq;
@@ -26,11 +21,8 @@ namespace VEPROMS
private List myMembershipInfoList;
private Folder myFolder;
- public dlgManageSecurity()
- {
- InitializeComponent();
- }
- private void dlgManageSecurity_Load(object sender, EventArgs e)
+ public dlgManageSecurity() => InitializeComponent();
+ private void dlgManageSecurity_Load(object sender, EventArgs e)
{
//load all folders
myFolder = Folder.Get(1);
@@ -331,10 +323,12 @@ namespace VEPROMS
private void addUserToolStripMenuItem_Click(object sender, EventArgs e)
{
User u = User.MakeUser("[Enter New UserID]", "", "", "", "", "", "", "", "", "", "", DateTime.Now, "");
- frmManageUser frm = new frmManageUser("add");
- frm.MyUser = u;
- frm.Text = "Enter New UserID"; //C2026-002 Change Title bar on Add/Edit User
- if (frm.ShowDialog(this) == DialogResult.OK)
+ frmManageUser frm = new frmManageUser("add")
+ {
+ MyUser = u,
+ Text = "Enter New UserID" //C2026-002 Change Title bar on Add/Edit User
+ };
+ if (frm.ShowDialog(this) == DialogResult.OK)
{
u = frm.MyUser;
u.Save();
@@ -362,9 +356,11 @@ namespace VEPROMS
UserInfo ui = myUserInfoList[lstUsers.SelectedIndex];
using (User u = User.Get(ui.UID))
{
- frmManageUser frm = new frmManageUser("edit");
- frm.MyUser = u;
- if (frm.ShowDialog(this) == DialogResult.OK)
+ frmManageUser frm = new frmManageUser("edit")
+ {
+ MyUser = u
+ };
+ if (frm.ShowDialog(this) == DialogResult.OK)
{
frm.MyUser.Save();
@@ -505,12 +501,14 @@ namespace VEPROMS
pnlGroups.Controls.Clear();
foreach (GroupInfo gi in myGroupInfoList)
{
- RadioButton rb = new RadioButton();
- rb.Text = gi.GroupName;
- rb.Parent = pnlGroups;
- rb.Dock = DockStyle.Top;
- rb.Tag = gi;
- rb.CheckedChanged -= new EventHandler(rb_CheckedChanged);
+ RadioButton rb = new RadioButton
+ {
+ Text = gi.GroupName,
+ Parent = pnlGroups,
+ Dock = DockStyle.Top,
+ Tag = gi
+ };
+ rb.CheckedChanged -= new EventHandler(rb_CheckedChanged);
rb.CheckedChanged += new EventHandler(rb_CheckedChanged);
pnlGroups.Controls.Add(rb);
rb.BringToFront();
diff --git a/PROMS/VEPROMS User Interface/dlgPhoneList.cs b/PROMS/VEPROMS User Interface/dlgPhoneList.cs
index 8ea9b42d..c7b58f51 100644
--- a/PROMS/VEPROMS User Interface/dlgPhoneList.cs
+++ b/PROMS/VEPROMS User Interface/dlgPhoneList.cs
@@ -1,9 +1,4 @@
using System;
-using System.Collections.Generic;
-using System.ComponentModel;
-using System.Data;
-using System.Drawing;
-using System.Text;
using System.Windows.Forms;
using VEPROMS.CSLA.Library;
@@ -11,8 +6,8 @@ namespace VEPROMS
{
public partial class dlgPhoneList : Form
{
- private DocVersionConfig _docVersionConfig;
- private string _origPhoneList;
+ private readonly DocVersionConfig _docVersionConfig;
+ private readonly string _origPhoneList;
public dlgPhoneList(DocVersionConfig dvc)
{
_docVersionConfig = dvc;
diff --git a/PROMS/VEPROMS User Interface/dlgPickROFolder.cs b/PROMS/VEPROMS User Interface/dlgPickROFolder.cs
index cf5f3e2d..a9d20b56 100644
--- a/PROMS/VEPROMS User Interface/dlgPickROFolder.cs
+++ b/PROMS/VEPROMS User Interface/dlgPickROFolder.cs
@@ -1,57 +1,24 @@
using System;
using System.Collections.Generic;
-using System.ComponentModel;
-using System.Data;
-using System.Drawing;
-using System.Text;
using System.Windows.Forms;
namespace VEPROMS
{
public partial class dlgPickROFolder : Form
{
- private string _ImportedROFolder;
- public string ImportedROFolder
- {
- get { return _ImportedROFolder; }
- set { _ImportedROFolder = value; }
- }
- private List _LocalROFolders;
- public List LocalROFolders
- {
- get { return _LocalROFolders; }
- set { _LocalROFolders = value; }
- }
- private string _SelectedROFolder;
- public string SelectedROFolder
- {
- get { return _SelectedROFolder; }
- set { _SelectedROFolder = value; }
- }
- public dlgPickROFolder()
- {
- InitializeComponent();
- }
+ public string ImportedROFolder { get; set; }
+ public List LocalROFolders { get; set; }
+ public string SelectedROFolder { get; set; }
+ public dlgPickROFolder() => InitializeComponent();
- private void dlgPickROFolder_Load(object sender, EventArgs e)
+ private void dlgPickROFolder_Load(object sender, EventArgs e)
{
- lblImportRO.Text = string.Format("The procedure you are trying to import was exported from a database that had the following RO folder path:\r\n\r\n{0}\r\n\r\nSelect from the following RO Folders that exist in the database you are trying to import this procedure into so that the import process can continue", _ImportedROFolder);
+ lblImportRO.Text = string.Format("The procedure you are trying to import was exported from a database that had the following RO folder path:\r\n\r\n{0}\r\n\r\nSelect from the following RO Folders that exist in the database you are trying to import this procedure into so that the import process can continue", ImportedROFolder);
clbLocalROFolders.DataSource = LocalROFolders;
}
- private void clbLocalROFolders_SelectedIndexChanged(object sender, EventArgs e)
- {
- if (clbLocalROFolders.CheckedItems.Count > 0)
- {
- btnOkay.Enabled = true;
- }
- else
- btnOkay.Enabled = false;
- }
+ private void clbLocalROFolders_SelectedIndexChanged(object sender, EventArgs e) => btnOkay.Enabled = clbLocalROFolders.CheckedItems.Count > 0;
- private void btnOkay_Click(object sender, EventArgs e)
- {
- SelectedROFolder = clbLocalROFolders.CheckedItems[0].ToString();
- }
- }
+ private void btnOkay_Click(object sender, EventArgs e) => SelectedROFolder = clbLocalROFolders.CheckedItems[0].ToString();
+ }
}
\ No newline at end of file
diff --git a/PROMS/VEPROMS User Interface/dlgPrintAllApprovedProcedures.cs b/PROMS/VEPROMS User Interface/dlgPrintAllApprovedProcedures.cs
index 1ad0e58b..f187ddcb 100644
--- a/PROMS/VEPROMS User Interface/dlgPrintAllApprovedProcedures.cs
+++ b/PROMS/VEPROMS User Interface/dlgPrintAllApprovedProcedures.cs
@@ -1,24 +1,19 @@
using System;
-using System.Collections.Generic;
-using System.ComponentModel;
-using System.Data;
-using System.Drawing;
-using System.Linq;
using System.Text;
-using System.Threading.Tasks;
using System.Windows.Forms;
using System.IO;
using VEPROMS.CSLA.Library;
using JR.Utils.GUI.Forms;
+using System.Linq;
namespace VEPROMS
{
public partial class dlgPrintAllApprovedProcedures : DevComponents.DotNetBar.Office2007Form
{
private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
- private StringBuilder NotApproved;
- private DocVersionInfo _DocVersionInfo = null;
- private int unitId = 0;
+ private readonly StringBuilder NotApproved;
+ private readonly DocVersionInfo _DocVersionInfo = null;
+ private readonly int unitId = 0;
public dlgPrintAllApprovedProcedures(DocVersionInfo dvi)
{
InitializeComponent();
@@ -43,7 +38,7 @@ namespace VEPROMS
// if SelectedSlave is > 0 then we are printing Approved Child Procedures and
// subtract one from the index (unitId) into the list of child names (UnitNames)
if (unitId > 0)
- rtnstr += "\\" + _DocVersionInfo.UnitNames[unitId - 1]; // append Child name to path
+ rtnstr += $"\\{_DocVersionInfo.UnitNames[unitId - 1]}"; // append Child name to path
return rtnstr;
}
@@ -91,7 +86,7 @@ namespace VEPROMS
int pdfCount = 0;
DeleteExistingPDFs(); // delete existing PDFs in the target folder
// Get the Child index for Parent/Child procedure - if not Parent/Child this will be zero
- foreach (ProcedureInfo myProc in _DocVersionInfo.Procedures)
+ foreach (ProcedureInfo myProc in _DocVersionInfo.Procedures.OfType())
{
RevisionInfoList ril = RevisionInfoList.GetByItemID(myProc.ItemID);
if (ril.Count == 0)
@@ -144,7 +139,7 @@ namespace VEPROMS
_MyLog.Error("Print All Approved PDFs", ex);// save error in PROMS error log
MessageBox.Show(ex.Message, ex.GetType().FullName, MessageBoxButtons.OK, MessageBoxIcon.Error);
}
- this.Close(); // close dialog
+ Close(); // close dialog
}
private void SaveApprovedPDFToFolder(RevisionInfo revInfo,string PDFName)
{
@@ -168,10 +163,6 @@ namespace VEPROMS
{
DirectoryInfo di = new DirectoryInfo(txbApprovedPDFsPath.Text);
FileInfo[] fis;
- //DirectoryInfo[] diAry = di.GetDirectories(txbApprovedPDFsPath.Text);
- //DirectoryInfo di_fmtgen;
- // remove all of the PDF fils
- //di_fmtgen = diAry[0];
try
{
fis = di.GetFiles("*.pdf");
@@ -189,14 +180,8 @@ namespace VEPROMS
}
}
- private void txbApprovedPDFsPath_TextChanged(object sender, EventArgs e)
- {
- btnPrntAllAprv.Enabled = txbApprovedPDFsPath.Text.Length > 0;
- }
+ private void txbApprovedPDFsPath_TextChanged(object sender, EventArgs e) => btnPrntAllAprv.Enabled = txbApprovedPDFsPath.Text.Length > 0;
- private void btnCancel_Click(object sender, EventArgs e)
- {
- this.Close();
- }
- }
+ private void btnCancel_Click(object sender, EventArgs e) => Close();
+ }
}
diff --git a/PROMS/VEPROMS User Interface/dlgSetChangeBarStartDate.cs b/PROMS/VEPROMS User Interface/dlgSetChangeBarStartDate.cs
index 1ccd47a5..593fab36 100644
--- a/PROMS/VEPROMS User Interface/dlgSetChangeBarStartDate.cs
+++ b/PROMS/VEPROMS User Interface/dlgSetChangeBarStartDate.cs
@@ -1,5 +1,4 @@
using System;
-using System.Collections.Generic;
using System.Data;
using System.Text;
using System.Windows.Forms;
@@ -29,7 +28,7 @@ namespace VEPROMS
if (tmp[0] == null || tmp[0] == "") // First time date set.
{
- cbdt = DateTime.Now.ToString("MM/dd/yyyy") + " " + DateTime.Now.ToString("HH:mm:ss");
+ cbdt = $"{DateTime.Now:MM/dd/yyyy} {DateTime.Now:HH:mm:ss}";
dateTimeInput1.Value = DateTime.Parse(cbdt);
return;
}
@@ -43,13 +42,13 @@ namespace VEPROMS
var time = tmpdt.TimeOfDay;
if (start < time) // If time is greater than 12:00:00 AM
{
- cbdt = DateTime.Now.ToString("MM/dd/yyyy") + " " + tmpdt.TimeOfDay.ToString();
+ cbdt = $"{DateTime.Now:MM/dd/yyyy} {tmpdt.TimeOfDay}";
dateTimeInput1.Value = DateTime.Parse(cbdt);
return;
}
else // if time is 12:00:00 AM
{
- cbdt = DateTime.Now.ToString("MM/dd/yyyy") + " " + " 00:00:00";
+ cbdt = $"{DateTime.Now:MM/dd/yyyy} 00:00:00";
dateTimeInput1.Value = DateTime.Parse(cbdt);
return;
}
@@ -68,7 +67,7 @@ namespace VEPROMS
MyProcConfig.Print_ChangeBarDate = dateTimeInput1.Value.ToString("MM/dd/yyyy HH:mm:ss");// ("MM/dd/yyyy HH:mm:ss");
//CSM - C2026-010 - Add Audit Record for Change Bar Audit History
- ChangeBarAuditHistory.AddAudit(MyProcInfo.ItemID, $"Set ChangeBars set to ({dateTimeInput1.Value.ToString("MM/dd/yyyy HH:mm:ss")}) by ({VlnSettings.UserID}) on ({DateTime.Now})", DateTime.Now, VlnSettings.UserID, 0);
+ ChangeBarAuditHistory.AddAudit(MyProcInfo.ItemID, $"Set ChangeBars set to ({dateTimeInput1.Value:MM/dd/yyyy HH:mm:ss}) by ({VlnSettings.UserID}) on ({DateTime.Now})", DateTime.Now, VlnSettings.UserID, 0);
//CSM C2026-014 if multi-unit, set for each unit
System.Data.DataTable dt = RevisionData.GetRevisionDataByUnit(MyProcInfo.ItemID);
@@ -83,7 +82,7 @@ namespace VEPROMS
MyProcConfig.Print_ChangeBarDate = dateTimeInput1.Value.ToString("MM/dd/yyyy HH:mm:ss");
//CSM - C2026-010 - Add Audit Record for Change Bar Audit History
- ChangeBarAuditHistory.AddAudit(MyProcInfo.ItemID, $"Set ChangeBars set to ({dateTimeInput1.Value.ToString("MM/dd/yyyy HH:mm:ss")}) by ({VlnSettings.UserID}) on ({DateTime.Now}) for (Unit {r["UnitName"]})", DateTime.Now, VlnSettings.UserID, MyProcConfig.SelectedSlave);
+ ChangeBarAuditHistory.AddAudit(MyProcInfo.ItemID, $"Set ChangeBars set to ({dateTimeInput1.Value:MM/dd/yyyy HH:mm:ss}) by ({VlnSettings.UserID}) on ({DateTime.Now}) for (Unit {r["UnitName"]})", DateTime.Now, VlnSettings.UserID, MyProcConfig.SelectedSlave);
}
}
MyProcConfig.SelectedSlave = 0;
@@ -91,12 +90,9 @@ namespace VEPROMS
}
- private void btnNow_Click(object sender, EventArgs e)
- {
- dateTimeInput1.Value = DateTime.Now;
- }
+ private void btnNow_Click(object sender, EventArgs e) => dateTimeInput1.Value = DateTime.Now;
- //C2026-009 Add Option to Reset Change Bar to Last Approved Date/Time
+ //C2026-009 Add Option to Reset Change Bar to Last Approved Date/Time
private void btnResetToApproved_Click(object sender, EventArgs e)
{
System.Data.DataTable dt = RevisionData.GetRevisionDataByUnit(MyProcInfo.ItemID);
@@ -134,7 +130,7 @@ namespace VEPROMS
sb.Append("\r\n Any Change Bars for Units not listed above will use the Overall/Procedure Viewer Change Bar Date (as these Units have no approvals).");
- if (CustomMessageBox.Show($"This will reset ChangeBars to show for changes newer than the last approval.\r\nThis includes the following changes:\r\n{sb.ToString()}\r\n\r\nAre you sure you wish to reset ChangeBars?", "Reset ChangeBar Date", "Yes", "No") == DialogResult.Yes)
+ if (CustomMessageBox.Show($"This will reset ChangeBars to show for changes newer than the last approval.\r\nThis includes the following changes:\r\n{sb}\r\n\r\nAre you sure you wish to reset ChangeBars?", "Reset ChangeBar Date", "Yes", "No") == DialogResult.Yes)
{
//Change the overall ChangeBarDate
MyProcConfig.Print_ChangeBarDate = maxDTS;
diff --git a/PROMS/VEPROMS User Interface/dlgTransitionReport.cs b/PROMS/VEPROMS User Interface/dlgTransitionReport.cs
index a8cf15af..8a6ea658 100644
--- a/PROMS/VEPROMS User Interface/dlgTransitionReport.cs
+++ b/PROMS/VEPROMS User Interface/dlgTransitionReport.cs
@@ -1,9 +1,5 @@
using System;
using System.Collections.Generic;
-using System.ComponentModel;
-using System.Data;
-using System.Drawing;
-using System.Text;
using System.Windows.Forms;
using VEPROMS.CSLA.Library;
using Volian.Print.Library;
@@ -13,10 +9,11 @@ namespace VEPROMS
{
public partial class dlgTransitionReport : Form
{
- private FolderInfo folderInfo = null;
- private ProcedureInfo procedureInfo = null;
+ private readonly FolderInfo folderInfo = null;
+ private readonly ProcedureInfo procedureInfo = null;
private PDFTransitionReport rpt;
- private List lstDocVersions;
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE0044:Add readonly modifier", Justification = "Keeping Collections Not ReadOnly")]
+ private List lstDocVersions;
public dlgTransitionReport(FolderInfo fi)
{
InitializeComponent();
@@ -26,7 +23,7 @@ namespace VEPROMS
if (lstDocVersions.Count == 1)
{
pnlVersions.Visible = false;
- this.Height = this.Height - pnlVersions.Height;
+ Height -= pnlVersions.Height;
}
}
public dlgTransitionReport(ProcedureInfo pi)
@@ -34,16 +31,17 @@ namespace VEPROMS
InitializeComponent();
procedureInfo = pi;
pnlVersions.Visible = pnlProcs.Visible = false;
- this.Height = this.Height - pnlVersions.Height - pnlProcs.Height;
+ Height = Height - pnlVersions.Height - pnlProcs.Height;
}
- //private DocVersionInfo docVersionInfo;
private void dlgTransitionReport_Load(object sender, EventArgs e)
{
if (folderInfo != null)
{
- rpt = new PDFTransitionReport(folderInfo, Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + @"\VEPROMS\TransitionReport.pdf");
- rpt.MyDocVersionList = lstDocVersions;
- if (lstDocVersions.Count == 1)
+ rpt = new PDFTransitionReport(folderInfo, Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + @"\VEPROMS\TransitionReport.pdf")
+ {
+ MyDocVersionList = lstDocVersions
+ };
+ if (lstDocVersions.Count == 1)
pbProcs.Maximum = lstDocVersions[0].Procedures.Count;
else
pbVersions.Maximum = lstDocVersions.Count;
@@ -54,8 +52,8 @@ namespace VEPROMS
if (VlnSettings.GetCommandFlag("PROFILE")) ProfileTimer.TurnOnTracking("Profile.txt");
VEPROMS.CSLA.Library.Database.TrackDBUsage = VlnSettings.GetCommandFlag("DBTrack");
ProfileTimer.Reset();
- int profileDepth = ProfileTimer.Push(">>>> transitionreport");
- rpt = new PDFTransitionReport(procedureInfo, Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + @"\VEPROMS\TransitionReport.pdf");
+ _ = ProfileTimer.Push(">>>> transitionreport");
+ rpt = new PDFTransitionReport(procedureInfo, Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + @"\VEPROMS\TransitionReport.pdf");
pbTrans.Maximum = rpt.TransitionInfoCount;
tmrReportStart.Enabled = true;
}
@@ -131,7 +129,7 @@ namespace VEPROMS
{
tmrReportFinish.Enabled = false;
System.Diagnostics.Process.Start(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + @"\VEPROMS\TransitionReport.pdf");
- this.Close();
+ Close();
}
}
}
\ No newline at end of file
diff --git a/PROMS/VEPROMS User Interface/frmAnnotationsCleanup.cs b/PROMS/VEPROMS User Interface/frmAnnotationsCleanup.cs
index ca3f70f8..3829783d 100644
--- a/PROMS/VEPROMS User Interface/frmAnnotationsCleanup.cs
+++ b/PROMS/VEPROMS User Interface/frmAnnotationsCleanup.cs
@@ -1,32 +1,22 @@
using System;
using System.Collections.Generic;
-using System.ComponentModel;
-using System.Data;
-using System.Drawing;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
using System.Windows.Forms;
using VEPROMS.CSLA.Library;
-using Volian.Base.Library;
-//using Volian.Pipe.Library;
-using System.Xml;
-using System.Diagnostics;
-using JR.Utils.GUI.Forms;
namespace VEPROMS
{
public partial class frmAnnotationsCleanup : Form
{
- Label mylab = new Label();
string procList = "";
string docvList = "";
int AnnotationTyp;
string AnnotationName = "";
string totalDeleteCnt = "";
- List pil2 = new List();
- List dvil2 = new List();
- private frmBatchRefresh mainForm = null;
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE0044:Add readonly modifier", Justification = "Keeping Collections Not ReadOnly")]
+ List pil2 = new List();
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE0044:Add readonly modifier", Justification = "Keeping Collections Not ReadOnly")]
+ List dvil2 = new List();
+ private readonly frmBatchRefresh mainForm = null;
// frmAnnotationsCleanup constructor passes users procedure and docversion selections from frmBatchRefresh
public frmAnnotationsCleanup(Form callingForm, List pil, List dvil)
@@ -47,7 +37,6 @@ namespace VEPROMS
foreach (LocalAnnotationTypeInfo lati in myLocalAnnotationTypeInfoList)
{
AnnotationsList.Add(lati.TypeID.ToString(), lati.Name);
- //cbAnnotationTypes.Items.Add(new { Name = lati.Name, Value = lati.TypeID });
}
lbAnnotationTypes.DataSource = new BindingSource(AnnotationsList, null);
@@ -67,11 +56,11 @@ namespace VEPROMS
{
if (procList == "")
{
- procList = procList + p.ItemID.ToString();
+ procList += p.ItemID.ToString();
}
else
{
- procList = procList + "," + p.ItemID.ToString();
+ procList = $"{procList},{p.ItemID}";
}
}
}
@@ -88,19 +77,20 @@ namespace VEPROMS
{
if (docvList == "")
{
- docvList = docvList + d.VersionID.ToString();
+ docvList += d.VersionID.ToString();
}
else
{
- docvList = docvList + "," + d.VersionID.ToString();
+ docvList = $"{docvList},{d.VersionID}";
}
}
}
return docvList;
}
-
- private AnnotationTypeInfoList myAnnotationTypeInfoList = null;
- private LocalAnnotationTypeInfoList myLocalAnnotationTypeInfoList = null;
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE0044:Add readonly modifier", Justification = "Keeping Collections Not ReadOnly")]
+ private AnnotationTypeInfoList myAnnotationTypeInfoList = null;
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE0044:Add readonly modifier", Justification = "Keeping Collections Not ReadOnly")]
+ private LocalAnnotationTypeInfoList myLocalAnnotationTypeInfoList = null;
// Process used to cleanup annotations "(Proceed?" button)
private void button1_Click(object sender, EventArgs e)
@@ -112,21 +102,15 @@ namespace VEPROMS
TextBox frm3 = mainForm.GettxtResults();
AnnotationTyp = System.Convert.ToInt32(((KeyValuePair)lbAnnotationTypes.SelectedItem).Key);
AnnotationName = System.Convert.ToString(((KeyValuePair)lbAnnotationTypes.SelectedItem).Value);
- frm3.AppendText("Deleting Annotations: Annotation Type: " + '"' + AnnotationName + '"');
- frm3.AppendText(Environment.NewLine + "P = Procedure, F = Folder" + Environment.NewLine);
- int deletecountProc = 0;
- int deletecountDocv = 0;
- foreach (var p in pil2)
+ frm3.AppendText($"Deleting Annotations: Annotation Type: \"{AnnotationName}\"");
+ frm3.AppendText($"{Environment.NewLine}P = Procedure, F = Folder{Environment.NewLine}");
+ foreach (var p in pil2)
{
if (p.IsProcedure)
{
- //AnnotationTyp = System.Convert.ToInt32(((KeyValuePair)lbAnnotationTypes.SelectedItem).Key);
- //AnnotationName = System.Convert.ToString(((KeyValuePair)lbAnnotationTypes.SelectedItem).Value);
- //deletecountProc = Annotation.getAnnotationProcCnt(AnnotationTyp, getAnnotationProcItems(p));
- deletecountProc = Annotation.getAnnotationProcCnt(AnnotationTyp, p.ItemID.ToString());
- frm2.AppendText(Environment.NewLine + p.DisplayNumber + ' ' + p.DisplayText);
- //frm3.AppendText(Environment.NewLine + "P: " + p.DisplayNumber + '"' + p.DisplayText + '"' + " Type: " + '"' + AnnotationName + '"' + " count: " + deletecountProc);
- frm3.AppendText(Environment.NewLine + "P: " + p.DisplayNumber + '"' + p.DisplayText + '"' + " Delete count: " + deletecountProc);
+ int deletecountProc = Annotation.getAnnotationProcCnt(AnnotationTyp, p.ItemID.ToString());
+ frm2.AppendText($"{Environment.NewLine}{p.DisplayNumber} {p.DisplayText}");
+ frm3.AppendText($"{Environment.NewLine}P: {p.DisplayNumber}\"{p.DisplayText}\" Delete count: {deletecountProc}");
Annotation.DeleteAnnotationProcByType(AnnotationTyp, p.ItemID.ToString());
lblCountNumber.Text = "0";
}
@@ -136,18 +120,16 @@ namespace VEPROMS
{
if (d.IsDocVersion)
{
- //AnnotationTyp = System.Convert.ToInt32(((KeyValuePair)lbAnnotationTypes.SelectedItem).Key);
- //AnnotationName = System.Convert.ToString(((KeyValuePair)lbAnnotationTypes.SelectedItem).Value);
- deletecountDocv = Annotation.getAnnotationCountDocv(AnnotationTyp, d.VersionID.ToString());
- frm2.AppendText(Environment.NewLine + d.ActiveParent.ToString());
- frm3.AppendText(Environment.NewLine + "F: " + '"' + d.ActiveParent.ToString() + '"' + " Delete count: " + deletecountDocv);
+ int deletecountDocv = Annotation.getAnnotationCountDocv(AnnotationTyp, d.VersionID.ToString());
+ frm2.AppendText(Environment.NewLine + d.ActiveParent.ToString());
+ frm3.AppendText($"{Environment.NewLine}F: \"{d.ActiveParent.ToString()}\" Delete count: {deletecountDocv}");
AnnotationTyp = System.Convert.ToInt32(((KeyValuePair)lbAnnotationTypes.SelectedItem).Key);
Annotation.DeleteAnnotationDocvByType(AnnotationTyp, d.VersionID.ToString());
lblCountNumber.Text = "0";
}
}
- frm3.AppendText(Environment.NewLine + Environment.NewLine + "Total Annotations Deleted: " + totalDeleteCnt + Environment.NewLine + Environment.NewLine);
+ frm3.AppendText($"{Environment.NewLine}{Environment.NewLine}Total Annotations Deleted: {totalDeleteCnt}{Environment.NewLine}{Environment.NewLine}");
}
}
@@ -178,13 +160,10 @@ namespace VEPROMS
}
}
- // Close form.
- private void btnClose_Click(object sender, EventArgs e)
- {
- this.Close();
- }
+ // Close form.
+ private void btnClose_Click(object sender, EventArgs e) => Close();
- }
+ }
}
diff --git a/PROMS/VEPROMS User Interface/frmBatchRefresh.cs b/PROMS/VEPROMS User Interface/frmBatchRefresh.cs
index 89d1bc48..6945e606 100644
--- a/PROMS/VEPROMS User Interface/frmBatchRefresh.cs
+++ b/PROMS/VEPROMS User Interface/frmBatchRefresh.cs
@@ -15,28 +15,23 @@ namespace VEPROMS
{
public partial class frmBatchRefresh : Form
{
- private SessionInfo _MySessionInfo;
- public SessionInfo MySessionInfo
- {
- get { return _MySessionInfo; }
- set { _MySessionInfo = value; }
- }
- private bool IsAdministratorUser = false; //C2020-035 used to control what Set Amins can do
+ public SessionInfo MySessionInfo { get; set; }
+ private readonly bool IsAdministratorUser = false; //C2020-035 used to control what Set Amins can do
// C2017-030 - new Admin Tools user interface
// pass in session info to constructor
- private frmVEPROMS _veProms;
+ private readonly frmVEPROMS _veProms;
public frmBatchRefresh(SessionInfo sessionInfo, frmVEPROMS veProms)
{
InitializeComponent();
- _MySessionInfo = sessionInfo;
+ MySessionInfo = sessionInfo;
_veProms = veProms;
// When opening Admin tools Repair tab will be default.
- this.sideNavItmRepair.Checked = true;
+ sideNavItmRepair.Checked = true;
if (sideNavItmDelete.Checked)
{
@@ -73,28 +68,22 @@ namespace VEPROMS
//default to 10 years back
dtePurge.Value = DateTime.Now.AddYears(-10);
}
- // Make txtProcess text box available to frmAnnotationsClean form.
- internal TextBox GettxtProcess()
+ // Make txtProcess text box available to frmAnnotationsClean form.
+ internal TextBox GettxtProcess() => txtProcess;
+
+ // Make txtResults text box available to frmAnnotationsClean form.
+ internal TextBox GettxtResults() => txtResults;
+
+ // NOTE: removed the Refresh ROs and Refresh Transitions and ROs options (now only Transitions can be refreshed)
+ // the Update ROs and Refresh ROs logic was merged together. The Update ROs will functionally do both
+ // also annotations will be placed on step elements that have RO changes
+
+ // make all of the hyphen character consistant so they can all be found with the Search function
+
+
+ private void FixHyphens()
{
- return txtProcess;
- }
-
- // Make txtResults text box available to frmAnnotationsClean form.
- internal TextBox GettxtResults()
- {
- return txtResults;
- }
-
- // NOTE: removed the Refresh ROs and Refresh Transitions and ROs options (now only Transitions can be refreshed)
- // the Update ROs and Refresh ROs logic was merged together. The Update ROs will functionally do both
- // also annotations will be placed on step elements that have RO changes
-
- // make all of the hyphen character consistant so they can all be found with the Search function
-
-
- private void FixHyphens()
- {
- this.Cursor = Cursors.WaitCursor;
+ Cursor = Cursors.WaitCursor;
DateTime pStart = DateTime.Now;
txtProcess.AppendText("Standardizing Hyphens");
txtProcess.AppendText(Environment.NewLine);
@@ -112,29 +101,26 @@ namespace VEPROMS
txtProcess.AppendText(Environment.NewLine);
txtProcess.AppendText(Environment.NewLine);
Application.DoEvents();
- this.Cursor = Cursors.Default;
+ Cursor = Cursors.Default;
}
- private Dictionary myProcedures = new Dictionary();
- private Dictionary myDocVersions = new Dictionary();
- private Dictionary myFolders = new Dictionary();
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE0044:Add readonly modifier", Justification = "Keeping Collections Not ReadOnly")]
+ private Dictionary myProcedures = new Dictionary();
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE0044:Add readonly modifier", Justification = "Keeping Collections Not ReadOnly")]
+ private Dictionary myDocVersions = new Dictionary();
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE0044:Add readonly modifier", Justification = "Keeping Collections Not ReadOnly")]
+ private Dictionary myFolders = new Dictionary();
- private void frmBatchRefresh_Load(object sender, EventArgs e)
- {
- IsClosing = false;//B2017-221 Allow the batch dialog to close when waiting to process.
- }
- private bool IsClosing = false;//B2017-221 Allow the batch dialog to close when waiting to process.
- private void frmBatchRefresh_FormClosing(object sender, EventArgs e)
- {
- IsClosing = true;//B2017-221 Allow the batch dialog to close when waiting to process.
- }
- // C2017-030 - new Admin Tools user interface
- // check to see if at least one tree node is checked.
- // Used to determin whether to make the process button active for
- // Refresh Transitions and for Update RO Values
- // B2025-013 Admin Tool Tree Behavior
- //Made this generic so same logic for all the TreeViews on this form
- private bool AtLeastOneNodeChecked(TreeNodeCollection col)
+ private void frmBatchRefresh_Load(object sender, EventArgs e) => IsClosing = false;//B2017-221 Allow the batch dialog to close when waiting to process.
+ private bool IsClosing = false;//B2017-221 Allow the batch dialog to close when waiting to process.
+ private void frmBatchRefresh_FormClosing(object sender, EventArgs e) => IsClosing = true;//B2017-221 Allow the batch dialog to close when waiting to process.
+ // C2017-030 - new Admin Tools user interface
+ // check to see if at least one tree node is checked.
+ // Used to determin whether to make the process button active for
+ // Refresh Transitions and for Update RO Values
+ // B2025-013 Admin Tool Tree Behavior
+ //Made this generic so same logic for all the TreeViews on this form
+ private bool AtLeastOneNodeChecked(TreeNodeCollection col)
{
foreach (TreeNode tn in col)
if (NodeIsChecked(tn))
@@ -154,7 +140,7 @@ namespace VEPROMS
//C2026-002 Enhancements to new admin Tool for ROs not used.
private void ResetmyTV_RO_DBs()
{
- this.Cursor = Cursors.WaitCursor;
+ Cursor = Cursors.WaitCursor;
myTV_RO_DBs.Nodes.Clear();
TreeNode tn = myTV_RO_DBs.Nodes.Add("Select All");
@@ -169,13 +155,13 @@ namespace VEPROMS
}
tn.Expand();
- this.Cursor = Cursors.Default;
+ Cursor = Cursors.Default;
}
private void ResetTV(bool noProcs)
{
btnFixLinks.Enabled = false;
- this.Cursor = Cursors.WaitCursor;
+ Cursor = Cursors.WaitCursor;
myTV.Nodes.Clear();
myDocVersions.Clear();
myFolders.Clear();
@@ -184,14 +170,13 @@ namespace VEPROMS
tn.Tag = fi;
if (fi.ChildFolderCount > 0)
LoadChildFolders(fi, tn, noProcs);
- if (myTV.SelectedNode != null)
- myTV.SelectedNode.Expand();
- this.Cursor = Cursors.Default;
+ myTV.SelectedNode?.Expand();
+ Cursor = Cursors.Default;
}
private void ResetDelTV(bool noProcs)
{
btnFixLinks.Enabled = false;
- this.Cursor = Cursors.WaitCursor;
+ Cursor = Cursors.WaitCursor;
myTVdel.Nodes.Clear();
myDocVersions.Clear();
FolderInfo fi = FolderInfo.GetTop();
@@ -200,21 +185,22 @@ namespace VEPROMS
if (fi.ChildFolderCount > 0)
{
- TreeNode tn = new TreeNode(fi.Name);
- tn.Tag = fi;
- tn.StateImageIndex = -1; // Hide the checkbox for the root node
- LoadChildFolders(fi, tn, noProcs);
+ TreeNode tn = new TreeNode(fi.Name)
+ {
+ Tag = fi,
+ StateImageIndex = -1 // Hide the checkbox for the root node
+ };
+ LoadChildFolders(fi, tn, noProcs);
myTVdel.Nodes.Add(tn);
}
- if (myTVdel.SelectedNode != null)
- myTVdel.SelectedNode.Expand();
+ myTVdel.SelectedNode?.Expand();
//Expand if folders
if (noProcs)
myTVdel.ExpandAll();
- this.Cursor = Cursors.Default;
+ Cursor = Cursors.Default;
}
// B2021-060 Higher level folders where being removed from the tree even if there was a child folder that containe a working draft set
@@ -304,7 +290,7 @@ namespace VEPROMS
private void UpdateROValues()
{
- this.Cursor = Cursors.WaitCursor;
+ Cursor = Cursors.WaitCursor;
List pil = new List(); // C2023-002: list of checked out procedures, used in frmBatchRefreshCheckedOut dialog
List dvil = new List();
foreach (TreeNode tn in myDocVersions.Keys)
@@ -377,14 +363,16 @@ namespace VEPROMS
sb.AppendLine("Once this is complete you can continue the process otherwise you may terminate the process immediately.");
sb.AppendLine();
sb.AppendLine("Have you requested the users to close the procedures and do you want to continue the process?");
- frmBatchRefreshCheckedOut frmCO = new frmBatchRefreshCheckedOut(1);
- frmCO.MySessionInfo = MySessionInfo;
- frmCO.CheckedOutProcedures = pil; // C2023-002: set list of checked out procedures
- frmCO.Location = new Point(Screen.PrimaryScreen.WorkingArea.Width - frmCO.Width, Screen.PrimaryScreen.WorkingArea.Height - frmCO.Height);
+ frmBatchRefreshCheckedOut frmCO = new frmBatchRefreshCheckedOut(1)
+ {
+ MySessionInfo = MySessionInfo,
+ CheckedOutProcedures = pil // C2023-002: set list of checked out procedures
+ };
+ frmCO.Location = new Point(Screen.PrimaryScreen.WorkingArea.Width - frmCO.Width, Screen.PrimaryScreen.WorkingArea.Height - frmCO.Height);
// C2023-002: Allow close of dialog that has list of procedures that are checked out
if (frmCO.ShowDialog(this) != DialogResult.Cancel)
{
- while (!this.Visible)
+ while (!Visible)
Application.DoEvents();
}
else
@@ -400,7 +388,7 @@ namespace VEPROMS
txtProcess.AppendText(string.Format("Could Not Complete: {0} {1} Seconds Elapsed", pEnd.ToString("MM/dd/yyyy @ HH:mm"), TimeSpan.FromTicks(pEnd.Ticks - pStart.Ticks).TotalSeconds));
pbProcess.Value = pbProcess.Maximum;
}
- this.Cursor = Cursors.Default;
+ Cursor = Cursors.Default;
}
//C2025-011 RO Update Admin Tool Memory Enhancements
@@ -425,7 +413,7 @@ namespace VEPROMS
private void CheckROLinks()
{
bool badLinksFound = false;
- this.Cursor = Cursors.WaitCursor;
+ Cursor = Cursors.WaitCursor;
List pil = new List();
// populate a list of procedures that the user selected to process
foreach (TreeNode tn in myProcedures.Keys)
@@ -500,15 +488,17 @@ namespace VEPROMS
if (piq.Count > 0)
{
- frmBatchRefreshCheckedOut frmCO = new frmBatchRefreshCheckedOut(0);
- frmCO.MySessionInfo = MySessionInfo;
- frmCO.Location = new Point(Screen.PrimaryScreen.WorkingArea.Width - frmCO.Width, Screen.PrimaryScreen.WorkingArea.Height - frmCO.Height);
+ frmBatchRefreshCheckedOut frmCO = new frmBatchRefreshCheckedOut(0)
+ {
+ MySessionInfo = MySessionInfo
+ };
+ frmCO.Location = new Point(Screen.PrimaryScreen.WorkingArea.Width - frmCO.Width, Screen.PrimaryScreen.WorkingArea.Height - frmCO.Height);
frmCO.Show(this);
- while (!this.Visible)
+ while (!Visible)
Application.DoEvents();
}
}
- this.Cursor = Cursors.Default;
+ Cursor = Cursors.Default;
}
// B2018-002 - Invalid Transitions - Define Transition Refresh Statistics
@@ -528,7 +518,7 @@ namespace VEPROMS
{
// B2018-002 - Invalid Transitions - Initialize Transition Refresh Statistics
ResetTransNumbers();
- this.Cursor = Cursors.WaitCursor;
+ Cursor = Cursors.WaitCursor;
List pil = new List();
foreach (TreeNode tn in myProcedures.Keys)
if (tn.Checked)
@@ -606,16 +596,18 @@ namespace VEPROMS
sb.AppendLine("Once this is complete you can continue the process otherwise you may terminate the process immediately.");
sb.AppendLine();
sb.AppendLine("Have you requested the users to close the procedures and do you want to continue the process?");
- frmBatchRefreshCheckedOut frmCO = new frmBatchRefreshCheckedOut(0);
- frmCO.MySessionInfo = MySessionInfo;
- frmCO.CheckedOutProcedures = pil;
- frmCO.Location = new Point(Screen.PrimaryScreen.WorkingArea.Width - frmCO.Width, Screen.PrimaryScreen.WorkingArea.Height - frmCO.Height);
+ frmBatchRefreshCheckedOut frmCO = new frmBatchRefreshCheckedOut(0)
+ {
+ MySessionInfo = MySessionInfo,
+ CheckedOutProcedures = pil
+ };
+ frmCO.Location = new Point(Screen.PrimaryScreen.WorkingArea.Width - frmCO.Width, Screen.PrimaryScreen.WorkingArea.Height - frmCO.Height);
frmCO.Show(this);
- while (!this.Visible)
+ while (!Visible)
Application.DoEvents();
}
}
- this.Cursor = Cursors.Default;
+ Cursor = Cursors.Default;
// B2018-002 - Invalid Transitions - Display Transition Refresh Statistic
if (numTransFixed == 0 && numTransConverted == 0 && numTransCantFix == 0)
MessageBox.Show(string.Format("{0} Transitions Checked.\n\nNo Transitions Modified.", numTransProcessed), "Refresh Transitions Completed");
@@ -629,7 +621,7 @@ namespace VEPROMS
// the next time the procedures are printed. This also forces ROs to be refreshed in the attachments
private void DeletePDFs()
{
- this.Cursor = Cursors.WaitCursor;
+ Cursor = Cursors.WaitCursor;
DateTime pStart = DateTime.Now;
txtProcess.AppendText("Refreshing Word Attachments");
txtProcess.AppendText(Environment.NewLine);
@@ -647,7 +639,7 @@ namespace VEPROMS
txtProcess.AppendText(Environment.NewLine);
txtProcess.AppendText(Environment.NewLine);
Application.DoEvents();
- this.Cursor = Cursors.Default;
+ Cursor = Cursors.Default;
}
private int RegenCounter = 0;
@@ -659,7 +651,7 @@ namespace VEPROMS
// so that this is not needed the next time the procedures are printed. This also forces ROs to be refreshed in the attachments
private void RegenPDFs()
{
- this.Cursor = Cursors.WaitCursor;
+ Cursor = Cursors.WaitCursor;
DateTime pStart = DateTime.Now;
txtProcess.AppendText("Generating missing Word Attachments");
txtProcess.AppendText(Environment.NewLine);
@@ -737,7 +729,7 @@ namespace VEPROMS
txtProcess.AppendText(Environment.NewLine);
txtProcess.AppendText(Environment.NewLine);
Application.DoEvents();
- this.Cursor = Cursors.Default;
+ Cursor = Cursors.Default;
}
//Outputs the Progress of Regenerating the PDFs every __ minutes
@@ -756,7 +748,7 @@ namespace VEPROMS
// rerun until all tables/text fields are completed.
private void RefreshTablesForSearch()
{
- this.Cursor = Cursors.WaitCursor;
+ Cursor = Cursors.WaitCursor;
DateTime pStart = DateTime.Now;
txtProcess.AppendText("Refreshing Tables for Search");
txtProcess.AppendText(Environment.NewLine);
@@ -783,7 +775,7 @@ namespace VEPROMS
txtProcess.AppendText(Environment.NewLine);
txtProcess.AppendText(Environment.NewLine);
Application.DoEvents();
- this.Cursor = Cursors.Default;
+ Cursor = Cursors.Default;
}
private int RefreshForSearch()
{
@@ -824,7 +816,7 @@ namespace VEPROMS
}
catch
{
- this.Cursor = Cursors.Default;
+ Cursor = Cursors.Default;
return -cntfix;
}
}
@@ -839,7 +831,7 @@ namespace VEPROMS
// tool renamed to Remove Orphan Items
private void PurgeDisconnectedItems()
{
- this.Cursor = Cursors.WaitCursor;
+ Cursor = Cursors.WaitCursor;
DateTime pStart = DateTime.Now;
txtProcess.AppendText("Purging Orphan Items");
txtProcess.AppendText(Environment.NewLine);
@@ -881,13 +873,13 @@ namespace VEPROMS
txtProcess.AppendText(Environment.NewLine);
txtProcess.AppendText(Environment.NewLine);
Application.DoEvents();
- this.Cursor = Cursors.Default;
+ Cursor = Cursors.Default;
}
// C2017-030 - new Admin Tools user interface is one of two tools run from Remove Obsolete RO Data
private void RemoveUnusedRoFstsAndFigures()
{
- this.Cursor = Cursors.WaitCursor;
+ Cursor = Cursors.WaitCursor;
DateTime pStart = DateTime.Now;
txtProcess.AppendText("Purging Unused RoFSTs and Figures Items");
txtProcess.AppendText(Environment.NewLine);
@@ -936,14 +928,14 @@ namespace VEPROMS
txtProcess.AppendText(Environment.NewLine);
txtProcess.AppendText(Environment.NewLine);
Application.DoEvents();
- this.Cursor = Cursors.Default;
+ Cursor = Cursors.Default;
}
// C2017-030 - new Admin Tools user interface
// is one of two tools run from Remove Obsolete RO Data
private void CleanUpROAssociations()
{
- this.Cursor = Cursors.WaitCursor;
+ Cursor = Cursors.WaitCursor;
DateTime pStart = DateTime.Now;
txtProcess.AppendText("Purging Unused Referenced Object Associations");
txtProcess.AppendText(Environment.NewLine);
@@ -985,14 +977,14 @@ namespace VEPROMS
txtProcess.AppendText(Environment.NewLine);
txtProcess.AppendText(Environment.NewLine);
Application.DoEvents();
- this.Cursor = Cursors.Default;
+ Cursor = Cursors.Default;
}
// C2017-030 - new Admin Tools user interface
// tool was renamed to Show Users
private void GetDatabaseSessions()
{
- this.Cursor = Cursors.WaitCursor;
+ Cursor = Cursors.WaitCursor;
DateTime pStart = DateTime.Now;
txtProcess.AppendText("Show Users in PROMS");
txtProcess.AppendText(Environment.NewLine);
@@ -1004,7 +996,7 @@ namespace VEPROMS
DateTime pEnd = DateTime.Now;
txtProcess.AppendText(string.Format("Completed: {0}", pEnd.ToString("MM/dd/yyyy @ HH:mm")));
Application.DoEvents();
- this.Cursor = Cursors.Default;
+ Cursor = Cursors.Default;
MessageBox.Show("Show Users Completed", "Show Users");
}
@@ -1046,10 +1038,10 @@ namespace VEPROMS
FinalProgressBarMessage = "No existing RO.FST";
txtProcess.AppendText(Environment.NewLine);
txtProcess.AppendText(Environment.NewLine);
- txtProcess.AppendText("No existing ro.fst in path " + roFstInfo.MyRODb.FolderPath + ". Check for invalid path");
+ txtProcess.AppendText($"No existing ro.fst in path {roFstInfo.MyRODb.FolderPath}. Check for invalid path");
txtProcess.AppendText(Environment.NewLine);
txtProcess.AppendText(Environment.NewLine);
- txtResults.AppendText("No existing ro.fst in path " + roFstInfo.MyRODb.FolderPath + ". Check for invalid path");
+ txtResults.AppendText($"No existing ro.fst in path {roFstInfo.MyRODb.FolderPath}. Check for invalid path");
txtResults.AppendText(Environment.NewLine);
txtResults.AppendText(Environment.NewLine);
return;
@@ -1123,15 +1115,12 @@ namespace VEPROMS
}
StringBuilder myFixes;
- int myFixesCount = 0;
- int myConvertCount = 0;
// show the changes made in the Results pannel, include the ItemId of the step element
void ContentInfo_StaticContentInfoChange(object sender, StaticContentInfoEventArgs args)
{
if (args.Type == "TX")
{
- myFixesCount++;
if (args.NewValue.StartsWith("Reason for Change:"))
myFixes.AppendLine(string.Format("Fixed Transition for {1}({4}){0}Old Text: {2}{0}{3}{0}", Environment.NewLine, (sender as ItemInfo).ShortPath, args.OldValue, args.NewValue, (sender as ItemInfo).ItemID));
else
@@ -1155,13 +1144,15 @@ namespace VEPROMS
private void btnSave_Click(object sender, EventArgs e)
{
- SaveFileDialog sfd = new SaveFileDialog();
- sfd.DefaultExt = "txt";
- sfd.AddExtension = true;
- sfd.Filter = "Text Files (*.txt)|*.txt";
- sfd.FileName = string.Format("BatchRefreshResults_{0}", DateTime.Now.ToString("yyyyMMdd_HHmm"));
- sfd.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + @"\VEPROMS";
- DialogResult dr = sfd.ShowDialog();
+ SaveFileDialog sfd = new SaveFileDialog
+ {
+ DefaultExt = "txt",
+ AddExtension = true,
+ Filter = "Text Files (*.txt)|*.txt",
+ FileName = string.Format("BatchRefreshResults_{0}", DateTime.Now.ToString("yyyyMMdd_HHmm")),
+ InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + @"\VEPROMS"
+ };
+ DialogResult dr = sfd.ShowDialog();
if (dr == DialogResult.OK)
{
@@ -1186,7 +1177,7 @@ namespace VEPROMS
{
//Purge Change History
- string statmsg = $"Purging all Change History before {dtePurge.Value.Date.ToString("MM/dd/yyyy")}";
+ string statmsg = $"Purging all Change History before {dtePurge.Value.Date:MM/dd/yyyy}";
InitialProgressBarMessage = statmsg;
txtResults.AppendText(statmsg);
txtResults.AppendText(Environment.NewLine);
@@ -1194,7 +1185,7 @@ namespace VEPROMS
Maintenance.PurgeChangeHistory(dtePurge.Value);
//update status
- statmsg = $"Finished Purging all Change History before {dtePurge.Value.Date.ToString("MM/dd/yyyy")}. Updating indexes to reflect cleaned data.";
+ statmsg = $"Finished Purging all Change History before {dtePurge.Value.Date:MM/dd/yyyy}. Updating indexes to reflect cleaned data.";
DoProgressBarRefresh(50, 100, statmsg);
txtProcess.AppendText(statmsg);
txtProcess.AppendText(Environment.NewLine);
@@ -1380,14 +1371,11 @@ namespace VEPROMS
ResetTV(false);
}
- // C2017-030 new Admin Tools user interface
- private void sideNavItmExit_Click(object sender, EventArgs e)
- {
- this.Close();
- }
+ // C2017-030 new Admin Tools user interface
+ private void sideNavItmExit_Click(object sender, EventArgs e) => Close();
- // new Admin Tools user interface for deletes
- private void sideNavItmDelete_Click(object sender, EventArgs e)
+ // new Admin Tools user interface for deletes
+ private void sideNavItmDelete_Click(object sender, EventArgs e)
{
AdminToolType = E_AdminToolType.Delete;
lblAdmToolProgressType.Text = "";
@@ -1426,12 +1414,12 @@ namespace VEPROMS
};
private E_AdminToolType AdminToolType = E_AdminToolType.Repair;
- DevComponents.DotNetBar.StepItem siOrphDatRecs = new DevComponents.DotNetBar.StepItem("siOrphDatRecs", "Orphan Data Records");
- DevComponents.DotNetBar.StepItem siObsoleteROData = new DevComponents.DotNetBar.StepItem("siObsoleteROData", "Obsolete RO Data");
- DevComponents.DotNetBar.StepItem siStandardHyphens = new DevComponents.DotNetBar.StepItem("siStandardHyphens", "Standardize Hyphens");
- DevComponents.DotNetBar.StepItem siRefreshAttmts = new DevComponents.DotNetBar.StepItem("siRefreshAttmts", "Refresh Word Attachments");
- DevComponents.DotNetBar.StepItem siRegenAttmts = new DevComponents.DotNetBar.StepItem("siRegenAttmts", "Regenerate Word Attachments");
- DevComponents.DotNetBar.StepItem siRefreshTblsSrchTxt = new DevComponents.DotNetBar.StepItem("siRefreshTblsSrchTxt", "Refresh Tables For Search");
+ readonly DevComponents.DotNetBar.StepItem siOrphDatRecs = new DevComponents.DotNetBar.StepItem("siOrphDatRecs", "Orphan Data Records");
+ readonly DevComponents.DotNetBar.StepItem siObsoleteROData = new DevComponents.DotNetBar.StepItem("siObsoleteROData", "Obsolete RO Data");
+ readonly DevComponents.DotNetBar.StepItem siStandardHyphens = new DevComponents.DotNetBar.StepItem("siStandardHyphens", "Standardize Hyphens");
+ readonly DevComponents.DotNetBar.StepItem siRefreshAttmts = new DevComponents.DotNetBar.StepItem("siRefreshAttmts", "Refresh Word Attachments");
+ readonly DevComponents.DotNetBar.StepItem siRegenAttmts = new DevComponents.DotNetBar.StepItem("siRegenAttmts", "Regenerate Word Attachments");
+ readonly DevComponents.DotNetBar.StepItem siRefreshTblsSrchTxt = new DevComponents.DotNetBar.StepItem("siRefreshTblsSrchTxt", "Refresh Tables For Search");
// this will update/rebuild the progress bar in the bottom panel of Admin Tools
private void setupProgessSteps1()
{
@@ -1483,13 +1471,10 @@ namespace VEPROMS
}
}
- // used for all of the Switch buttons (ON/OFF buttons)
- private void swCk_ValueChanged(object sender, EventArgs e)
- {
- setupProgessSteps1();
- }
+ // used for all of the Switch buttons (ON/OFF buttons)
+ private void swCk_ValueChanged(object sender, EventArgs e) => setupProgessSteps1();
- private void swUpdateROVals_ValueChanged(object sender, EventArgs e)
+ private void swUpdateROVals_ValueChanged(object sender, EventArgs e)
{
if (swUpdateROVals.Value)
{
@@ -1509,16 +1494,13 @@ namespace VEPROMS
}
}
- #endregion
+ #endregion
- // C2017-030 New Admin Tools user interface
- // functions to handle the progress bar in the bottom panel of Admin Tools
- private void StepProgress(int prgStpIdx, int val)
- {
- ((DevComponents.DotNetBar.StepItem)progressSteps1.Items[prgStpIdx]).Value = val;
- }
+ // C2017-030 New Admin Tools user interface
+ // functions to handle the progress bar in the bottom panel of Admin Tools
+ private void StepProgress(int prgStpIdx, int val) => ((DevComponents.DotNetBar.StepItem)progressSteps1.Items[prgStpIdx]).Value = val;
- private void ClearStepProgress()
+ private void ClearStepProgress()
{
for (int i = 0; i < progressSteps1.Items.Count; i++)
{
@@ -1673,7 +1655,7 @@ namespace VEPROMS
txtResults.Clear();
txtProcess.Clear();
- this.Cursor = Cursors.WaitCursor;
+ Cursor = Cursors.WaitCursor;
//Create checked proce and doc info lists.
List pil = new List();
@@ -1756,7 +1738,7 @@ namespace VEPROMS
sb.AppendLine("If you want to delete annotations from these working drafts, please contact the respective users and have them close any procedures in the working draft.");
sb.AppendLine();
txtProcess.AppendText(sb.ToString());
- this.Cursor = Cursors.Default;
+ Cursor = Cursors.Default;
return;
}
@@ -1790,7 +1772,7 @@ namespace VEPROMS
}
- this.Cursor = Cursors.Default;
+ Cursor = Cursors.Default;
}
private void ProcessDelete(List foldersToDelete, List emptyFoldersToDelete)
@@ -1952,14 +1934,16 @@ namespace VEPROMS
//CSM - C2025-043 report RO's that are not used in any of the PROMS data.
private void btnROsNotUsed_Click(object sender, EventArgs e)
{
- //Get the path to save the Image to
- SaveFileDialog sfd = new SaveFileDialog();
- sfd.DefaultExt = "bmp";
- sfd.AddExtension = true;
- sfd.Filter = "Image Files (*.bmp)|*.bmp";
- sfd.FileName = string.Format("ROsNotUsed_{0}", DateTime.Now.ToString("yyyyMMdd_HHmm"));
- sfd.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + @"\VEPROMS";
- DialogResult dr = sfd.ShowDialog();
+ //Get the path to save the Image to
+ SaveFileDialog sfd = new SaveFileDialog
+ {
+ DefaultExt = "bmp",
+ AddExtension = true,
+ Filter = "Image Files (*.bmp)|*.bmp",
+ FileName = string.Format("ROsNotUsed_{0}", DateTime.Now.ToString("yyyyMMdd_HHmm")),
+ InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + @"\VEPROMS"
+ };
+ DialogResult dr = sfd.ShowDialog();
if (dr == DialogResult.OK)
{
diff --git a/PROMS/VEPROMS User Interface/frmBatchRefreshCheckedOut.cs b/PROMS/VEPROMS User Interface/frmBatchRefreshCheckedOut.cs
index 8eba4e10..a44a601e 100644
--- a/PROMS/VEPROMS User Interface/frmBatchRefreshCheckedOut.cs
+++ b/PROMS/VEPROMS User Interface/frmBatchRefreshCheckedOut.cs
@@ -1,35 +1,18 @@
using System;
using System.Collections.Generic;
-using System.ComponentModel;
-using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using VEPROMS.CSLA.Library;
using LBOutlookLibrary;
-using System.Reflection;
-using System.Text.RegularExpressions;
-using System.Net.Mail;
-using System.Net;
-using System.IO;
namespace VEPROMS
{
public partial class frmBatchRefreshCheckedOut : Form
{
- private SessionInfo _MySessionInfo;
- public SessionInfo MySessionInfo
- {
- get { return _MySessionInfo; }
- set { _MySessionInfo = value; }
- }
- private List _CheckedOutProcedures;
- public List CheckedOutProcedures
- {
- get { return _CheckedOutProcedures; }
- set { _CheckedOutProcedures = value; }
- }
- private int RType = -1; // C2023-002: Flag type of checkout, docversion -1 or procedures 0
+ public SessionInfo MySessionInfo { get; set; }
+ public List CheckedOutProcedures { get; set; }
+ private readonly int RType = -1; // C2023-002: Flag type of checkout, docversion -1 or procedures 0
public frmBatchRefreshCheckedOut(int type)
{
RType = type;
@@ -53,32 +36,39 @@ namespace VEPROMS
}
private void AddToDisplayList(ProcedureInfo pi)
{
- Panel p = new Panel();
- p.BorderStyle = BorderStyle.FixedSingle;
- p.Dock = DockStyle.Top;
- p.Height = 28;
- if (RType != 1) // C2023-002: only put out ForceCheckin & sendemail buttons if on procedures (can't check in a docversion)
+ Panel p = new Panel
+ {
+ BorderStyle = BorderStyle.FixedSingle,
+ Dock = DockStyle.Top,
+ Height = 28
+ };
+ if (RType != 1) // C2023-002: only put out ForceCheckin & sendemail buttons if on procedures (can't check in a docversion)
{
- Button b = new Button();
- //b.FlatStyle = FlatStyle.Popup;
- b.Dock = DockStyle.Right;
- b.Text = "Force Check In";
- b.Tag = pi;
- b.Click += new EventHandler(ForceCheckIn_Click);
+ Button b = new Button
+ {
+ Dock = DockStyle.Right,
+ Text = "Force Check In",
+ Tag = pi
+ };
+ b.Click += new EventHandler(ForceCheckIn_Click);
p.Controls.Add(b);
- b = new Button();
- //b.FlatStyle = FlatStyle.Popup;
- b.Dock = DockStyle.Right;
- b.Text = "Send Email";
- b.Tag = pi;
- b.Click += new EventHandler(SendEmail_Click);
+ b = new Button
+ {
+ //b.FlatStyle = FlatStyle.Popup;
+ Dock = DockStyle.Right,
+ Text = "Send Email",
+ Tag = pi
+ };
+ b.Click += new EventHandler(SendEmail_Click);
p.Controls.Add(b);
}
- Label l = new Label();
- l.Dock = DockStyle.Fill;
- l.TextAlign = ContentAlignment.MiddleLeft;
- l.Text = string.Format("Procedure {0} is checked out to {1}", pi.DisplayNumber, UserInfo.GetByUserID(OwnerInfo.GetByItemID(pi.ItemID, CheckOutType.Procedure).SessionUserID).UserID);
- p.Controls.Add(l);
+ Label l = new Label
+ {
+ Dock = DockStyle.Fill,
+ TextAlign = ContentAlignment.MiddleLeft,
+ Text = $"Procedure {pi.DisplayNumber} is checked out to {UserInfo.GetByUserID(OwnerInfo.GetByItemID(pi.ItemID, CheckOutType.Procedure).SessionUserID).UserID}"
+ };
+ p.Controls.Add(l);
pnlList.Controls.Add(p);
p.BringToFront();
pnlList.Focus();
@@ -103,15 +93,7 @@ namespace VEPROMS
private string BuildEmailMessageBody(ProcedureInfo pi)
{
StringBuilder body = new StringBuilder();
- //body.AppendLine("THIS IS A TEST MESSAGE FROM JIM BODINE");
- //body.AppendLine();
- body.AppendLine(string.Format("The administrator needs you to check in procedure {0} so the administrator can continue an administrative tool process", pi.DisplayNumber));
- //body.AppendLine();
- //body.AppendLine("Obviously, you do not really have this procedure checked out, so you really do not have to do anything.");
- //body.AppendLine();
- //body.AppendLine("However, I would appreciate it if you would reply to this email so I know the email worked");
- //body.AppendLine();
- //body.AppendLine("I will try NOT to overwhelm your email system :-)");
+ body.AppendLine($"The administrator needs you to check in procedure {pi.DisplayNumber} so the administrator can continue an administrative tool process");
return body.ToString();
}
void ForceCheckIn_Click(object sender, EventArgs e)
@@ -134,15 +116,7 @@ namespace VEPROMS
private string BuildForcedMessageBody(ProcedureInfo pi)
{
StringBuilder body = new StringBuilder();
- //body.AppendLine("THIS IS A TEST MESSAGE FROM JIM BODINE");
- //body.AppendLine();
- body.AppendLine(string.Format("The administrator needed to force check in procedure {0} so the administrator could continue an administrative tool process", pi.DisplayNumber));
- //body.AppendLine();
- //body.AppendLine("Obviously, you do not really have this procedure checked out, so nothing really got forced checked in.");
- //body.AppendLine();
- //body.AppendLine("However, I would appreciate it if you would reply to this email so I know the email worked");
- //body.AppendLine();
- //body.AppendLine("I will try NOT to overwhelm your email system :-)");
+ body.AppendLine($"The administrator needed to force check in procedure {pi.DisplayNumber} so the administrator could continue an administrative tool process");
return body.ToString();
}
private bool SendOutlookEmail(string email, string subject, string body)
@@ -163,7 +137,7 @@ namespace VEPROMS
if (ex.Message.ToLower().Contains("failed due to the following error: 80080005"))
MessageBox.Show("You cannot send email via a running instance of Outlook from VE PROMS running from within Visual Studio.");
else
- MessageBox.Show(string.Format("{0} - {1}", ex.GetType().Name, ex.Message));
+ MessageBox.Show($"{ex.GetType().Name} - {ex.Message}");
return false;
}
}
@@ -180,7 +154,7 @@ namespace VEPROMS
CheckedOutProcedures = tmp;
if (CheckedOutProcedures.Count == 0)
{
- this.Close();
+ Close();
return;
}
foreach (ProcedureInfo pi in CheckedOutProcedures)
diff --git a/PROMS/VEPROMS User Interface/frmFolderProperties.cs b/PROMS/VEPROMS User Interface/frmFolderProperties.cs
index b15ad4b1..029c0ac5 100644
--- a/PROMS/VEPROMS User Interface/frmFolderProperties.cs
+++ b/PROMS/VEPROMS User Interface/frmFolderProperties.cs
@@ -1,13 +1,9 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
-using System.Data;
using System.Drawing;
-using System.Text;
using System.Windows.Forms;
-using System.IO;
using VEPROMS.CSLA.Library;
-using DevComponents;
using DevComponents.DotNetBar;
using DevComponents.DotNetBar.Controls;
using System.Drawing.Imaging;
@@ -20,9 +16,9 @@ namespace VEPROMS
public partial class frmFolderProperties : DevComponents.DotNetBar.Office2007Form
{
private bool _Initializing = false;
- private FolderConfig _FolderConfig;
- private bool _IsVepromsNode = false;
- private bool _IsDefaultSettingNode = false;
+ private readonly FolderConfig _FolderConfig;
+ private readonly bool _IsVepromsNode = false;
+ private readonly bool _IsDefaultSettingNode = false;
private string _DefaultFormatName = null;
private string _DefaultChgBarType = null;
@@ -31,16 +27,8 @@ namespace VEPROMS
private string _DefaultChgBarUsrMsg1 = null;
private string _DefaultChgBarUsrMsg2 = null;
private string _DefaultROGraficFileExtension = null;
- //private string _DefaultImagePrefix = null;
- //private string _DefaultROPrefix = null;
- //private string _DefaultPagination = null;
private string _DefaultWatermark = null;
- private bool _DefaultDisableDuplex = false;
private string _DefaultFormatColumns = null;
- //private string _ROcolor;
- //private string _TransColor;
- //private string _EditBckgndColor;
- //private string _ViewBckgndColor;
private bool _ValidateTextBox = true;
public frmFolderProperties(FolderConfig folderConfig)
@@ -54,7 +42,7 @@ namespace VEPROMS
btnGeneral.PerformClick(); // always start with General tab or button
_Initializing = false;
// Build window caption
- this.Text = string.Format("{0} Properties",folderConfig.Name);
+ Text = $"{folderConfig.Name} Properties";
if (_IsDefaultSettingNode)
{
// Change these labels for the first node after the VE-PROMS node.
@@ -108,10 +96,6 @@ namespace VEPROMS
}
SetupDefault(_DefaultROGraficFileExtension, ppLblGrphFileExtDefault, ppCmbxGrphFileExt);
- // Get the default Print Pagination
- //_DefaultPagination = _FolderConfig.Print_Pagination.ToString();
- //SetupDefault(EnumDescConverter.GetEnumDescription(_FolderConfig.Print_Pagination), ppLblPaginationDefault, ppCmbxPagination);
-
// Get the default Watermark
_DefaultWatermark = _FolderConfig.Print_Watermark.ToString();
SetupDefault(EnumDescConverter.GetEnumDescription(_FolderConfig.Print_Watermark), ppLblWatermarkDefault, ppCmbxWatermark);
@@ -132,17 +116,8 @@ namespace VEPROMS
private void frmFolderProperties_Load(object sender, EventArgs e)
{
_Initializing = true;
- // populate the a list box of possible graphic file types
- // supported by .NET
-// foreach (ImageCodecInfo info in ImageCodecInfo.GetImageDecoders())
-// {
-// string st = string.Format("{0} - ({1})", info.FormatDescription, info.FilenameExtension);
-// //string st = string.Format("{0}", info.FormatDescription);
-// comboBoxEx1.Items.Add(st);
-// }
imageCodecInfoBindingSource.DataSource = ImageCodecInfo.GetImageDecoders();
- //formatInfoListBindingSource.DataSource = FormatInfoList.Get();
folderConfigBindingSource.DataSource = _FolderConfig;
ppCmbxFormat.DataSource = null;
@@ -160,20 +135,16 @@ namespace VEPROMS
// Get the saved settings for this user
//
// This setting tells us if we should display the default values on this property page
- //ppCbShwDefSettings.Checked = (Settings.Default["ShowDefaultFolderProp"] != null)? Settings.Default.ShowDefaultFolderProp : false;
- if (_IsVepromsNode || Settings.Default["ShowDefaultFolderProp"] == null)
- ppCbShwDefSettings.Checked = false;
- else
- ppCbShwDefSettings.Checked = Settings.Default.ShowDefaultFolderProp;
+ ppCbShwDefSettings.Checked = !_IsVepromsNode && Settings.Default["ShowDefaultFolderProp"] != null && Settings.Default.ShowDefaultFolderProp;
- // Get the User's property page style "PropPageStyle" (this is a system wide user setting)
- // 1 - Button Dialog (default)
- // 2 - Tab Dialog
- if ((int)Settings.Default["PropPageStyle"] == (int)PropPgStyle.Tab)
+ // Get the User's property page style "PropPageStyle" (this is a system wide user setting)
+ // 1 - Button Dialog (default)
+ // 2 - Tab Dialog
+ if ((int)Settings.Default["PropPageStyle"] == (int)PropPgStyle.Tab)
{
tcFolder.TabsVisible = true;
panButtons.Visible = false;
- this.Width -= panButtons.Width;
+ Width -= panButtons.Width;
}
// Get the default values for the property page information
@@ -186,30 +157,26 @@ namespace VEPROMS
{
// if we are at the top node of the tree, remove the Folder Property page tabs
// that do not pertain to this level (top of tree)
- this.tcFolder.Tabs.Remove(tiOutputSettings);
- this.tcFolder.Tabs.Remove(tiEditSettings);
+ tcFolder.Tabs.Remove(tiOutputSettings);
+ tcFolder.Tabs.Remove(tiEditSettings);
// for format settings, include it if the top node's format is NOT the base, i.e. formatid != 1.
// this is done so that PROMS EXPRESS folder specific info can be displayed/used for the top
// node of the tree. The formatid for the top folder for PROMS EXPRESS databases must be
// set manually to the PROMS EXPRESS format.
if (_FolderConfig.MyFolder.MyFormat.FormatID == 1)
{
- this.tcFolder.Tabs.Remove(tiFmtSettings);
- this.btnFormatSettings.Visible = false;
+ tcFolder.Tabs.Remove(tiFmtSettings);
+ btnFormatSettings.Visible = false;
}
- //this.tcFolder.Tabs.Remove(tiAnnoTypes); // TEMPORARY - JSJ
- //this.tcFolder.Tabs.Remove(tiApprvStages);// TEMPORARY - JSJ
- //this.btnAnnoTypes.Visible = false; // TEMPORARY - JSJ
- //this.btnApprvStages.Visible = false; // TEMPORARY - JSJ
- this.btnOutputSettings.Visible = false;
- this.btnEdSettings.Visible = false;
+ btnOutputSettings.Visible = false;
+ btnEdSettings.Visible = false;
ppLblDefSettingsInfo.Visible = false;
ppCbShwDefSettings.Visible = false; // hide check box for showing default values for top node
ppCbShwDefSettings.Checked = false;
// FOR NOW, don't show Start Message tab
// TODO: later on, not needed for initial release.
- this.tcFolder.Tabs.Remove(tiStMsg);
- this.btnStMsg.Visible = false;
+ tcFolder.Tabs.Remove(tiStMsg);
+ btnStMsg.Visible = false;
// Also, for the referenced object tab, the top node (veproms system level) should
// allow setting of the default graphics file extension. No other folder level allows this.
@@ -230,38 +197,23 @@ namespace VEPROMS
tbSqlTimeout.Visible = true;
lblSqlTimeout.Visible = true;
lblSqlTimeoutDefault.Visible = true;
- this.cbIncTranCvtPerm.Visible = true;
- this.cbIncTranCvtPerm.Checked = _FolderConfig.General_IncTranCvtPerm; // C2020-033: defaults to does not have permission
- this.lblIncTrans.Visible = true;
+ cbIncTranCvtPerm.Visible = true;
+ cbIncTranCvtPerm.Checked = _FolderConfig.General_IncTranCvtPerm; // C2020-033: defaults to does not have permission
+ lblIncTrans.Visible = true;
}
else
{
// don't show Start Message or ref obj tab if not at top level
- this.tcFolder.Tabs.Remove(tiStMsg);
- this.tcFolder.Tabs.Remove(tiRefObj);
- this.tcFolder.Tabs.Remove(tiAnnoTypes);
- this.tcFolder.Tabs.Remove(tiRevisionStages);
- this.btnStMsg.Visible = false;
- this.btnRefObjs.Visible = false;
- this.btnAnnoTypes.Visible = false;
- this.btnRevisionStages.Visible = false;
- this.cbIncTranCvtPerm.Visible = false;
- this.lblIncTrans.Visible = false;
-
- /* This color settings property page is currently no visible...
- *
- // this was coded for demo purposes... setup the text colors for the sample text
- // of the Step Editor Text Colors property
- _ROcolor = _FolderConfig.Color_ro;
- if (_ROcolor == string.Empty) _ROcolor = "Orange";
- _EditBckgndColor = _FolderConfig.Color_editbackground;
- if (_EditBckgndColor == string.Empty) _EditBckgndColor = "LightGray";
- _ViewBckgndColor = _FolderConfig.Default_BkColor.Name;
- if (_ViewBckgndColor == string.Empty) _ViewBckgndColor = "White";
- _TransColor = _FolderConfig.Color_transition;
- if (_TransColor == string.Empty) _TransColor = "Orange";
- SetupSampleTextBoxes();
- * */
+ tcFolder.Tabs.Remove(tiStMsg);
+ tcFolder.Tabs.Remove(tiRefObj);
+ tcFolder.Tabs.Remove(tiAnnoTypes);
+ tcFolder.Tabs.Remove(tiRevisionStages);
+ btnStMsg.Visible = false;
+ btnRefObjs.Visible = false;
+ btnAnnoTypes.Visible = false;
+ btnRevisionStages.Visible = false;
+ cbIncTranCvtPerm.Visible = false;
+ lblIncTrans.Visible = false;
// Assign the data sources to the combo boxes
ppCmbxChangeBarType.DataSource = EnumDetail.Details();
@@ -279,11 +231,6 @@ namespace VEPROMS
ppCmbxChgBarTxtType.ValueMember = "EValue";
ppCmbxChgBarTxtType.SelectedValue = -1;
- //ppCmbxPagination.DataSource = EnumDetail.Details();
- //ppCmbxPagination.DisplayMember = "Name";
- //ppCmbxPagination.ValueMember = "EValue";
- //ppCmbxPagination.SelectedValue = -1;
-
ppCmbxWatermark.DataSource = EnumDetail.Details();
ppCmbxWatermark.DisplayMember = "Name";
ppCmbxWatermark.ValueMember = "EValue";
@@ -300,7 +247,7 @@ namespace VEPROMS
// allow setting of the default graphics file extension. No other folder level allows this.
ppCmbxGrphFileExt.Visible = false;
ppLblGrphFileExtDefault.Visible = false;
- this.lblGrphFileExt.Visible = false;
+ lblGrphFileExt.Visible = false;
// HIDE the text box that allows the user to change the Procedure Panel's heading (title) on the panel bar
ppRTxtHeading.Visible = false;
@@ -316,26 +263,19 @@ namespace VEPROMS
{
folderConfigBindingSource.CancelEdit();
DialogResult = DialogResult.Cancel;
- this.Close();
+ Close();
}
- private void ppBtnCancel_MouseEnter(object sender, EventArgs e)
- {
- _ValidateTextBox = false;
- }
+ private void ppBtnCancel_MouseEnter(object sender, EventArgs e) => _ValidateTextBox = false;
- private void ppBtnCancel_MouseLeave(object sender, EventArgs e)
- {
- _ValidateTextBox = true;
- }
+ private void ppBtnCancel_MouseLeave(object sender, EventArgs e) => _ValidateTextBox = true;
- private void ppBtnOK_Click(object sender, EventArgs e)
+ private void ppBtnOK_Click(object sender, EventArgs e)
{
if (btnRevisoinStageUndo.Enabled)
btnRevisoinStageUndo.PerformClick();
if (btnAnnoTypeUndo.Enabled)
btnAnnoTypeUndo.PerformClick();
- //if (btnAnnoTypeSave.Enabled) return;
folderConfigBindingSource.EndEdit();
// Save Default settings for User
@@ -352,7 +292,7 @@ namespace VEPROMS
SaveApprStages();
SaveAnnotationTypes();
DialogResult = DialogResult.OK;
- this.Close();
+ Close();
}
private void SaveApprStages()
@@ -415,9 +355,11 @@ namespace VEPROMS
{
at.Name = found.Name;
at.UserID = Volian.Base.Library.VlnSettings.UserID;
- AnnotationTypeConfig newAtc = new AnnotationTypeConfig();
- newAtc.PrintableText_XLocation = found.PrntLoc;
- at.Config = newAtc.ToString();
+ AnnotationTypeConfig newAtc = new AnnotationTypeConfig
+ {
+ PrintableText_XLocation = found.PrntLoc
+ };
+ at.Config = newAtc.ToString();
at.DTS = DateTime.Now;
at.Save();
}
@@ -436,27 +378,26 @@ namespace VEPROMS
}
foreach (LocalAnnotationTypeInfo lai in myLocalAnnotationTypeInfoList)
{
- AnnotationTypeConfig newAtc = new AnnotationTypeConfig();
- newAtc.PrintableText_XLocation = lai.PrntLoc;
- using (AnnotationType at = AnnotationType.New(lai.Name, newAtc.ToString(), DateTime.Now, Volian.Base.Library.VlnSettings.UserID))
+ AnnotationTypeConfig newAtc = new AnnotationTypeConfig
+ {
+ PrintableText_XLocation = lai.PrntLoc
+ };
+ using (AnnotationType at = AnnotationType.New(lai.Name, newAtc.ToString(), DateTime.Now, Volian.Base.Library.VlnSettings.UserID))
at.Save();
}
AnnotationTypeInfoList.Refresh();
}
- #region General tab
+ #region General tab
- ///
- /// This is the General button used on the button interface design
- ///
- /// object
- /// EventArgs
- private void btnGeneral_Click(object sender, EventArgs e)
- {
- ProcessButtonClick(tiGeneral, btnGeneral);
- }
+ ///
+ /// This is the General button used on the button interface design
+ ///
+ /// object
+ /// EventArgs
+ private void btnGeneral_Click(object sender, EventArgs e) => ProcessButtonClick(tiGeneral, btnGeneral);
- private void ppRTxtName_Leave(object sender, EventArgs e)
+ private void ppRTxtName_Leave(object sender, EventArgs e)
{
if (ppRTxtName.Text == null || ppRTxtName.Text == "")
{
@@ -469,31 +410,28 @@ namespace VEPROMS
bool isunique = _FolderConfig.CheckUniqueName(ppRTxtName.Text);
if (!isunique)
{
- MessageBox.Show(string.Format("The Name '{0}' that was entered is not a unique folder name", ppRTxtName.Text));
+ MessageBox.Show($"The Name '{ppRTxtName.Text}' that was entered is not a unique folder name");
ppRTxtName.Text = _FolderConfig.Name;
}
}
}
- #endregion
+ #endregion
- #region Referenced Objects tab
+ #region Referenced Objects tab
- ///
- /// This is the Referenced Objects button used on the button interface design
- ///
- /// object
- /// EventArgs
- private void btnRefObjs_Click(object sender, EventArgs e)
- {
- ProcessButtonClick(tiRefObj, btnRefObjs);
- }
+ ///
+ /// This is the Referenced Objects button used on the button interface design
+ ///
+ /// object
+ /// EventArgs
+ private void btnRefObjs_Click(object sender, EventArgs e) => ProcessButtonClick(tiRefObj, btnRefObjs);
- ///
- /// Selection in Graphic File Extension combo box changed.
- ///
- /// object
- /// EventArgs
- private void ppCmbxGrphFileExt_SelectedValueChanged(object sender, EventArgs e)
+ ///
+ /// Selection in Graphic File Extension combo box changed.
+ ///
+ /// object
+ /// EventArgs
+ private void ppCmbxGrphFileExt_SelectedValueChanged(object sender, EventArgs e)
{
if (!_Initializing)
ProcessCmbxSelectedValueChange(ppCmbxGrphFileExt, _DefaultROGraficFileExtension, ppBtnDefaultGrphFileExt, ppLblGrphFileExtDefault);
@@ -512,94 +450,25 @@ namespace VEPROMS
if (_DefaultROGraficFileExtension.Equals(_FolderConfig.Graphics_defaultext))
_FolderConfig.Graphics_defaultext = _DefaultROGraficFileExtension;// this will force a database update (write)
ppCmbxGrphFileExt.SelectedIndex = -1; //reset to the default Graphic File Extension setting
- //tcpRefObjs.Focus();
}
- ///
- /// TEMPORARY - TO PROVIDE DEMO FUNCTIONALITY
- /// An RO Folder was selected, find the RO.FST file and populate the RO and Image database combo boxes
- ///
- /// object
- /// EventArgs
- private void ppTxbxRoFoldLoc_TextChanged(object sender, EventArgs e)
- {
- //TODO:
- //string tpath = ppTxbxRoFoldLoc.Text + "\\RO.FST";
- //if (File.Exists(tpath))
- //{
- // build a list of available RO Accessory Page ID's
- //ROFst rofst = ROFst.Get(_DocVersionConfig.MyDocVersion.DocVersionDocVersionROFsts[0].MyROFst.ROFstID);//new ROFst(tpath, null);
- //ROFst.rodbi[] rodblist = rofst.GetRODatabaseList();
- //for (int i = 0; i < rodblist.Length; i++)
- //{
- // string mitem = string.Format("{0} - {1}", rodblist[i].dbiTitle, rodblist[i].dbiAP);
- // switch (rodblist[i].dbiType)
- // {
- // case 7: ppCmbxDefROPrefix.Items.Add(mitem); // setpoint
- // break;
- // case 8: ppCmbxDefImgPrefix.Items.Add(mitem); // graphic
- // break;
- // default: // user defined
- // ppCmbxDefROPrefix.Items.Add(mitem);
- // ppCmbxDefImgPrefix.Items.Add(mitem);
- // break;
- // }
- //}
- //}
- }
- #endregion
+ #endregion
- #region Output Settings tab
+ #region Output Settings tab
- ///
- /// This is the Output Settings button used on the button interface design
- ///
- /// object
- /// EventArgs
- private void btnOutputSettings_Click(object sender, EventArgs e)
- {
- ProcessButtonClick(tiOutputSettings, btnOutputSettings);
- }
+ ///
+ /// This is the Output Settings button used on the button interface design
+ ///
+ /// object
+ /// EventArgs
+ private void btnOutputSettings_Click(object sender, EventArgs e) => ProcessButtonClick(tiOutputSettings, btnOutputSettings);
- ///
- /// Selection in Pagination combo box changed.
- ///
- /// object
- /// EventArgs
- //private void ppCmbxPagination_SelectedValueChanged(object sender, EventArgs e)
- //{
- // if (!_Initializing || !_IsDefaultSettingNode)
- // {
- // PrintPagination pgtn = (PrintPagination)Enum.Parse(typeof(PrintPagination), _DefaultPagination);
- // ProcessCmbxSelectionEnumChanged(ppCmbxPagination, pgtn, ppBtnDefPagination, ppLblPaginationDefault);
- // }
- //}
-
- ///
- /// Reset to the parent setting.
- /// Find the parent setting and assign it to _FolderConfig.Print_Pagination.
- /// This will force the database to be updated.
- ///
- ///
- ///
- //private void ppBtnDefPagination_Click(object sender, EventArgs e)
- //{
- // Console.WriteLine("ppBtnDefPagination_Click");
- // // Get the parent setting
- // PrintPagination pgtn = (PrintPagination)Enum.Parse(typeof(PrintPagination), _DefaultPagination);
- // // Compare parent setting with current setting
- // if (pgtn != _FolderConfig.Print_Pagination)
- // _FolderConfig.Print_Pagination = pgtn; // this will force a database update (write)
- // ppCmbxPagination.SelectedIndex = -1; //reset to the default Pagination setting
- // //tcpOutputSettings.Focus();
- //}
-
- ///
- /// Selection in Watermark combo box changed.
- ///
- /// object
- /// EventArgs
- private void ppCmbxWatermark_SelectedValueChanged(object sender, EventArgs e)
+ ///
+ /// Selection in Watermark combo box changed.
+ ///
+ /// object
+ /// EventArgs
+ private void ppCmbxWatermark_SelectedValueChanged(object sender, EventArgs e)
{
if (!_Initializing)
{
@@ -623,76 +492,46 @@ namespace VEPROMS
if (wtr != _FolderConfig.Print_Watermark)
_FolderConfig.Print_Watermark = wtr; // this will force a database update (write)
ppCmbxWatermark.SelectedIndex = -1; //reset to the default Watermark setting
- //tcpOutputSettings.Focus();
}
+ #endregion
- #endregion
+ #region Startup Message tab
- #region Startup Message tab
+ ///
+ /// This is the Startup Message button used on the button interface design
+ ///
+ /// object
+ /// EventArgs
+ private void btnStMsg_Click(object sender, EventArgs e) => ProcessButtonClick(tiStMsg, btnStMsg);
- ///
- /// This is the Startup Message button used on the button interface design
- ///
- /// object
- /// EventArgs
- private void btnStMsg_Click(object sender, EventArgs e)
- {
- ProcessButtonClick(tiStMsg, btnStMsg);
- }
+ #endregion
- #endregion
+ #region Format Settings tab
- #region Format Settings tab
-
- ///
- /// This is the Format Settings button used on the button interface design
- ///
- /// object
- /// EventArgs
- private void btnFormatSettings_Click(object sender, EventArgs e)
+ ///
+ /// This is the Format Settings button used on the button interface design
+ ///
+ /// object
+ /// EventArgs
+ private void btnFormatSettings_Click(object sender, EventArgs e)
{
ProcessButtonClick(tiFmtSettings, btnFormatSettings);
// added for code change C2017-004 - select default format in dropdown list
if (_InitialIndex < -1) _InitialIndex = ppCmbxFormat.SelectedIndex; // save the current format selection (happens here when current section is set to the default format)
}
- // commented out as part of code change C2017-004. this also makes it consistent with section properties
- /////
- ///// Selection in Format combo box changed.
- /////
- ///// object
- ///// EventArgs
- //private void ppCmbxFormat_SelectedValueChanged(object sender, EventArgs e)
- //{
- // if (!_Initializing)
- // ProcessCmbxSelectedValueChange(ppCmbxFormat, _DefaultFormatName, ppBtnDefaultFmt, ppLblFormatDefault);
- //}
+ private void ppBtnDefaultFmt_Click(object sender, EventArgs e) => ppCmbxFormat.SelectedIndex = -1; //reset to the default Format setting
- private void ppBtnDefaultFmt_Click(object sender, EventArgs e)
+ ///
+ /// Enable or disable the user specified change bar options base on the type
+ /// of change bar selected.
+ ///
+ private void setEnabledUserSpecifiedChgBarCombos(PrintChangeBar pcb)
{
- ppCmbxFormat.SelectedIndex = -1; //reset to the default Format setting
- //tcpFmtSettings.Focus();
- }
-
- ///
- /// Enable or disable the user specified change bar options base on the type
- /// of change bar selected.
- ///
- private void setEnabledUserSpecifiedChgBarCombos(PrintChangeBar pcb)
- {
- //ppGpbxUserSpecCB.Enabled =
- //ppCmbxChgBarPos.Enabled =
- //ppCmbxChgBarTxtType.Enabled =
- //ppBtnDefaultCbPos.Enabled =
- //ppBtnDefCbTxtTyp.Enabled = (ppCmbxChangeBarType.SelectedValue != null &&
- //ppCmbxChangeBarType.SelectedValue.Equals(FolderConfig.PrintChangeBar.WithUserSpecified)) ||
- //(ppCmbxChangeBarType.SelectedValue == null && pcb.Equals(FolderConfig.PrintChangeBar.WithUserSpecified));
-
ppGpbxUserSpecCB.Enabled = (ppCmbxChangeBarType.SelectedValue != null &&
ppCmbxChangeBarType.SelectedValue.Equals(PrintChangeBar.WithUserSpecified)) ||
(ppCmbxChangeBarType.SelectedValue == null && pcb.Equals(PrintChangeBar.WithUserSpecified));
-
}
///
@@ -722,12 +561,9 @@ namespace VEPROMS
// Get the parent setting
PrintChangeBar pcb = (PrintChangeBar)Enum.Parse(typeof(PrintChangeBar), _DefaultChgBarType);
// Compare parent setting with current setting
- //_Initializing = true;
if (pcb != _FolderConfig.Print_ChangeBar)
_FolderConfig.Print_ChangeBar = pcb; // this will force a database update (write)
ppCmbxChangeBarType.SelectedIndex = -1; //reset combo box to the default Change Bar setting
- //_Initializing = false;
- //tcpFmtSettings.Focus();
}
///
@@ -759,7 +595,6 @@ namespace VEPROMS
if (cbl != _FolderConfig.Print_ChangeBarLoc)
_FolderConfig.Print_ChangeBarLoc = cbl; // this will force a database update (write)
ppCmbxChgBarPos.SelectedIndex = -1; //reset to the default Change Bar Position setting
- //tcpFmtSettings.Focus();
}
///
@@ -774,7 +609,6 @@ namespace VEPROMS
PrintChangeBarText cbt = (PrintChangeBarText)Enum.Parse(typeof(PrintChangeBarText), _DefaultChgBarText);
ProcessCmbxSelectionEnumChanged(ppCmbxChgBarTxtType, cbt, ppBtnDefCbTxtTyp, ppLblChgBarTxtTypeDefault);
setEnabledUserSpecifiedChgBarText();
- //tcpFmtSettings.Focus();
}
}
@@ -793,7 +627,6 @@ namespace VEPROMS
if (cbt != _FolderConfig.Print_ChangeBarText)
_FolderConfig.Print_ChangeBarText = cbt; // this will force a database update (write)
ppCmbxChgBarTxtType.SelectedIndex = -1; //reset to the default Change Bar Text Type setting
- //tcpFmtSettings.Focus();
}
///
@@ -802,13 +635,6 @@ namespace VEPROMS
///
private void setEnabledUserSpecifiedChgBarText()
{
- //ppGpbxUserSpecTxt.Enabled =
- //ppTxbxChangeBarUserMsgOne.Enabled =
- //ppTxbxChgBarUserMsgTwo.Enabled =
- //ppBtnDefCbTxt1.Enabled =
- //ppBtnDefCbTxt2.Enabled = (ppCmbxChgBarTxtType.SelectedValue != null &&
- //ppCmbxChgBarTxtType.SelectedValue.Equals(FolderConfig.PrintChangeBarText.UserDef));
-
// This string is used to check against our default setting to see if User Defined Changebar Text is active
string decUserDef = PrintChangeBarText.UserDef.ToString();
@@ -824,8 +650,6 @@ namespace VEPROMS
/// EventArgs
private void ppTxbxChangeBarUserMsgOne_TextChanged(object sender, EventArgs e)
{
- //ppBtnDefCbTxt1.Visible = (!_FolderConfig.Name.Equals("VEPROMS")) &&
- // ((ppTxbxChangeBarUserMsgOne.Text != null) && !ppTxbxChangeBarUserMsgOne.Text.Equals(_DefaultChgBarUsrMsg1));
ppBtnDefCbTxt1.Visible = ((ppTxbxChangeBarUserMsgOne.Text != null) && !ppTxbxChangeBarUserMsgOne.Text.Equals(_DefaultChgBarUsrMsg1));
ppLblChgBarUserMsgOneDefault.Visible = ppCbShwDefSettings.Checked && ppBtnDefCbTxt1.Visible;
}
@@ -837,188 +661,27 @@ namespace VEPROMS
/// EventArgs
private void ppTxbxChangeBarUserMsgTwo_TextChanged(object sender, EventArgs e)
{
- //ppBtnDefCbTxt2.Visible = (!_FolderConfig.Name.Equals("VEPROMS")) &&
- // ((ppTxbxChgBarUserMsgTwo.Text != null) && !ppTxbxChgBarUserMsgTwo.Text.Equals(_DefaultChgBarUsrMsg2));
ppBtnDefCbTxt2.Visible = ((ppTxbxChgBarUserMsgTwo.Text != null) && !ppTxbxChgBarUserMsgTwo.Text.Equals(_DefaultChgBarUsrMsg2));
ppLblChgBarUserMsgTwoDefault.Visible = ppCbShwDefSettings.Checked && ppBtnDefCbTxt2.Visible;
}
- #endregion
+ #endregion
- #region Editor Settings tab
+ #region Editor Settings tab
- ///
- /// This is the Editor Settings button used on the button interface design
- ///
- /// object
- /// EventArgs
- private void btnEdSettings_Click(object sender, EventArgs e)
- {
- ProcessButtonClick(tiEditSettings, btnEdSettings);
- }
+ ///
+ /// This is the Editor Settings button used on the button interface design
+ ///
+ /// object
+ /// EventArgs
+ private void btnEdSettings_Click(object sender, EventArgs e) => ProcessButtonClick(tiEditSettings, btnEdSettings);
- #region Editor Color Property Page Settings
- /** The property page for these color settings is not visible for now.
- *
- ///
- /// Set the text and background colors for the sample text for the Step Editor Text Colors
- /// on the Editor Settings property page
- ///
- private void SetupSampleTextBoxes()
- {
- ppPanelViewSample.BackColor = cGetColor(_ViewBckgndColor);
- ppLblViewRO.ForeColor = cGetColor(_ROcolor);
- ppLblViewTrans.ForeColor = cGetColor(_TransColor);
- ppPanelEditSample.BackColor = cGetColor(_EditBckgndColor);
- ppLblEditRO.ForeColor = cGetColor(_ROcolor);
- ppLblEditTrans.ForeColor = cGetColor(_TransColor);
- }
-
- ///
- /// Selection in View Mode Background Color changed.
- ///
- /// object
- /// EventArgs
- private void ppColorPickerViewModebckgnd_SelectedColorChanged(object sender, EventArgs e)
- {
- _ViewBckgndColor = strMakeColorName(ppColorPickerViewModebckgnd.SelectedColor);
- SetupSampleTextBoxes();
- }
-
- ///
- /// Selection in Edit Mode Background Color changed.
- ///
- /// object
- /// EventArgs
- private void ppColorPickerEditModeBckGnd_SelectedColorChanged(object sender, EventArgs e)
- {
- _EditBckgndColor = strMakeColorName(ppColorPickerEditModeBckGnd.SelectedColor);
- _FolderConfig.Color_editbackground = _EditBckgndColor;
- SetupSampleTextBoxes();
- }
-
- ///
- /// Selection in Transition Color changed.
- ///
- /// object
- /// EventArgs
- private void ppColorPickerTransition_SelectedColorChanged(object sender, EventArgs e)
- {
- _TransColor = strMakeColorName(ppColorPickerTransition.SelectedColor);
- SetupSampleTextBoxes();
- }
-
- ///
- /// Selection in RO Color changed.
- ///
- /// object
- /// EventArgs
- private void ppColorPickerRO_SelectedColorChanged(object sender, EventArgs e)
- {
- _ROcolor = strMakeColorName(ppColorPickerRO.SelectedColor);
- SetupSampleTextBoxes();
- }
-
- ///
- /// Preview the current color under mouse pointer
- /// For View Mode Background
- ///
- /// object
- /// ColorPreviewEventArgs
- private void ppColorPickerViewModebckgnd_ColorPreview(object sender, DevComponents.DotNetBar.ColorPreviewEventArgs e)
- {
- ppPanelViewSample.BackColor = e.Color;
- }
-
- ///
- /// Finalize the current color under mouse pointer
- /// For View Mode Background
- ///
- /// object
- /// EventArgs
- private void ppColorPickerViewModebckgnd_PopupFinalized(object sender, EventArgs e)
- {
- ppPanelViewSample.BackColor = cGetColor(_ViewBckgndColor);
- }
-
- ///
- /// Preview the current color under mouse pointer
- /// For Edit Mode Background
- ///
- /// object
- /// ColorPreviewEventArgs
- private void ppColorPickerEditModeBckGnd_ColorPreview(object sender, DevComponents.DotNetBar.ColorPreviewEventArgs e)
- {
- ppPanelEditSample.BackColor = e.Color;
- }
-
- ///
- /// Finalize the current color under mouse pointer
- /// For Edit Mode Background
- ///
- /// object
- /// EventArgs
- private void ppColorPickerEditModeBckGnd_PopupFinalized(object sender, EventArgs e)
- {
- ppPanelEditSample.BackColor = cGetColor(_EditBckgndColor);
- }
-
- ///
- /// Preview the current color under mouse pointer
- /// For Transition
- ///
- /// object
- /// ColorPreviewEventArgs
- private void ppColorPickerTransition_ColorPreview(object sender, DevComponents.DotNetBar.ColorPreviewEventArgs e)
- {
- ppLblViewTrans.ForeColor = e.Color;
- ppLblEditTrans.ForeColor = e.Color;
- }
-
- ///
- /// Finalize the current color under mouse pointer
- /// For Transition
- ///
- /// object
- /// EventArgs
- private void ppColorPickerTransition_PopupFinalized(object sender, EventArgs e)
- {
- ppLblViewTrans.ForeColor = cGetColor(_TransColor);
- ppLblEditTrans.ForeColor = cGetColor(_TransColor);
- }
-
- ///
- /// Preview the current color under mouse pointer
- /// For RO
- ///
- /// object
- /// ColorPreviewEventArgs
- private void ppColorPickerRO_ColorPreview(object sender, DevComponents.DotNetBar.ColorPreviewEventArgs e)
- {
- ppLblViewRO.ForeColor = e.Color;
- ppLblEditRO.ForeColor = e.Color;
- }
-
- ///
- /// Finalize the current color under mouse pointer
- /// For RO
- ///
- /// object
- /// EventArgs
- private void ppColorPickerRO_PopupFinalized(object sender, EventArgs e)
- {
- ppLblViewRO.ForeColor = cGetColor(_ROcolor);
- ppLblEditRO.ForeColor = cGetColor(_ROcolor);
- }
-**/
- #endregion
-
- ///
- /// Selection in Step Editor Columns combo box changed.
- ///
- /// object
- /// EventArgs
- private void ppCmbxStpEditorCols_SelectedValueChanged(object sender, EventArgs e)
+ ///
+ /// Selection in Step Editor Columns combo box changed.
+ ///
+ /// object
+ /// EventArgs
+ private void ppCmbxStpEditorCols_SelectedValueChanged(object sender, EventArgs e)
{
if (!_Initializing)
{
@@ -1042,59 +705,11 @@ namespace VEPROMS
if (fcl != _FolderConfig.Format_Columns)
_FolderConfig.Format_Columns = fcl; // this will force a database update (write)
ppCmbxStpEditorCols.SelectedIndex = -1; //reset to the default Step Editor Columns setting
- //tcpEdSettings.Focus();
}
- #endregion
+ #endregion
- #region Generic functions used on this property page
-
- ///
- /// Convert the given System.Drawing.Color to a string containing either the color's name or the Argb.
- ///
- /// System.Drawing.Color
- ///
- private string strMakeColorName(Color c)
- {
- string rtnstring = "";
- if (c.IsNamedColor)
- rtnstring = c.Name;
- else
- rtnstring = string.Format("[A={0},R={1},G={2},B={3}]", c.A, c.R, c.G, c.B);
- return rtnstring;
- }
-
- ///
- /// Get a System.Drawing.Color from an Argb or color name
- ///
- /// Color Name or "[(alpha,)red,green,blue]"
- ///
- // a copy of this function was put in frmVEPROMS.CS
- private static Color cGetColor(string strColor)
- {
- Color rtnColor; // = new Color();
- if (strColor == null || strColor.Equals(""))
- rtnColor = Color.White;
- else
- {
- if (strColor[0] == '[')
- {
- string[] parts = strColor.Substring(1, strColor.Length - 2).Split(",".ToCharArray());
- int parts_cnt = 0;
- foreach (string s in parts)
- {
- parts[parts_cnt] = parts[parts_cnt].TrimStart(' '); // remove preceeding blanks
- parts_cnt++;
- }
- if (parts_cnt == 3)
- rtnColor = Color.FromArgb(Int32.Parse(parts[0]), Int32.Parse(parts[1]), Int32.Parse(parts[2]));
- else
- rtnColor = Color.FromArgb(Int32.Parse(parts[0].Substring(2)), Int32.Parse(parts[1].Substring(2)), Int32.Parse(parts[2].Substring(2)), Int32.Parse(parts[3].Substring(2)));
- }
- else rtnColor = Color.FromName(strColor);
- }
- return rtnColor;
- }
+ #region Generic functions used on this property page
///
/// Set the watermark and default label
@@ -1125,7 +740,6 @@ namespace VEPROMS
ppLblStpEditorColsDefault.Visible = ppCbShwDefSettings.Checked && ppBtnDefEdCols.Visible;
ppLblGrphFileExtDefault.Visible = (ppCbShwDefSettings.Checked || _IsVepromsNode) && ppBtnDefaultGrphFileExt.Visible;
ppLblWatermarkDefault.Visible = ppCbShwDefSettings.Checked && ppBtnDefWatermark.Visible;
- //ppLblPaginationDefault.Visible = ppCbShwDefSettings.Checked && ppBtnDefPagination.Visible;
ppLblChgBarTxtTypeDefault.Visible = ppCbShwDefSettings.Checked && ppBtnDefCbTxtTyp.Visible;
ppLblFormatDefault.Visible = ppCbShwDefSettings.Checked && ppBtnDefaultFmt.Visible;
ppLblChangeBarTypeDefault.Visible = ppCbShwDefSettings.Checked && ppBtnDefaultChgBar.Visible;
@@ -1169,7 +783,6 @@ namespace VEPROMS
cmbx.SelectedIndex = -1; // This will hide the Default button
_Initializing = false;
}
- //button.Visible = ((!_FolderConfig.Name.Equals("VEPROMS")) && (cmbx.SelectedValue != null));
button.Visible = (!_IsVepromsNode && (cmbx.SelectedValue != null)&&(cmbx.SelectedIndex >= 0));
deflabel.Visible = ppCbShwDefSettings.Checked && button.Visible;
}
@@ -1214,9 +827,8 @@ namespace VEPROMS
private void tabpage_Enter(object sender, EventArgs e)
{
// Show or hide the labels containing the default values
- //if (!_Initializing)
- defaultSettingsVisiblity();
- }
+ defaultSettingsVisiblity();
+ }
#endregion
private void ppBtnDefCbTxt1_Click(object sender, EventArgs e)
@@ -1225,12 +837,9 @@ namespace VEPROMS
// Reset with the default and hide the default button and label
if (_DefaultChgBarUsrMsg1 != _FolderConfig.Print_UserCBMess1)
{
- //_Initializing = true;
_FolderConfig.Print_UserCBMess1 = _DefaultChgBarUsrMsg1; // this will force a database update (write)
ppLblChgBarUserMsgOneDefault.Visible = false;
ppBtnDefCbTxt1.Visible = false;
- //tcpFmtSettings.Focus();
- //_Initializing = false;
}
}
@@ -1243,39 +852,25 @@ namespace VEPROMS
_FolderConfig.Print_UserCBMess2 = _DefaultChgBarUsrMsg2; // this will force a database update (write)
ppLblChgBarUserMsgTwoDefault.Visible = false;
ppBtnDefCbTxt2.Visible = false;
- //tcpFmtSettings.Focus();
}
}
- private void frmFolderProperties_Shown(object sender, EventArgs e)
- {
- ppRTxtName.Focus();
- }
+ private void frmFolderProperties_Shown(object sender, EventArgs e) => ppRTxtName.Focus();
- private void btnAnnoTypes_Click(object sender, EventArgs e)
- {
- ProcessButtonClick(tiAnnoTypes, btnAnnoTypes);
- }
+ private void btnAnnoTypes_Click(object sender, EventArgs e) => ProcessButtonClick(tiAnnoTypes, btnAnnoTypes);
- private void btnApprvStages_Click(object sender, EventArgs e)
- {
- ProcessButtonClick(tiRevisionStages, btnRevisionStages);
- }
+ private void btnApprvStages_Click(object sender, EventArgs e) => ProcessButtonClick(tiRevisionStages, btnRevisionStages);
- #region Annotation Types
- private void lbAnnotationTypes_SelectedIndexChanged(object sender, System.EventArgs e)
+ #region Annotation Types
+ private void lbAnnotationTypes_SelectedIndexChanged(object sender, System.EventArgs e)
{
if (btnAnnoTypeUndo.Enabled)
{
btnAnnoTypeUndo.Enabled = false;
btnAnnoTypeApply.Enabled = false;
- //DialogResult dr = MessageBox.Show("The Annotation Description was changed. \n\nSave your Changes?", "Annotation Desctiption", MessageBoxButtons.YesNo);
- //if (dr == DialogResult.Yes)
- //{
- myLocalAnnotationTypeInfoList[_LastAnnotationTypeInfoIndex].Name = tbxAnnotationDescription.Text;
- myLocalAnnotationTypeInfoList[_LastAnnotationTypeInfoIndex].PrntLoc = int.Parse(txbPrntLoc.Text == "" ? "0" : txbPrntLoc.Text);
- RefreshAnnotationTypeList();
- //}
+ myLocalAnnotationTypeInfoList[_LastAnnotationTypeInfoIndex].Name = tbxAnnotationDescription.Text;
+ myLocalAnnotationTypeInfoList[_LastAnnotationTypeInfoIndex].PrntLoc = int.Parse(txbPrntLoc.Text == "" ? "0" : txbPrntLoc.Text);
+ RefreshAnnotationTypeList();
}
LoadLocalAnnotationTypeInfo();
}
@@ -1287,22 +882,21 @@ namespace VEPROMS
btnAnnoTypeApply.Enabled = false;
_LastAnnotationTypeInfoIndex = lbAnnotationTypes.SelectedIndex;
- LocalAnnotationTypeInfo ai = lbAnnotationTypes.SelectedValue as LocalAnnotationTypeInfo;
- if (ai == null)
- {
- tbxAnnotationDescription.Text = "";
- tbxAnnotationDescription.Enabled = false;
- btnAnnoTypeUndo.Enabled = false;
- btnAnnoTypeApply.Enabled = false;
- btnAnnoTypeNew.Enabled = true;
- btnAnnoTypeRemove.Enabled = false;
- txbxRemoveMsg.Visible = false;
- lblAnnoTypeCntMessage.Visible = false;
- txbPrntLoc.Visible = false;
- lblPrintTxt.Visible = false;
- return;
- }
- tbxAnnotationDescription.Enabled = true;
+ if (!(lbAnnotationTypes.SelectedValue is LocalAnnotationTypeInfo ai))
+ {
+ tbxAnnotationDescription.Text = "";
+ tbxAnnotationDescription.Enabled = false;
+ btnAnnoTypeUndo.Enabled = false;
+ btnAnnoTypeApply.Enabled = false;
+ btnAnnoTypeNew.Enabled = true;
+ btnAnnoTypeRemove.Enabled = false;
+ txbxRemoveMsg.Visible = false;
+ lblAnnoTypeCntMessage.Visible = false;
+ txbPrntLoc.Visible = false;
+ lblPrintTxt.Visible = false;
+ return;
+ }
+ tbxAnnotationDescription.Enabled = true;
tbxAnnotationDescription.Text = ai.Name;
btnAnnoTypeUndo.Enabled = false;
btnAnnoTypeApply.Enabled = false;
@@ -1317,7 +911,7 @@ namespace VEPROMS
}
else
{
- string countMsg = string.Format("{0} is used in {1} places", ai.Name, ai.AnnotationTypeAnnotationCount);
+ string countMsg = $"{ai.Name} is used in {ai.AnnotationTypeAnnotationCount} places";
btnAnnoTypeRemove.Enabled = false;
lblAnnoTypeCntMessage.Text = countMsg;
txbxRemoveMsg.Visible = true;
@@ -1365,7 +959,6 @@ namespace VEPROMS
LocalAnnotationTypeInfo lati = new LocalAnnotationTypeInfo("New Annotation Type");
lati.Name = string.Format("{0} {1}", lati.Name, lati.TypeID);
myLocalAnnotationTypeInfoList.Add(lati);
- //myLocalAnnotationTypeInfoList.Add(new LocalAnnotationTypeInfo("New Annotation Type"));
btnAnnoTypeUndo.Enabled = false;
btnAnnoTypeApply.Enabled = false;
RefreshAnnotationTypeList();
@@ -1380,12 +973,6 @@ namespace VEPROMS
txbPrntLoc.Undo();
btnAnnoTypeUndo.Enabled = false;
btnAnnoTypeApply.Enabled = false;
- //int saveIdx = lbAnnotationTypes.SelectedIndex;
- //LocalAnnotationTypeInfo ai = lbAnnotationTypes.SelectedValue as LocalAnnotationTypeInfo;
- //btnAnnoTypeSave.Enabled = false;
- //ai.Name = tbxAnnotationDescription.Text;
- //RefreshAnnotationTypeList();
- //lbAnnotationTypes.SelectedIndex = saveIdx;
}
private void btnAnnoTypeRemove_Click(object sender, EventArgs e)
@@ -1415,8 +1002,8 @@ namespace VEPROMS
{
int newloci = int.Parse(newloc);
}
- catch (Exception ex)
- {
+ catch (Exception)
+ {
MessageBox.Show("Invalid Print Location, must be an integer.", "Print Text Location");
e.Cancel = true;
}
@@ -1445,20 +1032,14 @@ namespace VEPROMS
}
}
- private void btnAnnoTypeRemove_MouseEnter(object sender, EventArgs e)
- {
- _ValidateTextBox = false;
- }
+ private void btnAnnoTypeRemove_MouseEnter(object sender, EventArgs e) => _ValidateTextBox = false;
- private void btnAnnoTypeRemove_MouseLeave(object sender, EventArgs e)
- {
- _ValidateTextBox = true;
- }
+ private void btnAnnoTypeRemove_MouseLeave(object sender, EventArgs e) => _ValidateTextBox = true;
- #endregion
- #region Revision Stages
+ #endregion
+ #region Revision Stages
- private void tbRevisionStage_TextChanged(object sender, EventArgs e)
+ private void tbRevisionStage_TextChanged(object sender, EventArgs e)
{
btnRevisoinStageUndo.Enabled = true;
btnRevisionStageApply.Enabled = true;
@@ -1468,8 +1049,7 @@ namespace VEPROMS
private void btnRevisionStageNew_Click(object sender, EventArgs e)
{
LocalStageInfo lsi = new LocalStageInfo("New Stage", 0);
- lsi.Name = string.Format("{0} {1}", lsi.Name, lsi.ID);
- //myLocalStageInfoList.Add(new LocalStageInfo("New Stage", 0));
+ lsi.Name = $"{lsi.Name} {lsi.ID}";
myLocalStageInfoList.Add(lsi);
btnRevisoinStageUndo.Enabled = false;
btnRevisionStageApply.Enabled = false;
@@ -1512,13 +1092,6 @@ namespace VEPROMS
LocalStageInfo si = lbRevisionStages.SelectedValue as LocalStageInfo;
rbApprovalStage.Checked = (si.IsApproved > 0);
rbWorkflowStage.Checked = (si.IsApproved == 0);
- //int savIdx = lbRevisionStages.SelectedIndex;
- //LocalStageInfo si = lbRevisionStages.SelectedValue as LocalStageInfo;
- //si.Name = tbRevisionStage.Text;
- //si.IsApproved = rbRevisionStage.Checked ? 1 : 0;
- //RefreshRevisionStagesList();
- //lbRevisionStages.SelectedIndex = savIdx;
-
}
private void lbRevisionStages_SelectedIndexChanged(object sender, EventArgs e)
@@ -1527,13 +1100,9 @@ namespace VEPROMS
{
btnRevisoinStageUndo.Enabled = false;
btnRevisionStageApply.Enabled = false;
- //DialogResult dr = MessageBox.Show("The Approval Stage Description was changed. \n\nSave your Changes?", "Approval Stage Desctiption", MessageBoxButtons.YesNo);
- //if (dr == DialogResult.Yes)
- //{
- myLocalStageInfoList[_LastStageInfoIndex].Name = tbRevisionStage.Text;
- myLocalStageInfoList[_LastStageInfoIndex].IsApproved = rbApprovalStage.Checked ? 1 : 0;
- RefreshRevisionStagesList();
- //}
+ myLocalStageInfoList[_LastStageInfoIndex].Name = tbRevisionStage.Text;
+ myLocalStageInfoList[_LastStageInfoIndex].IsApproved = rbApprovalStage.Checked ? 1 : 0;
+ RefreshRevisionStagesList();
}
LoadLocalStageInfo();
}
@@ -1543,18 +1112,17 @@ namespace VEPROMS
btnRevisoinStageUndo.Enabled = false;
btnRevisionStageApply.Enabled = false;
_LastStageInfoIndex = lbRevisionStages.SelectedIndex;
- LocalStageInfo si = lbRevisionStages.SelectedValue as LocalStageInfo;
- if (si == null)
- {
- tbRevisionStage.Text = "";
- tbRevisionStage.Enabled = false;
- btnRevisoinStageUndo.Enabled = false;
- btnRevisionStageApply.Enabled = false;
- btnRevisionStageNew.Enabled = true;
- btnRevisionStageRemove.Enabled = false;
- return;
- }
- tbRevisionStage.Enabled = true;
+ if (!(lbRevisionStages.SelectedValue is LocalStageInfo si))
+ {
+ tbRevisionStage.Text = "";
+ tbRevisionStage.Enabled = false;
+ btnRevisoinStageUndo.Enabled = false;
+ btnRevisionStageApply.Enabled = false;
+ btnRevisionStageNew.Enabled = true;
+ btnRevisionStageRemove.Enabled = false;
+ return;
+ }
+ tbRevisionStage.Enabled = true;
tbRevisionStage.Text = si.Name;
if (si.IsApproved > 0)
rbApprovalStage.Checked = true;
@@ -1611,45 +1179,25 @@ namespace VEPROMS
}
}
- private void btnRevisionStageRemove_MouseEnter(object sender, EventArgs e)
- {
- _ValidateTextBox = false;
- }
+ private void btnRevisionStageRemove_MouseEnter(object sender, EventArgs e) => _ValidateTextBox = false;
- private void btnRevisionStageRemove_MouseLeave(object sender, EventArgs e)
- {
- _ValidateTextBox = true;
- }
+ private void btnRevisionStageRemove_MouseLeave(object sender, EventArgs e) => _ValidateTextBox = true;
- private void rbReviseStage_MouseEnter(object sender, EventArgs e)
- {
- _ValidateTextBox = false;
- }
+ private void rbReviseStage_MouseEnter(object sender, EventArgs e) => _ValidateTextBox = false;
- private void rbReviseStage_MouseLeave(object sender, EventArgs e)
- {
- _ValidateTextBox = true;
- }
+ private void rbReviseStage_MouseLeave(object sender, EventArgs e) => _ValidateTextBox = true;
- private void rbApproveStage_MouseEnter(object sender, EventArgs e)
- {
- _ValidateTextBox = false;
- }
+ private void rbApproveStage_MouseEnter(object sender, EventArgs e) => _ValidateTextBox = false;
- private void rbApproveStage_MouseLeave(object sender, EventArgs e)
- {
- _ValidateTextBox = true;
- }
- #endregion
+ private void rbApproveStage_MouseLeave(object sender, EventArgs e) => _ValidateTextBox = true;
+ #endregion
- private void btnRevisionStageApply_Click(object sender, EventArgs e)
+ private void btnRevisionStageApply_Click(object sender, EventArgs e)
{
//add code to apply changes
btnRevisoinStageUndo.Enabled = false;
btnRevisionStageApply.Enabled = false;
LocalStageInfo si = lbRevisionStages.SelectedValue as LocalStageInfo;
- //rbApprovalStage.Checked = (si.IsApproved > 0);
- //rbWorkflowStage.Checked = (si.IsApproved == 0);
si.Name = tbRevisionStage.Text;
si.IsApproved = rbApprovalStage.Checked ? 1 : 0;
RefreshRevisionStagesList();
@@ -1712,36 +1260,16 @@ namespace VEPROMS
public partial class LocalStageInfo
{
private static int _UniqueID = 0;
- protected static int UniqueID
- { get { return --_UniqueID; } }
- private int _MyUniqueID = UniqueID;
- public int MyUniqueID // Absolutely Unique ID - Editable
- { get { return _MyUniqueID; } }
- private int _ID;
- public int ID
- {
- get { return _ID; }
- set { _ID = value; }
- }
- private string _Name;
- public string Name
- {
- get { return _Name; }
- set { _Name = value; }
- }
- private int _IsApproved;
- public int IsApproved
- {
- get { return _IsApproved; }
- set { _IsApproved = value; }
- }
- private int _StageVersionCount;
- public int StageVersionCount
- {
- get { return _StageVersionCount; }
- set { _StageVersionCount = value; }
- }
- public LocalStageInfo(string name, int isApproved)
+ protected static int UniqueID => --_UniqueID;
+ private readonly int _MyUniqueID = UniqueID;
+ // Absolutely Unique ID - Editable
+ public int MyUniqueID => _MyUniqueID;
+
+ public int ID { get; set; }
+ public string Name { get; set; }
+ public int IsApproved { get; set; }
+ public int StageVersionCount { get; set; }
+ public LocalStageInfo(string name, int isApproved)
{
ID = MyUniqueID;
Name = name;
@@ -1755,11 +1283,8 @@ namespace VEPROMS
IsApproved = si.IsApproved;
StageVersionCount = si.StageVersionCount;
}
- public override string ToString()
- {
- return string.Format("{0} {1}", ID, Name);
- }
- }
+ public override string ToString() => $"{ID} {Name}";
+ }
public partial class LocalStageInfoList : List
{
public LocalStageInfoList(StageInfoList sil)
@@ -1774,34 +1299,15 @@ namespace VEPROMS
private static int _UniqueID = 0;
protected static int UniqueID
{ get { return --_UniqueID; } }
- private int _MyUniqueID = UniqueID;
- public int MyUniqueID // Absolutely Unique ID - Editable
- { get { return _MyUniqueID; } }
- private int _TypeID;
- public int TypeID
- {
- get { return _TypeID; }
- set { _TypeID = value; }
- }
- private string _Name;
- public string Name
- {
- get { return _Name; }
- set { _Name = value; }
- }
- private int _PrntLoc;
- public int PrntLoc
- {
- get {return _PrntLoc;}
- set {_PrntLoc = value; }
- }
- private int _AnnotationTypeAnnotationCount;
- public int AnnotationTypeAnnotationCount
- {
- get { return _AnnotationTypeAnnotationCount; }
- set { _AnnotationTypeAnnotationCount = value; }
- }
- public LocalAnnotationTypeInfo(string name)
+ private readonly int _MyUniqueID = UniqueID;
+ // Absolutely Unique ID - Editable
+ public int MyUniqueID => _MyUniqueID;
+
+ public int TypeID { get; set; }
+ public string Name { get; set; }
+ public int PrntLoc { get; set; }
+ public int AnnotationTypeAnnotationCount { get; set; }
+ public LocalAnnotationTypeInfo(string name)
{
TypeID = MyUniqueID;
Name = name;
@@ -1819,11 +1325,8 @@ namespace VEPROMS
}
AnnotationTypeAnnotationCount = ai.AnnotationTypeAnnotationCount;
}
- public override string ToString()
- {
- return string.Format("{0} {1}", TypeID, Name);
- }
- }
+ public override string ToString() => $"{TypeID} {Name}";
+ }
public partial class LocalAnnotationTypeInfoList : List
{
public LocalAnnotationTypeInfoList(AnnotationTypeInfoList ail)
diff --git a/PROMS/VEPROMS User Interface/frmGenTools.cs b/PROMS/VEPROMS User Interface/frmGenTools.cs
index 4d0decc8..d5cff385 100644
--- a/PROMS/VEPROMS User Interface/frmGenTools.cs
+++ b/PROMS/VEPROMS User Interface/frmGenTools.cs
@@ -1,14 +1,9 @@
using System;
using System.Collections.Generic;
-using System.Drawing;
-using System.Text;
using System.Windows.Forms;
using VEPROMS.CSLA.Library;
-using System.IO;
using Volian.Controls.Library;
using DevComponents.DotNetBar;
-using JR.Utils.GUI.Forms;
-using System.Linq;
using System.Data;
using xls = Microsoft.Office.Interop.Excel;
@@ -16,52 +11,42 @@ namespace VEPROMS
{
public partial class frmGenTools : Form
{
- private SessionInfo _MySessionInfo;
- public SessionInfo MySessionInfo
- {
- get { return _MySessionInfo; }
- set { _MySessionInfo = value; }
- }
+ public SessionInfo MySessionInfo { get; set; }
- public frmGenTools(SessionInfo sessionInfo, frmVEPROMS veProms)
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE0060:Remove unused parameter", Justification = "Keeping veProms for potential future use")]
+ public frmGenTools(SessionInfo sessionInfo, frmVEPROMS veProms)
{
InitializeComponent();
- _MySessionInfo = sessionInfo;
+ MySessionInfo = sessionInfo;
// When opening General tools Check tab will be default.
- this.sideNavItmCheck.Checked = true;
+ sideNavItmCheck.Checked = true;
setupProgessSteps1(); // C2017-030 - new Tools user interface
}
- private void frmGenTools_Load(object sender, EventArgs e)
- {
- IsClosing = false;//B2017-221 Allow the batch dialog to close when waiting to process.
- }
- private bool IsClosing = false;//B2017-221 Allow the batch dialog to close when waiting to process.
- private void frmGenTools_FormClosing(object sender, EventArgs e)
- {
- IsClosing = true;//B2017-221 Allow the batch dialog to close when waiting to process.
- }
+ private void frmGenTools_Load(object sender, EventArgs e) => IsClosing = false;//B2017-221 Allow the batch dialog to close when waiting to process.
+ private bool IsClosing = false;//B2017-221 Allow the batch dialog to close when waiting to process.
+ private void frmGenTools_FormClosing(object sender, EventArgs e) => IsClosing = true;//B2017-221 Allow the batch dialog to close when waiting to process.
- // C2017-030 - new Tools user interface
- // tool renamed to Identify Orphan Items
- private void IdentifyDisconnectedItems()
+ // C2017-030 - new Tools user interface
+ // tool renamed to Identify Orphan Items
+ private void IdentifyDisconnectedItems()
{
- this.Cursor = Cursors.WaitCursor;
+ Cursor = Cursors.WaitCursor;
DateTime pStart = DateTime.Now;
txtProcess.AppendText("Identifing Orphan Items");
txtProcess.AppendText(Environment.NewLine);
- txtProcess.AppendText(string.Format("Started: {0}", pStart.ToString("MM/dd/yyyy @ HH:mm")));
+ txtProcess.AppendText($"Started: {pStart:MM/dd/yyyy @ HH:mm}");
txtProcess.AppendText(Environment.NewLine);
Application.DoEvents();
int rowCount = ESP_IdentifyDisconnectedItems.Execute("vesp_GetDisconnectedItemsCount");
- txtProcess.AppendText(string.Format("Orphan Items Count: {0}", rowCount));
+ txtProcess.AppendText($"Orphan Items Count: {rowCount}");
txtProcess.AppendText(Environment.NewLine);
if (rowCount > 0)
{
- txtResults.AppendText(string.Format("The database contains {0} Orphan items.", rowCount));
+ txtResults.AppendText($"The database contains {rowCount} Orphan items.");
txtResults.AppendText(Environment.NewLine);
txtResults.AppendText("These can be removed via the Remove Orphan Data Records in the Repair tools");
txtResults.AppendText(Environment.NewLine);
@@ -74,33 +59,33 @@ namespace VEPROMS
txtResults.AppendText(Environment.NewLine);
}
DateTime pEnd = DateTime.Now;
- txtProcess.AppendText(string.Format("Completed: {0}", pEnd.ToString("MM/dd/yyyy @ HH:mm")));
+ txtProcess.AppendText($"Completed: {pEnd:MM/dd/yyyy @ HH:mm}");
txtProcess.AppendText(Environment.NewLine);
txtProcess.AppendText(Environment.NewLine);
Application.DoEvents();
- this.Cursor = Cursors.Default;
+ Cursor = Cursors.Default;
}
// C2017-030 - new Tools user interface
// is one of two tools run from Check Obsolete RO Data
private void IdentifyUnusedRoFstsAndFigures()
{
- this.Cursor = Cursors.WaitCursor;
+ Cursor = Cursors.WaitCursor;
DateTime pStart = DateTime.Now;
txtProcess.AppendText("Identifing Unused RoFsts and Figures");
txtProcess.AppendText(Environment.NewLine);
- txtProcess.AppendText(string.Format("Started: {0}", pStart.ToString("MM/dd/yyyy @ HH:mm")));
+ txtProcess.AppendText($"Started: {pStart:MM/dd/yyyy @ HH:mm}");
txtProcess.AppendText(Environment.NewLine);
Application.DoEvents();
int rowCountRoFst = ESP_GetUnusedRoFsts.Execute("vesp_GetUnusedRoFstsCount");
int rowCountFigures = ESP_GetUnusedFigures.Execute("vesp_GetUnusedFiguresCount");
- txtProcess.AppendText(string.Format("Unused RoFsts Count: {0}, Unused Figures Count: {1}", rowCountRoFst, rowCountFigures));
+ txtProcess.AppendText($"Unused RoFsts Count: {rowCountRoFst}, Unused Figures Count: {rowCountFigures}");
txtProcess.AppendText(Environment.NewLine);
if (rowCountRoFst > 0 || rowCountFigures > 0)
{
- txtResults.AppendText(string.Format("The database contains {0} unused RoFsts.", rowCountRoFst));
+ txtResults.AppendText($"The database contains {rowCountRoFst} unused RoFsts.");
txtResults.AppendText(Environment.NewLine);
- txtResults.AppendText(string.Format("The database contains {0} unused Figures items.", rowCountFigures));
+ txtResults.AppendText($"The database contains {rowCountFigures} unused Figures items.");
txtResults.AppendText(Environment.NewLine);
txtResults.AppendText(Environment.NewLine);
}
@@ -112,31 +97,31 @@ namespace VEPROMS
}
DateTime pEnd = DateTime.Now;
- txtProcess.AppendText(string.Format("Completed: {0}", pEnd.ToString("MM/dd/yyyy @ HH:mm")));
+ txtProcess.AppendText($"Completed: {pEnd:MM/dd/yyyy @ HH:mm}");
txtProcess.AppendText(Environment.NewLine);
- txtProcess.AppendText(string.Format("Started: {0}", pStart.ToString("MM/dd/yyyy @ HH:mm")));
+ txtProcess.AppendText($"Started: {pStart:MM/dd/yyyy @ HH:mm}");
txtProcess.AppendText(Environment.NewLine);
Application.DoEvents();
- this.Cursor = Cursors.Default;
+ Cursor = Cursors.Default;
}
// C2017-030 - new Tools user interface
// is one of two tools run from Check Obsolete RO Data
private void IdentifyROAssociations()
{
- this.Cursor = Cursors.WaitCursor;
+ Cursor = Cursors.WaitCursor;
DateTime pStart = DateTime.Now;
txtProcess.AppendText("Identifing Unused RO Associations");
txtProcess.AppendText(Environment.NewLine);
- txtProcess.AppendText(string.Format("Started: {0}", pStart.ToString("MM/dd/yyyy @ HH:mm")));
+ txtProcess.AppendText($"Started: {pStart:MM/dd/yyyy @ HH:mm}");
txtProcess.AppendText(Environment.NewLine);
Application.DoEvents();
int rowCount = ESP_GetROAssoc.Execute("vesp_GetUnusedROAssociationsCount");
- txtProcess.AppendText(string.Format("Unused RO Associations Count: {0}", rowCount));
+ txtProcess.AppendText($"Unused RO Associations Count: {rowCount}");
txtProcess.AppendText(Environment.NewLine);
if (rowCount > 0)
{
- txtResults.AppendText(string.Format("The database contains {0} unused RO Associations.", rowCount));
+ txtResults.AppendText($"The database contains {rowCount} unused RO Associations.");
txtResults.AppendText(Environment.NewLine);
txtResults.AppendText(Environment.NewLine);
}
@@ -147,26 +132,26 @@ namespace VEPROMS
txtResults.AppendText(Environment.NewLine);
}
DateTime pEnd = DateTime.Now;
- txtProcess.AppendText(string.Format("Completed: {0}", pEnd.ToString("MM/dd/yyyy @ HH:mm")));
+ txtProcess.AppendText($"Completed: {pEnd:MM/dd/yyyy @ HH:mm}");
txtProcess.AppendText(Environment.NewLine);
txtProcess.AppendText(Environment.NewLine);
Application.DoEvents();
- this.Cursor = Cursors.Default;
+ Cursor = Cursors.Default;
}
// C2017-030 - new Tools user interface
// tool was renamed to Hidden Data Locations (on Check list)
private void IdentifyNonEditableItems()
{
- this.Cursor = Cursors.WaitCursor;
+ Cursor = Cursors.WaitCursor;
DateTime pStart = DateTime.Now;
txtProcess.AppendText("Identifing Hidden Item Locations");
txtProcess.AppendText(Environment.NewLine);
- txtProcess.AppendText(string.Format("Started: {0}", pStart.ToString("MM/dd/yyyy @ HH:mm")));
+ txtProcess.AppendText($"Started: {pStart:MM/dd/yyyy @ HH:mm}");
txtProcess.AppendText(Environment.NewLine);
Application.DoEvents();
List myItems = ESP_IdentifyNonEditableItems.Execute("vesp_GetNonEditableItems");
- txtProcess.AppendText(string.Format("Hidden Items Count: {0}", myItems.Count));
+ txtProcess.AppendText($"Hidden Items Count: {myItems.Count}");
txtProcess.AppendText(Environment.NewLine);
if (myItems.Count > 0)
{
@@ -190,52 +175,46 @@ namespace VEPROMS
//clear the list since no longer using it
myItems.Clear();
DateTime pEnd = DateTime.Now;
- txtProcess.AppendText(string.Format("Completed: {0}", pEnd.ToString("MM/dd/yyyy @ HH:mm")));
+ txtProcess.AppendText($"Completed: {pEnd:MM/dd/yyyy @ HH:mm}");
txtProcess.AppendText(Environment.NewLine);
txtProcess.AppendText(Environment.NewLine);
Application.DoEvents();
- this.Cursor = Cursors.Default;
+ Cursor = Cursors.Default;
}
// C2017-030 - new Tools user interface
// tool was renamed to Show Users
private void GetDatabaseSessions()
{
- this.Cursor = Cursors.WaitCursor;
+ Cursor = Cursors.WaitCursor;
DateTime pStart = DateTime.Now;
txtProcess.AppendText("Show Users in PROMS");
txtProcess.AppendText(Environment.NewLine);
- txtProcess.AppendText(string.Format("Started: {0}", pStart.ToString("MM/dd/yyyy @ HH:mm")));
+ txtProcess.AppendText($"Started: {pStart:MM/dd/yyyy @ HH:mm}");
txtProcess.AppendText(Environment.NewLine);
Application.DoEvents();
txtResults.Clear();
txtResults.AppendText(ESP_GetDatabaseSessions.Execute("vesp_GetDatabaseSessions"));
DateTime pEnd = DateTime.Now;
- txtProcess.AppendText(string.Format("Completed: {0}", pEnd.ToString("MM/dd/yyyy @ HH:mm")));
+ txtProcess.AppendText($"Completed: {pEnd:MM/dd/yyyy @ HH:mm}");
Application.DoEvents();
- this.Cursor = Cursors.Default;
+ Cursor = Cursors.Default;
MessageBox.Show("Show Users Completed", "Show Users");
}
- public List roFstInfo_ROTableUpdate(object sender, ROFstInfoROTableUpdateEventArgs args)
- {
- return VlnFlexGrid.ROTableUpdate(sender, args);
- }
+ private void btnClear_Click(object sender, EventArgs e) => txtResults.Clear();
- private void btnClear_Click(object sender, EventArgs e)
+ private void btnSave_Click(object sender, EventArgs e)
{
- txtResults.Clear();
- }
-
- private void btnSave_Click(object sender, EventArgs e)
- {
- SaveFileDialog sfd = new SaveFileDialog();
- sfd.DefaultExt = "txt";
- sfd.AddExtension = true;
- sfd.Filter = "Text Files (*.txt)|*.txt";
- sfd.FileName = string.Format("BatchRefreshResults_{0}", DateTime.Now.ToString("yyyyMMdd_HHmm"));
- sfd.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + @"\VEPROMS";
- DialogResult dr = sfd.ShowDialog();
+ SaveFileDialog sfd = new SaveFileDialog
+ {
+ DefaultExt = "txt",
+ AddExtension = true,
+ Filter = "Text Files (*.txt)|*.txt",
+ FileName = $"BatchRefreshResults_{DateTime.Now:yyyyMMdd_HHmm}",
+ InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + @"\VEPROMS"
+ };
+ DialogResult dr = sfd.ShowDialog();
if (dr == DialogResult.OK)
{
@@ -257,13 +236,10 @@ namespace VEPROMS
}
}
- private void chkLater_CheckedChanged(object sender, EventArgs e)
- {
- pnlLater.Enabled = chkLater.Checked;
- }
+ private void chkLater_CheckedChanged(object sender, EventArgs e) => pnlLater.Enabled = chkLater.Checked;
- // C2017-030 new Tools user interface
- private void sideNavItmCheck_Click(object sender, EventArgs e)
+ // C2017-030 new Tools user interface
+ private void sideNavItmCheck_Click(object sender, EventArgs e)
{
GenToolType = E_GenToolType.Check;
lblAdmToolProgressType.Text = "Checking:";
@@ -284,16 +260,13 @@ namespace VEPROMS
setupProgessSteps1();
}
- // C2017-030 new Tools user interface
- private void sideNavItmExit_Click(object sender, EventArgs e)
- {
- this.Close();
- }
+ // C2017-030 new Tools user interface
+ private void sideNavItmExit_Click(object sender, EventArgs e) => Close();
- #region On/Off Swiches
+ #region On/Off Swiches
- // C2017-030 new Tools user interface
- private enum E_GenToolType : int
+ // C2017-030 new Tools user interface
+ private enum E_GenToolType : int
{
Check = 0,
Users = 3,
@@ -301,9 +274,9 @@ namespace VEPROMS
};
private E_GenToolType GenToolType = 0;
- DevComponents.DotNetBar.StepItem siOrphDatRecs = new DevComponents.DotNetBar.StepItem("siOrphDatRecs", "Orphan Data Records");
- DevComponents.DotNetBar.StepItem siHiddenDataLocs = new DevComponents.DotNetBar.StepItem("siHiddenDataLocs", "Hidden Data");
- DevComponents.DotNetBar.StepItem siObsoleteROData = new DevComponents.DotNetBar.StepItem("siObsoleteROData", "Obsolete RO Data");
+ readonly DevComponents.DotNetBar.StepItem siOrphDatRecs = new DevComponents.DotNetBar.StepItem("siOrphDatRecs", "Orphan Data Records");
+ readonly DevComponents.DotNetBar.StepItem siHiddenDataLocs = new DevComponents.DotNetBar.StepItem("siHiddenDataLocs", "Hidden Data");
+ readonly DevComponents.DotNetBar.StepItem siObsoleteROData = new DevComponents.DotNetBar.StepItem("siObsoleteROData", "Obsolete RO Data");
// this will update/rebuild the progress bar in the bottom panel of Tools
private void setupProgessSteps1()
@@ -332,22 +305,16 @@ namespace VEPROMS
}
}
- // used for all of the Switch buttons (ON/OFF buttons)
- private void swCk_ValueChanged(object sender, EventArgs e)
- {
- setupProgessSteps1();
- }
+ // used for all of the Switch buttons (ON/OFF buttons)
+ private void swCk_ValueChanged(object sender, EventArgs e) => setupProgessSteps1();
- #endregion
+ #endregion
- // C2017-030 New Tools user interface
- // functions to handle the progress bar in the bottom panel of Tools
- private void StepProgress(int prgStpIdx, int val)
- {
- ((DevComponents.DotNetBar.StepItem)progressSteps1.Items[prgStpIdx]).Value = val;
- }
+ // C2017-030 New Tools user interface
+ // functions to handle the progress bar in the bottom panel of Tools
+ private void StepProgress(int prgStpIdx, int val) => ((DevComponents.DotNetBar.StepItem)progressSteps1.Items[prgStpIdx]).Value = val;
- private void ClearStepProgress()
+ private void ClearStepProgress()
{
for (int i = 0; i < progressSteps1.Items.Count; i++)
{
@@ -362,7 +329,7 @@ namespace VEPROMS
{
if (chkLater.Checked)
{
- long later = long.Parse(dtpDate.Value.ToString("yyyyMMdd") + dtpTime.Value.ToString("HHmm"));
+ long later = long.Parse($"{dtpDate.Value:yyyyMMdd}{dtpTime.Value:HHmm}");
long now = long.Parse(DateTime.Now.ToString("yyyyMMddHHmm"));
while (now < later)
@@ -435,10 +402,12 @@ namespace VEPROMS
{
if (string.IsNullOrEmpty(UACfilename))
{
- SaveFileDialog sfd = new SaveFileDialog();
- sfd.Filter = "Excel XLS (*.xlsx)|*.xlsx";
- sfd.FileName = "UACReport.xlsx";
- if (sfd.ShowDialog() == DialogResult.OK)
+ SaveFileDialog sfd = new SaveFileDialog
+ {
+ Filter = "Excel XLS (*.xlsx)|*.xlsx",
+ FileName = "UACReport.xlsx"
+ };
+ if (sfd.ShowDialog() == DialogResult.OK)
{
UACfilename = sfd.FileName;
}
@@ -462,11 +431,11 @@ namespace VEPROMS
//Get Datatable of results then loop through outputting into excel
private void Generate_UAC_Report(string filename)
{
- this.Cursor = Cursors.WaitCursor;
+ Cursor = Cursors.WaitCursor;
DateTime pStart = DateTime.Now;
txtProcess.AppendText("Generate User Access Control Report in PROMS");
txtProcess.AppendText(Environment.NewLine);
- txtProcess.AppendText(string.Format("Started: {0}", pStart.ToString("MM/dd/yyyy @ HH:mm")));
+ txtProcess.AppendText($"Started: {pStart:MM/dd/yyyy @ HH:mm}");
txtProcess.AppendText(Environment.NewLine);
Application.DoEvents();
txtResults.Clear();
@@ -525,9 +494,9 @@ namespace VEPROMS
}
DateTime pEnd = DateTime.Now;
- txtProcess.AppendText(string.Format("Completed: {0}", pEnd.ToString("MM/dd/yyyy @ HH:mm")));
+ txtProcess.AppendText($"Completed: {pEnd:MM/dd/yyyy @ HH:mm}");
Application.DoEvents();
- this.Cursor = Cursors.Default;
+ Cursor = Cursors.Default;
MessageBox.Show("Generate User Access Control Report Completed", "User Access Control Report");
}
@@ -544,7 +513,7 @@ namespace VEPROMS
catch (Exception ex)
{
obj = null;
- MessageBox.Show("Exception Occurred while releasing object " + ex.ToString());
+ MessageBox.Show($"Exception Occurred while releasing object {ex}");
}
finally
{
@@ -552,18 +521,11 @@ namespace VEPROMS
}
}
- //C2025-011 RO Update Tool Memory Enhancements
- private void txtProcess_TextChanged(object sender, EventArgs e)
- {
- //clears the stack to help with memory - should never need to undo text changes to this.
- txtProcess.ClearUndo();
- }
-
- private void txtResults_TextChanged(object sender, EventArgs e)
- {
- //clears the stack to help with memory - should never need to undo text changes to this.
- txtResults.ClearUndo();
- }
+ //C2025-011 RO Update Tool Memory Enhancements
+ //clears the stack to help with memory - should never need to undo text changes to this.
+ private void txtProcess_TextChanged(object sender, EventArgs e) => txtProcess.ClearUndo();
+ //clears the stack to help with memory - should never need to undo text changes to this.
+ private void txtResults_TextChanged(object sender, EventArgs e) => txtResults.ClearUndo();
}
}
diff --git a/PROMS/VEPROMS User Interface/frmManageUser.cs b/PROMS/VEPROMS User Interface/frmManageUser.cs
index f9ac650e..6e5faba2 100644
--- a/PROMS/VEPROMS User Interface/frmManageUser.cs
+++ b/PROMS/VEPROMS User Interface/frmManageUser.cs
@@ -1,9 +1,5 @@
using System;
-using System.Collections.Generic;
using System.ComponentModel;
-using System.Data;
-using System.Drawing;
-using System.Text;
using System.Windows.Forms;
using VEPROMS.CSLA.Library;
@@ -40,10 +36,10 @@ namespace VEPROMS
tmp = $"{su.UserID} Information";
}
- this.Text = tmp;
+ Text = tmp;
}
}
- private string _Mode;
+ private readonly string _Mode;
public frmManageUser(string mode)
{
InitializeComponent();
@@ -55,7 +51,7 @@ namespace VEPROMS
_MyUser = (pgUser.SelectedObject as SimpleUser).MyUser;
if (_MyUser.UserID.StartsWith("["))
{
- MessageBox.Show(string.Format("{0} is an invalid UserID", _MyUser.UserID));
+ MessageBox.Show($"{_MyUser.UserID} is an invalid UserID");
return;
}
if (_MyUser.UserID == string.Empty)
@@ -65,29 +61,26 @@ namespace VEPROMS
}
if (UserInfo.GetByUserID(_MyUser.UserID) != null && _Mode.ToUpper() == "ADD")
{
- MessageBox.Show(string.Format("A user already exists with the UserID '{0}'", _MyUser.UserID));
+ MessageBox.Show($"A user already exists with the UserID '{_MyUser.UserID}'");
return;
}
_MyUser.Save();
- this.DialogResult = DialogResult.OK;
+ DialogResult = DialogResult.OK;
}
private void btnCancel_Click(object sender, EventArgs e)
{
_MyUser = User.Get(_MyUser.UID);
- this.DialogResult = DialogResult.Cancel;
+ DialogResult = DialogResult.Cancel;
}
}
internal class SimpleUser
{
- private User _MyUser;
- private UserConfig _MyUC;
- [Browsable(false)]
- public User MyUser
- {
- get { return _MyUser; }
- }
- public SimpleUser(User myUser)
+ private readonly User _MyUser;
+ private readonly UserConfig _MyUC;
+ [Browsable(false)]
+ public User MyUser => _MyUser;
+ public SimpleUser(User myUser)
{
_MyUser = myUser;
_MyUC = new UserConfig(myUser.Config);
diff --git a/PROMS/VEPROMS User Interface/frmPDFStatusForm.cs b/PROMS/VEPROMS User Interface/frmPDFStatusForm.cs
index 14ddb2ab..dbfec5cb 100644
--- a/PROMS/VEPROMS User Interface/frmPDFStatusForm.cs
+++ b/PROMS/VEPROMS User Interface/frmPDFStatusForm.cs
@@ -1,9 +1,6 @@
using System;
using System.Collections.Generic;
-using System.ComponentModel;
-using System.Data;
using System.Drawing;
-using System.Text;
using System.Windows.Forms;
using Volian.Print.Library;
using VEPROMS.CSLA.Library;
@@ -14,90 +11,24 @@ namespace VEPROMS
{
public partial class frmPDFStatusForm : Form
{
- private bool _CancelPrinting = false;
- public bool CancelPrinting
- {
- get { return _CancelPrinting; }
- set { _CancelPrinting = value; }
- }
- private bool _CloseWhenDone = false;
- public bool CloseWhenDone
- {
- get { return _CloseWhenDone; }
- set { _CloseWhenDone = value; }
- }
- private bool _CancelStop = false;
- public bool CancelStop
- {
- get { return _CancelStop; }
- set { _CancelStop = value; }
- }
- private bool _Stop = false;
- public bool Stop
- {
- get { return _Stop; }
- set { _Stop = value; }
- }
- private string _PDFPath;
+ public bool CancelPrinting { get; set; } = false;
+ public bool CloseWhenDone { get; set; } = false;
+ public bool CancelStop { get; set; } = false;
+ public bool Stop { get; set; } = false;
- public string PDFPath
- {
- get { return _PDFPath; }
- set { _PDFPath = value; }
- }
- private PromsPrinter _MyPromsPrinter;
+ public string PDFPath { get; set; }
- public PromsPrinter MyPromsPrinter
- {
- get { return _MyPromsPrinter; }
- set { _MyPromsPrinter = value; }
- }
+ public PromsPrinter MyPromsPrinter { get; set; }
- private bool _OpenPDF;
+ public bool OpenPDF { get; set; }
+ private Point _NewLocation;
- public bool OpenPDF
- {
- get { return _OpenPDF; }
- set { _OpenPDF = value; }
- }
- private Point _NewLocation;
- private string _Prefix = ""; // RHM20150506 Multiline ItemID TextBox
- public string Prefix
- {
- get { return _Prefix; }
- set { _Prefix = value; }
- }
- // this flag is used when the Continuous Action Sumamry is printed from the tree or ribbon button
- // it will prevent the temporary PDF (generated with printing - needed to get page numbers) from being displayed
- // and will delete that temporary PDF file
- private bool _OnlyShowContinuousActionSummary = false;
- public bool OnlyShowContinuousActionSummary
- {
- get { return _OnlyShowContinuousActionSummary; }
- set { _OnlyShowContinuousActionSummary = value; }
- }
- // F2022-024 this flag is used when the Time Critical Action Sumamry is printed from the tree or ribbon button
- // it will prevent the temporary PDF (generated with printing - needed to get page numbers) from being displayed
- // and will delete that temporary PDF file
- private bool _OnlyShowTimeCriticalActionSummary = false;
- public bool OnlyShowTimeCriticalActionSummary
- {
- get { return _OnlyShowTimeCriticalActionSummary; }
- set { _OnlyShowTimeCriticalActionSummary = value; }
- }
- private bool _DidAll = false;
- public bool DidAll
- {
- get { return _DidAll; }
- set { _DidAll = value; }
- }
- private int _prtSectID = -1;
- public int PrtSectID
- {
- get { return _prtSectID; }
- set { _prtSectID = value; }
- }
- public frmPDFStatusForm(ItemInfo myItem, string rev, string watermark, bool debugOutput, bool origPgBrk, bool openPDF, bool overWrite, string pdfPath, ChangeBarDefinition cbd, string pdfFile, Point newLocation, bool insertBlankPages, bool allOrAuto, string prefix, bool saveLinks, int removeTrailingHardReturnsAndManualPageBreaks, bool showPROMSVer, bool didAll, string blankPageText, MergedPdf mergedPdf, string watermarkColor, int PrtSectID = -1)
+ public string Prefix { get; set; } = "";
+ public bool OnlyShowContinuousActionSummary { get; set; } = false;
+ public bool OnlyShowTimeCriticalActionSummary { get; set; } = false;
+ public bool DidAll { get; set; } = false;
+ public int PrtSectID { get; set; } = -1;
+ public frmPDFStatusForm(ItemInfo myItem, string rev, string watermark, bool debugOutput, bool origPgBrk, bool openPDF, bool overWrite, string pdfPath, ChangeBarDefinition cbd, string pdfFile, Point newLocation, bool insertBlankPages, bool allOrAuto, string prefix, bool saveLinks, int removeTrailingHardReturnsAndManualPageBreaks, bool showPROMSVer, bool didAll, string blankPageText, MergedPdf mergedPdf, string watermarkColor, int PrtSectID = -1)
{
// B2021-088 moved this if/else from CreatePDF() so that the Approval logic will have access to this logic
ProcedureInfo MyProcedure = myItem as ProcedureInfo;
@@ -114,28 +45,29 @@ namespace VEPROMS
// B2021-102 moved the baseline meta file write here too - should have been done with B2021-088 fix
// C2018-015 add the procedure tree path and the procedure number and title to the meta file
- if (BaselineMetaFile.IsOpen) BaselineMetaFile.WriteLine("!! {0}", MyProcedure.SearchDVPath.Replace("\a", " | "));
- if (BaselineMetaFile.IsOpen) BaselineMetaFile.WriteLine("!! {0} | {1}", MyProcedure.DisplayNumber, MyProcedure.DisplayText);
+ if (BaselineMetaFile.IsOpen) BaselineMetaFile.WriteLine($"!! {MyProcedure.SearchDVPath.Replace("\a", " | ")}");
+ if (BaselineMetaFile.IsOpen) BaselineMetaFile.WriteLine($"!! {MyProcedure.DisplayNumber} | {MyProcedure.DisplayText}");
myItem = MyProcedure;
Prefix = prefix;
OpenPDF = openPDF;
DidAll = didAll;
- _prtSectID = PrtSectID;
+ this.PrtSectID = PrtSectID;
InitializeComponent();
- // if the version number of PROMS is 1.0, then we are running a Demo version.
- // When running a Demo version, force a "Sample" watermark when printing.
- // B2020-022 append a ".pdf" extension if the file name does on have one.
- MyPromsPrinter = new PromsPrinter(myItem, rev, (VlnSettings.ReleaseMode.Equals("DEMO")) ? "Sample" : watermark, debugOutput, origPgBrk, pdfPath + @"\Compare", false, overWrite, cbd, (pdfFile.ToUpper().EndsWith(".PDF"))?pdfFile:pdfFile+".pdf", insertBlankPages, allOrAuto,Prefix,saveLinks,removeTrailingHardReturnsAndManualPageBreaks, blankPageText, DidAll, mergedPdf, watermarkColor);
-
- MyPromsPrinter.PromsVersion = (showPROMSVer) ? AboutVEPROMS.PROMSVersion : ""; //C2018-009 print PROMS version
-
-
- PDFPath = pdfPath;
- this.Text = "Creating PDF of " + myItem.DisplayNumber;
+ // if the version number of PROMS is 1.0, then we are running a Demo version.
+ // When running a Demo version, force a "Sample" watermark when printing.
+ // B2020-022 append a ".pdf" extension if the file name does on have one.
+ MyPromsPrinter = new PromsPrinter(myItem, rev, (VlnSettings.ReleaseMode.Equals("DEMO")) ? "Sample" : watermark, debugOutput, origPgBrk, pdfPath + @"\Compare", false, overWrite, cbd, (pdfFile.ToUpper().EndsWith(".PDF")) ? pdfFile : $"{pdfFile}.pdf", insertBlankPages, allOrAuto, Prefix, saveLinks, removeTrailingHardReturnsAndManualPageBreaks, blankPageText, DidAll, mergedPdf, watermarkColor)
+ {
+ PromsVersion = (showPROMSVer) ? AboutVEPROMS.PROMSVersion : "" //C2018-009 print PROMS version
+ };
+
+
+ PDFPath = pdfPath;
+ Text = $"Creating PDF of {myItem.DisplayNumber}";
_NewLocation = newLocation;
DialogResult = DialogResult.OK;
@@ -162,24 +94,18 @@ namespace VEPROMS
if (waterMarkText.ToUpper() == "[U-TEXT]")
{
string utxt = (procInfo.MyDocVersion.MultiUnitCount > 1) ? procInfo.MyDocVersion.DocVersionConfig.Unit_Text : "";
- waterMarkText = (utxt == null) ? "" : utxt;
+ waterMarkText = utxt ?? "";
}
else if (waterMarkText.ToUpper() == "[U-NUMBER]")
{
string uNum = (procInfo.MyDocVersion.MultiUnitCount > 1) ? procInfo.MyDocVersion.DocVersionConfig.Unit_Number : "";
- waterMarkText = (uNum == null) ? "" : uNum;
+ waterMarkText = uNum ?? "";
}
}
}
- // used when the approved function creates an export file with unlinked ROs and Transitons. Word sections that have RO tokens are saved with the RO Vaules in DocReplace
- // DocReplace is passed on to the Export functions.
- private Dictionary _DocReplace;
- public Dictionary DocReplace
- {
- get { return _DocReplace; }
- set { _DocReplace = value; }
- }
- public bool AllowAllWatermarks
+
+ public Dictionary DocReplace { get; set; }
+ public bool AllowAllWatermarks
{
get { return MyPromsPrinter.AllowAllWatermarks; }
set { MyPromsPrinter.AllowAllWatermarks = value; }
@@ -195,7 +121,7 @@ namespace VEPROMS
if (args.Progress == pb.Maximum)
pb.Text = args.MyStatus;
else
- pb.Text = string.Format("Processing {0} ({1} of {2})", args.MyStatus, args.Progress + 1, pb.Maximum);
+ pb.Text = $"Processing {args.MyStatus} ({args.Progress + 1} of {pb.Maximum})";
}
MyStatus = args.MyStatus;
Application.DoEvents();
@@ -217,38 +143,15 @@ namespace VEPROMS
Text = Text.Replace("PDF", "Time Critical Action Summary"); // F2022-024 Time Critical Action
}
- private string _PdfFile;
- public string PdfFile
- {
- get { return _PdfFile; }
- set { _PdfFile = value; }
- }
- private bool _MakePlaceKeeper = false;
+ public string PdfFile { get; set; }
- public bool MakePlaceKeeper
- {
- get { return _MakePlaceKeeper; }
- set { _MakePlaceKeeper = value; }
- }
+ public bool MakePlaceKeeper { get; set; } = false;
- private bool _MakeContinuousActionSummary = false;
+ public bool MakeContinuousActionSummary { get; set; } = false;
- public bool MakeContinuousActionSummary
- {
- get { return _MakeContinuousActionSummary; }
- set { _MakeContinuousActionSummary = value; }
- }
+ public bool MakeTimeCriticalActionSummary { get; set; } = false;
- // F2022-024 Time Critical Action Summary
- private bool _MakeTimeCriticalActionSummary = false;
-
- public bool MakeTimeCriticalActionSummary
- {
- get { return _MakeTimeCriticalActionSummary; }
- set { _MakeTimeCriticalActionSummary = value; }
- }
-
- private void tmrRun_Tick(object sender, EventArgs e)
+ private void tmrRun_Tick(object sender, EventArgs e)
{
tmrRun.Enabled = false;
if (CancelStop) btnCancel.Visible = true;
@@ -293,7 +196,7 @@ namespace VEPROMS
if (OnlyShowTimeCriticalActionSummary)
{ MyPromsPrinter.PromsPrinterPrintType = PromsPrinterPrintType.TCAS_only; }
- _PdfFile = MyPromsPrinter.Print(PDFPath, MakePlaceKeeper, MakeContinuousActionSummary, MakeTimeCriticalActionSummary, PrtSectID);
+ PdfFile = MyPromsPrinter.Print(PDFPath, MakePlaceKeeper, MakeContinuousActionSummary, MakeTimeCriticalActionSummary, PrtSectID);
ProfileTimer.Pop(profileDepth);
@@ -307,13 +210,13 @@ namespace VEPROMS
}
// B2024-062 Added check for EmptyProcedure. We don't need to show the Try Again message if the procedure
// is empty, as it would be just be a waste of time for the user.
- while (!MyPromsPrinter.MergeNotIncluded && _PdfFile == null && !MyPromsPrinter.EmptyProcedure &&
+ while (!MyPromsPrinter.MergeNotIncluded && PdfFile == null && !MyPromsPrinter.EmptyProcedure &&
MessageBox.Show("Try Again?", "PDF Creation Failed", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes);
- if (_PdfFile == null)
+ if (PdfFile == null)
{
- this.Close();
+ Close();
return;
}
@@ -329,13 +232,13 @@ namespace VEPROMS
}
DateTime tEnd = DateTime.Now;
- MyStatus = _PdfFile + " created.";
- MyStatus = string.Format("{0} created in {1:0.} milliseconds", _PdfFile, (TimeSpan.FromTicks(tEnd.Ticks - tStart.Ticks).TotalMilliseconds));
+ MyStatus = $"{PdfFile} created.";
+ MyStatus = $"{PdfFile} created in {(TimeSpan.FromTicks(tEnd.Ticks - tStart.Ticks).TotalMilliseconds):0.} milliseconds";
if (OpenPDF)
{
- OpenPDFandPlacekeeper(_PdfFile);
- this.Close();
+ OpenPDFandPlacekeeper(PdfFile);
+ Close();
// C2021-010: Remove trailing returns/spaces & manual page breaks & allow save. Ask if user wants to save chanages
// if they were found.
@@ -362,15 +265,15 @@ namespace VEPROMS
if (CloseWhenDone)
{
OpenPDFandPlacekeeper(null);
- this.Close();
+ Close();
return;
}
}
private void btnOpenPDF_Click(object sender, EventArgs e)
{
- OpenPDFandPlacekeeper(_PdfFile);
- this.Close();
+ OpenPDFandPlacekeeper(PdfFile);
+ Close();
}
// set a delay so that the word document containing the newly generated placekeeper will appear on top of everything else.
@@ -383,8 +286,7 @@ namespace VEPROMS
{
System.Diagnostics.Process sdp = System.Diagnostics.Process.Start(pdffile);
- if (sdp != null)
- sdp.WaitForInputIdle();
+ sdp?.WaitForInputIdle();
}
if (OnlyShowContinuousActionSummary || OnlyShowTimeCriticalActionSummary) // F2022-024 Time Critical Action Summary
@@ -441,16 +343,16 @@ namespace VEPROMS
}
catch (Exception ex)
{
- string str = string.Format("{0} - {1} - {2}",pdffile,ex.GetType().Name,ex.Message);
+ string str = $"{pdffile} - {ex.GetType().Name} - {ex.Message}";
MessageBox.Show(str, "Error Opening PDFFile", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
}
}
private void btnOpenFolder_Click(object sender, EventArgs e)
{
- System.Diagnostics.Process.Start("Explorer", "/select," + _PdfFile);
+ System.Diagnostics.Process.Start("Explorer", $"/select,{PdfFile}");
OpenPDFandPlacekeeper(null);
- this.Close();
+ Close();
}
private void btnCancel_Click(object sender, EventArgs e)
diff --git a/PROMS/VEPROMS User Interface/frmPSI.cs b/PROMS/VEPROMS User Interface/frmPSI.cs
index f84bafbf..8d1d9211 100644
--- a/PROMS/VEPROMS User Interface/frmPSI.cs
+++ b/PROMS/VEPROMS User Interface/frmPSI.cs
@@ -1,7 +1,5 @@
using System;
using System.Collections.Generic;
-using System.ComponentModel;
-using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
@@ -13,10 +11,13 @@ namespace VEPROMS
public partial class frmPSI : Form
{
private ProcedureInfo _MyProcedureInfo;
- private StepTabRibbon _MyStepTabRibbon;
- private Dictionary _DicStepRtb;
- private Dictionary _DicCheckBox;
- private Dictionary _DicComboBox;
+ private readonly StepTabRibbon _MyStepTabRibbon;
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE0044:Add readonly modifier", Justification = "Keeping Collections Not ReadOnly")]
+ private Dictionary _DicStepRtb;
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE0044:Add readonly modifier", Justification = "Keeping Collections Not ReadOnly")]
+ private Dictionary _DicCheckBox;
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE0044:Add readonly modifier", Justification = "Keeping Collections Not ReadOnly")]
+ private Dictionary _DicComboBox;
public frmPSI(ProcedureInfo pi)
{
InitializeComponent();
@@ -31,22 +32,23 @@ namespace VEPROMS
{
_MyProcedureInfo = pi;
PSI psiDialogDef = pi.ActiveFormat.PlantFormat.FormatData.ProcData.PSI;
- this.Text = psiDialogDef.Caption;
- this.Location = new Point((int)psiDialogDef.x * 2, (int)psiDialogDef.y * 2);
+ Text = psiDialogDef.Caption;
+ Location = new Point((int)psiDialogDef.x * 2, (int)psiDialogDef.y * 2);
int maxx = 0;
int maxy = 0;
int xB4Scroll = 900;
int yB4Scroll = 630;
- this.panelPSI.AutoScroll = false;
+ panelPSI.AutoScroll = false;
foreach (SILabel lbl in psiDialogDef.LabelList)
{
- Label wlbl = new Label();
- wlbl.Text = lbl.text;
- wlbl.Location = new Point((int)lbl.x * 2, (int)lbl.y * 2);
- wlbl.AutoSize = true;
- //wlbl.Size = new Size((int)lbl.width * 2, (int)lbl.height * 2);
- wlbl.Visible = true;
- this.panelPSI.Controls.Add(wlbl);
+ Label wlbl = new Label
+ {
+ Text = lbl.text,
+ Location = new Point((int)lbl.x * 2, (int)lbl.y * 2),
+ AutoSize = true,
+ Visible = true
+ };
+ panelPSI.Controls.Add(wlbl);
maxx = ((int)lbl.x * 2 + (int)lbl.width * 2) > maxx ? ((int)lbl.x * 2 + (int)lbl.width * 2) : maxx;
maxy = ((int)lbl.y * 2 + (int)lbl.height * 2) > maxy ? ((int)lbl.y * 2 + (int)lbl.height * 2) : maxy;
}
@@ -62,7 +64,7 @@ namespace VEPROMS
tb.MyItemInfo = pi as ItemInfo;
tb.FieldToEdit = E_FieldToEdit.PSI;
tb.BorderStyle = BorderStyle.FixedSingle;
- tb.Enter += new System.EventHandler(this.FieldStepRTB_Enter);
+ tb.Enter += new System.EventHandler(FieldStepRTB_Enter);
// see if config has data for this field, i.e. search for the 'name'
// B2018-057 Replace non-breaking hyphen with hyphen.
string val = procConfig.GetValue("PSI", fld.name).Replace("\\u8209?", "-");
@@ -70,13 +72,13 @@ namespace VEPROMS
StringBuilder sb = new StringBuilder();
sb.Append(@"{\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\fnil\fcharset2 Arial;}");
sb.Append(@"{\f1\fnil\fcharset0 Arial;}}{\colortbl ;\red255\green0\blue0;}"); //C2017-036 changed to just Arial because Microsoft removed Arial Unicode MS with Word16
- sb.Append(@"\viewkind4\uc1\pard\sl-240\slmult0\fs" + (int)(this.Font.SizeInPoints*2) + " " + dt.StartText + @"}");
+ sb.Append(@"\viewkind4\uc1\pard\sl-240\slmult0\fs" + (int)(Font.SizeInPoints*2) + " " + dt.StartText + @"}");
tb.Rtf = sb.ToString();
tb.Location = new Point((int)fld.x * 2, (int)fld.y * 2);
tb.Size = new Size((int)fld.width * 2, (int)fld.height * 2);
tb.MinimumSize = new Size((int)fld.width * 2, (int)fld.height * 2);
tb.Visible = true;
- this.panelPSI.Controls.Add(tb);
+ panelPSI.Controls.Add(tb);
maxx = ((int)fld.x * 2 + (int)fld.width * 2) > maxx ? ((int)fld.x * 2 + (int)fld.width * 2) : maxx;
maxy = ((int)fld.y * 2 + (int)fld.height * 2) > maxy ? ((int)fld.y * 2 + (int)fld.height * 2) : maxy;
}
@@ -89,8 +91,8 @@ namespace VEPROMS
cb.Visible = true;
cb.Width = (int)fld.width * 2;
string val = procConfig.GetValue("PSI", fld.name);
- cb.Checked = val!=null && val!="" && val.ToUpper()[0] == 'Y' ? true : false;
- this.panelPSI.Controls.Add(cb);
+ cb.Checked = val !=null && val!="" && val.ToUpper()[0] == 'Y';
+ panelPSI.Controls.Add(cb);
maxx = ((int)fld.x * 2 + (int)fld.width * 2) > maxx ? ((int)fld.x * 2 + (int)fld.width * 2) : maxx;
maxy = ((int)fld.y * 2 + (int)fld.height * 2) > maxy ? ((int)fld.y * 2 + (int)fld.height * 2) : maxy;
}
@@ -107,7 +109,7 @@ namespace VEPROMS
foreach (string t in tmps) cmb.Items.Add(t);
string val = procConfig.GetValue("PSI", fld.name);
if (val != null && val != "") cmb.SelectedItem = val;
- this.panelPSI.Controls.Add(cmb);
+ panelPSI.Controls.Add(cmb);
maxx = ((int)fld.x * 2 + (int)fld.width * 2) > maxx ? ((int)fld.x * 2 + (int)fld.width * 2) : maxx;
maxy = ((int)fld.y * 2 + (int)fld.height * 2) > maxy ? ((int)fld.y * 2 + (int)fld.height * 2) : maxy;
}
@@ -115,19 +117,19 @@ namespace VEPROMS
if (maxx > xB4Scroll)
{
maxx = xB4Scroll;
- this.panelPSI.Width = xB4Scroll;
- this.panelPSI.AutoScroll = true;
+ panelPSI.Width = xB4Scroll;
+ panelPSI.AutoScroll = true;
}
else
- this.panelPSI.Width = maxx + 50;
+ panelPSI.Width = maxx + 50;
if (maxy > yB4Scroll)
{
maxy = yB4Scroll;
- this.panelPSI.Height = yB4Scroll;
- this.panelPSI.AutoScroll = true;
+ panelPSI.Height = yB4Scroll;
+ panelPSI.AutoScroll = true;
}
else
- this.panelPSI.Height = maxy; // B2018-062: Ok/Cancel buttons not displayed if more than a few labels/fields are defined.
+ panelPSI.Height = maxy; // B2018-062: Ok/Cancel buttons not displayed if more than a few labels/fields are defined.
if (psiDialogDef.ButtonsOnBottom == null || psiDialogDef.ButtonsOnBottom.ToUpper() == "NO")
{
btnOk.Location = new Point(maxx+70, 30);
@@ -138,17 +140,14 @@ namespace VEPROMS
// B2018-062: Ok/Cancel buttons not displayed if more than a few labels/fields are defined:
// Adjust location of buttons so that they have a larger Y than the panel that holds the labels/fields
// and adjust the dialog size if it's height is not enough.
- btnOk.Location = new Point(btnOk.Location.X, panelPSI.Location.Y + this.panelPSI.Height + 10);
- btnCancel.Location = new Point(btnCancel.Location.X, panelPSI.Location.Y + this.panelPSI.Height + 10);
- if (this.Height < btnOk.Location.Y + btnOk.Size.Height + 10)
- this.Height = btnOk.Location.Y + btnOk.Size.Height + 30;
+ btnOk.Location = new Point(btnOk.Location.X, panelPSI.Location.Y + panelPSI.Height + 10);
+ btnCancel.Location = new Point(btnCancel.Location.X, panelPSI.Location.Y + panelPSI.Height + 10);
+ if (Height < btnOk.Location.Y + btnOk.Size.Height + 10)
+ Height = btnOk.Location.Y + btnOk.Size.Height + 30;
}
}
- private void FieldStepRTB_Enter(object sender, EventArgs e)
- {
- _MyStepTabRibbon.MyStepRTB = (StepRTB)sender;
- }
- private void btnOk_Click(object sender, EventArgs e)
+ private void FieldStepRTB_Enter(object sender, EventArgs e) => _MyStepTabRibbon.MyStepRTB = (StepRTB)sender;
+ private void btnOk_Click(object sender, EventArgs e)
{
ProcedureConfig procConfig = _MyProcedureInfo.MyConfig as ProcedureConfig;
PSI psiDialogDef = _MyProcedureInfo.ActiveFormat.PlantFormat.FormatData.ProcData.PSI;
@@ -204,13 +203,13 @@ namespace VEPROMS
}
}
DialogResult = DialogResult.OK;
- this.Close();
+ Close();
}
private void btnCancel_Click(object sender, EventArgs e)
{
DialogResult = DialogResult.Cancel;
- this.Close();
+ Close();
}
}
}
\ No newline at end of file
diff --git a/PROMS/VEPROMS User Interface/frmProcedureProperties.cs b/PROMS/VEPROMS User Interface/frmProcedureProperties.cs
index 19d5958d..4bf03180 100644
--- a/PROMS/VEPROMS User Interface/frmProcedureProperties.cs
+++ b/PROMS/VEPROMS User Interface/frmProcedureProperties.cs
@@ -1,9 +1,4 @@
using System;
-using System.Collections.Generic;
-using System.ComponentModel;
-using System.Data;
-using System.Drawing;
-using System.Text;
using System.Windows.Forms;
using VEPROMS.CSLA.Library;
using VEPROMS.Properties;
@@ -11,8 +6,6 @@ using DescriptiveEnum;
using DevComponents.DotNetBar;
using DevComponents.DotNetBar.Controls;
using Volian.Controls.Library;
-using System.Xml;
-using Csla;
namespace VEPROMS
{
@@ -20,7 +13,6 @@ namespace VEPROMS
{
private bool _Initializing = false;
private string _DefaultFormatName = null;
- //private string _DefaultPagination = null;
private string _DefaultWatermark = null;
private string _DefaultChgBarType = null;
private string _DefaultChgBarLoc = null;
@@ -28,21 +20,18 @@ namespace VEPROMS
private string _DefaultChgBarUsrMsg1 = null;
private string _DefaultChgBarUsrMsg2 = null;
private string _DefaultFormatColumns = null;
- private bool _DefaultDisableDuplex = false;
- private ProcedureConfig _ProcedureConfig;
- private StepTabRibbon _MyStepTabRibbon;
+ private readonly ProcedureConfig _ProcedureConfig;
+ private readonly StepTabRibbon _MyStepTabRibbon;
public frmProcedureProperties(ProcedureConfig procedureConfig)
{
_ProcedureConfig = procedureConfig;
_Initializing = true;
InitializeComponent();
- btnGeneral.PerformClick(); // always start with General tab or button
- _Initializing = false;
- // build the title bar caption
- //this.Text = string.Format("{0} {1} Properties", procedureConfig.Number, procedureConfig.Title);
+ btnGeneral.PerformClick(); // always start with General tab or button
ItemInfo itmInfo = ItemInfo.Get(_ProcedureConfig.MyProcedure.ItemID);
- this.Text = string.Format("{0} {1} Properties", itmInfo.DisplayNumber, itmInfo.DisplayText);
+ // build the title bar caption
+ Text = $"{itmInfo.DisplayNumber} {itmInfo.DisplayText} Properties";
ppProcTitleStpRTB.Font = ppProcTitleStpRTB.FormatFont = new System.Drawing.Font("Microsoft Sans Serif", 10F);
ppProcTitleStpRTB.FieldToEdit = E_FieldToEdit.Text;
ppProcTitleStpRTB.BorderStyle = BorderStyle.Fixed3D;
@@ -54,12 +43,11 @@ namespace VEPROMS
ppProcNumStpRTB.MyItemInfo = itmInfo;
ppProcNumStpRTB.RefreshDisplay(true);
- _MyStepTabRibbon = new StepTabRibbon();
- //_MyStepTabRibbon.Dock = System.Windows.Forms.DockStyle.Top;
- //_MyStepTabRibbon.Location = new System.Drawing.Point(0, 0);
- _MyStepTabRibbon.Name = "displayTabRibbon1";
- _MyStepTabRibbon.Visible = false;
- //defaultSettingsVisiblity();
+ _MyStepTabRibbon = new StepTabRibbon
+ {
+ Name = "displayTabRibbon1",
+ Visible = false
+ };
}
private void ppBtnOK_Click(object sender, EventArgs e)
@@ -99,7 +87,7 @@ namespace VEPROMS
}
}
DialogResult = DialogResult.OK;
- this.Close();
+ Close();
}
public void SaveText(StepRTB myStepRTB)
{
@@ -118,8 +106,8 @@ namespace VEPROMS
{
procedureConfigBindingSource.CancelEdit();
_ProcedureConfig.MyProcedure.MyProcedureInfo.CreateEnhanced = false;
- this.DialogResult = DialogResult.Cancel;
- this.Close();
+ DialogResult = DialogResult.Cancel;
+ Close();
}
///
@@ -156,10 +144,6 @@ namespace VEPROMS
if (!(_DefaultChgBarUsrMsg2.Equals("")))
ppLblChgBarUserMsgTwoDefault.Text = string.Format("({0})", _DefaultChgBarUsrMsg2);
- // Get the default Print Pagination
- //_DefaultPagination = _ProcedureConfig.Print_Pagination.ToString();
- //SetupDefault(EnumDescConverter.GetEnumDescription(_ProcedureConfig.Print_Pagination), ppLblPaginationDefault, ppCmbxPagination);
-
// Get the default Watermark
_DefaultWatermark = _ProcedureConfig.Print_Watermark.ToString();
SetupDefault(EnumDescConverter.GetEnumDescription(_ProcedureConfig.Print_Watermark), ppLblWatermarkDefault, ppCmbxWatermark);
@@ -178,8 +162,6 @@ namespace VEPROMS
_Initializing = true;
procedureConfigBindingSource.DataSource = _ProcedureConfig;
- //formatInfoListBindingSource.DataSource = FormatInfoList.Get();
-
ppCmbxFormat.DataSource = null;
ppCmbxFormat.DisplayMember = "FullName";
ppCmbxFormat.ValueMember = "FullName";
@@ -195,7 +177,7 @@ namespace VEPROMS
// Get the saved settings for this user
//
// This setting tells us if we should display the default values on this property page
- ppCbShwDefSettings.Checked = (Settings.Default["ShowDefaultProcedureProp"] != null) ? Settings.Default.ShowDefaultProcedureProp : false;
+ ppCbShwDefSettings.Checked = (Settings.Default["ShowDefaultProcedureProp"] != null) && Settings.Default.ShowDefaultProcedureProp;
// Get the User's property page style "PropPageStyle" (this is a system wide user setting)
// 1 - Button Dialog (default)
@@ -204,7 +186,7 @@ namespace VEPROMS
{
tcProcProp.TabsVisible = true;
panProcBtns.Visible = false;
- this.Width -= panProcBtns.Width;
+ Width -= panProcBtns.Width;
}
// Get the default values for the property page information
@@ -230,11 +212,6 @@ namespace VEPROMS
ppCmbxChangeBarType.ValueMember = "EValue";
ppCmbxChangeBarType.SelectedIndex = -1;
- //ppCmbxPagination.DataSource = EnumDetail.Details();
- //ppCmbxPagination.DisplayMember = "Description";
- //ppCmbxPagination.ValueMember = "EValue";
- //ppCmbxPagination.SelectedIndex = -1;
-
ppCmbxWatermark.DataSource = EnumDetail.Details();
ppCmbxWatermark.DisplayMember = "Description";
ppCmbxWatermark.ValueMember = "EValue";
@@ -247,8 +224,7 @@ namespace VEPROMS
// the only time the create enhanced checkbox is visisble is if this is a 'New' procedure in a set that is the 'Source'.
cbEnhanced.Visible = false;
- DocVersionConfig dvc = _ProcedureConfig.MyProcedure.MyProcedureInfo.MyDocVersion.MyConfig as DocVersionConfig;
- if (_ProcedureConfig.CreatingNew && dvc != null && dvc.MyEnhancedDocuments != null && dvc.MyEnhancedDocuments.Count > 0 && dvc.MyEnhancedDocuments[0].Type != 0)
+ if (_ProcedureConfig.CreatingNew && _ProcedureConfig.MyProcedure.MyProcedureInfo.MyDocVersion.MyConfig is DocVersionConfig dvc && dvc.MyEnhancedDocuments != null && dvc.MyEnhancedDocuments.Count > 0 && dvc.MyEnhancedDocuments[0].Type != 0)
cbEnhanced.Visible = true;
cbNotIncludeInMerged.Checked = _ProcedureConfig.Print_NotInMergeAll;
_Initializing = false;
@@ -262,10 +238,7 @@ namespace VEPROMS
///
/// object
/// EventArgs
- private void btnGeneral_Click(object sender, EventArgs e)
- {
- ProcessButtonClick(tiGeneral, btnGeneral);
- }
+ private void btnGeneral_Click(object sender, EventArgs e) => ProcessButtonClick(tiGeneral, btnGeneral);
///
/// Selection in Default Column Mode combo box changed.
@@ -278,14 +251,6 @@ namespace VEPROMS
{
FormatColumns fc = (FormatColumns)Enum.Parse(typeof(FormatColumns), _DefaultFormatColumns);
ProcessCmbxSelectionEnumChanged(ppCmbxStpEditorCols, fc, ppBtnDefEdCols, ppLblStpEditorColsDefault);
- //if ((ppCmbxStpEditorCols.SelectedIndex != -1) && ppCmbxStpEditorCols.SelectedValue.Equals(fc))
- //{
- // ppBtnDefEdCols.Focus();
- // ppBtnDefEdCols.PerformClick();
- //}
- //ppBtnDefEdCols.Visible = ppCmbxStpEditorCols.SelectedValue != null;
- //ppLblStpEditorColsDefault.Visible = ppCbShwDefSettings.Checked && ppBtnDefEdCols.Visible;
- //tcpGeneral.Focus();
}
}
#endregion
@@ -304,22 +269,7 @@ namespace VEPROMS
if (_InitialIndex < -1) _InitialIndex = ppCmbxFormat.SelectedIndex; // save the current format selection (happens here when current section is set to the default format)
}
- private void ppBtnDefaultFmt_Click(object sender, EventArgs e)
- {
- ppCmbxFormat.SelectedIndex = -1; //reset to the default Format setting
- //tcpFormatSettings.Focus();
- }
-
- // Commented out as part of code change C2017-004. this also makes it consistent with section properties
- ///
- /// Selection in Format combo box changed.
- ///
- /// object
- /// EventArgs
- //private void ppCmbxFormat_SelectedValueChanged(object sender, EventArgs e)
- //{
- // ProcessCmbxSelectedValueChange(ppCmbxFormat, _DefaultFormatName, ppBtnDefaultFmt, ppLblFormatDefault);
- //}
+ private void ppBtnDefaultFmt_Click(object sender, EventArgs e) => ppCmbxFormat.SelectedIndex = -1; //reset to the default Format setting
///
/// Enable or disable the user specified change bar options base on the type
@@ -327,14 +277,6 @@ namespace VEPROMS
///
private void setEnabledUserSpecifiedChgBarCombos(PrintChangeBar pcb)
{
- //ppGpbxUserSpecCB.Enabled =
- //ppCmbxChgBarPos.Enabled =
- //ppCmbxChgBarTxtType.Enabled =
- //ppBtnDefaultCbPos.Enabled =
- //ppBtnDefCbTxtTyp.Enabled = (ppCmbxChangeBarType.SelectedValue != null &&
- // ppCmbxChangeBarType.SelectedValue.Equals(ProcedureConfig.PrintChangeBar.WithUserSpecified)) ||
- // (ppCmbxChangeBarType.SelectedValue == null && pcb.Equals(DocVersionConfig.PrintChangeBar.WithUserSpecified));
-
ppGpbxUserSpecCB.Enabled = (ppCmbxChangeBarType.SelectedValue != null &&
ppCmbxChangeBarType.SelectedValue.Equals(PrintChangeBar.WithUserSpecified)) ||
(ppCmbxChangeBarType.SelectedValue == null && pcb.Equals(PrintChangeBar.WithUserSpecified));
@@ -353,7 +295,6 @@ namespace VEPROMS
PrintChangeBar pcb = (PrintChangeBar)Enum.Parse(typeof(PrintChangeBar), _DefaultChgBarType);
ProcessCmbxSelectionEnumChanged(ppCmbxChangeBarType, pcb, ppBtnDefaultChgBar, ppLblChangeBarTypeDefault);
setEnabledUserSpecifiedChgBarCombos(pcb);
- //tcpFormatSettings.Focus();
}
}
@@ -369,12 +310,9 @@ namespace VEPROMS
// Get the parent setting
PrintChangeBar pcb = (PrintChangeBar)Enum.Parse(typeof(PrintChangeBar), _DefaultChgBarType);
// Compare parent setting with current setting
- //_Initializing = true;
if (pcb != _ProcedureConfig.Print_ChangeBar)
_ProcedureConfig.Print_ChangeBar = pcb; // this will force a database update (write)
ppCmbxChangeBarType.SelectedIndex = -1; //reset to the default Change Bar setting
- //_Initializing = false;
- //tcpFormatSettings.Focus();
}
///
@@ -388,7 +326,6 @@ namespace VEPROMS
{
PrintChangeBarLoc cbl = (PrintChangeBarLoc)Enum.Parse(typeof(PrintChangeBarLoc), _DefaultChgBarLoc);
ProcessCmbxSelectionEnumChanged(ppCmbxChgBarPos, cbl, ppBtnDefaultCbPos, ppLblChgBarPosDefault);
- //tcpFormatSettings.Focus();
}
}
@@ -407,7 +344,6 @@ namespace VEPROMS
if (cbl != _ProcedureConfig.Print_ChangeBarLoc)
_ProcedureConfig.Print_ChangeBarLoc = cbl; // this will force a database update (write)
ppCmbxChgBarPos.SelectedIndex = -1; //reset to the default Change Bar Position setting
- //tcpFormatSettings.Focus();
}
///
@@ -422,7 +358,6 @@ namespace VEPROMS
PrintChangeBarText cbt = (PrintChangeBarText)Enum.Parse(typeof(PrintChangeBarText), _DefaultChgBarText);
ProcessCmbxSelectionEnumChanged(ppCmbxChgBarTxtType, cbt, ppBtnDefCbTxtTyp, ppLblChgBarTxtTypeDefault);
setEnabledUserSpecifiedChgBarText();
- //tcpFormatSettings.Focus();
}
}
@@ -441,7 +376,6 @@ namespace VEPROMS
if (cbt != _ProcedureConfig.Print_ChangeBarText)
_ProcedureConfig.Print_ChangeBarText = cbt; // this will force a database update (write)
ppCmbxChgBarTxtType.SelectedIndex = -1; //reset to the default Change Bar Text Type setting
- //tcpFormatSettings.Focus();
}
///
@@ -450,13 +384,6 @@ namespace VEPROMS
///
private void setEnabledUserSpecifiedChgBarText()
{
- //ppGpbxUserSpecTxt.Enabled =
- //ppTxbxChangeBarUserMsgOne.Enabled =
- //ppTxbxChgBarUserMsgTwo.Enabled =
- //ppBtnDefCbTxt1.Enabled =
- //ppBtnDefCbTxt2.Enabled = (ppCmbxChgBarTxtType.SelectedValue != null &&
- //ppCmbxChgBarTxtType.SelectedValue.Equals(ProcedureConfig.PrintChangeBarText.UserDef));
-
// This string is used to check against our default setting to see if User Defined Changebar Text is active
string decUserDef = PrintChangeBarText.UserDef.ToString();
@@ -475,43 +402,7 @@ namespace VEPROMS
///
/// object
/// EventArgs
- private void btnOutputStngs_Click(object sender, EventArgs e)
- {
- ProcessButtonClick(tiOutputStngs, btnOutputStngs);
- }
-
- ///
- /// Selection in Pagination combo box changed.
- ///
- /// object
- /// EventArgs
- //private void ppCmbxPagination_SelectedValueChanged(object sender, EventArgs e)
- //{
- // if (!_Initializing)
- // {
- // PrintPagination pgtn = (PrintPagination)Enum.Parse(typeof(PrintPagination), _DefaultPagination);
- // ProcessCmbxSelectionEnumChanged(ppCmbxPagination, pgtn, ppBtnDefPagination, ppLblPaginationDefault);
- // //tcpOutputSettings.Focus();
- // }
- //}
-
- ///
- /// Reset to the parent setting.
- /// Find the parent setting and assign it to _ProcedureConfig.Print_Pagination.
- /// This will force the database to be updated.
- ///
- ///
- ///
- //private void ppBtnDefPagination_Click(object sender, EventArgs e)
- //{
- // // Get the parent setting
- // PrintPagination pgtn = (PrintPagination)Enum.Parse(typeof(PrintPagination), _DefaultPagination);
- // // Compare parent setting with current setting
- // if (pgtn != _ProcedureConfig.Print_Pagination)
- // _ProcedureConfig.Print_Pagination = pgtn; // this will force a database update (write)
- // ppCmbxPagination.SelectedIndex = -1; //reset to the default Pagination setting
- // //tcpOutputSettings.Focus();
- //}
+ private void btnOutputStngs_Click(object sender, EventArgs e) => ProcessButtonClick(tiOutputStngs, btnOutputStngs);
///
/// Selection in Watermark combo box changed.
@@ -524,7 +415,6 @@ namespace VEPROMS
{
PrintWatermark wtr = (PrintWatermark)Enum.Parse(typeof(PrintWatermark), _DefaultWatermark);
ProcessCmbxSelectionEnumChanged(ppCmbxWatermark, wtr, ppBtnDefWatermark, ppLblWatermarkDefault);
- //tcpOutputSettings.Focus();
}
}
@@ -547,19 +437,6 @@ namespace VEPROMS
#endregion
- #region View Settings tab
-
- /////
- ///// This is the View Settings button used on the button interface design
- /////
- ///// object
- ///// EventArgs
- //private void btnVwStngs_Click(object sender, EventArgs e)
- //{
- // ProcessButtonClick(tiViewStngs, btnVwStngs);
- //}
- #endregion
-
#region Generic functions used on this property page
///
@@ -570,7 +447,6 @@ namespace VEPROMS
ppLblDefSettingsInfo.Visible = ppCbShwDefSettings.Checked;
ppLblWatermarkDefault.Visible = ppCbShwDefSettings.Checked && ppBtnDefWatermark.Visible;
- //ppLblPaginationDefault.Visible = ppCbShwDefSettings.Checked && ppBtnDefPagination.Visible;
ppLblStpEditorColsDefault.Visible = ppCbShwDefSettings.Checked && ppBtnDefEdCols.Visible;
ppLblFormatDefault.Visible = ppCbShwDefSettings.Checked && ppBtnDefaultFmt.Visible;
ppLblChangeBarTypeDefault.Visible = ppCbShwDefSettings.Checked && ppBtnDefaultChgBar.Visible;
@@ -603,7 +479,6 @@ namespace VEPROMS
btnGeneral.Checked = false;
btnFmtStngs.Checked = false;
btnOutputStngs.Checked = false;
- //btnVwStngs.Checked = false;
}
///
@@ -616,7 +491,6 @@ namespace VEPROMS
private void tabpage_Enter(object sender, EventArgs e)
{
// Show or hide the labels containing the default values
- //if (!_Initializing)
defaultSettingsVisiblity();
}
@@ -658,36 +532,11 @@ namespace VEPROMS
button.Visible = (cmbx.SelectedValue != null);
deflabel.Visible = ppCbShwDefSettings.Checked && button.Visible;
}
- // Commented out as part of code change C2017-004 - select default format on dropdown
- /////
- ///// Process a change in the combo box selection
- /////
- ///// Combo Box Name
- ///// string containing default text
- ///// button to reset to default value
- ///// label containing the default
- //private void ProcessCmbxSelectedValueChange(ComboBoxEx cmbx, string defstr, ButtonX button, Label deflabel)
- //{
- // if ((cmbx.SelectedIndex != -1) && defstr != null && defstr.Equals(cmbx.SelectedValue))
- // {
- // button.Visible = true;
- // button.Focus();
- // button.PerformClick();
- // }
- // button.Visible = cmbx.SelectedValue != null;
- // deflabel.Visible = ppCbShwDefSettings.Checked && button.Visible;
- //}
#endregion
- private void ppProcTitleStpRTB_Enter(object sender, EventArgs e)
- {
- _MyStepTabRibbon.MyStepRTB = ppProcTitleStpRTB;
- }
+ private void ppProcTitleStpRTB_Enter(object sender, EventArgs e) => _MyStepTabRibbon.MyStepRTB = ppProcTitleStpRTB;
- private void ppProcNumStpRTB_Enter(object sender, EventArgs e)
- {
- _MyStepTabRibbon.MyStepRTB = ppProcNumStpRTB;
- }
+ private void ppProcNumStpRTB_Enter(object sender, EventArgs e) => _MyStepTabRibbon.MyStepRTB = ppProcNumStpRTB;
private void ppBtnDefCbTxt1_Click(object sender, EventArgs e)
{
@@ -698,9 +547,7 @@ namespace VEPROMS
_ProcedureConfig.Print_UserCBMess1 = _DefaultChgBarUsrMsg1;
ppLblChgBarUserMsgOneDefault.Visible = false;
ppBtnDefCbTxt1.Visible = false;
- //tcpFormatSettings.Focus();
}
-
}
private void ppBtnDefCbTxt2_Click(object sender, EventArgs e)
@@ -712,7 +559,6 @@ namespace VEPROMS
_ProcedureConfig.Print_UserCBMess2 = _DefaultChgBarUsrMsg2;
ppLblChgBarUserMsgTwoDefault.Visible = false;
ppBtnDefCbTxt2.Visible = false;
- //tcpFormatSettings.Focus();
}
}
@@ -723,7 +569,6 @@ namespace VEPROMS
if (fc != _ProcedureConfig.Format_Columns)
_ProcedureConfig.Format_Columns = fc; // this will force a database update (write)
ppCmbxStpEditorCols.SelectedIndex = -1; //reset to the default
- //tcpGeneral.Focus();
}
private void ppBtnDefWatermark_Click_1(object sender, EventArgs e)
@@ -734,30 +579,23 @@ namespace VEPROMS
if (wtr != _ProcedureConfig.Print_Watermark)
_ProcedureConfig.Print_Watermark = wtr; // this will force a database update (write)
ppCmbxWatermark.SelectedIndex = -1;
- //tcpOutputSettings.Focus();
}
private void ppTxbxChangeBarUserMsgOne_TextChanged(object sender, EventArgs e)
{
- ppBtnDefCbTxt1.Visible = ((ppTxbxChangeBarUserMsgOne.Text != null) && !ppTxbxChangeBarUserMsgOne.Text.Equals(_DefaultChgBarUsrMsg1));
+ ppBtnDefCbTxt1.Visible = (ppTxbxChangeBarUserMsgOne.Text != null) && !ppTxbxChangeBarUserMsgOne.Text.Equals(_DefaultChgBarUsrMsg1);
ppLblChgBarUserMsgOneDefault.Visible = ppCbShwDefSettings.Checked && ppBtnDefCbTxt1.Visible;
- //tcpOutputSettings.Focus();
}
private void ppTxbxChgBarUserMsgTwo_TextChanged(object sender, EventArgs e)
{
ppBtnDefCbTxt2.Visible = ((ppTxbxChgBarUserMsgTwo.Text != null) && !ppTxbxChgBarUserMsgTwo.Text.Equals(_DefaultChgBarUsrMsg2));
ppLblChgBarUserMsgTwoDefault.Visible = ppCbShwDefSettings.Checked && ppBtnDefCbTxt2.Visible;
- //tcpOutputSettings.Focus();
}
- private void frmProcedureProperties_Shown(object sender, EventArgs e)
- {
- ppProcNumStpRTB.Focus();
-
- }
+ private void frmProcedureProperties_Shown(object sender, EventArgs e) => ppProcNumStpRTB.Focus();
private void ppCmbxFormat_DropDown(object sender, EventArgs e)
{
diff --git a/PROMS/VEPROMS User Interface/frmPropGrid.cs b/PROMS/VEPROMS User Interface/frmPropGrid.cs
index fc03069f..bac237df 100644
--- a/PROMS/VEPROMS User Interface/frmPropGrid.cs
+++ b/PROMS/VEPROMS User Interface/frmPropGrid.cs
@@ -1,9 +1,4 @@
using System;
-using System.Collections.Generic;
-using System.ComponentModel;
-using System.Data;
-using System.Drawing;
-using System.Text;
using System.Windows.Forms;
using VEPROMS.CSLA.Library;
@@ -11,7 +6,7 @@ namespace VEPROMS
{
public partial class frmPropGrid : DevComponents.DotNetBar.Office2007Form
{
- private object _PGobject;
+ private readonly object _PGobject;
public frmPropGrid(object pgobject)
{
@@ -23,24 +18,23 @@ namespace VEPROMS
{
InitializeComponent();
_PGobject = pgobject;
- this.Text = title;
+ Text = title;
}
private void btnOK_Click(object sender, EventArgs e)
{
DialogResult = DialogResult.OK;
- DocVersionConfig dvcfg = this._PGobject as DocVersionConfig;
- if (dvcfg != null && dvcfg.IsDirty)
- {
- dvcfg.MyDocVersion.Save();
- }
- this.Close();
+ if (_PGobject is DocVersionConfig dvcfg && dvcfg.IsDirty)
+ {
+ dvcfg.MyDocVersion.Save();
+ }
+ Close();
}
private void btnCancel_Click(object sender, EventArgs e)
{
DialogResult = DialogResult.Cancel;
- this.Close();
+ Close();
}
private void frmPropGrid_Load(object sender, EventArgs e)
@@ -51,39 +45,23 @@ namespace VEPROMS
private void pg_PropertyValueChanged(object s, PropertyValueChangedEventArgs e)
{
- DocVersionConfig dvcfg = this._PGobject as DocVersionConfig;
- if (dvcfg != null)
- dvcfg.IsDirty = true;
- // check if folder config & if so, check for name change
- FolderConfig tstfoldercfg = this._PGobject as FolderConfig;
- if (tstfoldercfg != null)
- {
- if ((string)e.OldValue != tstfoldercfg.Name)
- {
- bool isunique = tstfoldercfg.CheckUniqueName(tstfoldercfg.Name);
- if (!isunique)
- {
- MessageBox.Show(string.Format("The Name '{0}' that was entered is not a unique folder name", tstfoldercfg.Name));
- tstfoldercfg.Name = (string)e.OldValue;
- }
- }
- }
- this.Refresh();
+ if (_PGobject is DocVersionConfig dvcfg)
+ dvcfg.IsDirty = true;
+ // check if folder config & if so, check for name change
+ if (_PGobject is FolderConfig tstfoldercfg)
+ {
+ if ((string)e.OldValue != tstfoldercfg.Name)
+ {
+ bool isunique = tstfoldercfg.CheckUniqueName(tstfoldercfg.Name);
+ if (!isunique)
+ {
+ MessageBox.Show(string.Format("The Name '{0}' that was entered is not a unique folder name", tstfoldercfg.Name));
+ tstfoldercfg.Name = (string)e.OldValue;
+ }
+ }
+ }
+ Refresh();
}
}
- //public partial class SystemConfig
- //{
- // FolderConfig _FolderConfig;
- // public SystemConfig(FolderConfig folderConfig)
- // {
- // _FolderConfig = folderConfig;
- // //_FolderConfig.Default_SPPrefix;
- // }
- // public string Default_SPPrefix
- // {
- // get { return _FolderConfig.Default_SPPrefix; }
- // set { _FolderConfig.Default_SPPrefix = value; }
- // }
- //}
}
\ No newline at end of file
diff --git a/PROMS/VEPROMS User Interface/frmRODbProperties.cs b/PROMS/VEPROMS User Interface/frmRODbProperties.cs
index f0381c40..1af79ffb 100644
--- a/PROMS/VEPROMS User Interface/frmRODbProperties.cs
+++ b/PROMS/VEPROMS User Interface/frmRODbProperties.cs
@@ -1,10 +1,7 @@
using System;
-using System.Collections.Generic;
-using System.ComponentModel;
using System.Data;
using System.Data.SqlClient;
using System.Drawing;
-using System.Text;
using System.Windows.Forms;
using System.IO;
using VEPROMS.CSLA.Library;
@@ -15,13 +12,8 @@ namespace VEPROMS
{
public partial class frmRODbProperties : Form
{
- private ProgressBarItem _ProgressBar = null;
- public ProgressBarItem ProgressBar
- {
- get { return _ProgressBar; }
- set { _ProgressBar = value; }
- }
- private void DoProgressBarRefresh(int value, int max, string text)
+ public ProgressBarItem ProgressBar { get; set; } = null;
+ private void DoProgressBarRefresh(int value, int max, string text)
{
if (ProgressBar == null) return;
ProgressBar.Value = value;
@@ -29,54 +21,30 @@ namespace VEPROMS
ProgressBar.Text = text;
Application.DoEvents();
}
- private string InitialProgressBarMessage
- {
- set
- {
- if (ProgressBar == null) return;
- ProgressBar.Value = 100;
- ProgressBar.Maximum = 100;
- ProgressBar.Text = value;
- Application.DoEvents();
- }
- }
- private string FinalProgressBarMessage
- {
- set
- {
- if (ProgressBar == null) return;
- ProgressBar.Value = 100;
- ProgressBar.Maximum = 100;
- ProgressBar.Text = value;
- Application.DoEvents();
- }
- }
private Point _ParentLocation;
public Point ParentLocation
{
get { return _ParentLocation; }
set { _ParentLocation = value; }
}
- private RODbInfo _roDbInfo;
- private string _origROName;
- private string _origFolderPath;
- private string _origSQLConnect = null;
- private DocVersion _docVersion;
+ private readonly RODbInfo _roDbInfo;
+ private readonly string _origROName;
+ private readonly string _origFolderPath;
+ private readonly string _origSQLConnect = null;
+ private readonly DocVersion _docVersion;
public frmRODbProperties(DocVersion docVersion, RODbInfo roDbInfo)
{
_roDbInfo = roDbInfo;
_docVersion = docVersion;
InitializeComponent();
- _origROName = (_roDbInfo == null) ? null : _roDbInfo.ROName;
- _origFolderPath = (_roDbInfo == null) ? null : _roDbInfo.FolderPath;
+ _origROName = _roDbInfo?.ROName;
+ _origFolderPath = _roDbInfo?.FolderPath;
_origSQLConnect = (_roDbInfo == null) ? null : (_roDbInfo.DBConnectionString == null || _roDbInfo.DBConnectionString == "" || _roDbInfo.DBConnectionString == "cstring") ? null : _roDbInfo.DBConnectionString;
// Disable the OK button when initialized. Enable it if the user makes changes
- ppBtnTestSQL.Visible = ppBtnTestSQL.Enabled = CanMigrateRoAccessToSql(roDbInfo);
- ppTxtSQL.Visible = ppTxtSQL.Enabled = CanMigrateRoAccessToSql(roDbInfo);
- ppLblSQL.Visible = CanMigrateRoAccessToSql(roDbInfo);
+ ppBtnTestSQL.Visible = ppBtnTestSQL.Enabled = ppTxtSQL.Visible = ppTxtSQL.Enabled = ppLblSQL.Visible = CanMigrateRoAccessToSql();
ppBtnOk.Enabled = false;
}
- private bool CanMigrateRoAccessToSql(RODbInfo rODbi)
+ private bool CanMigrateRoAccessToSql()
{
// C2017-003: This method is used to determine whether the sql server version can be used & if there is data.
// A command line argument 'RoInSql'. For now, this argument must be used to allow code to run for ro->sql. Later
@@ -92,10 +60,12 @@ namespace VEPROMS
}
private void ppBtnFldrDlg_Click(object sender, EventArgs e)
{
- FolderBrowserDialog dlgROFolder = new FolderBrowserDialog();
- // Initialize the starting location in the Browser window
- dlgROFolder.SelectedPath = ppTxtPath.Text;
- if (dlgROFolder.ShowDialog() == DialogResult.OK)
+ FolderBrowserDialog dlgROFolder = new FolderBrowserDialog
+ {
+ // Initialize the starting location in the Browser window
+ SelectedPath = ppTxtPath.Text
+ };
+ if (dlgROFolder.ShowDialog() == DialogResult.OK)
{
ppTxtPath.Text = dlgROFolder.SelectedPath;
}
@@ -141,7 +111,7 @@ namespace VEPROMS
catch (SqlException) { }
}
}
- catch (Exception ex) {}
+ catch (Exception) { }
if (canconnect)
roDb.DBConnectionString = (ppTxtSQL.Text == null || ppTxtSQL.Text == "") ? "cstring" : ppTxtSQL.Text;
else
@@ -228,7 +198,7 @@ namespace VEPROMS
string rofstPath = ppTxtPath.Text + @"\ro.fst";
if (!File.Exists(rofstPath))
{
- MessageBox.Show("No existing ro.fst in path " + ppTxtPath.Text + ". Check for invalid path");
+ MessageBox.Show($"No existing ro.fst in path {ppTxtPath.Text}. Check for invalid path");
return;
}
string connectstr = ppTxtSQL.Text != null && ppTxtSQL.Text != "" ? ppTxtExt.Text : "cstring";
@@ -242,8 +212,8 @@ namespace VEPROMS
private void frmRODbProperties_Load(object sender, EventArgs e)
{
Location = ParentLocation;
- ppRTxtName.Text = (_roDbInfo == null) ? null : _roDbInfo.ROName;
- ppTxtPath.Text = (_roDbInfo == null) ? null : _roDbInfo.FolderPath;
+ ppRTxtName.Text = _roDbInfo?.ROName;
+ ppTxtPath.Text = _roDbInfo?.FolderPath;
ppTxtSQL.Text = (_roDbInfo == null) ? null : (_roDbInfo.DBConnectionString == "cstring") ? null : _roDbInfo.DBConnectionString;
RODbConfig cfg = (_roDbInfo == null) ? new RODbConfig() : new RODbConfig(_roDbInfo);
// Note that the Graphic Extension data is shown in a non-editable text box here because
@@ -251,15 +221,17 @@ namespace VEPROMS
// the file system. Otherwise it is derived from the top node - and changed from folder
// properties on the top node. And lastly, it is the code default.
ppTxtExt.Text = cfg.GetDefaultGraphicExtension();
- ppLblGraphicFileExtLoc.Text = (cfg == null) ? null : cfg.GetDefaultGraphicExtensionLocation();
+ ppLblGraphicFileExtLoc.Text = cfg?.GetDefaultGraphicExtensionLocation();
ppBtnOk.Enabled = false;
if (_roDbInfo == null)
{
string newFolderPath = null;
- FolderBrowserDialog dlgROFolder = new FolderBrowserDialog();
- dlgROFolder.RootFolder = Environment.SpecialFolder.MyComputer;
- dlgROFolder.SelectedPath = ppTxtPath.Text;
- if (dlgROFolder.ShowDialog() == DialogResult.OK)
+ FolderBrowserDialog dlgROFolder = new FolderBrowserDialog
+ {
+ RootFolder = Environment.SpecialFolder.MyComputer,
+ SelectedPath = ppTxtPath.Text
+ };
+ if (dlgROFolder.ShowDialog() == DialogResult.OK)
{
newFolderPath = dlgROFolder.SelectedPath;
RODbInfoList allRODBs = RODbInfoList.Get();
@@ -275,8 +247,6 @@ namespace VEPROMS
}
ppTxtPath.Text = newFolderPath;
}
- // Initialize the enabled status for the OK button to false.
- //ppBtnOk.Enabled = false;
ppTxtPath.TextChanged += ppTxtPath_TextChanged;
}
void ppTxtPath_TextChanged(object sender, EventArgs e)
@@ -313,7 +283,7 @@ namespace VEPROMS
}
catch (Exception ex)
{
- MessageBox.Show("Connection failed: " + ex);
+ MessageBox.Show($"Connection failed: {ex}");
}
}
diff --git a/PROMS/VEPROMS User Interface/frmSI.cs b/PROMS/VEPROMS User Interface/frmSI.cs
index 2f409572..08e650fa 100644
--- a/PROMS/VEPROMS User Interface/frmSI.cs
+++ b/PROMS/VEPROMS User Interface/frmSI.cs
@@ -1,7 +1,5 @@
using System;
using System.Collections.Generic;
-using System.ComponentModel;
-using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
@@ -12,14 +10,16 @@ namespace VEPROMS
{
public partial class frmSI : Form
{
- private StepTabRibbon _MyStepTabRibbon;
- private Dictionary _DicStepRtb;
- private Dictionary _DicCheckBox;
- private bool DoFolder = true;
- private SI SIDialogDef = null;
- private string OrigConfig = null;
- private FolderInfo MyFolderInfo = null;
- private DocVersionInfo MyDocVersionInfo = null;
+ private readonly StepTabRibbon _MyStepTabRibbon;
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE0044:Add readonly modifier", Justification = "Keeping Collections Not ReadOnly")]
+ private Dictionary _DicStepRtb;
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE0044:Add readonly modifier", Justification = "Keeping Collections Not ReadOnly")]
+ private Dictionary _DicCheckBox;
+ private readonly bool DoFolder = true;
+ private readonly SI SIDialogDef = null;
+ private readonly string OrigConfig = null;
+ private readonly FolderInfo MyFolderInfo = null;
+ private readonly DocVersionInfo MyDocVersionInfo = null;
public frmSI(SI siDialogDef, string config, bool doFolder, FolderInfo fi, DocVersionInfo dvi)
{
DoFolder = doFolder;
@@ -36,22 +36,23 @@ namespace VEPROMS
private void InitializeSpecificControls()
{
- this.Text = SIDialogDef.Caption;
- this.Location = new Point((int)SIDialogDef.x * 2, (int)SIDialogDef.y * 2);
+ Text = SIDialogDef.Caption;
+ Location = new Point((int)SIDialogDef.x * 2, (int)SIDialogDef.y * 2);
int maxx = 0;
int maxy = 0;
int xB4Scroll = 900;
int yB4Scroll = 630;
- this.panelSI.AutoScroll = false;
+ panelSI.AutoScroll = false;
foreach (SILabel lbl in SIDialogDef.LabelList)
{
- Label wlbl = new Label();
- wlbl.Text = lbl.text;
- wlbl.Location = new Point((int)lbl.x * 2, (int)lbl.y * 2);
- wlbl.AutoSize = true;
- //wlbl.Size = new Size((int)lbl.width * 2, (int)lbl.height * 2);
- wlbl.Visible = true;
- this.panelSI.Controls.Add(wlbl);
+ Label wlbl = new Label
+ {
+ Text = lbl.text,
+ Location = new Point((int)lbl.x * 2, (int)lbl.y * 2),
+ AutoSize = true,
+ Visible = true
+ };
+ panelSI.Controls.Add(wlbl);
maxx = ((int)lbl.x * 2 + (int)lbl.width * 2) > maxx ? ((int)lbl.x * 2 + (int)lbl.width * 2) : maxx;
maxy = ((int)lbl.y * 2 + (int)lbl.height * 2) > maxy ? ((int)lbl.y * 2 + (int)lbl.height * 2) : maxy;
}
@@ -70,7 +71,7 @@ namespace VEPROMS
// (Removed the frmSI specific contextmenustrip1)
tb.FieldToEdit = E_FieldToEdit.PSI;
tb.BorderStyle = BorderStyle.FixedSingle;
- tb.Enter += new System.EventHandler(this.FieldStepRTB_Enter);
+ tb.Enter += new System.EventHandler(FieldStepRTB_Enter);
// see if config has data for this field, i.e. search for the 'name'
// B2019-133 continuation of B2018-057 Replace non-breaking hyphen with hyphen.
string val = (DoFolder ? folderConfig.GetValue("SI", fld.name) : dvConfig.GetValue("SI", fld.name)).Replace("\\u8209?", "-");
@@ -78,12 +79,12 @@ namespace VEPROMS
StringBuilder sb = new StringBuilder();
sb.Append(@"{\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\fnil\fcharset2 Arial;}");
sb.Append(@"{\f1\fnil\fcharset0 Arial;}}{\colortbl ;\red255\green0\blue0;}"); // C2017-036 Microsoft removed Arial Unicode MS with Word16
- sb.Append(@"\viewkind4\uc1\pard\sl-240\slmult0\fs" + (int)(this.Font.SizeInPoints*2) + " " + dt.StartText + @"}");
+ sb.Append(@"\viewkind4\uc1\pard\sl-240\slmult0\fs" + (int)(Font.SizeInPoints*2) + " " + dt.StartText + @"}");
tb.Rtf = sb.ToString();
tb.Location = new Point((int)fld.x * 2, (int)fld.y * 2);
tb.Size = new Size((int)fld.width * 2, (int)fld.height * 2);
tb.Visible = true;
- this.panelSI.Controls.Add(tb);
+ panelSI.Controls.Add(tb);
maxx = ((int)fld.x * 2 + (int)fld.width * 2) > maxx ? ((int)fld.x * 2 + (int)fld.width * 2) : maxx;
maxy = ((int)fld.y * 2 + (int)fld.height * 2) > maxy ? ((int)fld.y * 2 + (int)fld.height * 2) : maxy;
}
@@ -96,8 +97,8 @@ namespace VEPROMS
cb.Visible = true;
cb.Width = (int)fld.width * 2;
string val = DoFolder ? folderConfig.GetValue("SI", fld.name) : dvConfig.GetValue("SI", fld.name);
- cb.Checked = val!=null && val!="" && val.ToUpper()[0] == 'Y' ? true : false;
- this.panelSI.Controls.Add(cb);
+ cb.Checked = val !=null && val!="" && val.ToUpper()[0] == 'Y';
+ panelSI.Controls.Add(cb);
maxx = ((int)fld.x * 2 + (int)fld.width * 2) > maxx ? ((int)fld.x * 2 + (int)fld.width * 2) : maxx;
maxy = ((int)fld.y * 2 + (int)fld.height * 2) > maxy ? ((int)fld.y * 2 + (int)fld.height * 2) : maxy;
}
@@ -105,19 +106,19 @@ namespace VEPROMS
if (maxx > xB4Scroll)
{
maxx = xB4Scroll;
- this.panelSI.Width = xB4Scroll;
- this.panelSI.AutoScroll = true;
+ panelSI.Width = xB4Scroll;
+ panelSI.AutoScroll = true;
}
else
- this.panelSI.Width = maxx + 50;
+ panelSI.Width = maxx + 50;
if (maxy > yB4Scroll)
{
maxy = yB4Scroll;
- this.panelSI.Height = yB4Scroll;
- this.panelSI.AutoScroll = true;
+ panelSI.Height = yB4Scroll;
+ panelSI.AutoScroll = true;
}
else
- this.panelSI.Height = maxy + 50;
+ panelSI.Height = maxy + 50;
if (SIDialogDef.ButtonsOnBottom == null || SIDialogDef.ButtonsOnBottom.ToUpper() == "NO")
{
btnOk.Location = new Point(maxx+70, 30);
@@ -189,29 +190,20 @@ namespace VEPROMS
}
}
DialogResult = DialogResult.OK;
- this.Close();
+ Close();
}
private void btnCancel_Click(object sender, EventArgs e)
{
DialogResult = DialogResult.Cancel;
- this.Close();
+ Close();
}
- // B2017-024 - added a clip board context menu
- private void fwdCMCbCut_Click(object sender, EventArgs e)
- {
- SendKeys.Send("^x"); //
- }
+ // B2017-024 - added a clip board context menu
+ private void fwdCMCbCut_Click(object sender, EventArgs e) => SendKeys.Send("^x"); //
- private void fwdCMCbCopy_Click(object sender, EventArgs e)
- {
- SendKeys.Send("^c"); //
- }
+ private void fwdCMCbCopy_Click(object sender, EventArgs e) => SendKeys.Send("^c"); //
- private void fwdCMCbPaste_Click(object sender, EventArgs e)
- {
- SendKeys.Send("^v"); //
- }
- }
+ private void fwdCMCbPaste_Click(object sender, EventArgs e) => SendKeys.Send("^v"); //
+ }
}
\ No newline at end of file
diff --git a/PROMS/VEPROMS User Interface/frmSectionProperties.cs b/PROMS/VEPROMS User Interface/frmSectionProperties.cs
index 06ee3ce2..f2ccb8e5 100644
--- a/PROMS/VEPROMS User Interface/frmSectionProperties.cs
+++ b/PROMS/VEPROMS User Interface/frmSectionProperties.cs
@@ -1,9 +1,5 @@
using System;
using System.Collections.Generic;
-using System.ComponentModel;
-using System.Data;
-using System.Drawing;
-using System.Text;
using System.Windows.Forms;
using VEPROMS.CSLA.Library;
using VEPROMS.Properties;
@@ -12,6 +8,7 @@ using DevComponents.DotNetBar.Controls;
using Volian.Controls.Library;
using DescriptiveEnum;
using System.IO;
+using System.Linq;
namespace VEPROMS
{
@@ -20,11 +17,10 @@ namespace VEPROMS
private string _DefaultFormatName = null;
private string _DefaultNumColumns = null;
private string _DefaultPaginationStyle = null;
- private string _DefaultPrintSize = null;
private bool _Initializing;
- private SectionConfig _SectionConfig;
- private Document _DocumentToDelete = null;
- private StepTabRibbon _MyStepTabRibbon;
+ private readonly SectionConfig _SectionConfig;
+ private Document _DocumentToDelete = null;
+ private readonly StepTabRibbon _MyStepTabRibbon;
private bool _isStepSection = true;
private bool _hasSectionCheckoffDefault = false;
private bool _isDefaultStepSection = false;
@@ -35,36 +31,30 @@ namespace VEPROMS
InitializeComponent();
btnGeneral.PerformClick(); // always start with General tab or button
ItemInfo ii = ItemInfo.Get(_SectionConfig.MySection.ItemID);
- //if (sectionConfig.Number.Length > 0)
- // this.Text = string.Format("{0} {1} Properties", sectionConfig.Number, sectionConfig.Title);
- //else
- // this.Text = string.Format("{0} Properties", sectionConfig.Title);
if (sectionConfig.Number.Length > 0)
- this.Text = string.Format("{0} {1} Properties", ii.DisplayNumber, ii.DisplayText);
+ Text = $"{ii.DisplayNumber} {ii.DisplayText} Properties";
else
- this.Text = string.Format("{0} Properties", ii.DisplayText);
+ Text = $"{ii.DisplayText} Properties";
ppSectTitleStpRTB.Font = ppSectTitleStpRTB.FormatFont = new System.Drawing.Font("Microsoft Sans Serif", 10F);
ppSectTitleStpRTB.FieldToEdit = E_FieldToEdit.Text;
ppSectTitleStpRTB.BorderStyle = BorderStyle.Fixed3D;
ppSectTitleStpRTB.MyItemInfo = ii;
ppSectTitleStpRTB.RefreshDisplay(true);
- ppSectNumberStpRTB.Font = this.ppSectNumberStpRTB.FormatFont = new System.Drawing.Font("Microsoft Sans Serif", 10F);
+ ppSectNumberStpRTB.Font = ppSectNumberStpRTB.FormatFont = new System.Drawing.Font("Microsoft Sans Serif", 10F);
ppSectNumberStpRTB.FieldToEdit = E_FieldToEdit.Number;
ppSectNumberStpRTB.BorderStyle = BorderStyle.Fixed3D;
ppSectNumberStpRTB.MyItemInfo = ii;
ppSectNumberStpRTB.RefreshDisplay(true);
- _MyStepTabRibbon = new StepTabRibbon();
- //_MyStepTabRibbon.Dock = System.Windows.Forms.DockStyle.Top;
- //_MyStepTabRibbon.Location = new System.Drawing.Point(0, 0);
- _MyStepTabRibbon.Name = "displayTabRibbon1";
- _MyStepTabRibbon.Visible = false;
+ _MyStepTabRibbon = new StepTabRibbon
+ {
+ Name = "displayTabRibbon1",
+ Visible = false
+ };
// B2017-272 disable/enable the Steps and Word radio buttons based on the section types defined in the format
// and the type of an existing section or if we are creating a new section.
// Move the check of creating a new section into CheckAvailableSectionTypes()
CheckAvaibleSectionTypes();
- //// if creating a new section, enable the StepSect and WordSect radio buttons
- //rbStepSect.Enabled = rbWordSect.Enabled = !(ii.HasWordContent || ii.HasStepContent);
// if this is an auto table of contents (mydocstyle == null if new section, so must check for that first)
if (ii.IsAutoTOCSection)
@@ -181,15 +171,14 @@ namespace VEPROMS
{
// find first section in list that has originalsteps (flags a default section)
int defsctId = 0;
- foreach (SectionInfo si in _SectionConfig.MySection.MySectionInfo.MyProcedure.Sections)
+ foreach (SectionInfo si in _SectionConfig.MySection.MySectionInfo.MyProcedure.Sections.OfType())
{
- SectionConfig sc = si.MyConfig as SectionConfig;
- if (si.ItemID != _SectionConfig.MySection.ItemID && sc != null && sc.Section_OriginalSteps == "Y")
- {
- defsctId = si.ItemID;
- break;
- }
- }
+ if (si.ItemID != _SectionConfig.MySection.ItemID && si.MyConfig is SectionConfig sc && sc.Section_OriginalSteps == "Y")
+ {
+ defsctId = si.ItemID;
+ break;
+ }
+ }
if (defsctId != 0)
{
// also need to set the procedure's config sectionstart to the selected section
@@ -209,19 +198,18 @@ namespace VEPROMS
// this property set - it is used when printing page numbers with 'WithSteps' numbering sequence.
else if (!_isDefaultStepSection && ppCbDefaultStepSection.Checked)
{
- foreach (SectionInfo si in _SectionConfig.MySection.MySectionInfo.MyProcedure.Sections)
+ foreach (SectionInfo si in _SectionConfig.MySection.MySectionInfo.MyProcedure.Sections.OfType())
{
- SectionConfig sc = si.MyConfig as SectionConfig;
- if (si.ItemID != _SectionConfig.MySection.ItemID && sc != null && sc.Section_OriginalSteps == "Y")
- {
- using (Section ssav = si.Get())
- {
- ssav.SectionConfig.Section_OriginalSteps = "N";
- ssav.Save();
- ItemInfo.Refresh(ssav);
- }
- }
- }
+ if (si.ItemID != _SectionConfig.MySection.ItemID && si.MyConfig is SectionConfig sc && sc.Section_OriginalSteps == "Y")
+ {
+ using (Section ssav = si.Get())
+ {
+ ssav.SectionConfig.Section_OriginalSteps = "N";
+ ssav.Save();
+ ItemInfo.Refresh(ssav);
+ }
+ }
+ }
// also need to set the procedure's config sectionstart to the selected section
// if it is not set:
using (Procedure p = Procedure.Get(_SectionConfig.MySection.MySectionInfo.MyProcedure.ItemID))
@@ -253,8 +241,8 @@ namespace VEPROMS
}
}
}
- this.DialogResult = DialogResult.OK;
- this.Close();
+ DialogResult = DialogResult.OK;
+ Close();
}
public void SaveText(StepRTB myStepRTB)
{
@@ -269,7 +257,7 @@ namespace VEPROMS
myStepRTB.ClearUndo();
}
}
- //private static void FinishSectionSave(Section section)
+
private void FinishSectionSave(Section section)
{
ItemInfo sectinfo = ItemInfo.Get(section.ItemID);
@@ -305,7 +293,7 @@ namespace VEPROMS
_DocumentToDelete = null;
sectionConfigBindingSource.CancelEdit();
DialogResult = DialogResult.Cancel;
- this.Close();
+ Close();
}
///
@@ -320,12 +308,6 @@ namespace VEPROMS
// Get the default format name
_DefaultFormatName = _SectionConfig.DefaultFormatSelection;
SetupDefault(_DefaultFormatName, ppLblFormatDefault, ppCmbxFormat);
- //if (_DefaultFormatName != null && !(_DefaultFormatName.Equals("")))
- //{
- // string defName = string.Format("{0}", _DefaultFormatName);
- // ppLblFormatDefault.Text = defName;
- // ppCmbxFormat.WatermarkText = defName;
- //}
SectionConfig.SectionColumnMode sc = _SectionConfig.Section_ColumnMode;
_DefaultNumColumns = sc.ToString();
SetupDefault(EnumDescConverter.GetEnumDescription(sc), ppLblDefaultNumColumns, ppCmbxNumColumns);
@@ -333,8 +315,6 @@ namespace VEPROMS
//Console.WriteLine("{0}, {1}, default pagination", _SectionConfig.MySection.DisplayNumber, sp);
_DefaultPaginationStyle = sp.ToString();
SetupDefault(EnumDescConverter.GetEnumDescription(sp), ppLblDefPaginationStyle, ppCmbxSectPagination);
- //_DefaultPrintSize = _SectionConfig.Section_AttachmentPrintSize.ToString();
- //SetupDefault(EnumDescConverter.GetEnumDescription(_SectionConfig.Section_AttachmentPrintSize), ppLblDefaultPrintSize, ppCmbxAccPgPrintSize);
_SectionConfig.ParentLookup = false;
}
@@ -349,7 +329,7 @@ namespace VEPROMS
{
if (defaultText != null && !(defaultText.Equals("")))
{
- string deftext = string.Format("{0}", defaultText);
+ string deftext = $"{defaultText}";
lbl.Text = deftext;
cmbo.WatermarkText = deftext;
}
@@ -365,7 +345,7 @@ namespace VEPROMS
ppCmbxFormat.DisplayMember = "FullName";
ppCmbxFormat.ValueMember = "FullName";
ppCmbxFormat.DataSource = FormatUtility.GetFilteredFormatList(FormatInfoList.SortedFormatInfoList);
- if (_SectionConfig.MySection.MySectionInfo.ActiveFormat != null) _cmbxformatOriginal = (int)_SectionConfig.MySection.MySectionInfo.ActiveFormat.FormatID;
+ if (_SectionConfig.MySection.MySectionInfo.ActiveFormat != null) _cmbxformatOriginal = (int)_SectionConfig.MySection.MySectionInfo.ActiveFormat.FormatID;
if (_SectionConfig.FormatSelection != null)
ppCmbxFormat.SelectedValue = _SectionConfig.FormatSelection;
else
@@ -373,7 +353,7 @@ namespace VEPROMS
// Get the saved settings for this user
//
// Get setting telling us whether to display the default values on this property page
- ppCbShwDefSettings.Checked = (Settings.Default["ShowDefaultSectionProp"] != null) ? Settings.Default.ShowDefaultSectionProp : false;
+ ppCbShwDefSettings.Checked = (Settings.Default["ShowDefaultSectionProp"] != null) && Settings.Default.ShowDefaultSectionProp;
// Get the User's property page style "PropPageStyle" (this is a system wide user setting)
// 1 - Button Dialog (default)
@@ -382,7 +362,7 @@ namespace VEPROMS
{
tcSectionProp.TabsVisible = true;
panSectBtns.Visible = false;
- this.Width -= panSectBtns.Width;
+ Width -= panSectBtns.Width;
}
// Get the default values for the property page information
@@ -419,24 +399,10 @@ namespace VEPROMS
ppBtnDefaultNumColumns.Visible = false;
ppCmbxNumColumns.SelectedValueChanged += new EventHandler(ppCmbxNumColumns_SelectedValueChanged);
- //ppCmbxAccPgPrintSize.DataSource = EnumDetail.Details();
- //ppCmbxAccPgPrintSize.DisplayMember = "Description";
- //ppCmbxAccPgPrintSize.ValueMember = "Evalue";
- //ppCmbxAccPgPrintSize.SelectedIndex = -1;
-
if (!_isStepSection)
ppCmbxLibDocFill();
- // check type of section from document styles to determine if the stepsection checkbox should
- // be checked.
- //int secindx = (int)_SectionConfig.SectionType;
- //// find the index for the document style to determine whether this is a step or word section.
PlantFormat pf = _SectionConfig.MyFormat != null ? _SectionConfig.MyFormat.PlantFormat : _SectionConfig.MyDefaultFormat.PlantFormat;
- //for (int i = 0; i < pf.DocStyles.DocStyleList.Count; i++)
- //{
- // if (pf.DocStyles.DocStyleList[i].Index == secindx)
- // rbStepSect.Checked = pf.DocStyles.DocStyleList[i].IsStepSection; _SectionConfig.MySection.
- //}
// set the StepSect radio button based on _isStepSection to ensure the proper section types are available
rbStepSect.Checked = _isStepSection;
@@ -455,7 +421,6 @@ namespace VEPROMS
// show the automatic indent checkbox.
ppCbEditableData.Enabled = _SectionConfig.MySection.MySectionInfo.Sections != null && _SectionConfig.MySection.MySectionInfo.Sections.Count > 0;
ppCbEditableData.Visible = _isStepSection; // only display if we are on a step editor section
- //ppCbAutoIndent.Enabled = _SectionConfig.MySection.MySectionInfo.Sections != null && _SectionConfig.MySection.MySectionInfo.Sections.Count > 0;
ppCbAutoIndent.Enabled = pf.FormatData.SectData.UseMetaSections;
ppCbAutoIndent.Visible = _isStepSection; // only display if we are on a step editor section
@@ -493,8 +458,6 @@ namespace VEPROMS
ppCbPlaceKeeper.Enabled = _isStepSection;
if (!_isStepSection && (_SectionConfig.MySection.MySectionInfo.MyDocStyle.StructureStyle.Style & E_DocStructStyle.Placekeeper) == E_DocStructStyle.Placekeeper)
{
- //ppCbPlaceKeeper.Text = "Auto Generate Placekeeper";
- //ppCbPlaceKeeper.Enabled = true;
ppCbPlaceKeeper.Enabled = false;
}
if (ppCbPlaceKeeper.Enabled) ppCbPlaceKeeper.Checked = _SectionConfig.Section_Placekeeper == "Y";
@@ -606,7 +569,7 @@ namespace VEPROMS
ppBtnConvertToDocX.Visible = false; // Don't allow save as DOCX for libraries documents
ppBtnCvrtToLibDoc.Text = "Convert this Section To A Non-Library Document";
lblLibraryDocument.Text = "Library Document";
- superTooltip1.SetSuperTooltip(this.ppBtnCvrtToLibDoc, new DevComponents.DotNetBar.SuperTooltipInfo("Convert To Non-Library Document", "", "This button will convert the current section from a library document to a non-library document",
+ superTooltip1.SetSuperTooltip(ppBtnCvrtToLibDoc, new DevComponents.DotNetBar.SuperTooltipInfo("Convert To Non-Library Document", "", "This button will convert the current section from a library document to a non-library document",
null, null, DevComponents.DotNetBar.eTooltipColor.Gray, true, false, new System.Drawing.Size(250, 76)));
}
else
@@ -616,17 +579,17 @@ namespace VEPROMS
{
ItemInfo ii = ItemInfo.Get(_SectionConfig.MySection.ItemID);
if (!ii.IsAutoTOCSection) // Only show the Convert To DocX button for non-Auto Table Of Contents Section
- this.ppBtnConvertToDocX.Visible = true; // Only allow save as DocX for normal word sections when the existing text is RTF.
+ ppBtnConvertToDocX.Visible = true; // Only allow save as DocX for normal word sections when the existing text is RTF.
}
else
- this.ppBtnConvertToDocX.Visible = false;
+ ppBtnConvertToDocX.Visible = false;
if (_SectionConfig.MySection.MyContent.MyEntry.MyDocument == null)
ppBtnCvrtToLibDoc.Visible = false;
else
{
ppBtnCvrtToLibDoc.Text = "Convert this to a Library Document";
lblLibraryDocument.Text = "Select Library Document";
- superTooltip1.SetSuperTooltip(this.ppBtnCvrtToLibDoc, new DevComponents.DotNetBar.SuperTooltipInfo("Convert To Library Document button", "", "This button will convert the current section to a library document, allowing it t" +
+ superTooltip1.SetSuperTooltip(ppBtnCvrtToLibDoc, new DevComponents.DotNetBar.SuperTooltipInfo("Convert To Library Document button", "", "This button will convert the current section to a library document, allowing it t" +
"o be shared with other procedures.", null, null, DevComponents.DotNetBar.eTooltipColor.Gray, true, false, new System.Drawing.Size(250, 76)));
}
}
@@ -694,12 +657,11 @@ namespace VEPROMS
int oldSelIndx = -1;
if (!myInit)
{
- DocStyleList oldDocStyles = null;
- opf = _SectionConfig.MyFormat != null ? _SectionConfig.MyFormat.PlantFormat : _SectionConfig.MyDefaultFormat.PlantFormat;
+ opf = _SectionConfig.MyFormat != null ? _SectionConfig.MyFormat.PlantFormat : _SectionConfig.MyDefaultFormat.PlantFormat;
if (pf != opf)
{
- oldDocStyles = new DocStyleList(null);
- foreach (DocStyle ds in opf.DocStyles.DocStyleListActive)
+ DocStyleList oldDocStyles = new DocStyleList(null);
+ foreach (DocStyle ds in opf.DocStyles.DocStyleListActive)
{
if (_isStepSection && ds.IsStepSection)
oldDocStyles.Add(ds); // find only step section types
@@ -786,7 +748,8 @@ namespace VEPROMS
}
}
private List SectionPropertyCheckOffList = null;
- private Dictionary _CheckOffIndex = new Dictionary(); // C2020-003 translate the sorted index number to the actual checkoff index
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE0044:Add readonly modifier", Justification = "Keeping Collections Not ReadOnly")]
+ private Dictionary _CheckOffIndex = new Dictionary(); // C2020-003 translate the sorted index number to the actual checkoff index
private void SetupCheckoffsDropdowns()
{
if (!_isStepSection) return; // not needed for accessory pages (word attachments)
@@ -794,7 +757,7 @@ namespace VEPROMS
_Initializing = true;
PlantFormat pf = _SectionConfig.MyFormat!=null?_SectionConfig.MyFormat.PlantFormat:_SectionConfig.MyDefaultFormat.PlantFormat;
CheckOffList chkoffList = pf.FormatData.ProcData.CheckOffData.CheckOffList;
- if (chkoffList != null) chkoffList.Sort(CompareCheckoffUsingOrderBy); // C2020-003 sort the checkoff list via the Index and/or OrderBy elements
+ chkoffList?.Sort(CompareCheckoffUsingOrderBy); // C2020-003 sort the checkoff list via the Index and/or OrderBy elements
CheckOffHeaderList chkoffHeaderList = pf.FormatData.ProcData.CheckOffData.CheckOffHeaderList;
int maxindx = pf.FormatData.ProcData.CheckOffData.CheckOffList.MaxIndexNoInherit;
// B2019-013: was crashing on indexer of checkofflist. If there were UCF checkoffs but none in original format, the indexer
@@ -815,10 +778,9 @@ namespace VEPROMS
if (chkoffList != null && maxindx > 0 &&
(pf.FormatData.ProcData.CheckOffData.Menu == "Signoff") || _hasSectionCheckoffDefault)
{
- if (SectionPropertyCheckOffList!=null)SectionPropertyCheckOffList.Clear();
+ SectionPropertyCheckOffList?.Clear();
SectionPropertyCheckOffList = new List();
// Don't put up the first item in the chkoffList, it is '{Section Default}'.
- //for (int i = 1; i < chkoffList.Count; i++)
int idxcnt = 0;
int translatedCfgIdx = 0;
_CheckOffIndex.Clear();
@@ -882,7 +844,7 @@ namespace VEPROMS
{
string suffix = "format ";
if (_DefaultFormatName.ToUpper().Contains("FORMAT")) suffix = "";
- MessageBox.Show(string.Format("{0}\n\n{1}does not support {2} section type", _DefaultFormatName, suffix, isWordSection ? "MS Word" : "Step"), "Incompatible Format", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
+ MessageBox.Show($"{_DefaultFormatName}\n\n{suffix}does not support {(isWordSection ? "MS Word" : "Step")} section type", "Incompatible Format", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
}
}
@@ -918,7 +880,6 @@ namespace VEPROMS
// determine if the default button and the default description text should visable
ppBtnDefaultFmt.Visible = !(ppCmbxFormat.SelectedValue == null || ppCmbxFormat.SelectedIndex == -1);
ppLblFormatDefault.Visible = ppCbShwDefSettings.Checked && ppBtnDefaultFmt.Visible;
- //if (!didDefault) SetupPpCmbxSectionType();
SetupPpCmbxSectionType();
// B2017-272 disable/enable the Steps and Word radio buttons based on the section types defined in the format
// and the type of an existing section or if we are creating a new section.
@@ -940,7 +901,7 @@ namespace VEPROMS
return true; // valid format
string suffix = "format ";
if (ppCmbxFormat.SelectedValue.ToString().ToUpper().Contains("FORMAT")) suffix = "";
- MessageBox.Show(string.Format("{0}\n\n{1}does not support {2} section type", ppCmbxFormat.SelectedValue, suffix, isWordSection ? "MS Word" : "Step"), "Incompatible Format", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
+ MessageBox.Show($"{ppCmbxFormat.SelectedValue}\n\n{suffix}does not support {(isWordSection ? "MS Word" : "Step")} section type", "Incompatible Format", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
return false;
}
@@ -951,20 +912,17 @@ namespace VEPROMS
_SectionConfig.SectionType = (int)(ppCmbxStyleSectionType.SelectedValue);
}
- #endregion
+ #endregion
- #region Library Document tab
+ #region Library Document tab
- ///
- /// This is the Library Document button used on the button interface design
- ///
- /// object
- /// EventArgs
- private void btnLibDocs_Click(object sender, EventArgs e)
- {
- ProcessButtonClick(tiLibDoc, btnLibDocs);
- }
- private void ppBtnCvrtToLibDoc_Click(object sender, EventArgs e)
+ ///
+ /// This is the Library Document button used on the button interface design
+ ///
+ /// object
+ /// EventArgs
+ private void btnLibDocs_Click(object sender, EventArgs e) => ProcessButtonClick(tiLibDoc, btnLibDocs);
+ private void ppBtnCvrtToLibDoc_Click(object sender, EventArgs e)
{
// Double Check that this is not a step section, if so just return.
if (_isStepSection) return;
@@ -995,7 +953,7 @@ namespace VEPROMS
ppCmbxLibDoc.Items.Clear();
ppCmbxLibDoc.WatermarkEnabled = true;
ppBtnCvrtToLibDoc.Text = "Convert this to a Library Document";
- superTooltip1.SetSuperTooltip(this.ppBtnCvrtToLibDoc, new DevComponents.DotNetBar.SuperTooltipInfo("Convert To Library Document button", "", "This button will convert the current section to a library document, allowing it t" +
+ superTooltip1.SetSuperTooltip(ppBtnCvrtToLibDoc, new DevComponents.DotNetBar.SuperTooltipInfo("Convert To Library Document button", "", "This button will convert the current section to a library document, allowing it t" +
"o be shared with other procedures.", null, null, DevComponents.DotNetBar.eTooltipColor.Gray, true, false, new System.Drawing.Size(250, 76)));
return;
}
@@ -1038,7 +996,7 @@ namespace VEPROMS
}
ppBtnCvrtToLibDoc.Text = "Convert this Section To A Non-Library Document";
lblLibraryDocument.Text = "Library Document";
- superTooltip1.SetSuperTooltip(this.ppBtnCvrtToLibDoc, new DevComponents.DotNetBar.SuperTooltipInfo("Convert To Non-Library Document", "", "This button will convert the current section from a library document to a non-library document",
+ superTooltip1.SetSuperTooltip(ppBtnCvrtToLibDoc, new DevComponents.DotNetBar.SuperTooltipInfo("Convert To Non-Library Document", "", "This button will convert the current section from a library document to a non-library document",
null, null, DevComponents.DotNetBar.eTooltipColor.Gray, true, false, new System.Drawing.Size(250, 76)));
}
@@ -1070,11 +1028,6 @@ namespace VEPROMS
}
}
- //else if (_SectionConfig.MySection.MyContent.MyEntry.MyDocument == null)
- //{
- // // was creating a new document & selected to connect it to a libdoc
- // _DocumentToDelete = _SectionConfig.MySection.MyContent.MyEntry.MyDocument;
- //}
else
{
// it already is a library document, just change usages...
@@ -1086,34 +1039,30 @@ namespace VEPROMS
}
else
{
- throw new Exception(string.Format("Index Out Of Range Index = {0}, Count = {1}", ppCmbxLibDoc.SelectedIndex, LibDocList.Count));
+ throw new Exception($"Index Out Of Range Index = {ppCmbxLibDoc.SelectedIndex}, Count = {LibDocList.Count}");
}
}
}
- #endregion
+ #endregion
- #region View Settings tab
+ #region View Settings tab
- ///
- /// This is the View Settings button used on the button interface design
- ///
- /// object
- /// EventArgs
- private void btnAutomation_Click(object sender, EventArgs e)
+ ///
+ /// This is the View Settings button used on the button interface design
+ ///
+ /// object
+ /// EventArgs
+ private void btnAutomation_Click(object sender, EventArgs e) => ProcessButtonClick(tiAutomation, btnAutomation);
+
+ #endregion
+
+ #region Generic functions used on this property page
+
+ ///
+ /// Determines what labels (showing default values) are visable on the property pages
+ ///
+ private void defaultSettingsVisiblity()
{
- ProcessButtonClick(tiAutomation, btnAutomation);
- }
-
- #endregion
-
- #region Generic functions used on this property page
-
- ///
- /// Determines what labels (showing default values) are visable on the property pages
- ///
- private void defaultSettingsVisiblity()
- {
- //ItemInfo ii = ItemInfo.Get(_SectionConfig.MySection.ItemID);
ppLblDefSettingsInfo.Visible = ppCbShwDefSettings.Checked;
ppLblFormatDefault.Visible = ppCbShwDefSettings.Checked && ppBtnDefaultFmt.Visible;
ppLblDefaultNumColumns.Visible = _isStepSection && ppCbShwDefSettings.Checked && ppBtnDefaultNumColumns.Visible;
@@ -1160,26 +1109,7 @@ namespace VEPROMS
private void tabpage_Enter(object sender, EventArgs e)
{
// Show or hide the labels containing the default values
- //if (!_Initializing) // jsj 1-23-2017 was not showing default check upon property page entry
- defaultSettingsVisiblity();
- }
- ///
- /// Process a change in the combo box selection
- ///
- /// Combo Box Name
- /// string containing default text
- /// button to reset to default value
- /// label containing the default
- private void ProcessCmbxSelectedValueChange(ComboBoxEx cmbx, string defstr, ButtonX button, Label deflabel)
- {
- if ((cmbx.SelectedIndex != -1) && defstr != null && defstr.Equals(cmbx.SelectedValue))
- {
- button.Visible = true;
- button.Focus();
- button.PerformClick();
- }
- button.Visible = (cmbx.SelectedValue != null);
- deflabel.Visible = (ppCbShwDefSettings.Checked) && button.Visible;
+ defaultSettingsVisiblity();
}
///
/// Process a change in the enum combo box selection
@@ -1201,30 +1131,21 @@ namespace VEPROMS
cmbx.SelectedIndex = -1; // This will hide the Default button
_Initializing = sav_Initializing;
}
- //button.Visible = ((!_FolderConfig.Name.Equals("VEPROMS")) && (cmbx.SelectedValue != null));
button.Visible = ((cmbx.SelectedValue != null) && (cmbx.SelectedIndex >= 0));
deflabel.Visible = ppCbShwDefSettings.Checked && button.Visible;
}
- #endregion
+ #endregion
- private void ppSectNumberStpRTB_Enter(object sender, EventArgs e)
- {
- _MyStepTabRibbon.MyStepRTB = ppSectNumberStpRTB;
- }
+ private void ppSectNumberStpRTB_Enter(object sender, EventArgs e) => _MyStepTabRibbon.MyStepRTB = ppSectNumberStpRTB;
- private void ppSectTitleStpRTB_Enter(object sender, EventArgs e)
- {
- _MyStepTabRibbon.MyStepRTB = ppSectTitleStpRTB;
- }
+ private void ppSectTitleStpRTB_Enter(object sender, EventArgs e) => _MyStepTabRibbon.MyStepRTB = ppSectTitleStpRTB;
- private void ShowAvailableOptionsForSectionType()
+ private void ShowAvailableOptionsForSectionType()
{
lblColumns.Visible = _isStepSection;
ppCmbxNumColumns.Visible = _isStepSection;
lblPagination.Visible = _isStepSection;
ppCmbxSectPagination.Visible = _isStepSection;
- //lblPrintSize.Visible = !_isStepSection;
- //ppCmbxAccPgPrintSize.Visible = !_isStepSection;
ppGpbxSignoffCheckoff.Visible = _isStepSection;
cbKeepWordDocMargins.Visible = !_isStepSection;
ppCbDefaultStepSection.Visible = _isStepSection;
@@ -1257,12 +1178,6 @@ namespace VEPROMS
tcpFormat.Focus();
}
- //private void ppCmbxAccPgPrintSize_SelectedValueChanged(object sender, EventArgs e)
- //{
- // SectionConfig.AttPrintSize attsize = (SectionConfig.AttPrintSize)Enum.Parse(typeof(SectionConfig.AttPrintSize), _DefaultPrintSize);
- // ProcessCmbxSelectionEnumChanged(ppCmbxAccPgPrintSize, attsize, ppBtnDefaultPrintSize, ppLblDefaultPrintSize);
- //}
-
private void ppBtnDefaultPaginationStyle_Click(object sender, EventArgs e)
{
// Get the parent setting
@@ -1285,12 +1200,9 @@ namespace VEPROMS
tcpFormat.Focus();
}
- private void frmSectionProperties_Shown(object sender, EventArgs e)
- {
- ppSectNumberStpRTB.Focus();
- }
+ private void frmSectionProperties_Shown(object sender, EventArgs e) => ppSectNumberStpRTB.Focus();
- private void ppCbEditableData_CheckedChanged(object sender, EventArgs e)
+ private void ppCbEditableData_CheckedChanged(object sender, EventArgs e)
{
bool isEditable = ppCbEditableData.Checked;
if (!_Initializing)
@@ -1353,7 +1265,7 @@ namespace VEPROMS
int cntDefaultSect = 0;
string defSectDesc = "";
string curSectDesc = "";
- foreach (SectionInfo si in _SectionConfig.MySection.MySectionInfo.MyProcedure.Sections)
+ foreach (SectionInfo si in _SectionConfig.MySection.MySectionInfo.MyProcedure.Sections.OfType())
{
SectionConfig sc = si.MyConfig as SectionConfig;
if (sc != null && sc.Section_OriginalSteps == "Y")
@@ -1405,10 +1317,6 @@ namespace VEPROMS
ItemInfo ii = ItemInfo.Get(_SectionConfig.MySection.ItemID);
DocumentInfo doclibinfo = ii.MyContent.MyEntry.MyDocument;
DSOFile myfile = new DSOFile(doclibinfo);
- // When trying to fix this , the update of the document waas causing a CSLA crash so I switched
- // to make document
- //using (Document myDoc = doclibinfo.Get())
- //{
// Open MSWord App
LBWordLibrary.LBApplicationClass ap = new LBWordLibrary.LBApplicationClass();
LBWordLibrary.LBDocumentClass doc = ap.Documents.Open(myfile.FullName);
@@ -1420,17 +1328,13 @@ namespace VEPROMS
FileStream fs = File.Open(filename, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);// B2016-053
long len = fs.Length;
byte[] ByteArray = new byte[len];
- int nBytesRead = fs.Read(ByteArray, 0, (int)len);
+ _ = fs.Read(ByteArray, 0, (int)len);
fs.Close();
Document myDoc = Document.MakeDocument(null, ByteArray, doclibinfo.DocAscii, doclibinfo.Config, ".DOCX");
_SectionConfig.MySection.MyContent.MyEntry.MyDocument = myDoc;
_SectionConfig.MySection.MyContent.MyEntry.Save();
- //myDoc.DocContent = ByteArray;
- //myDoc.FileExtension = ".DOCX";
- //myDoc.Save();
fi.Delete();// Cleanup afterwards
ppBtnConvertToDocX.Visible = false; // Hide the button after the execution is complete.
- //}
}
private void ppCmbxFormat_DropDown(object sender, EventArgs e)
@@ -1460,14 +1364,11 @@ namespace VEPROMS
_SectionConfig.Section_IsFoldout = (cbIsFoldoutSection.Checked) ? "Y" : "N";
}
- // B2019-165 check box added to Automation tab to prevent a duplex foldout from
- // being printed on the back of the last page of the Word document that does not include duplex foldouts
- private void ppCbNoDuplexFoldout_CheckedChanged(object sender, EventArgs e)
- {
- _SectionConfig.Section_DontIncludeDuplexFoldout = ppCbNoDuplexFoldout.Checked;
- }
- // C2029-025 Show or hide replace words. Can highlight replace words in editor.
- private void ppCbShowRplWords_CheckedChanged(object sender, EventArgs e)
+ // B2019-165 check box added to Automation tab to prevent a duplex foldout from
+ // being printed on the back of the last page of the Word document that does not include duplex foldouts
+ private void ppCbNoDuplexFoldout_CheckedChanged(object sender, EventArgs e) => _SectionConfig.Section_DontIncludeDuplexFoldout = ppCbNoDuplexFoldout.Checked;
+ // C2029-025 Show or hide replace words. Can highlight replace words in editor.
+ private void ppCbShowRplWords_CheckedChanged(object sender, EventArgs e)
{
if (!_Initializing)
{
@@ -1475,15 +1376,5 @@ namespace VEPROMS
}
}
- //private void ppBtnDefaultPrintSize_Click(object sender, EventArgs e)
- //{
- // // Get the parent setting
- // SectionConfig.AttPrintSize attsize = (SectionConfig.AttPrintSize)Enum.Parse(typeof(SectionConfig.AttPrintSize), _DefaultPrintSize);
- // // Compare parent setting with current setting
- // if (attsize != _SectionConfig.Section_AttachmentPrintSize)
- // _SectionConfig.Section_AttachmentPrintSize = attsize; // this will force a database update (write)
- // ppCmbxAccPgPrintSize.SelectedIndex = -1;//reset to the default Accessory page Print Size setting
- // tcpFormat.Focus();
- //}
}
}
diff --git a/PROMS/VEPROMS User Interface/frmSysOptions.cs b/PROMS/VEPROMS User Interface/frmSysOptions.cs
index 7d6fd3a2..e7200866 100644
--- a/PROMS/VEPROMS User Interface/frmSysOptions.cs
+++ b/PROMS/VEPROMS User Interface/frmSysOptions.cs
@@ -1,32 +1,21 @@
using System;
-using System.Collections.Generic;
-using System.ComponentModel;
-using System.Data;
using System.Drawing;
-using System.Text;
using System.Windows.Forms;
-using DevComponents;
using DevComponents.DotNetBar.Rendering;
using DevComponents.DotNetBar;
using VEPROMS.Properties;
using Volian.Base.Library;
-using DescriptiveEnum;
using VEPROMS.CSLA.Library;
namespace VEPROMS
{
public partial class frmSysOptions : DevComponents.DotNetBar.Office2007Form
{
- bool _initializing;
- private bool _CanChangeSeparateWindowsSetting = true;
+ readonly bool _initializing;
- public bool CanChangeSeparateWindowsSetting
- {
- get { return _CanChangeSeparateWindowsSetting; }
- set { _CanChangeSeparateWindowsSetting = value; }
- }
+ public bool CanChangeSeparateWindowsSetting { get; set; } = true;
- private UserSettings _usersettings;
+ private UserSettings _usersettings;
public frmSysOptions()
{
@@ -160,8 +149,8 @@ namespace VEPROMS
//C2025-013 - Allow not continuously generate message that opening Summaries in MS Word
_usersettings.SetUserSetting_MSWord_Summary_Prompt(cbMSWordPrompt.Checked);
- this.DialogResult = DialogResult.OK;
- this.Close();
+ DialogResult = DialogResult.OK;
+ Close();
}
private int ss_propPageStyle;
@@ -197,7 +186,7 @@ namespace VEPROMS
private void RestoreStartingSettings() // used with the cancel button
{
Settings.Default.PropPageStyle = ss_propPageStyle;
- Settings.Default.SystemColor = ss_SystemColor;
+ Settings.Default.SystemColor = ss_SystemColor;
Settings.Default.TransitionRangeColor = ss_TransRangeColor;
Settings.Default.AutoPopUpAnnotations = ss_PopUPAnnotations;
Settings.Default.StepTypeToolTip = ss_StepTypeToolTip;
@@ -255,52 +244,30 @@ namespace VEPROMS
}
}
- private void cbAnnotationPopup_CheckedChanged(object sender, EventArgs e)
- {
- Settings.Default.AutoPopUpAnnotations = cbAnnotationPopup.Checked;
- }
+ private void cbAnnotationPopup_CheckedChanged(object sender, EventArgs e) => Settings.Default.AutoPopUpAnnotations = cbAnnotationPopup.Checked;
- private void frmSysOptions_Load(object sender, EventArgs e)
+ private void frmSysOptions_Load(object sender, EventArgs e)
{
ClearAllCheckedButtons();
tcSysOpts.SelectedTab = tiIntrFaceStngs;
btnIntrFaceStngs.Checked = true;
- gpSeparateWindows.Enabled = CanChangeSeparateWindowsSetting; //Separate Windows only if one or less procedure sets open
- }
+ gpSeparateWindows.Enabled = CanChangeSeparateWindowsSetting; //Separate Windows only if one or less procedure sets open
+ }
private void cbStepTypeToolTip_CheckedChanged(object sender, EventArgs e)
{
Settings.Default.StepTypeToolTip = cbStepTypeToolTip.Checked;
VlnSettings.StepTypeToolTip = cbStepTypeToolTip.Checked;
}
- private void cbTVExpand_CheckedChanged(object sender, EventArgs e)
- {
- Settings.Default.SaveTreeviewExpanded = cbTVExpand.Checked;
- }
- private void cbSeparateWindows_CheckedChanged(object sender, EventArgs e)
- {
- Settings.Default.SeparateWindows = cbSeparateWindows.Checked;
- }
- private void txbxVisioPath_Leave(object sender, EventArgs e)
- {
- Settings.Default.VisioPath = txbxVisioPath.Text;
- }
+ private void cbTVExpand_CheckedChanged(object sender, EventArgs e) => Settings.Default.SaveTreeviewExpanded = cbTVExpand.Checked;
+ private void cbSeparateWindows_CheckedChanged(object sender, EventArgs e) => Settings.Default.SeparateWindows = cbSeparateWindows.Checked;
+ private void txbxVisioPath_Leave(object sender, EventArgs e) => Settings.Default.VisioPath = txbxVisioPath.Text;
- private void btnCancel_Click(object sender, EventArgs e)
- {
- RestoreStartingSettings();
- }
+ private void btnCancel_Click(object sender, EventArgs e) => RestoreStartingSettings();
- private void txbxVisioPath_Leave_1(object sender, EventArgs e)
- {
- Settings.Default.VisioPath = txbxVisioPath.Text;
- }
+ private void txbxVisioPath_Leave_1(object sender, EventArgs e) => Settings.Default.VisioPath = txbxVisioPath.Text;
-
- private void cbOTRemember_CheckedChanged(object sender, EventArgs e)
- {
- cbOTAutoOpen.Enabled = cbOTAutoOpen.Visible = cbShwRplWrdsColor.Checked;
- }
- private void cbShwRplWrdsColor_CheckedChanged(object sender, EventArgs e)
+ private void cbOTRemember_CheckedChanged(object sender, EventArgs e) => cbOTAutoOpen.Enabled = cbOTAutoOpen.Visible = cbShwRplWrdsColor.Checked;
+ private void cbShwRplWrdsColor_CheckedChanged(object sender, EventArgs e)
{
Settings.Default.cbShwRplWrdsColor = cbShwRplWrdsColor.Checked;
VlnSettings.cbShwRplWrdsColor = cbShwRplWrdsColor.Checked;
@@ -308,10 +275,7 @@ namespace VEPROMS
Properties.Settings.Default.Save(); // save settings
}
- private void cbShwAnnoFilter_Click(object sender, EventArgs e)
- {
- frmVEPROMS.tv_SelectAnnotations();
- }
+ private void cbShwAnnoFilter_Click(object sender, EventArgs e) => frmVEPROMS.tv_SelectAnnotations();
- }
+ }
}
\ No newline at end of file
diff --git a/PROMS/VEPROMS User Interface/frmVEPROMS.cs b/PROMS/VEPROMS User Interface/frmVEPROMS.cs
index dd1ce0e3..744327a8 100644
--- a/PROMS/VEPROMS User Interface/frmVEPROMS.cs
+++ b/PROMS/VEPROMS User Interface/frmVEPROMS.cs
@@ -39,17 +39,12 @@ namespace VEPROMS
StepTabPanel _SelectedStepTabPanel = null;
public FindReplace dlgFindReplace = null;
public VlnSpellCheck SpellChecker = null;
- private Int64 _LastContentChange;
- public Int64 LastContentChange
- {
- get { return _LastContentChange; }
- set { _LastContentChange = value; }
- }
+ public long LastContentChange { get; set; }
- public void RefreshLastChange()
+ public void RefreshLastChange()
{
- lblLastChange.Text = string.Format("Last Change: {0}", MySessionInfo.LastContentChange - this.LastContentChange);
+ lblLastChange.Text = $"Last Change: {MySessionInfo.LastContentChange - LastContentChange}";
}
public StepTabPanel SelectedStepTabPanel
@@ -71,10 +66,6 @@ namespace VEPROMS
}
else // Step Tab Panel
{
- // The following line was broken into separate lines because a NullReferenceError was occurring.
- // Now we should be able to tell what is wrong by which line causes the Null Reference Error
- // RHM 20101217
- //SelectedDVI = value.MyStepPanel.MyProcedureItemInfo.MyProcedure.ActiveParent as DocVersionInfo;
StepPanel stepPanel = value.MyStepPanel;
ItemInfo itemInfo = stepPanel.MyProcedureItemInfo;
ProcedureInfo procedureInfo = itemInfo.MyProcedure;
@@ -101,7 +92,7 @@ namespace VEPROMS
void MyStepTabRibbon_ContActionSummaryRequest(object sender, StepTabRibbonEventArgs args)
{
- DialogResult dr = System.Windows.Forms.DialogResult.Yes;
+ DialogResult dr = DialogResult.Yes;
ProcedureInfo piThis = null;
if (_CurrentItem != null) piThis = _CurrentItem.MyProcedure;
@@ -114,17 +105,18 @@ namespace VEPROMS
//added by jcb 20130718 to support create pdf button when multi-unit and user selects a unit
pi.MyDocVersion.DocVersionConfig.SelectedSlave = pi.ProcedureConfig.SelectedSlave;
- DlgPrintProcedure prnDlg = new DlgPrintProcedure(pi);
+ DlgPrintProcedure prnDlg = new DlgPrintProcedure(pi)
+ {
+ //added by jcb 20130718 to support create pdf button when multi-unit and user selects a unit
+ SelectedSlave = (pi.ProcedureConfig.SelectedSlave == 0) ? -1 : pi.ProcedureConfig.SelectedSlave,
+ MySessionInfo = MySessionInfo,
+ Automatic = true,
+ CreateContinuousActionSummary = true,
+ OpenAfterCreate = (dr == DialogResult.Yes),
+ Prefix = "CASTMP_" // A temporary procedure PDF is created to grab page numbers
+ };
- //added by jcb 20130718 to support create pdf button when multi-unit and user selects a unit
- prnDlg.SelectedSlave = (pi.ProcedureConfig.SelectedSlave == 0) ? -1 : pi.ProcedureConfig.SelectedSlave;
- prnDlg.MySessionInfo = MySessionInfo;
- prnDlg.Automatic = true;
- prnDlg.CreateContinuousActionSummary = true;
- prnDlg.OpenAfterCreate = (dr == System.Windows.Forms.DialogResult.Yes);
- prnDlg.Prefix = "CASTMP_"; // A temporary procedure PDF is created to grab page numbers
-
- prnDlg.SetupForProcedure();
+ prnDlg.SetupForProcedure();
prnDlg.CreatePDF();
//added by jcb 20130718 to support create pdf button when multi-unit and user selects a unit
@@ -133,7 +125,7 @@ namespace VEPROMS
// F2022-024 Time Critical Action Summary
void MyStepTabRibbon_TimeCriticalActionSummaryRequest(object sender, StepTabRibbonEventArgs args)
{
- DialogResult dr = System.Windows.Forms.DialogResult.Yes;
+ DialogResult dr = DialogResult.Yes;
ProcedureInfo piThis = null;
if (_CurrentItem != null) piThis = _CurrentItem.MyProcedure;
@@ -146,17 +138,18 @@ namespace VEPROMS
//added by jcb 20130718 to support create pdf button when multi-unit and user selects a unit
pi.MyDocVersion.DocVersionConfig.SelectedSlave = pi.ProcedureConfig.SelectedSlave;
- DlgPrintProcedure prnDlg = new DlgPrintProcedure(pi);
+ DlgPrintProcedure prnDlg = new DlgPrintProcedure(pi)
+ {
+ //added by jcb 20130718 to support create pdf button when multi-unit and user selects a unit
+ SelectedSlave = (pi.ProcedureConfig.SelectedSlave == 0) ? -1 : pi.ProcedureConfig.SelectedSlave,
+ MySessionInfo = MySessionInfo,
+ Automatic = true,
+ CreateTimeCriticalActionSummary = true,
+ OpenAfterCreate = (dr == DialogResult.Yes),
+ Prefix = "TCASTMP_" // A temporary procedure PDF is created to grab page numbers
+ };
- //added by jcb 20130718 to support create pdf button when multi-unit and user selects a unit
- prnDlg.SelectedSlave = (pi.ProcedureConfig.SelectedSlave == 0) ? -1 : pi.ProcedureConfig.SelectedSlave;
- prnDlg.MySessionInfo = MySessionInfo;
- prnDlg.Automatic = true;
- prnDlg.CreateTimeCriticalActionSummary = true;
- prnDlg.OpenAfterCreate = (dr == System.Windows.Forms.DialogResult.Yes);
- prnDlg.Prefix = "TCASTMP_"; // A temporary procedure PDF is created to grab page numbers
-
- prnDlg.SetupForProcedure();
+ prnDlg.SetupForProcedure();
prnDlg.CreatePDF();
//added by jcb 20130718 to support create pdf button when multi-unit and user selects a unit
@@ -174,7 +167,7 @@ namespace VEPROMS
_SelectedROFst = null;
}
InitiateSearch(false);
- InitiateDisplayReports(false);
+ InitiateDisplayReports();
}
}
@@ -197,24 +190,13 @@ namespace VEPROMS
set { _SelectedROFst = value; }
}
- #endregion
+ #endregion
- private frmVEPROMS _MyParent;
- public frmVEPROMS MyParent
- {
- get { return _MyParent; }
- set { _MyParent = value; }
- }
+ public frmVEPROMS MyParent { get; set; }
+ public DocVersionInfo MyDocVersion { get; set; } = null;
- private DocVersionInfo _MyDocVersion = null;
- public DocVersionInfo MyDocVersion
- {
- get { return _MyDocVersion; }
- set { _MyDocVersion = value; }
- }
-
- // C2015-022 setup the child PROMS window
- public frmVEPROMS(frmVEPROMS myParent, DocVersionInfo myDocVersion)
+ // C2015-022 setup the child PROMS window
+ public frmVEPROMS(frmVEPROMS myParent, DocVersionInfo myDocVersion)
{
MyParent = myParent;
MyDocVersion = myDocVersion;
@@ -245,17 +227,11 @@ namespace VEPROMS
(tv.Nodes[0] as VETreeNode).InChildWindow = true; // tells us this folder's tree nodes are in the child window
}
- public void OpenItem(ItemInfo myItemInfo)
- {
- tc.OpenItem(myItemInfo);
- }
+ public void OpenItem(ItemInfo myItemInfo) => tc.OpenItem(myItemInfo);
- public void RefreshItem(ItemInfo myItemInfo)
- {
- tc.RefreshItem(myItemInfo);
- }
+ public void RefreshItem(ItemInfo myItemInfo) => tc.RefreshItem(myItemInfo);
- public void tv_FolderDelete(int folderId)
+ public void tv_FolderDelete(int folderId)
{
// Create an instance of the event args if needed
var args = new vlnTreeFolderDeleteEventArgs(folderId);
@@ -278,16 +254,16 @@ namespace VEPROMS
// instructs the user to try again.
try
{
- if (Properties.Settings.Default.UpdateSettings)
+ if (Settings.Default.UpdateSettings)
{
- Properties.Settings.Default.Upgrade();
- Properties.Settings.Default.UpdateSettings = false;
- Properties.Settings.Default.Save();
+ Settings.Default.Upgrade();
+ Settings.Default.UpdateSettings = false;
+ Settings.Default.Save();
}
}
catch (Exception ex)
{
- _MyLog.Error(ex.GetType().Name + " - " + ex.InnerException, ex);
+ _MyLog.Error($"{ex.GetType().Name} - {ex.InnerException}", ex);
if (ex.Message.StartsWith("Configuration system failed to initialize"))
{
@@ -300,44 +276,20 @@ namespace VEPROMS
MessageBox.Show("Config file was corrupt, it has been deleted.\r\nTry Again", "Corrupt config file", MessageBoxButtons.OK, MessageBoxIcon.Error);
- System.Diagnostics.Process.GetCurrentProcess().Kill();
+ Process.GetCurrentProcess().Kill();
}
}
// If first time close any remaining WinWords. These will sometimes get hung in memory and cause problems.
- if (System.Diagnostics.Process.GetProcessesByName(System.Diagnostics.Process.GetCurrentProcess().ProcessName).Length == 1)
+ if (Process.GetProcessesByName(Process.GetCurrentProcess().ProcessName).Length == 1)
{
Volian.MSWord.WordDoc.KillWordApps();
}
- // cleanup from previous run:
- Volian.Base.Library.TmpFile.RemoveAllTmps();
+ // cleanup from previous run:
+ TmpFile.RemoveAllTmps();
- if (VlnSettings.DebugMode)
- {
- //use local data (for development/debug mode)
- if (Environment.MachineName == "RMARK-PC")
- VEPROMS.CSLA.Library.Database.ConnectionName = "VEPROMS_RMARK_DEBUG";
- else if (Environment.MachineName == "WINDOWS7-RHM")
- VEPROMS.CSLA.Library.Database.ConnectionName = "VEPROMS_RMARK_DEBUG";
- else if (Environment.UserName.ToUpper() == "BODINE")
- VEPROMS.CSLA.Library.Database.ConnectionName = "VEPROMS_BODINE_DEBUG";
- else
- VEPROMS.CSLA.Library.Database.ConnectionName = "VEPROMS_LOCAL";
- }
- else
- {
- // use server data (default)
- // - except for the volian laptop and Rich's Demo version where we need to use local data
- if (Environment.MachineName == "RMARK-PC")
- VEPROMS.CSLA.Library.Database.ConnectionName = "VEPROMS_RMARK_DEMO";
- else if (Environment.MachineName == "WINDOWS7-RHM")
- VEPROMS.CSLA.Library.Database.ConnectionName = "VEPROMS_RMARK_DEMO";
- else if (Environment.UserName.ToUpper() == "BODINE")
- VEPROMS.CSLA.Library.Database.ConnectionName = "VEPROMS_BODINE_DEMO";
- else
- VEPROMS.CSLA.Library.Database.ConnectionName = "VEPROMS_LOCAL";
- }
+ Database.ConnectionName = "VEPROMS_LOCAL";
InitializeComponent();
@@ -369,15 +321,15 @@ namespace VEPROMS
cmbFont.DataSource = FontFamily.Families;
cmbFont.DisplayMember = "Name";
cmbFont.SelectedIndex = -1;
- string[] parameters = System.Environment.CommandLine.Split(" ".ToCharArray());
- string db = Volian.Base.Library.VlnSettings.GetDB();
+ string[] parameters = Environment.CommandLine.Split(" ".ToCharArray());
+ string db = VlnSettings.GetDB();
if (db != null)
Database.SelectedDatabase = db;
//B2018-129 Most Recently Used list was being cleared. Needed to remove a (string) type case in the IF statement
- if (!string.IsNullOrEmpty((string)Properties.Settings.Default["DefaultDB"]))
- Database.LastDatabase = Properties.Settings.Default.DefaultDB;
+ if (!string.IsNullOrEmpty((string)Settings.Default["DefaultDB"]))
+ Database.LastDatabase = Settings.Default.DefaultDB;
// Setup the Context menu for DisplaySearch including the symbols
displaySearch1.SetupContextMenu();
@@ -396,12 +348,11 @@ namespace VEPROMS
if ((Database.LastDatabase ?? "") != (Database.SelectedDatabase ?? ""))
{
- if (Properties.Settings.Default.VersionWindows != null)
- Properties.Settings.Default.VersionWindows.Clear();
+ Settings.Default.VersionWindows?.Clear();
- Properties.Settings.Default.MRIList = null;
- Properties.Settings.Default.DefaultDB = Database.SelectedDatabase;
- Properties.Settings.Default.Save();
+ Settings.Default.MRIList = null;
+ Settings.Default.DefaultDB = Database.SelectedDatabase;
+ Settings.Default.Save();
}
displayBookMarks.SetupBookMarks();
@@ -410,30 +361,30 @@ namespace VEPROMS
// D2017-260 - Use a prefix of the server name combined with the database name for temporary MSWord sections
DSOFile.TempFilePrefix = System.Text.RegularExpressions.Regex.Replace(System.Text.RegularExpressions.Regex.Replace(c, @"([^[\]]*) \[.*\]", "$1"), @"[\#\~\%\@\[\]\(\)\{\}\-. \\*<>:;""/?|]+", "_");
- ChangeLogFileName("LogFileAppender", Database.ActiveDatabase + " " + dtSunday.ToString("yyyyMMdd") + " ErrorLog.txt");
+ ChangeLogFileName("LogFileAppender", $"{Database.ActiveDatabase} {dtSunday:yyyyMMdd} ErrorLog.txt");
// B2019-107 Error Log message for inconsistent PromsFixes
- _MyLog.InfoFormat("\r\nSession Beginning\r\n<===={0}[SQL:{1:yyMM.ddHH}]====== User: {2}/{3} Started {4} ===============>{5}"
- , Application.ProductVersion, Database.RevDate, Environment.UserDomainName, Environment.UserName, DateTime.Now.ToString("dddd MMMM d, yyyy h:mm:ss tt"), FormatInfo.Failed ?? "");
+ _MyLog.InfoFormat($"\r\nSession Beginning\r\n<===={{0}}[SQL:{{1:yyMM.ddHH}}]====== User: {{2}}/{{3}} Started {{4}} ===============>{{5}}"
+ , Application.ProductVersion, Database.RevDate, Environment.UserDomainName, Environment.UserName, DateTime.Now.ToString("dddd MMMM d, yyyy h:mm:ss tt"), FormatInfo.Failed ?? "");
// C2022-030 Notify the user if the stored procedure in the database are not update to date
// with those in the PROMSFixes.sql delivered with the PROMS executable
string pfVersion = ExeInfo.GetAssocicatedPROMSFixesVersion();
- string dbpfVersion = string.Format("{0:yyMM.ddHH}", Database.RevDate);
+ string dbpfVersion = $"{Database.RevDate:yyMM.ddHH}";
// if pfVersion is null, that means there was a problem finding or reading the PROMSFixes.SQL file in the executable folder
if (pfVersion != null && !pfVersion.Equals(dbpfVersion))
{
- _MyLog.WarnFormat("PROMSFixes Version - in Data Version is {0} PROMS is Expecting Version {1}", dbpfVersion, pfVersion);
+ _MyLog.WarnFormat($"PROMSFixes Version - in Data Version is {dbpfVersion} PROMS is Expecting Version {pfVersion}");
StringBuilder sbMsg = new StringBuilder();
//sbMsg.Append("The SQL Stored Procedures in the Database are a different version than what PROMS is expecting.");
sbMsg.Append("The SQL Stored Procedures version in the database is different than what PROMS is expecting.");
sbMsg.Append("\nPROMS may not run properly until the lastest SQL Stored Procedures are installed.");
- sbMsg.AppendFormat("\n\n The database has SQL Stored Procedures version: {0}", dbpfVersion);
- sbMsg.AppendFormat("\n PROMS is expecting SQL Stored Procedures version: {0}", pfVersion);
+ sbMsg.AppendFormat($"\n\n The database has SQL Stored Procedures version: {dbpfVersion}");
+ sbMsg.AppendFormat($"\n PROMS is expecting SQL Stored Procedures version: {pfVersion}");
sbMsg.Append("\n\nPlease have your DBA update the database with the PROMSFixes.sql script file that was\ndelivered with this PROMS executable.");
sbMsg.Append("\n\nThe PROMSFixes.sql file is included with the PROMS installation download.");
sbMsg.Append("\n\nIt can also be found in your PROMS executable folder:");
- sbMsg.AppendFormat("\n\t{0}",ExeInfo.PROMSExecutableFolderPath());
+ sbMsg.AppendFormat($"\n\t{{0}}", ExeInfo.PROMSExecutableFolderPath());
FlexibleMessageBox.Show(sbMsg.ToString(),"SQL Stored Procedures Version Difference");
}
@@ -449,29 +400,18 @@ namespace VEPROMS
SetupFolder(1);
tc.VersionID = 0;
- tc.SeparateWindows = Properties.Settings.Default.SeparateWindows;
+ tc.SeparateWindows = Settings.Default.SeparateWindows;
tv.PauseRefresh += tv_PauseRefresh;
tv.UnPauseRefresh += tv_UnPauseRefresh;
}
- void displaySearch1_SearchComplete(object sender, DisplaySearchEventArgs args)
- {
- ProgBarText = string.Format("{0} Seconds", args.HowLong.TotalSeconds);
- }
+ void displaySearch1_SearchComplete(object sender, DisplaySearchEventArgs args) => ProgBarText = $"{args.HowLong.TotalSeconds} Seconds";
- private bool _PauseRefresh = false;
- public bool PauseRefresh
- {
- get { return _PauseRefresh; }
- set { _PauseRefresh = value; }
- }
+ public bool PauseRefresh { get; set; } = false;
- void tv_UnPauseRefresh(object sender, vlnTreeSectionInfoEventArgs args)
- {
- PauseRefresh = false;
- }
+ void tv_UnPauseRefresh(object sender, vlnTreeSectionInfoEventArgs args) => PauseRefresh = false;
- void tv_PauseRefresh(object sender, vlnTreeSectionInfoEventArgs args)
+ void tv_PauseRefresh(object sender, vlnTreeSectionInfoEventArgs args)
{
//_MyLog.WarnFormat("Pause");
//PauseRefresh = true;
@@ -521,7 +461,7 @@ namespace VEPROMS
displayHistory.AnnotationRestored += new AnnotationRestoredHandler(displayHistory_AnnotationRestored);
displayReports.PrintRequest += new DisplayReportsEvent(displayReports_PrintRequest);
- this.Activated += new EventHandler(frmVEPROMS_Activated);
+ Activated += new EventHandler(frmVEPROMS_Activated);
VlnSettings.StepTypeToolTip = Settings.Default.StepTypeToolTip;
VlnSettings.cbShwRplWrdsColor = Settings.Default.cbShwRplWrdsColor;
@@ -578,11 +518,11 @@ namespace VEPROMS
{
frmVEPROMS tmp = PROMSWindowForms[k];
- if (tmp.MyDocVersion.VersionID != this.SelectedDVI.VersionID)
+ if (tmp.MyDocVersion.VersionID != SelectedDVI.VersionID)
tmp.displayBookMarks.ResetBookMarkList();
- else if (tmp.MyParent != null)
- tmp.MyParent.displayBookMarks.ResetBookMarkList();
+ else
+ tmp.MyParent?.displayBookMarks.ResetBookMarkList();
}
}
@@ -607,20 +547,18 @@ namespace VEPROMS
void tv_SelectDateToStartChangeBars(object sender, vlnTreeEventArgs args)
{
- ProcedureInfo pi = (args.Node as VETreeNode).VEObject as ProcedureInfo;
- if (pi == null) return;
- tc.SaveCurrentEditItem(pi);
+ if (!((args.Node as VETreeNode).VEObject is ProcedureInfo pi)) return;
+ tc.SaveCurrentEditItem(pi);
- ProcedureConfig pc = pi.MyConfig as ProcedureConfig;
- if (pc == null) return;
+ if (!(pi.MyConfig is ProcedureConfig pc)) return;
- dlgSetChangeBarStartDate cbdDlg = new dlgSetChangeBarStartDate(pc, pi);
+ dlgSetChangeBarStartDate cbdDlg = new dlgSetChangeBarStartDate(pc, pi);
if (cbdDlg.ShowDialog() == DialogResult.OK)
{
using (Item itm = Item.Get(pi.ItemID))
{
itm.MyContent.Config = pc.ToString();
- itm.UserID = Volian.Base.Library.VlnSettings.UserID;
+ itm.UserID = VlnSettings.UserID;
itm.Save();
//B2019-140 Change bars do not get refreshed when approval is run.
@@ -648,14 +586,9 @@ namespace VEPROMS
}
}
- private bool _SkipRefresh = false;
- public bool SkipRefresh
- {
- get { return _SkipRefresh; }
- set { _SkipRefresh = value; }
- }
+ public bool SkipRefresh { get; set; } = false;
- void tv_Processing(object sender, vlnTreeStatusEventArgs args)
+ void tv_Processing(object sender, vlnTreeStatusEventArgs args)
{
SkipRefresh = args.MyStatus;
@@ -672,7 +605,7 @@ namespace VEPROMS
void tv_ProcessingComplete(object sender, vlnTreeTimeEventArgs args)
{
- bottomProgBar.Text = string.Format("{0} seconds - {1}", args.MyTimeSpan.TotalSeconds, args.MyMessage);
+ bottomProgBar.Text = $"{args.MyTimeSpan.TotalSeconds} seconds - {args.MyMessage}";
Application.DoEvents();
}
@@ -688,12 +621,9 @@ namespace VEPROMS
return tc.ChgId;
}
- ItemInfo tv_ClipboardStatus(object sender, vlnTreeEventArgs args)
- {
- return tc.MyCopyStep;
- }
+ ItemInfo tv_ClipboardStatus(object sender, vlnTreeEventArgs args) => tc.MyCopyStep;
- void tv_NodeCopy(object sender, vlnTreeEventArgs args)
+ void tv_NodeCopy(object sender, vlnTreeEventArgs args)
{
VETreeNode tn = args.Node as VETreeNode;
ItemInfo ii = tn.VEObject as ItemInfo;
@@ -720,11 +650,11 @@ namespace VEPROMS
if (pi != null) //working with procedure
{
- this.Cursor = Cursors.WaitCursor;
+ Cursor = Cursors.WaitCursor;
Application.DoEvents();
dlgTransitionReport dlg = new dlgTransitionReport(pi);
dlg.ShowDialog(this);
- this.Cursor = Cursors.Default;
+ Cursor = Cursors.Default;
}
}
@@ -751,7 +681,6 @@ namespace VEPROMS
// don't stop the export (CheckOutType.Session was changed to CheckOutType.Folder).
bool ok = MySessionInfo.CanCheckOutItem(fi.FolderID, CheckOutType.Folder, ref msg);
- //bool ok = MySessionInfo.CanCheckOutItem(fi.FolderID, (args.Index == 0)? CheckOutType.Folder : CheckOutType.Session, ref msg);
if (!ok)
{
if (args.Index == 0)
@@ -817,10 +746,12 @@ namespace VEPROMS
//form for exporting Electronic Procedures from DocVersionInfo
if (args.AnnotationTypeId > 0)
{
- dlgExportImportEP dlg = new dlgExportImportEP(args.Index == 0 ? "Export" : "Import", dvi, this, args.AnnotationTypeId, args.UnitIndex);
- dlg.MyNewProcedure = null;
- dlg.ExternalTransitionItem = null;
- dlg.ShowDialog(this);
+ dlgExportImportEP dlg = new dlgExportImportEP(args.Index == 0 ? "Export" : "Import", dvi, this, args.AnnotationTypeId, args.UnitIndex)
+ {
+ MyNewProcedure = null,
+ ExternalTransitionItem = null
+ };
+ dlg.ShowDialog(this);
MySessionInfo.CheckInItem(ownerid);
@@ -833,10 +764,12 @@ namespace VEPROMS
else
{
- dlgExportImport dlg = new dlgExportImport("Import", dvi, this);//Added frmVEPROMS Parameter
- dlg.MyNewProcedure = null;
- dlg.ExternalTransitionItem = null;
- dlg.ShowDialog(this);
+ dlgExportImport dlg = new dlgExportImport("Import", dvi, this)
+ {
+ MyNewProcedure = null,
+ ExternalTransitionItem = null
+ };//Added frmVEPROMS Parameter
+ dlg.ShowDialog(this);
MySessionInfo.CheckInItem(ownerid);
@@ -917,31 +850,21 @@ namespace VEPROMS
}
}
- static string _ErrorLogFileName;
+ public static string ErrorLogFileName { get; set; }
- public static string ErrorLogFileName
- {
- get { return frmVEPROMS._ErrorLogFileName; }
- set { frmVEPROMS._ErrorLogFileName = value; }
- }
+ public static bool colorReplaceWords() => Settings.Default.cbShwRplWrdsColor;
- public static bool colorReplaceWords()
- {
- return Properties.Settings.Default.cbShwRplWrdsColor;
- }
-
- static bool ChangeLogFileName(string AppenderName, string NewFilename)
+ static bool ChangeLogFileName(string AppenderName, string NewFilename)
{
log4net.Repository.ILoggerRepository RootRep;
RootRep = log4net.LogManager.GetRepository();
foreach (log4net.Appender.IAppender iApp in RootRep.GetAppenders())
{
- if ((iApp.Name.CompareTo(AppenderName) == 0) && (iApp is log4net.Appender.FileAppender))
+ if ((iApp.Name.CompareTo(AppenderName) == 0) && (iApp is log4net.Appender.FileAppender fApp))
{
- log4net.Appender.FileAppender fApp = (log4net.Appender.FileAppender)iApp;
string folderPath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
- fApp.File = folderPath + @"\VEPROMS\" + (Volian.Base.Library.VlnSettings.GetCommand("prefix", "") + "_").TrimStart("_".ToCharArray()) + NewFilename;
+ fApp.File = folderPath + @"\VEPROMS\" + (VlnSettings.GetCommand("prefix", "") + "_").TrimStart("_".ToCharArray()) + NewFilename;
ErrorLogFileName = fApp.File;
fApp.ActivateOptions();
@@ -984,22 +907,25 @@ namespace VEPROMS
else
buffer = args.MyBuffer;
- string fileName = Volian.Base.Library.VlnSettings.TemporaryFolder + "\\" + args.MyFilename;
+ string fileName = $"{VlnSettings.TemporaryFolder}\\{args.MyFilename}";
try
- {
- FileStream fs = new FileStream(fileName, FileMode.Create);
- fs.Write(buffer, 0, buffer.Length);
- fs.Close();
- System.Diagnostics.Process.Start(fileName);
- }
- catch (Exception ex)
+ {
+ using (FileStream fs = new FileStream(fileName, FileMode.Create))
+ {
+ fs.Write(buffer, 0, buffer.Length);
+ fs.Close();
+ }
+
+ Process.Start(fileName);
+ }
+ catch (Exception)
{
StringBuilder sb = new StringBuilder();
sb.AppendLine("Could not create");
sb.AppendLine();
- sb.AppendLine(fileName + ".");
+ sb.AppendLine($"{fileName}.");
sb.AppendLine();
sb.AppendLine("If it is open, close and retry.");
@@ -1007,23 +933,19 @@ namespace VEPROMS
}
}
- void displayHistory_AnnotationRestored(AnnotationInfo restoredAnnotationInfo, ItemInfo currentItem)
- {
- ctrlAnnotationDetails.UpdateAnnotationGrid(currentItem);
- }
+ void displayHistory_AnnotationRestored(AnnotationInfo restoredAnnotationInfo, ItemInfo currentItem) => ctrlAnnotationDetails.UpdateAnnotationGrid(currentItem);
- void tv_ReportAllProceduresInconsistencies(object sender, vlnTreeEventArgs args)
+ void tv_ReportAllProceduresInconsistencies(object sender, vlnTreeEventArgs args)
{
- DocVersionInfo dvi = (args.Node as VETreeNode).VEObject as DocVersionInfo;
- if (dvi == null) return;
+ if (!((args.Node as VETreeNode).VEObject is DocVersionInfo dvi)) return;
- this.Cursor = Cursors.WaitCursor;
+ Cursor = Cursors.WaitCursor;
ItemInfoList iil = ItemInfoList.GetAllInconsistencies(dvi.VersionID);
- Volian.Print.Library.PDFConsistencyCheckReport rpt = new Volian.Print.Library.PDFConsistencyCheckReport(Volian.Base.Library.VlnSettings.TemporaryFolder + @"\AllInconsistencies.pdf", iil, dvi); //B2020-020 needed to pass in DocVersion to get paper size from format
+ Volian.Print.Library.PDFConsistencyCheckReport rpt = new Volian.Print.Library.PDFConsistencyCheckReport(VlnSettings.TemporaryFolder + @"\AllInconsistencies.pdf", iil, dvi); //B2020-020 needed to pass in DocVersion to get paper size from format
rpt.BuildAllReport(dvi);
- this.Cursor = Cursors.Default;
+ Cursor = Cursors.Default;
}
//C2020-036 returns a string of duplicate procedure numbers separated by newlines for use in FlexibleMessageBox
@@ -1041,8 +963,8 @@ namespace VEPROMS
return rtn;
}
}
-
- private List dpl = new List(); //C2020-036 used to create list duplicate procedure numbers
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE0044:Add readonly modifier", Justification = "Keeping Collections Not ReadOnly")]
+ private List dpl = new List(); //C2020-036 used to create list duplicate procedure numbers
// B2017-242 added check for duplicate procedure numbers in a procedure set
// This is called before doing any of the approval
@@ -1054,7 +976,7 @@ namespace VEPROMS
dvi.ResetProcedures(); // B2021-035: Approve All – Pasted, modified number and deleted procedures not refreshed so missing from list
List pnList = new List();
- foreach (ProcedureInfo pi in dvi.Procedures)
+ foreach (ProcedureInfo pi in dvi.Procedures.OfType())
{
if (!pnList.Contains(pi.DisplayNumber))
{
@@ -1084,11 +1006,10 @@ namespace VEPROMS
void tv_ApproveSomeProcedures(object sender, vlnTreeEventArgs args)
{
- DocVersionInfo dvi = (args.Node as VETreeNode).VEObject as DocVersionInfo;
- if (dvi == null) return;
+ if (!((args.Node as VETreeNode).VEObject is DocVersionInfo dvi)) return;
- // B2017-242 added check for duplicate procedure numbers in a procedure set
- if (DuplicateProcedureNumbers(dvi, null))
+ // B2017-242 added check for duplicate procedure numbers in a procedure set
+ if (DuplicateProcedureNumbers(dvi, null))
{
// C2020-036 display list of duplicate procedure numbers
FlexibleMessageBox.Show("This procedure set has two or more procedures with the same procedure number.\n\n" +
@@ -1110,9 +1031,11 @@ namespace VEPROMS
int ownerid = MySessionInfo.CheckOutItem(dvi.VersionID, CheckOutType.DocVersion);
dvi.DocVersionConfig.SelectedSlave = args.UnitIndex;
- dlgApproveProcedure dlg = new dlgApproveProcedure(dvi, true, this);
- dlg.MySessionInfo = MySessionInfo;
- dlg.ShowDialog(this);
+ dlgApproveProcedure dlg = new dlgApproveProcedure(dvi, true, this)
+ {
+ MySessionInfo = MySessionInfo
+ };
+ dlg.ShowDialog(this);
displayHistory.RefreshList();
MySessionInfo.CheckInItem(ownerid);
@@ -1122,11 +1045,10 @@ namespace VEPROMS
void tv_ApproveAllProcedures(object sender, vlnTreeEventArgs args)
{
- DocVersionInfo dvi = (args.Node as VETreeNode).VEObject as DocVersionInfo;
- if (dvi == null) return;
+ if (!((args.Node as VETreeNode).VEObject is DocVersionInfo dvi)) return;
- // B2017-242 added check for duplicate procedure numbers in a procedure set
- if (DuplicateProcedureNumbers(dvi, null))
+ // B2017-242 added check for duplicate procedure numbers in a procedure set
+ if (DuplicateProcedureNumbers(dvi, null))
{
// C2020-036 display list of duplicate procedure numbers
FlexibleMessageBox.Show("This procedure set has two or more procedures with the same procedure number.\n\n" +
@@ -1148,9 +1070,11 @@ namespace VEPROMS
int ownerid = MySessionInfo.CheckOutItem(dvi.VersionID, CheckOutType.DocVersion);
dvi.DocVersionConfig.SelectedSlave = args.UnitIndex;
- dlgApproveProcedure dlg = new dlgApproveProcedure(dvi, this);//Added frmVEPROMS Parameter
- dlg.MySessionInfo = MySessionInfo;
- dlg.ShowDialog(this);
+ dlgApproveProcedure dlg = new dlgApproveProcedure(dvi, this)
+ {
+ MySessionInfo = MySessionInfo
+ };//Added frmVEPROMS Parameter
+ dlg.ShowDialog(this);
displayHistory.RefreshList();
MySessionInfo.CheckInItem(ownerid);
@@ -1213,11 +1137,10 @@ namespace VEPROMS
void tv_ProcedureCheckedOutTo(object sender, vlnTreeEventArgs args)
{
- ProcedureInfo pi = null;
- SectionInfo si = null;
+ SectionInfo si = null;
- pi = (args.Node as VETreeNode).VEObject as ProcedureInfo;
- if (pi == null) si = (args.Node as VETreeNode).VEObject as SectionInfo;
+ ProcedureInfo pi = (args.Node as VETreeNode).VEObject as ProcedureInfo;
+ if (pi == null) si = (args.Node as VETreeNode).VEObject as SectionInfo;
UserInfo ui = UserInfo.GetByUserID(MySessionInfo.UserID);
@@ -1229,11 +1152,10 @@ namespace VEPROMS
void tv_ApproveProcedure(object sender, vlnTreeEventArgs args)
{
- ProcedureInfo pi = (args.Node as VETreeNode).VEObject as ProcedureInfo;
- if (pi == null) return;
+ if (!((args.Node as VETreeNode).VEObject is ProcedureInfo pi)) return;
- // B2017-242 added check for duplicate procedure numbers in a procedure set?
- if (DuplicateProcedureNumbers(pi.MyDocVersion, pi))
+ // B2017-242 added check for duplicate procedure numbers in a procedure set?
+ if (DuplicateProcedureNumbers(pi.MyDocVersion, pi))
{
// C2020-036 display list of duplicate procedure numbers
FlexibleMessageBox.Show("Procedure number " + dupProcList + " is used by two or more procedures within this procedure set.\n\n" +
@@ -1255,9 +1177,11 @@ namespace VEPROMS
int ownerid = MySessionInfo.CheckOutItem(pi.ItemID, 0);
pi.MyDocVersion.DocVersionConfig.SelectedSlave = args.UnitIndex;
- dlgApproveProcedure dlg = new dlgApproveProcedure(pi, this);//Added frmVEPROMS Parameter
- dlg.MySessionInfo = MySessionInfo;
- dlg.ShowDialog(this);
+ dlgApproveProcedure dlg = new dlgApproveProcedure(pi, this)
+ {
+ MySessionInfo = MySessionInfo
+ };//Added frmVEPROMS Parameter
+ dlg.ShowDialog(this);
displayHistory.RefreshList();
MySessionInfo.CheckInItem(ownerid);
@@ -1267,17 +1191,18 @@ namespace VEPROMS
void tv_PrintAllProcedures(object sender, vlnTreeEventArgs args)
{
- DocVersionInfo dvi = (args.Node as VETreeNode).VEObject as DocVersionInfo;
- if (dvi == null) return;
+ if (!((args.Node as VETreeNode).VEObject is DocVersionInfo dvi)) return;
- tc.SaveCurrentEditItem();
+ tc.SaveCurrentEditItem();
dvi.DocVersionConfig.SelectedSlave = args.UnitIndex;
- DlgPrintProcedure prnDlg = new DlgPrintProcedure(dvi);
- prnDlg.SelectedSlave = args.UnitIndex;
- prnDlg.MySessionInfo = MySessionInfo;
- prnDlg.ShowDialog(this); // RHM 20120925 - Center dialog over PROMS window
+ DlgPrintProcedure prnDlg = new DlgPrintProcedure(dvi)
+ {
+ SelectedSlave = args.UnitIndex,
+ MySessionInfo = MySessionInfo
+ };
+ prnDlg.ShowDialog(this); // RHM 20120925 - Center dialog over PROMS window
dvi.DocVersionConfig.SelectedSlave = 0;
}
@@ -1304,17 +1229,18 @@ namespace VEPROMS
void tv_PrintProcedure(object sender, vlnTreeEventArgs args)
{
- ProcedureInfo pi = (args.Node as VETreeNode).VEObject as ProcedureInfo;
- if (pi == null) return;
+ if (!((args.Node as VETreeNode).VEObject is ProcedureInfo pi)) return;
- tc.SaveCurrentEditItem(pi);
+ tc.SaveCurrentEditItem(pi);
pi.MyDocVersion.DocVersionConfig.SelectedSlave = args.UnitIndex;
- DlgPrintProcedure prnDlg = new DlgPrintProcedure(pi);
- prnDlg.SelectedSlave = args.UnitIndex;
- prnDlg.MySessionInfo = MySessionInfo;
- prnDlg.ShowDialog(this); // RHM 20120925 - Center dialog over PROMS window
+ DlgPrintProcedure prnDlg = new DlgPrintProcedure(pi)
+ {
+ SelectedSlave = args.UnitIndex,
+ MySessionInfo = MySessionInfo
+ };
+ prnDlg.ShowDialog(this); // RHM 20120925 - Center dialog over PROMS window
pi.MyDocVersion.DocVersionConfig.SelectedSlave = 0;
}
@@ -1323,10 +1249,9 @@ namespace VEPROMS
{
try
{
- ProcedureInfo pi = (args.Node as VETreeNode).VEObject as ProcedureInfo;
- if (pi == null) return;
+ if (!((args.Node as VETreeNode).VEObject is ProcedureInfo pi)) return;
- tc.SaveCurrentEditItem(pi);
+ tc.SaveCurrentEditItem(pi);
pi.MyDocVersion.DocVersionConfig.SelectedSlave = args.UnitIndex;
@@ -1354,23 +1279,17 @@ namespace VEPROMS
}
- //Print Section
- //C2025-028 Add a Quick Print Section option
+ //Print Section
+ //C2025-028 Add a Quick Print Section option
- void tv_PrintSection(object sender, vlnTreeEventArgs args)
- {
- PrintSection(sender, args, false);
- }
- void tv_QPrintSection(object sender, vlnTreeEventArgs args)
- {
- PrintSection(sender, args, true);
- }
+ void tv_PrintSection(object sender, vlnTreeEventArgs args) => PrintSection(sender, args, false);
+ void tv_QPrintSection(object sender, vlnTreeEventArgs args) => PrintSection(sender, args, true);
- void PrintSection(object sender, vlnTreeEventArgs args, bool quickprint)
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE0060:Remove unused parameter", Justification = "Keeping sender for Debugging")]
+ void PrintSection(object sender, vlnTreeEventArgs args, bool quickprint)
{
try
{
- //args.Node.Parent.
SectionInfo si2 = (args.Node as VETreeNode).VEObject as SectionInfo;
int _prtSectID = si2.ItemID;
@@ -1420,23 +1339,24 @@ namespace VEPROMS
void tv_CreateContinuousActionSummary(object sender, vlnTreeEventArgs args)
{
- DialogResult dr = System.Windows.Forms.DialogResult.Yes;
+ DialogResult dr = DialogResult.Yes;
- ProcedureInfo pi = (args.Node as VETreeNode).VEObject as ProcedureInfo;
- if (pi == null) return;
+ if (!((args.Node as VETreeNode).VEObject is ProcedureInfo pi)) return;
- tc.SaveCurrentEditItem(pi);
+ tc.SaveCurrentEditItem(pi);
pi.MyDocVersion.DocVersionConfig.SelectedSlave = args.UnitIndex;
- DlgPrintProcedure prnDlg = new DlgPrintProcedure(pi, true);
- prnDlg.MySessionInfo = MySessionInfo;
- prnDlg.SelectedSlave = args.UnitIndex;
- prnDlg.Automatic = true;
- prnDlg.CreateContinuousActionSummary = true;
- prnDlg.OpenAfterCreate = (dr == System.Windows.Forms.DialogResult.Yes);
- prnDlg.Prefix = "CASTMP_"; // prefix the temporary procedure PDF file that is generated (to grab page numbers)
- prnDlg.SetupForProcedure();
+ DlgPrintProcedure prnDlg = new DlgPrintProcedure(pi, true)
+ {
+ MySessionInfo = MySessionInfo,
+ SelectedSlave = args.UnitIndex,
+ Automatic = true,
+ CreateContinuousActionSummary = true,
+ OpenAfterCreate = (dr == DialogResult.Yes),
+ Prefix = "CASTMP_" // prefix the temporary procedure PDF file that is generated (to grab page numbers)
+ };
+ prnDlg.SetupForProcedure();
prnDlg.CreatePDF();
pi.MyDocVersion.DocVersionConfig.SelectedSlave = 0;
@@ -1448,39 +1368,34 @@ namespace VEPROMS
}
void tv_CreateTimeCriticalActionSummary(object sender, vlnTreeEventArgs args)
{
- DialogResult dr = System.Windows.Forms.DialogResult.Yes;
+ DialogResult dr = DialogResult.Yes;
- ProcedureInfo pi = (args.Node as VETreeNode).VEObject as ProcedureInfo;
- if (pi == null) return;
+ if (!((args.Node as VETreeNode).VEObject is ProcedureInfo pi)) return;
- tc.SaveCurrentEditItem(pi);
+ tc.SaveCurrentEditItem(pi);
pi.MyDocVersion.DocVersionConfig.SelectedSlave = args.UnitIndex;
- DlgPrintProcedure prnDlg = new DlgPrintProcedure(pi, true);
- prnDlg.MySessionInfo = MySessionInfo;
- prnDlg.SelectedSlave = args.UnitIndex;
- prnDlg.Automatic = true;
- prnDlg.CreateTimeCriticalActionSummary = true;
- prnDlg.OpenAfterCreate = (dr == System.Windows.Forms.DialogResult.Yes);
- prnDlg.Prefix = "TCASTMP_"; // prefix the temporary procedure PDF file that is generated (to grab page numbers)
- prnDlg.SetupForProcedure();
+ DlgPrintProcedure prnDlg = new DlgPrintProcedure(pi, true)
+ {
+ MySessionInfo = MySessionInfo,
+ SelectedSlave = args.UnitIndex,
+ Automatic = true,
+ CreateTimeCriticalActionSummary = true,
+ OpenAfterCreate = (dr == DialogResult.Yes),
+ Prefix = "TCASTMP_" // prefix the temporary procedure PDF file that is generated (to grab page numbers)
+ };
+ prnDlg.SetupForProcedure();
prnDlg.CreatePDF();
pi.MyDocVersion.DocVersionConfig.SelectedSlave = 0;
}
- void RefreshDisplayHistory(object sender)
- {
- displayHistory.RefreshChangeList();
- }
+ void RefreshDisplayHistory(object sender) => displayHistory.RefreshChangeList();
- void displayHistory_HistorySelectionChanged(object sender, DisplayHistoryEventArgs args)
- {
- tc.OpenItem(ItemInfo.Get(args.ItemID));
- }
+ void displayHistory_HistorySelectionChanged(object sender, DisplayHistoryEventArgs args) => tc.OpenItem(ItemInfo.Get(args.ItemID));
- void displayHistory_SummaryPrintRequest(object sender, DisplayHistoryReportEventArgs args)
+ void displayHistory_SummaryPrintRequest(object sender, DisplayHistoryReportEventArgs args)
{
Volian.Print.Library.PDFChronologyReport myChronoRpt = new Volian.Print.Library.PDFChronologyReport(args.ReportTitle, args.ProcedureInfo, args.AuditList, args.AnnotationList);
myChronoRpt.BuildSummary();
@@ -1549,16 +1464,10 @@ namespace VEPROMS
return dr;
}
+ // Activate tmrTreeView so that the newly created Step receives focus
+ void tv_NodeInsert(object sender, vlnTreeEventArgs args) => tmrTreeView.Enabled = true;
- void tv_NodeInsert(object sender, vlnTreeEventArgs args)
- {
- // Activate tmrTreeView so that the newly created Step receives focus
- tmrTreeView.Enabled = true;
- }
-
- private int _LastROFSTID = 0;
-
- void frmVEPROMS_Activated(object sender, EventArgs e)
+ void frmVEPROMS_Activated(object sender, EventArgs e)
{
//Volian.Base.Library.vlnStackTrace.ShowStack();
@@ -1617,14 +1526,11 @@ namespace VEPROMS
}
}
- // Add a tree node for a procedure if this is the first procedure in the docversion, added from
- // step editor (used for creating enhanced procedure in empty docversion)
- void MyStepTabRibbon_AddProcToDocVersionInTree(object sender, StepTabRibbonEventArgs args)
- {
- tv.AdjustTree(args.Proc as ProcedureInfo);
- }
+ // Add a tree node for a procedure if this is the first procedure in the docversion, added from
+ // step editor (used for creating enhanced procedure in empty docversion)
+ void MyStepTabRibbon_AddProcToDocVersionInTree(object sender, StepTabRibbonEventArgs args) => tv.AdjustTree(args.Proc as ProcedureInfo);
- void MyStepTabRibbon_PrintRequest(object sender, StepTabRibbonEventArgs args)
+ void MyStepTabRibbon_PrintRequest(object sender, StepTabRibbonEventArgs args)
{
// Fix for B2013-173:
// if the user did the print by using the shortcut keys 'Ctrl-P' the arguments sent in
@@ -1724,7 +1630,7 @@ namespace VEPROMS
// C2020-002 paper size is now set in the format files - default is Letter, pass this PDFReport
//C2019-013 pass in sorted by information
Volian.Print.Library.PDFReport myReport = new Volian.Print.Library.PDFReport(args.ReportTitle, args.TypesSelected, args.MyItemInfoList,
- Volian.Base.Library.VlnSettings.TemporaryFolder + @"\searchresults.pdf", args.PaperSize, args.SortedBy);
+ VlnSettings.TemporaryFolder + @"\searchresults.pdf", args.PaperSize, args.SortedBy);
if (args.SearchString != null)
myReport.SearchString = args.SearchString;
@@ -1737,7 +1643,7 @@ namespace VEPROMS
annotationCount += itm.ItemAnnotationCount;
if (annotationCount > 0)
- myReport.ShowAnnotations = (MessageBox.Show("Show Annotations", "Include Annotations", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.Yes);
+ myReport.ShowAnnotations = (MessageBox.Show("Show Annotations", "Include Annotations", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes);
}
myReport.Build();
@@ -1745,7 +1651,7 @@ namespace VEPROMS
void displayLibDocs_PrintRequest(object sender, DisplayLibDocEventArgs args)
{
- Volian.Print.Library.PDFReport myReport = new Volian.Print.Library.PDFReport(args.ReportTitle, args.LibDocList, Volian.Base.Library.VlnSettings.TemporaryFolder + @"\LibDocUsage.pdf", args.PaperSize);
+ Volian.Print.Library.PDFReport myReport = new Volian.Print.Library.PDFReport(args.ReportTitle, args.LibDocList, VlnSettings.TemporaryFolder + @"\LibDocUsage.pdf", args.PaperSize);
myReport.Build();
}
@@ -1754,28 +1660,25 @@ namespace VEPROMS
// C2020-002 paper size is now set in the format files - default is Letter, pass this PDFReport
if (args.TypesSelected == "RO Usage")
{
- Volian.Print.Library.PDFReport myReport = new Volian.Print.Library.PDFReport(args.ReportTitle, args.MyItemInfoList, Volian.Base.Library.VlnSettings.TemporaryFolder + @"\ROUsageReport.pdf", args.SortUsageByProcedure, args.IncludeMissingROs, args.PaperSize);
+ Volian.Print.Library.PDFReport myReport = new Volian.Print.Library.PDFReport(args.ReportTitle, args.MyItemInfoList, VlnSettings.TemporaryFolder + @"\ROUsageReport.pdf", args.SortUsageByProcedure, args.IncludeMissingROs, args.PaperSize);
myReport.Build();
}
else if (args.TypesSelected == "Complete RO Report")
{
- Volian.Print.Library.PDFReport myReport = new Volian.Print.Library.PDFReport(args.ReportTitle, args.RODataFile, Volian.Base.Library.VlnSettings.TemporaryFolder + @"\CompleteROReport.pdf", args.RofstLookup, args.CompleteROReport, args.ConvertCaretToDelta, args.IncludeEmptyROFields, args.PaperSize);
+ Volian.Print.Library.PDFReport myReport = new Volian.Print.Library.PDFReport(args.ReportTitle, args.RODataFile, VlnSettings.TemporaryFolder + @"\CompleteROReport.pdf", args.RofstLookup, args.ConvertCaretToDelta, args.IncludeEmptyROFields, args.PaperSize);
myReport.Build();
}
else if (args.TypesSelected == "RO Summary Report")
{
- Volian.Print.Library.PDFReport myReport = new Volian.Print.Library.PDFReport(args.ReportTitle, Volian.Base.Library.VlnSettings.TemporaryFolder + @"\ROSummaryReport.pdf", args.RofstLookup, args.ROListForReport, args.PaperSize);
+ Volian.Print.Library.PDFReport myReport = new Volian.Print.Library.PDFReport(args.ReportTitle, VlnSettings.TemporaryFolder + @"\ROSummaryReport.pdf", args.RofstLookup, args.ROListForReport, args.PaperSize);
myReport.Build();
}
}
- bool tv_InsertItemInfo(object sender, vlnTreeItemInfoInsertEventArgs args)
- {
- // Don't select the newly created Step. This will be handled by tmrTreeView
- return tc.InsertRTBItem(args.MyItemInfo, args.StepText, args.InsertType, args.FromType, args.Type, false);
- }
+ // Don't select the newly created Step. This will be handled by tmrTreeView
+ bool tv_InsertItemInfo(object sender, vlnTreeItemInfoInsertEventArgs args) => tc.InsertRTBItem(args.MyItemInfo, args.StepText, args.InsertType, args.FromType, args.Type, false);
- private bool tv_DeleteItemInfo(object sender, vlnTreeItemInfoEventArgs args)
+ private bool tv_DeleteItemInfo(object sender, vlnTreeItemInfoEventArgs args)
{
if (displayHistory.MyEditItem != null && displayHistory.MyItemInfo.MyProcedure.ItemID == args.MyItemInfo.ItemID)
displayHistory.MyEditItem = null;
@@ -1801,12 +1704,9 @@ namespace VEPROMS
return rtval;
}
- private bool tv_PasteItemInfo(object sender, vlnTreeItemInfoPasteEventArgs args)
- {
- return tc.PasteRTBItem(args.MyItemInfo, args.CopyStartID, args.PasteType, (int)args.Type);
- }
+ private bool tv_PasteItemInfo(object sender, vlnTreeItemInfoPasteEventArgs args) => tc.PasteRTBItem(args.MyItemInfo, args.CopyStartID, args.PasteType, (int)args.Type);
- private ItemInfo tv_SearchIncTrans(object sender, vlnTreeItemInfoEventArgs args)
+ private ItemInfo tv_SearchIncTrans(object sender, vlnTreeItemInfoEventArgs args)
{
// C2020-033: Display the search panel with Incoming Transition info for the tree view and for the editor.
displaySearch1.SearchIncTransII = args.MyItemInfo;
@@ -1829,161 +1729,158 @@ namespace VEPROMS
public bool ClosingWithError = false; // B2019-098: prevent looping between error & exit dialog
private bool _WeAreExitingPROMS = false; // B2019-101 if exiting PROMS from main window don't prompt on each child window (separate windows)
- private void frmVEPROMS_FormClosing(object sender, FormClosingEventArgs e)
- {
- // B2017-212 If the user uses the X button in Word to close the word attachment, PROMS thinks that the user wants to close out of PROMS as well
- // trap for this and close only the Word tab in PROMS
- // B2017-214 added a null reference check
- // B2010-071 Since we cannot tell if the user click on the X in Word or the X in PROMS, ask if the current tab
- // should be closed or if we should exit PROMS or just Cancel to continue working
- if (tc._MyDisplayTabItems.Count < 1) // If all thabs are closed in the editor will indicate that in the database.
- {
- Item.DeactivateStateDisplayTabTmp(MySessionInfo.UserID);
- }
- if (!_WeAreExitingPROMS && !ClosingWithError && tc.SelectedDisplayTabItem != null && tc._MyDisplayTabItems.Count > 0)
- {
- // B2019-071 dialog to ask user if we are to close one tab or exit
- DlgCloseTabsOrExit dctoe = new DlgCloseTabsOrExit(MyParent == null, PROMSWindowForms.Count > 0);
- dctoe.ShowDialog();
+ private void frmVEPROMS_FormClosing(object sender, FormClosingEventArgs e)
+ {
+ // B2017-212 If the user uses the X button in Word to close the word attachment, PROMS thinks that the user wants to close out of PROMS as well
+ // trap for this and close only the Word tab in PROMS
+ // B2017-214 added a null reference check
+ // B2010-071 Since we cannot tell if the user click on the X in Word or the X in PROMS, ask if the current tab
+ // should be closed or if we should exit PROMS or just Cancel to continue working
+ if (tc._MyDisplayTabItems.Count < 1) // If all thabs are closed in the editor will indicate that in the database.
+ {
+ Item.DeactivateStateDisplayTabTmp(MySessionInfo.UserID);
+ }
+ if (!_WeAreExitingPROMS && !ClosingWithError && tc.SelectedDisplayTabItem != null && tc._MyDisplayTabItems.Count > 0)
+ {
+ // B2019-071 dialog to ask user if we are to close one tab or exit
+ DlgCloseTabsOrExit dctoe = new DlgCloseTabsOrExit(MyParent == null, PROMSWindowForms.Count > 0);
+ dctoe.ShowDialog();
- // B2019-101 flag that we are exiting from PROMS main window (separate windows)
- _WeAreExitingPROMS = (MyParent == null && dctoe.ExitPROMS);
+ // B2019-101 flag that we are exiting from PROMS main window (separate windows)
+ _WeAreExitingPROMS = (MyParent == null && dctoe.ExitPROMS);
- if (dctoe.Cancel) // B2019-071 user decided to not close any tab and not exit PROMS - so do nothing and continue working
- {
- e.Cancel = true;
- dctoe.Close();
- return;
- }
+ if (dctoe.Cancel) // B2019-071 user decided to not close any tab and not exit PROMS - so do nothing and continue working
+ {
+ e.Cancel = true;
+ dctoe.Close();
+ return;
+ }
- string stk = vlnStackTrace.StackToString();
+ string stk = vlnStackTrace.StackToString();
- if (!stk.Contains("Exception"))
- {
- // B2018-091 Allow PROMS to close if only MSWord sections have been opened.
- // B2019-071 we will now close one or all of the tabs (even step editor ones)
- if (_WeAreExitingPROMS)
- {
- // Deactivate previous procedure tab state by user
- Item.DeactivateStateDisplayTabTmp(MySessionInfo.UserID);
- // Save current procedure tab state
- //B2024-082 Remember Tabs Not opening in correct order
- int cnt = 0;
- foreach (DisplayTabItem dti in tc.MyBar.Items)
- {
- cnt++;
- ItemInfo itminfo = dti.MyItemInfo;
- string DisplayTabID = dti.MyKey;
- string DisplayTabName = dti.ToString();
- // B2026-074 if a Word section, save the ItemID of the entire Word section
- // else if a Step Editor section, save the ItemID of the step part the user was on
- int TabItemID = itminfo.HasWordContent ? itminfo.ItemID : dti.MyStepTabPanel.MyStepTabRibbon.MyEditItem.MyItemInfo.ItemID;
- Item.AddDisplayTabsState(TabItemID, DisplayTabID, DisplayTabName, MySessionInfo.UserID, cnt);
- }
- }
+ if (!stk.Contains("Exception"))
+ {
+ // B2018-091 Allow PROMS to close if only MSWord sections have been opened.
+ // B2019-071 we will now close one or all of the tabs (even step editor ones)
+ if (_WeAreExitingPROMS)
+ {
+ // Deactivate previous procedure tab state by user
+ Item.DeactivateStateDisplayTabTmp(MySessionInfo.UserID);
+ // Save current procedure tab state
+ //B2024-082 Remember Tabs Not opening in correct order
+ int cnt = 0;
+ foreach (DisplayTabItem dti in tc.MyBar.Items)
+ {
+ cnt++;
+ ItemInfo itminfo = dti.MyItemInfo;
+ string DisplayTabID = dti.MyKey;
+ string DisplayTabName = dti.ToString();
+ // B2026-074 if a Word section, save the ItemID of the entire Word section
+ // else if a Step Editor section, save the ItemID of the step part the user was on
+ int TabItemID = itminfo.HasWordContent ? itminfo.ItemID : dti.MyStepTabPanel.MyStepTabRibbon.MyEditItem.MyItemInfo.ItemID;
+ Item.AddDisplayTabsState(TabItemID, DisplayTabID, DisplayTabName, MySessionInfo.UserID, cnt);
+ }
+ }
- int n = tc._MyDisplayTabItems.Count;
- while (n-- > 0 && tc._MyDisplayTabItems.Count > 0)
- {
- tc.CloseTabItem(tc.SelectedDisplayTabItem);
- // B2019-071 close just the current tab and continue working
- if (!dctoe.ExitPROMS)
- {
- n = 0;
- e.Cancel = true;
- dctoe.Close();
- return;
- }
- }
+ int n = tc._MyDisplayTabItems.Count;
+ while (n-- > 0 && tc._MyDisplayTabItems.Count > 0)
+ {
+ tc.CloseTabItem(tc.SelectedDisplayTabItem);
+ // B2019-071 close just the current tab and continue working
+ if (!dctoe.ExitPROMS)
+ {
+ e.Cancel = true;
+ dctoe.Close();
+ return;
+ }
+ }
- if (tc.SelectedDisplayTabItem != null && tc._MyDisplayTabItems.Count > 0 && dctoe.ExitPROMS)
- {
- _MyLog.WarnFormat(string.Format("Stack Does not contain an Exception\r\n" +
- "PROMS will Not Exit. Stack : \r\n{0}", stk));
- e.Cancel = true; // If Display Items still exist don't close.
- }
+ if (tc.SelectedDisplayTabItem != null && tc._MyDisplayTabItems.Count > 0 && dctoe.ExitPROMS)
+ {
+ _MyLog.WarnFormat($"Stack Does not contain an Exception\r\nPROMS will Not Exit. Stack : \r\n{stk}");
+ e.Cancel = true; // If Display Items still exist don't close.
+ }
- dctoe.Close();
- }
- }
+ dctoe.Close();
+ }
+ }
- //C2015-022 Separate Windows - if child windows are open and we are closing the main PROMS window, give user a chance to not close PROMS and that child windows
- // B2019-101 if we are exiting from PROMS main window no need to prompt user about child windows.
- if (MyParent == null && PROMSWindowForms != null && PROMSWindowForms.Count > 0 && !_WeAreExitingPROMS)
- {
- DialogResult dr = MessageBox.Show("Close all of the child windows and exit PROMS?", "Exit PROMS", MessageBoxButtons.YesNo);
- if (dr == System.Windows.Forms.DialogResult.No)
- {
- e.Cancel = true;
- return;
- }
- }
+ //C2015-022 Separate Windows - if child windows are open and we are closing the main PROMS window, give user a chance to not close PROMS and that child windows
+ // B2019-101 if we are exiting from PROMS main window no need to prompt user about child windows.
+ if (MyParent == null && PROMSWindowForms != null && PROMSWindowForms.Count > 0 && !_WeAreExitingPROMS)
+ {
+ DialogResult dr = MessageBox.Show("Close all of the child windows and exit PROMS?", "Exit PROMS", MessageBoxButtons.YesNo);
+ if (dr == DialogResult.No)
+ {
+ e.Cancel = true;
+ return;
+ }
+ }
- // This keeps PROMS from Hanging under certain circumstances
- tc.ShuttingDown = true;
+ // This keeps PROMS from Hanging under certain circumstances
+ tc.ShuttingDown = true;
- // B2019-161 When shutting down output the timing information (to the error log)
- if (VolianTimer.TimingsOn)
- VolianTimer.ShowTimers();
+ // B2019-161 When shutting down output the timing information (to the error log)
+ if (VolianTimer.TimingsOn)
+ VolianTimer.ShowTimers();
- foreach (DisplayTabItem dti in tc.MyBar.Items)
- {
- if (dti.MyDSOTabPanel != null)
- dti.MyDSOTabPanel.CloseDSO();
- else
- MySessionInfo.CheckInItem(dti.OwnerID); //C2015-022 Separate Windows closing child form only left procedure ownership active
- }
+ foreach (DisplayTabItem dti in tc.MyBar.Items)
+ {
+ if (dti.MyDSOTabPanel != null)
+ dti.MyDSOTabPanel.CloseDSO();
+ else
+ MySessionInfo.CheckInItem(dti.OwnerID); //C2015-022 Separate Windows closing child form only left procedure ownership active
+ }
- if (MyParent == null)
- {
- if (MyActivityTimer != null)
- {
- MyActivityTimer.Dispose();
- _MyLog.Debug("VEPROMS FormClosing - dispose timer");
- }
+ if (MyParent == null)
+ {
+ if (MyActivityTimer != null)
+ {
+ MyActivityTimer.Dispose();
+ _MyLog.Debug("VEPROMS FormClosing - dispose timer");
+ }
- // C2015-022: part of separate windows upgrade close all of the child windows before closing the main PROMS window
- if (PROMSWindowForms != null && PROMSWindowForms.Count > 0)
- {
- foreach (int k in PROMSWindowForms.Keys)
- {
- frmVEPROMS child = PROMSWindowForms[k];
- _RemoveFromPROMSWindowForms = false;
- child._RemoveFromPROMSWindowForms = false;
- child._WeAreExitingPROMS = _WeAreExitingPROMS;
- child.Close();
- child.MySessionInfo.EndSession();
- }
- }
+ // C2015-022: part of separate windows upgrade close all of the child windows before closing the main PROMS window
+ if (PROMSWindowForms != null && PROMSWindowForms.Count > 0)
+ {
+ foreach (int k in PROMSWindowForms.Keys)
+ {
+ frmVEPROMS child = PROMSWindowForms[k];
+ _RemoveFromPROMSWindowForms = false;
+ child._RemoveFromPROMSWindowForms = false;
+ child._WeAreExitingPROMS = _WeAreExitingPROMS;
+ child.Close();
+ child.MySessionInfo.EndSession();
+ }
+ }
- if (MySessionInfo != null) MySessionInfo.EndSession();
+ MySessionInfo?.EndSession();
- // Save the location and size of the VE-PROMS application for this user
- if (this.WindowState == FormWindowState.Normal)
- {
- Settings.Default.Location = this.Location;
- Settings.Default.Size = this.Size;
- }
+ // Save the location and size of the VE-PROMS application for this user
+ if (WindowState == FormWindowState.Normal)
+ {
+ Settings.Default.Location = Location;
+ Settings.Default.Size = Size;
+ }
- if (this.MyVersionWindowList != null)
- {
- Settings.Default.VersionWindows = this.MyVersionWindowList.ToSettings();
- }
+ if (MyVersionWindowList != null)
+ {
+ Settings.Default.VersionWindows = MyVersionWindowList.ToSettings();
+ }
- Settings.Default.WindowState = this.WindowState;
- Settings.Default.QATItems = ribbonControl1.QatLayout;
+ Settings.Default.WindowState = WindowState;
+ Settings.Default.QATItems = ribbonControl1.QatLayout;
- SaveMRU();
+ SaveMRU();
- //Settings.Default.Save();
- Volian.Base.Library.DebugPagination.Close();
- Volian.Base.Library.DebugText.Close();
- Volian.Base.Library.BaselineMetaFile.Close(); // C2018-004 create meta file for baseline compares
- }
- }
+ DebugPagination.Close();
+ DebugText.Close();
+ BaselineMetaFile.Close(); // C2018-004 create meta file for baseline compares
+ }
+ }
- void frmVEPROMS_FormClosed(object sender, System.Windows.Forms.FormClosedEventArgs e)
+ void frmVEPROMS_FormClosed(object sender, System.Windows.Forms.FormClosedEventArgs e)
{
// Close any open documents
tc.Dispose();
@@ -1995,7 +1892,7 @@ namespace VEPROMS
{
try
{
- System.Diagnostics.Process.GetCurrentProcess().Kill();
+ Process.GetCurrentProcess().Kill();
}
catch (Exception ex)
{
@@ -2022,10 +1919,9 @@ namespace VEPROMS
{
VETreeNode jj_vetn = (VETreeNode)tv.Nodes[0]; // the VEPROMS tree node
string s = ((FolderConfig)jj_vetn.VEObject.MyConfig).Timeout; // get the panel heading
- int result = 30;
- if (!int.TryParse(s, out result))
- result = 30;
- return result;
+ if (!int.TryParse(s, out int result))
+ result = 30;
+ return result;
}
private Timer _RefreshTimer;
@@ -2036,27 +1932,23 @@ namespace VEPROMS
{
if (_RefreshTimer == null)
{
- _RefreshTimer = new Timer();
- _RefreshTimer.Interval = 20000; //
- _RefreshTimer.Enabled = true;
- _RefreshTimer.Tick += _RefreshTimer_Tick;
+ _RefreshTimer = new Timer
+ {
+ Interval = 20000, //
+ Enabled = true
+ };
+ _RefreshTimer.Tick += _RefreshTimer_Tick;
}
return _RefreshTimer;
}
}
- private bool _RefreshTimerActive = false;
+ // B2019-161 When tracking timing time this action
+ private static readonly VolianTimer _TimeActivity = new VolianTimer("frmVEPROMS.cs _RefreshTimer_Tick", 1346);
- // B2019-161 When tracking timing time this action
- private static VolianTimer _TimeActivity = new VolianTimer("frmVEPROMS.cs _RefreshTimer_Tick", 1346);
+ public bool RefreshTimerActive { get; set; } = false;
- public bool RefreshTimerActive
- {
- get { return _RefreshTimerActive; }
- set { _RefreshTimerActive = value; }
- }
-
- void _RefreshTimer_Tick(object sender, EventArgs e)
+ void _RefreshTimer_Tick(object sender, EventArgs e)
{
if (RefreshTimerActive)
{
@@ -2064,7 +1956,7 @@ namespace VEPROMS
_TimeActivity.Open();
if (PauseRefresh) return;
- RefreshChanged(this);
+ RefreshChanged();
_TimeActivity.Close();
}
}
@@ -2072,10 +1964,10 @@ namespace VEPROMS
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"))
+ if (Process.GetCurrentProcess().ProcessName.ToLower().EndsWith("vshost"))
{
PingSession(null);
- StartRefreshChanged(null);
+ StartRefreshChanged();
}
}
@@ -2100,15 +1992,12 @@ namespace VEPROMS
private DevComponents.DotNetBar.ButtonItem btnFormats;
private DevComponents.DotNetBar.ButtonItem btnGeneralTools;
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE0044:Add readonly modifier", Justification = "Keeping Collections Not ReadOnly")]
+ private TabItemsToClose _MyCloseTabList = new TabItemsToClose();
- private TabItemsToClose _MyCloseTabList = new TabItemsToClose();
-
- public TabItemsToClose MyCloseTabList
- {
- get { return _MyCloseTabList; }
- }
-
- private bool _DisablePing = false;
+ public TabItemsToClose MyCloseTabList => _MyCloseTabList;
+
+ private bool _DisablePing = false;
public bool DisablePing
{
get { return _DisablePing; }
@@ -2119,7 +2008,7 @@ namespace VEPROMS
}
}
- private void PingSession(Object obj)
+ private void PingSession(object obj)
{
MySemaphore.WaitOne();
@@ -2146,8 +2035,6 @@ namespace VEPROMS
MySemaphore.Release();
}
- WindowsFormsSynchronizationContext mUIContext = new WindowsFormsSynchronizationContext();
-
public void MyFindNodeAndExpand(object obj)
{
if (tv == null || tv.SelectedNode == null) return;
@@ -2181,20 +2068,16 @@ namespace VEPROMS
MySemaphore.Release(); // ping session control
}
- private void StartRefreshChanged(Object obj)
+ private void StartRefreshChanged()
{
- //_MyLog.Debug("StartRefreshChanged");
- //if (SkipRefresh) return;
MySemaphore.WaitOne();
RefreshTimerActive = !PauseRefresh;
MySemaphore.Release();
}
- private void RefreshChanged(Object obj)
+ private void RefreshChanged()
{
- //if (SkipRefresh) return;
- //MySemaphore.WaitOne();
- Int64 lastChanged = 0;
+ long lastChanged = 0;
//_MyLog.WarnFormat(">>> RefreshChanged");
try
@@ -2245,7 +2128,6 @@ namespace VEPROMS
}
catch { }
- //MySemaphore.Release();
//_MyLog.DebugFormat("{0},{1:X},{2:X},{3:X}", DateTime.Now.ToLongTimeString(), lastChanged, MySessionInfo.LastContentChange, MySessionInfo.LastChangedInt64);
}
@@ -2261,19 +2143,6 @@ namespace VEPROMS
return total;
}
- private bool ByteArrayIsEmpty(byte[] myArray)
- {
- for (int i = 0; i < myArray.Length; i++)
- {
- if (myArray[i] != 0)
- {
- return false;
- }
- }
-
- return true;
- }
-
public UserInfo MyUserInfo = null;
public static UserInfo SMyUserInfo = null; // C2021-010: Remove trailing returns/spaces & manual page breaks & allow save.
public VersionWindowList MyVersionWindowList;
@@ -2282,14 +2151,13 @@ namespace VEPROMS
public ContentInfo ci3;
public Timer tmrCloseTabItems;
public System.Threading.Semaphore MySemaphore = new System.Threading.Semaphore(1, 1);
- private bool _frmVEPROMSloading = false;
private void frmVEPROMS_Load(object sender, EventArgs e)
{
- // B2019-116 Use Volian.Base.Library.VlnItextFont
- // This is a generic class for dealing with iTextSharp Fonts
- // Code moved and consolidated from Volian.Print.Library, Volian PDF.Library and VG
- Volian.Base.Library.VlnItextFont.RegisterPromsFonts();
+ // B2019-116 Use Volian.Base.Library.VlnItextFont
+ // This is a generic class for dealing with iTextSharp Fonts
+ // Code moved and consolidated from Volian.Print.Library, Volian PDF.Library and VG
+ VlnItextFont.RegisterPromsFonts();
InitializeSecurity();
UpdateUser();
@@ -2315,19 +2183,19 @@ namespace VEPROMS
//general Tools
btnGeneralTools = new ButtonItem("btnGeneralTools", "General Tools");
btnGeneralTools.Visible = btnGeneralTools.Enabled = true;
- btnGeneralTools.ButtonStyle = DevComponents.DotNetBar.eButtonStyle.ImageAndText;
+ btnGeneralTools.ButtonStyle = eButtonStyle.ImageAndText;
btnGeneralTools.CanCustomize = false;
- btnGeneralTools.Image = global::VEPROMS.Properties.Resources.toolbox;
+ btnGeneralTools.Image = Resources.toolbox;
btnGeneralTools.Click += new EventHandler(btnGeneralTools_Click);
itemContainer3.SubItems.Add(btnGeneralTools);
// C2025-031 added tool tip messages
- this.superTooltip1.SetSuperTooltip(btnManageSecurity, new SuperTooltipInfo("Manage Security", "", "Add, Modify, and Delete PROMS User Access", null, null, eTooltipColor.Gray));
- this.superTooltip1.SetSuperTooltip(btnResetSecurity, new SuperTooltipInfo("Reset Security", "", "WARNING this will \nREMOVE ALL PROMS USERS and Reset to the\nOriginal Volian Defaults", null, null, eTooltipColor.Gray));
- this.superTooltip1.SetSuperTooltip(btnAdministrativeTools, new SuperTooltipInfo("Administrative Tools", "", "Open the PROMS Adminstration Tools Window", null, null, eTooltipColor.Gray));
- this.superTooltip1.SetSuperTooltip(btnUpdateFormats, new SuperTooltipInfo("Update Formats", "", "Install New Formats \n or Re-Install Formats", null, null, eTooltipColor.Gray));
- this.superTooltip1.SetSuperTooltip(btnGeneralTools, new SuperTooltipInfo("General Tools", "", "Open the PROMS General Tools Window", null, null, eTooltipColor.Gray));
+ superTooltip1.SetSuperTooltip(btnManageSecurity, new SuperTooltipInfo("Manage Security", "", "Add, Modify, and Delete PROMS User Access", null, null, eTooltipColor.Gray));
+ superTooltip1.SetSuperTooltip(btnResetSecurity, new SuperTooltipInfo("Reset Security", "", "WARNING this will \nREMOVE ALL PROMS USERS and Reset to the\nOriginal Volian Defaults", null, null, eTooltipColor.Gray));
+ superTooltip1.SetSuperTooltip(btnAdministrativeTools, new SuperTooltipInfo("Administrative Tools", "", "Open the PROMS Adminstration Tools Window", null, null, eTooltipColor.Gray));
+ superTooltip1.SetSuperTooltip(btnUpdateFormats, new SuperTooltipInfo("Update Formats", "", "Install New Formats \n or Re-Install Formats", null, null, eTooltipColor.Gray));
+ superTooltip1.SetSuperTooltip(btnGeneralTools, new SuperTooltipInfo("General Tools", "", "Open the PROMS General Tools Window", null, null, eTooltipColor.Gray));
try
{
@@ -2375,14 +2243,16 @@ namespace VEPROMS
btnFormats.Visible = isVisible;
btnSecurity.Visible = isVisible;
btnAdmin.Enabled = (isVisible || HasSetAdministrator(MyUserInfo));
-
- tmrCloseTabItems = new Timer();
- tmrCloseTabItems.Interval = 100;
- tmrCloseTabItems.Tick += new EventHandler(tmrCloseTabItems_Tick);
+
+ tmrCloseTabItems = new Timer
+ {
+ Interval = 100
+ };
+ tmrCloseTabItems.Tick += new EventHandler(tmrCloseTabItems_Tick);
tmrCloseTabItems.Enabled = true;
CloseSessionsNoLongerActive();
- MySessionInfo = SessionInfo.BeginSession(Environment.MachineName, System.Diagnostics.Process.GetCurrentProcess().Id);
+ MySessionInfo = SessionInfo.BeginSession(Environment.MachineName, Process.GetCurrentProcess().Id);
if (MySessionInfo == null)
{
@@ -2390,7 +2260,7 @@ namespace VEPROMS
Application.Exit();
}
- this.LastContentChange = MySessionInfo.LastContentChange;
+ LastContentChange = MySessionInfo.LastContentChange;
//_MyLog.WarnFormat("Original last content change {0}", this.LastContentChange);
RefreshLastChange();
@@ -2404,13 +2274,14 @@ namespace VEPROMS
SetCaption(tv.TopNode as VETreeNode);
System.Threading.AutoResetEvent autoEvent = new System.Threading.AutoResetEvent(false);
+ // For Debugging:
//System.Threading.TimerCallback timerDelegate = new System.Threading.TimerCallback(MySessionInfo.PingSession);
//System.Diagnostics.Process xyzzy = System.Diagnostics.Process.GetCurrentProcess();
- if (!System.Diagnostics.Debugger.IsAttached)// running in Production Mode (Not in the debugger)
+ if (!Debugger.IsAttached)// running in Production Mode (Not in the debugger)
{
- System.Threading.TimerCallback timerDelegate = new System.Threading.TimerCallback(this.PingSession);
- if (this._MyParent == null)
+ System.Threading.TimerCallback timerDelegate = new System.Threading.TimerCallback(PingSession);
+ if (MyParent == null)
{
MyActivityTimer = new System.Threading.Timer(timerDelegate, autoEvent, 10000, 10000);
}
@@ -2418,16 +2289,14 @@ namespace VEPROMS
// get the saved location and size of the VE-PROMS application for this user
- this.txtSearch.KeyPress += new KeyPressEventHandler(txtSearch_KeyPress);
- this.txtSearch.KeyUp += txtSearch_KeyUp; // RHM20150506 Multi-Line ItemID TextBox
- this.txtSearch.TextChanged += txtSearch_TextChanged; // RHM20150506 Multi-Line ItemID TextBox
- this.btnNext.Click += btnNext_Click; // RHM20150506 Multi-Line ItemID TextBox
- this.btnPrint1.Click += btnPrint1_Click; // RHM20150506 Multi-Line ItemID TextBox
- this.btnPrevious.Click += btnPrevious_Click; // RHM20150506 Multi-Line ItemID TextBox
- if (Settings.Default["Location"] != null) this.Location = Settings.Default.Location;
- if (Settings.Default["Size"] != null) this.Size = Settings.Default.Size;
- //if (Settings.Default["WindowState"] != null) this.WindowState = Settings.Default.WindowState;
- //if (Settings.Default.SaveTreeviewExpanded) epProcedures.Expanded = Settings.Default.TreeviewExpanded;
+ txtSearch.KeyPress += new KeyPressEventHandler(txtSearch_KeyPress);
+ txtSearch.KeyUp += txtSearch_KeyUp; // RHM20150506 Multi-Line ItemID TextBox
+ txtSearch.TextChanged += txtSearch_TextChanged; // RHM20150506 Multi-Line ItemID TextBox
+ btnNext.Click += btnNext_Click; // RHM20150506 Multi-Line ItemID TextBox
+ btnPrint1.Click += btnPrint1_Click; // RHM20150506 Multi-Line ItemID TextBox
+ btnPrevious.Click += btnPrevious_Click; // RHM20150506 Multi-Line ItemID TextBox
+ if (Settings.Default["Location"] != null) Location = Settings.Default.Location;
+ if (Settings.Default["Size"] != null) Size = Settings.Default.Size;
// if the Procedures panel was left open from the last session, then open it
epProcedures.Expanded = Settings.Default.TreeviewExpanded;
@@ -2436,10 +2305,10 @@ namespace VEPROMS
// See if any database 'changes' need done and do them:
MakeDatabaseChanges();
- if (Volian.Base.Library.VlnSettings.GetCommandFlag("NOMRU")) // B2017-193 Error occurred when a section in the MRU was being loaded as an iteminfo
+ if (VlnSettings.GetCommandFlag("NOMRU")) // B2017-193 Error occurred when a section in the MRU was being loaded as an iteminfo
_MyMRIList = new MostRecentItemList();
else
- _MyMRIList = MostRecentItemList.GetMRILst((System.Collections.Specialized.StringCollection)(Properties.Settings.Default["MRIList"]));
+ _MyMRIList = MostRecentItemList.GetMRILst((System.Collections.Specialized.StringCollection)(Settings.Default["MRIList"]));
_MyMRIList.AfterRemove += new ItemInfoEvent(_MyMRIList_AfterRemove);
SetupMRU();
@@ -2449,19 +2318,15 @@ namespace VEPROMS
{
if (Settings.Default.SaveTreeviewExpanded && _MyMRIList.Count > 0)
{
- _frmVEPROMSloading = true; // C2015-022 so we don't try to create child windows when proms is first starting and position in the procedure tree
-
tv.AdjustTree(_MyMRIList[0].MyItemInfo.MyProcedure);
tv.SelectedNode.Expand();
SetCaption(tv.SelectedNode as VETreeNode);
-
- _frmVEPROMSloading = false;
}
}
//get version windows settings
- MyVersionWindowList = VersionWindowList.GetVersionWindowList(Properties.Settings.Default.VersionWindows);
- tc.SyncEnhancedDocuments = Properties.Settings.Default.SyncEnhancedDocuments;
+ MyVersionWindowList = VersionWindowList.GetVersionWindowList(Settings.Default.VersionWindows);
+ tc.SyncEnhancedDocuments = Settings.Default.SyncEnhancedDocuments;
// Assign the Procedure Panel's title (heading)
epProcedures.TitleText = getProcedurePanelHeading(); // get the panel heading
@@ -2478,7 +2343,6 @@ namespace VEPROMS
displayBookMarks.MyDisplayTabControl = tc; // allows bookmark selection to bring up steps/docs
office2007StartButton1.MouseDown += new MouseEventHandler(office2007StartButton1_MouseDown);
- //displayRO.EnabledChanged += new EventHandler(displayRO_EnabledChanged);
tc.Enter += new EventHandler(tc_Enter);
tc.Leave += new EventHandler(tc_Leave);
@@ -2488,7 +2352,7 @@ namespace VEPROMS
tc.RefreshEnhancedDocument += tc_RefreshEnhancedDocument;
tc.CopyStepSelected += tc_CopyStepSelected; // will extend CopyStep info to all child windows (separate windows upgrade)
- this.Deactivate += new EventHandler(frmVEPROMS_Deactivate);
+ Deactivate += new EventHandler(frmVEPROMS_Deactivate);
if (VlnSettings.DemoMode) StepRTB.MyFontFamily = GetFamily("Bookman Old Style");
displaySearch1.Enter += new EventHandler(displaySearch1_Enter);
@@ -2499,9 +2363,11 @@ namespace VEPROMS
if (RunningNewRevision && ShowEULA() != DialogResult.OK)
{
- Timer tmrShutDown = new Timer();
- tmrShutDown.Interval = 250;
- tmrShutDown.Tick += new EventHandler(tmrShutDown_Tick);
+ Timer tmrShutDown = new Timer
+ {
+ Interval = 250
+ };
+ tmrShutDown.Tick += new EventHandler(tmrShutDown_Tick);
tmrShutDown.Enabled = true;
}
else
@@ -2509,21 +2375,18 @@ namespace VEPROMS
tmrAutomatic.Enabled = true;
}
- //// Shutoff UpdateFormats for Production Mode
- //if (Volian.Base.Library.VlnSettings.ProductionMode)
- // btnAdmin.Visible = false;
- StepTabRibbon.PasteNoReturnsSetting = Properties.Settings.Default.PasteNoReturns;
- StepTabRibbon.PastePlainTextSetting = Properties.Settings.Default.PastePlainText;
- StepTabRibbon.SpecifiedVisioPath = Properties.Settings.Default.VisioPath;
+ StepTabRibbon.PasteNoReturnsSetting = Settings.Default.PasteNoReturns;
+ StepTabRibbon.PastePlainTextSetting = Settings.Default.PastePlainText;
+ StepTabRibbon.SpecifiedVisioPath = Settings.Default.VisioPath;
Activate();
// RHM20150506 Multi-line ItemID TextBox
if (MyParent == null)
{
- this.txtSearch.Text = Volian.Base.Library.VlnSettings.GetItemIDs().Replace(",", "\r\n");
+ txtSearch.Text = VlnSettings.GetItemIDs().Replace(",", "\r\n");
// Open First Item
- if (!string.IsNullOrEmpty(this.txtSearch.Text) && this.txtSearch.Text.Length > 0 && !this.txtSearch.Text.Contains("\r\n"))
+ if (!string.IsNullOrEmpty(txtSearch.Text) && txtSearch.Text.Length > 0 && !txtSearch.Text.Contains("\r\n"))
{
CurrentID = txtSearch.Text;
}
@@ -2572,7 +2435,7 @@ namespace VEPROMS
// We were running into performace and random hanging issues with the Word tabs - maybe windows event related.
if (_Procedure == null || _Procedure.HasWordContent) continue; //skip and continue with foreach
OpenItem(_Procedure);
- if (tc.MyEditItem == null) continue; // skip and continue with foreach
+ if (tc.MyEditItem == null) continue; // skip and continue with foreach
// SelectedStepTabPanel needs to be set so the print buttons on the ribbon will work.
SelectedStepTabPanel = tc.MyEditItem.MyStepPanel.MyStepTabPanel;
@@ -2595,19 +2458,17 @@ namespace VEPROMS
void tc_RefreshEnhancedDocument(object sender, ItemSelectedChangedEventArgs args)
{
// if the procedure is opened then move to the select step
- if (!Properties.Settings.Default.SeparateWindows)
+ if (!Settings.Default.SeparateWindows)
{
tc.RefreshItem(args.MyItemInfo);
}
else
{
int versionID = args.MyItemInfo.MyDocVersion.VersionID;
- frmVEPROMS child = null;
-
- if (PROMSWindowForms.ContainsKey(versionID))
+ if (PROMSWindowForms.ContainsKey(versionID))
{
- child = PROMSWindowForms[versionID];
- child.RefreshItem(args.MyItemInfo);
+ frmVEPROMS child = PROMSWindowForms[versionID];
+ child.RefreshItem(args.MyItemInfo);
}
}
}
@@ -2620,7 +2481,7 @@ namespace VEPROMS
{
frmVEPROMS tmp = PROMSWindowForms[k];
- if (tmp.MyDocVersion.VersionID != this.SelectedDVI.VersionID)
+ if (tmp.MyDocVersion.VersionID != SelectedDVI.VersionID)
tmp.tc.MyCopyStep = tc.MyCopyStep;
else if (tmp.MyParent != null)
tmp.MyParent.tc.MyCopyStep = tc.MyCopyStep;
@@ -2638,21 +2499,21 @@ namespace VEPROMS
foreach (SessionInfo si in sil)
{
- if (si.DTSEnd == null && si.MachineName == Environment.MachineName && si.UserID == Volian.Base.Library.VlnSettings.UserID)
+ if (si.DTSEnd == null && si.MachineName == Environment.MachineName && si.UserID == VlnSettings.UserID)
{
try
{
- System.Diagnostics.Process p = System.Diagnostics.Process.GetProcessById(si.ProcessID);
+ System.Diagnostics.Process p = Process.GetProcessById(si.ProcessID);
}
- catch (Exception ex)// Process not found
- {
+ catch (Exception)// Process not found
+ {
// Remove Session record associated with a closed process
Session.Delete(si.SessionID);
}
}
else if (si.DTSEnd == null)
{
- i = i + 1;
+ i++;
}
}
@@ -2672,7 +2533,7 @@ namespace VEPROMS
{
if (_PROMSWindowForms == null)
{
- if (_MyParent == null)
+ if (MyParent == null)
_PROMSWindowForms = new Dictionary();
else
_PROMSWindowForms = MyParent.PROMSWindowForms;
@@ -2695,9 +2556,8 @@ namespace VEPROMS
return;
}
- frmVEPROMS child = null;
-
- if (PROMSWindowForms.ContainsKey(versionID))
+ frmVEPROMS child;
+ if (PROMSWindowForms.ContainsKey(versionID))
{
child = PROMSWindowForms[versionID]; // use existing child window
}
@@ -2788,7 +2648,7 @@ namespace VEPROMS
// RHM20150507 Table Scrunch
// B2018-033 VCS SAG-6 Steps 3 and 9 and SACRG1 Step 13
// Set default Scrunching flags
- private TableScrunching _DefaultScrunchingRules = TableScrunching.AllPhases;
+ private readonly TableScrunching _DefaultScrunchingRules = TableScrunching.AllPhases;
void btnPrint1_Click(object sender, EventArgs e)
{
@@ -2806,7 +2666,7 @@ namespace VEPROMS
}
}
- DialogResult dr = System.Windows.Forms.DialogResult.Yes;
+ DialogResult dr = DialogResult.Yes;
// RHM20150507 Table Scrunch
Rtf2Pdf.AllowTableScrunching = cbScrunch.Checked ? _DefaultScrunchingRules : TableScrunching.None;
@@ -2815,15 +2675,16 @@ namespace VEPROMS
{
ProcedureInfo proc = dicProcs[key];
- DlgPrintProcedure prnDlg = new DlgPrintProcedure(proc, true);
- prnDlg.MySessionInfo = MySessionInfo;
- prnDlg.Prefix = proc.MyDocVersion.VersionID.ToString() + "_";
- prnDlg.Automatic = true;
- prnDlg.OpenAfterCreate = (dr == System.Windows.Forms.DialogResult.Yes);
- prnDlg.SetupForProcedure();
+ DlgPrintProcedure prnDlg = new DlgPrintProcedure(proc, true)
+ {
+ MySessionInfo = MySessionInfo,
+ Prefix = proc.MyDocVersion.VersionID.ToString() + "_",
+ Automatic = true,
+ OpenAfterCreate = (dr == DialogResult.Yes)
+ };
+ prnDlg.SetupForProcedure();
prnDlg.CreatePDF();
- //prnDlg.ShowDialog(this); // RHM 20120925 - Center dialog over PROMS window
}
}
@@ -2954,9 +2815,10 @@ namespace VEPROMS
}
- //C2024-036 IntelliSense
- //Collection to block for task to complete
- private BlockingCollection blockingQueueFilter = new BlockingCollection();
+ //C2024-036 IntelliSense
+ //Collection to block for task to complete
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE0044:Add readonly modifier", Justification = "Keeping Collections Not ReadOnly")]
+ private BlockingCollection blockingQueueFilter = new BlockingCollection();
//C2024-036 IntelliSense
// When Text Changes, Perform the filtering
@@ -3003,28 +2865,28 @@ namespace VEPROMS
//Step 1: reload the base tree
VETreeNode tbase = (VETreeNode)tv.Nodes[0];
tbase.ChildrenLoaded = false;
- this.Invoke((Action) (() => { tbase.RefreshNode(); }));
+ Invoke((Action) (() => { tbase.RefreshNode(); }));
if (!string.IsNullOrEmpty(fltrtxt))
{
//Step 2: Expand all TreeNodes
- this.Invoke((Action)(() => { LoadAllProcedures(tbase); }));
+ Invoke((Action)(() => { LoadAllProcedures(tbase); }));
//Step 3: get items that match filter to those containing the title or number
List filterlist = GetMatchingTreeNodes(tbase, fltrtxt);
//Step 4: filter to those containing the title or number
- this.Invoke((Action)(() => {FilterTreeNodes(tbase, filterlist);}));
+ Invoke((Action)(() => {FilterTreeNodes(tbase, filterlist);}));
//Step 5: refresh the view
- this.Invoke((Action)(() => {tv.Update();}));
+ Invoke((Action)(() => {tv.Update();}));
//Step 6: select 1st procedure in tree view
- this.Invoke((Action)(() => {SelectFirstProcedure(filterlist);}));
+ Invoke((Action)(() => {SelectFirstProcedure(filterlist);}));
}
//Step 7: set progress bar as done
- this.Invoke((Action)(() => {ProgBarText = "Filtering Complete";}));
+ Invoke((Action)(() => {ProgBarText = "Filtering Complete";}));
}
@@ -3046,17 +2908,11 @@ namespace VEPROMS
tv.Focus();
}
- void btnPrevious_Click(object sender, EventArgs e)
- {
- CurrentID = FindPreviousLine();
- }
+ void btnPrevious_Click(object sender, EventArgs e) => CurrentID = FindPreviousLine();
- void btnNext_Click(object sender, EventArgs e)
- {
- CurrentID = FindNextLine();
- }
+ void btnNext_Click(object sender, EventArgs e) => CurrentID = FindNextLine();
- public string CurrentID
+ public string CurrentID
{
get
{
@@ -3097,13 +2953,12 @@ namespace VEPROMS
if (txtSearch.SelectionLength > 0)
txtSearch.SelectionLength = 0;
- string sub = txtSearch.Text;
int selStart = 0;
if (txtSearch.SelectionStart == 0) return null;
if (txtSearch.SelectionStart > 2)
{
- sub = txtSearch.Text.Substring(0, txtSearch.SelectionStart - 2);
+ string sub = txtSearch.Text.Substring(0, txtSearch.SelectionStart - 2);
if (sub.Contains("\n"))
{
selStart = sub.LastIndexOf("\r\n") + 2;
@@ -3187,52 +3042,56 @@ namespace VEPROMS
tc.SelectedDisplayTabItem = dti;
dti.SelectedItemInfo = ii;
tv.AdjustTree(ii);
- lblItemID.Text = string.Format("ItemID = {0}", ii.ItemID);
+ lblItemID.Text = $"ItemID = {ii.ItemID}";
}
else
{
- MessageBox.Show(string.Format("Looking for: {0}", str), "No item found");
+ MessageBox.Show($"Looking for: {str}", "No item found");
}
}
private static ItemInfo GetItemInfoFromString(string str) // RHM20150506 Multi-Line ItemID TextBox
{
ItemInfo ii = null;
- int id = 0;
- ContentInfo ci = null;
+ ContentInfo ci = null;
- if (str.ToUpper().StartsWith("C="))
- {
- if (int.TryParse(str.Substring(2), out id))
- ci = ContentInfo.Get(id);
+ int id;
+ if (str.ToUpper().StartsWith("C="))
+ {
+ if (int.TryParse(str.Substring(2), out id))
+ ci = ContentInfo.Get(id);
- if (ci != null)
- ii = ci.ContentItems[0];
- }
- else
- {
- if (int.TryParse(str, out id))
- ii = ItemInfo.Get(id);
- }
+ if (ci != null)
+ ii = ci.ContentItems[0];
+ }
+ else
+ {
+ if (int.TryParse(str, out id))
+ ii = ItemInfo.Get(id);
+ }
- return ii;
+ return ii;
}
void btnAdministrativeTools_Click(object sender, EventArgs e)
{
- frmBatchRefresh frm = new frmBatchRefresh(MySessionInfo, this);
- frm.ProgressBar = bottomProgBar;
- frm.ShowDialog(this);
+ frmBatchRefresh frm = new frmBatchRefresh(MySessionInfo, this)
+ {
+ ProgressBar = bottomProgBar
+ };
+ frm.ShowDialog(this);
}
void btnGeneralTools_Click(object sender, EventArgs e)
{
- frmGenTools frm = new frmGenTools(MySessionInfo, this);
- frm.ProgressBar = bottomProgBar;
- frm.ShowDialog(this);
+ frmGenTools frm = new frmGenTools(MySessionInfo, this)
+ {
+ ProgressBar = bottomProgBar
+ };
+ frm.ShowDialog(this);
}
- private static VolianTimer _TimeActivity1 = new VolianTimer("frmVEPROMS.cs tmrCloseTabItems_Tick", 2108);
+ private static readonly VolianTimer _TimeActivity1 = new VolianTimer("frmVEPROMS.cs tmrCloseTabItems_Tick", 2108);
void tmrCloseTabItems_Tick(object sender, EventArgs e)
{
@@ -3321,8 +3180,8 @@ namespace VEPROMS
while (proxyUser == null)
{
- cms.Show(new System.Drawing.Point((System.Windows.Forms.Screen.PrimaryScreen.WorkingArea.Width - cms.Width) / 2, (System.Windows.Forms.Screen.PrimaryScreen.WorkingArea.Height - cms.Height) / 2));
- System.Windows.Forms.Application.DoEvents();
+ cms.Show(new System.Drawing.Point((Screen.PrimaryScreen.WorkingArea.Width - cms.Width) / 2, (Screen.PrimaryScreen.WorkingArea.Height - cms.Height) / 2));
+ Application.DoEvents();
}
VlnSettings.UserID = proxyUser;
@@ -3361,7 +3220,6 @@ namespace VEPROMS
*/
if ("|VLN|RICH-WINDOWS10|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");
}
@@ -3378,9 +3236,9 @@ namespace VEPROMS
cms.Items.Add("Choose User");
System.Windows.Forms.ToolStripMenuItem tsmi = cms.Items[0] as System.Windows.Forms.ToolStripMenuItem;
- tsmi.BackColor = System.Drawing.Color.FromKnownColor(System.Drawing.KnownColor.ActiveCaption);// System.Drawing.Color.Pink;
- tsmi.ForeColor = System.Drawing.Color.FromKnownColor(System.Drawing.KnownColor.ActiveCaptionText);
- tsmi.Font = new System.Drawing.Font(tsmi.Font, System.Drawing.FontStyle.Bold);
+ tsmi.BackColor = Color.FromKnownColor(KnownColor.ActiveCaption);// System.Drawing.Color.Pink;
+ tsmi.ForeColor = Color.FromKnownColor(KnownColor.ActiveCaptionText);
+ tsmi.Font = new System.Drawing.Font(tsmi.Font, FontStyle.Bold);
UserInfoList uil = UserInfoList.Get();
foreach (UserInfo ui in uil)
@@ -3391,7 +3249,7 @@ namespace VEPROMS
{
if (mi.EndDate == string.Empty)
{
- string txt = string.Format("{0} - {1}", ui.UserID, mi.MyGroup.GroupName);
+ string txt = $"{ui.UserID} - {mi.MyGroup.GroupName}";
ToolStripItem tsi = cms.Items.Add(txt, null, new EventHandler(User_Click));
tsi.Tag = ui;
break;
@@ -3405,14 +3263,12 @@ namespace VEPROMS
private void User_Click(object sender, EventArgs e)
{
- ToolStripMenuItem tsmi = sender as ToolStripMenuItem;
-
- if (tsmi != null)
- {
- UserInfo ui = tsmi.Tag as UserInfo;
- proxyUser = ui.UserID;
- }
- }
+ if (sender is ToolStripMenuItem tsmi)
+ {
+ UserInfo ui = tsmi.Tag as UserInfo;
+ proxyUser = ui.UserID;
+ }
+ }
void btnManageSecurity_Click(object sender, EventArgs e)
{
@@ -3454,35 +3310,42 @@ namespace VEPROMS
private static DialogResult ShowInputDialog(ref string input)
{
System.Drawing.Size size = new System.Drawing.Size(200, 70);
- Form inputBox = new Form();
+ Form inputBox = new Form
+ {
+ FormBorderStyle = FormBorderStyle.FixedDialog,
+ ClientSize = size,
+ Text = "Enter Password",
+ StartPosition = FormStartPosition.CenterScreen
+ };
- inputBox.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
- inputBox.ClientSize = size;
- inputBox.Text = "Enter Password";
- inputBox.StartPosition = FormStartPosition.CenterScreen;
+ System.Windows.Forms.TextBox textBox = new TextBox
+ {
+ Size = new System.Drawing.Size(size.Width - 10, 23),
+ Location = new System.Drawing.Point(5, 5),
+ PasswordChar = '*',
+ Text = input
+ };
+ inputBox.Controls.Add(textBox);
- System.Windows.Forms.TextBox textBox = new TextBox();
- textBox.Size = new System.Drawing.Size(size.Width - 10, 23);
- textBox.Location = new System.Drawing.Point(5, 5);
- textBox.PasswordChar = '*';
- textBox.Text = input;
- inputBox.Controls.Add(textBox);
+ Button okButton = new Button
+ {
+ DialogResult = DialogResult.OK,
+ Name = "okButton",
+ Size = new System.Drawing.Size(75, 23),
+ Text = "&OK",
+ Location = new System.Drawing.Point(size.Width - 80 - 80, 39)
+ };
+ inputBox.Controls.Add(okButton);
- Button okButton = new Button();
- okButton.DialogResult = System.Windows.Forms.DialogResult.OK;
- okButton.Name = "okButton";
- okButton.Size = new System.Drawing.Size(75, 23);
- okButton.Text = "&OK";
- okButton.Location = new System.Drawing.Point(size.Width - 80 - 80, 39);
- inputBox.Controls.Add(okButton);
-
- Button cancelButton = new Button();
- cancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
- cancelButton.Name = "cancelButton";
- cancelButton.Size = new System.Drawing.Size(75, 23);
- cancelButton.Text = "&Cancel";
- cancelButton.Location = new System.Drawing.Point(size.Width - 80, 39);
- inputBox.Controls.Add(cancelButton);
+ Button cancelButton = new Button
+ {
+ DialogResult = DialogResult.Cancel,
+ Name = "cancelButton",
+ Size = new System.Drawing.Size(75, 23),
+ Text = "&Cancel",
+ Location = new System.Drawing.Point(size.Width - 80, 39)
+ };
+ inputBox.Controls.Add(cancelButton);
DialogResult result = inputBox.ShowDialog();
@@ -3519,23 +3382,24 @@ namespace VEPROMS
void tmrShutDown_Tick(object sender, EventArgs e)
{
(sender as Timer).Enabled = false;
- this.Close();
+ Close();
}
private DialogResult ShowEULA()
{
string eulaFile = string.Format(@"\{0}", VlnSettings.EULAfile);
- string strEULA = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location) + eulaFile;
- //string strEULA = System.Environment.CurrentDirectory + eulaFile;
- frmViewTextFile ViewFile = new frmViewTextFile(strEULA, RichTextBoxStreamType.PlainText);
- ViewFile.Text = "End-User License Agreement";
- ViewFile.ButtonText = "Agree";
+ string strEULA = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location) + eulaFile;
+ frmViewTextFile ViewFile = new frmViewTextFile(strEULA, RichTextBoxStreamType.PlainText)
+ {
+ Text = "End-User License Agreement",
+ ButtonText = "Agree"
+ };
- if (ViewFile.ShowDialog() == DialogResult.OK)
+ if (ViewFile.ShowDialog() == DialogResult.OK)
{
System.Version ver = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version;
string thisVersion = ver.Major.ToString() + "." + ver.Minor.ToString();
- Properties.Settings.Default.LastVersion = thisVersion;
+ Settings.Default.LastVersion = thisVersion;
return DialogResult.OK;
}
@@ -3546,19 +3410,16 @@ namespace VEPROMS
{
get
{
- string lastVersion = Properties.Settings.Default.LastVersion;
+ string lastVersion = Settings.Default.LastVersion;
System.Version ver = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version;
- string thisVersion = ver.Major.ToString() + "." + ver.Minor.ToString();
+ string thisVersion = $"{ver.Major}.{ver.Minor}";
return thisVersion != lastVersion;
}
}
- void displayHistory_Enter(object sender, EventArgs e)
- {
- tc.HideCaret();
- }
+ void displayHistory_Enter(object sender, EventArgs e) => tc.HideCaret();
- void AnnotationTypeInfoList_ListChanged()
+ void AnnotationTypeInfoList_ListChanged()
{
displaySearch1.SetupAnnotationSearch(ctrlAnnotationDetails, tc);
ctrlAnnotationDetails.SetupAnnotations(displaySearch1);
@@ -3566,7 +3427,7 @@ namespace VEPROMS
private void RunAutomatic()
{
- string[] parameters = System.Environment.CommandLine.Split(" ".ToCharArray());
+ string[] parameters = Environment.CommandLine.Split(" ".ToCharArray());
bool ranAuto = false;
foreach (string parameter in parameters)
@@ -3611,8 +3472,6 @@ namespace VEPROMS
}
prnDlg.AllowDateTimePrefixSuffix = false; //C2018-033 don't append any selected date/time pdf file prefix or suffix (defined in working draft properties)
prnDlg.ShowDialog(this); // RHM 20120925 - Center dialog over PROMS window
- //prnDlg.FormClosed += new FormClosedEventHandler(prnDlg_FormClosed);
- //while (!_RunNext) Application.DoEvents();
}
@@ -3622,7 +3481,7 @@ namespace VEPROMS
BaseLnSettings.blBaseLine = false;
if (ranAuto)
{
- this.Close();
+ Close();
}
}
}
@@ -3642,38 +3501,23 @@ namespace VEPROMS
ribbonControl1.Expanded = !ribbonControl1.Expanded;
}
- void frmVEPROMS_Deactivate(object sender, EventArgs e)
- {
- tc.HideCaret(); // Hide the pseudo cursor (caret)
- }
+ void frmVEPROMS_Deactivate(object sender, EventArgs e) => tc.HideCaret(); // Hide the pseudo cursor (caret)
- void tc_Leave(object sender, EventArgs e)
+ void tc_Leave(object sender, EventArgs e)
{
if (tc.ShuttingDown) return;
tc.ShowCaret();// Show the pseudo cursor (caret)
}
- void tc_Enter(object sender, EventArgs e)
- {
- tc.HideCaret();// Hide the pseudo cursor (caret)
- }
+ void tc_Enter(object sender, EventArgs e) => tc.HideCaret();// Hide the pseudo cursor (caret)
- void displaySearch1_Enter(object sender, EventArgs e)
- {
- tc.HideCaret();// Hide the pseudo cursor (caret)
- }
+ void displaySearch1_Enter(object sender, EventArgs e) => tc.HideCaret();// Hide the pseudo cursor (caret)
- void ctrlAnnotationDetails_Enter(object sender, EventArgs e)
- {
- tc.HideCaret();// Hide the pseudo cursor (caret)
- }
+ void ctrlAnnotationDetails_Enter(object sender, EventArgs e) => tc.HideCaret();// Hide the pseudo cursor (caret)
- void _MyMRIList_AfterRemove(object sender)
- {
- SetupMRU();
- }
+ void _MyMRIList_AfterRemove(object sender) => SetupMRU();
- private void SetupButtons()
+ private void SetupButtons()
{
if (!VlnSettings.DebugMode)
{
@@ -3691,8 +3535,8 @@ namespace VEPROMS
{
// C2024-007: On Proms main form, allow for control of whether the FontMenu
// combo box is displayed. Only done when running in debugmode
- cmbFont.Visible = Volian.Base.Library.VlnSettings.GetCommandFlag("FontMenu");
- lblDummy.Visible = !Volian.Base.Library.VlnSettings.GetCommandFlag("FontMenu");
+ cmbFont.Visible = VlnSettings.GetCommandFlag("FontMenu");
+ lblDummy.Visible = !VlnSettings.GetCommandFlag("FontMenu");
}
}
@@ -3703,10 +3547,11 @@ namespace VEPROMS
icRecentDocs.SubItems.Clear();
if (_MyMRIList.Count > 0)
{
- LabelItem lblItem = new LabelItem();
- lblItem.Text = "Recent Documents:";
- icRecentDocs.SubItems.Add(lblItem);
- //icRecentDocs.SubItems.Add();
+ LabelItem lblItem = new LabelItem
+ {
+ Text = "Recent Documents:"
+ };
+ icRecentDocs.SubItems.Add(lblItem);
for (int i = 0; i < _MyMRIList.Count; i++)
{
MostRecentItem mri = _MyMRIList[i];
@@ -3728,15 +3573,14 @@ namespace VEPROMS
{
ButtonItem btnItem = (ButtonItem)sender;
MostRecentItem mri = _MyMRIList.Add((int)(btnItem.Tag));
- //SaveMRU();
SetupMRU();
if (mri != null) tc.OpenItem(mri.MyItemInfo);
}
private void SaveMRU()
{
- if (_MyMRIList != null) Properties.Settings.Default.MRIList = _MyMRIList.ToSettings();
- Properties.Settings.Default.TreeviewExpanded = epProcedures.Expanded;
- Properties.Settings.Default.Save();
+ if (_MyMRIList != null) Settings.Default.MRIList = _MyMRIList.ToSettings();
+ Settings.Default.TreeviewExpanded = epProcedures.Expanded;
+ Settings.Default.Save();
}
#endregion
@@ -3749,24 +3593,6 @@ namespace VEPROMS
{
if (_MyMRIList.Add(node.VEObject) != null)
SetupMRU();
- #region Sample Display Table Code
- // display an exiting table in that rtf grid thing
- //if ((_LastStepInfo.MyContent.Type == 20007) || (_LastStepInfo.MyContent.Type == 20009))
- //{
- // //MessageBox.Show("Source Grid");
- // //frmTable newtable1 = new frmTable(_LastStepInfo.MyContent.Text);
- // //newtable1.ShowDialog();
- // //MessageBox.Show("IGrid");
- // //frmIGrid newtable2 = new frmIGrid(_LastStepInfo.MyContent.Text);
- // //newtable2.ShowDialog();
- // //MessageBox.Show("GridView"); //standard Visual Studio Control
- // //frmGridView newtable3 = new frmGridView(_LastStepInfo.MyContent.Text);
- // //newtable3.ShowDialog();
- // MessageBox.Show("FlexCell");
- // frmFlexCell newtable4 = new frmFlexCell(_LastStepInfo.MyContent.Text);
- // newtable4.ShowDialog();
- //}
- #endregion
ItemInfo ii = node.VEObject as ItemInfo;
if (ii != null) tc.OpenItem(ii);
SetCaption(node);
@@ -3778,21 +3604,16 @@ namespace VEPROMS
{
VETreeNode vNode = (VETreeNode)args.Node;
IVEDrillDownReadOnly veObj = vNode.VEObject;
- SectionInfo mySection = veObj as SectionInfo;
- if (mySection != null && mySection.MyContent.MyEntry != null)
- {
- // if it is a word section, find the DisplayTabItem;
- DisplayTabItem tabItem = tc.GetProcDisplayTabItem(mySection);
- if (tabItem != null) tabItem.MyStepTabPanel.MyStepPanel.Reset();
- }
- // Don't select the newly created Step. This will be handled by tmrTreeView
- //SetupNodes((VETreeNode)args.Node);
- }
- private void tv_NodeSelect(object sender, vlnTreeEventArgs args)
- {
- SetupNodes((VETreeNode)args.Node);
- }
- private void SetCaption(VETreeNode tn)
+ if (veObj is SectionInfo mySection && mySection.MyContent.MyEntry != null)
+ {
+ // if it is a word section, find the DisplayTabItem;
+ DisplayTabItem tabItem = tc.GetProcDisplayTabItem(mySection);
+ tabItem?.MyStepTabPanel.MyStepPanel.Reset();
+ }
+ // Don't select the newly created Step. This will be handled by tmrTreeView
+ }
+ private void tv_NodeSelect(object sender, vlnTreeEventArgs args) => SetupNodes((VETreeNode)args.Node);
+ private void SetCaption(VETreeNode tn)
{
StringBuilder caption = new StringBuilder();
string sep = string.Empty;
@@ -3806,41 +3627,22 @@ namespace VEPROMS
}
tn = (VETreeNode)tn.Parent;
}
- caption.Insert(0, VEPROMS.CSLA.Library.Database.DBServer + sep);
- this.Text = caption.ToString();
+ caption.Insert(0, Database.DBServer + sep);
+ Text = caption.ToString();
}
void tv_OpenItem(object sender, vlnTreeItemInfoEventArgs args)
{
tc.OpenItem(args.MyItemInfo);
}
- ///
- /// When the treeview is clicked - a timer is set
- /// This is done because the focus is returned to the treeview after the click event
- /// This approach did not work and was replaced with the code below.
- /// The problem was that each time the treeview was clicked, the last selected node
- /// was opened again, or the edit window was repositioned.
- /// If the item was deleted and another treenode expanded, the click to expand the
- /// node would cause the deleted node to be selected.
- ///
- ///
- ///
- //private void tv_Click(object sender, EventArgs e)
- //{
- //tv.Enabled = false;
- //tmrTreeView.Enabled = true;
- //}
- ///
- /// This opens nodes if the mouse is within the bounds of a node.
- /// By using the timer, the focus can be passed to the edit window.
- ///
- ///
- ///
- void tv_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
- {
- _ExpandingTree = false;
- }
+ ///
+ /// This opens nodes if the mouse is within the bounds of a node.
+ /// By using the timer, the focus can be passed to the edit window.
+ ///
+ ///
+ ///
+ void tv_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e) => _ExpandingTree = false;
- void tv_MouseUp(object sender, System.Windows.Forms.MouseEventArgs e)
+ void tv_MouseUp(object sender, System.Windows.Forms.MouseEventArgs e)
{
if (_ExpandingTree)
{
@@ -3882,7 +3684,7 @@ namespace VEPROMS
}
}
private frmVEPROMS selectedChildWindow = null; // C2015-022 used for separate windows
- private static VolianTimer _TimeActivity2 = new VolianTimer("frmVEPROMS.cs tmrTreeView_Tick", 2697);
+ private static readonly VolianTimer _TimeActivity2 = new VolianTimer("frmVEPROMS.cs tmrTreeView_Tick", 2697);
///
/// This event is fired from the timer after the treeview click event completes
///
@@ -3890,18 +3692,15 @@ namespace VEPROMS
///
private void tmrTreeView_Tick(object sender, EventArgs e)
{
-
-
_TimeActivity2.Open();
bool giveTvFocus = true;
tmrTreeView.Enabled = false; // Timer has now fired
- VETreeNode tn = tv.SelectedNode as VETreeNode;
- if (tn != null) giveTvFocus = !SetupNodes(tn);
- tv.Enabled = true;
+ if (tv.SelectedNode is VETreeNode tn) giveTvFocus = !SetupNodes(tn);
+ tv.Enabled = true;
if (giveTvFocus) tv.Focus();
_TimeActivity2.Close();
}
- private static VolianTimer _TimeActivity3 = new VolianTimer("frmVEPROMS.cs tmrAutomatic_Tick", 2711);
+ private static readonly VolianTimer _TimeActivity3 = new VolianTimer("frmVEPROMS.cs tmrAutomatic_Tick", 2711);
private void tmrAutomatic_Tick(object sender, EventArgs e)
{
@@ -3931,7 +3730,7 @@ namespace VEPROMS
#region Property Page and Grid
DialogResult tv_NodeOpenProperty(object sender, vlnTreePropertyEventArgs args)
{
- this.Cursor = Cursors.WaitCursor;
+ Cursor = Cursors.WaitCursor;
DialogResult dr = DialogResult.Cancel;
if ((int)Settings.Default["PropPageStyle"] == (int)PropPgStyle.Grid)
{
@@ -3946,7 +3745,7 @@ namespace VEPROMS
if (!MySessionInfo.CanCheckOutItem(args.FolderConfig.MyFolder.FolderID, CheckOutType.Folder, ref message))
{
MessageBox.Show(this, message, "Folder Already Checked Out", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- this.Cursor = Cursors.Default;
+ Cursor = Cursors.Default;
return DialogResult.None;
}
int ownerID = MySessionInfo.CheckOutItem(args.FolderConfig.MyFolder.FolderID, CheckOutType.Folder);
@@ -3965,14 +3764,16 @@ namespace VEPROMS
if (!MySessionInfo.CanCheckOutItem(args.DocVersionConfig.MyDocVersion.VersionID, CheckOutType.DocVersion, ref message))
{
MessageBox.Show(this, message, "Working Draft Already Checked Out", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- this.Cursor = Cursors.Default;
+ Cursor = Cursors.Default;
return DialogResult.None;
}
int ownerID = MySessionInfo.CheckOutItem(args.DocVersionConfig.MyDocVersion.VersionID, CheckOutType.DocVersion);
- frmVersionsProperties frmver = new frmVersionsProperties(args.DocVersionConfig);
- frmver.ProgressBar = bottomProgBar;
- frmver.DisplaySearch1 = displaySearch1; //B2017-230 provide access to global search
- dr = frmver.ShowDialog();
+ frmVersionsProperties frmver = new frmVersionsProperties(args.DocVersionConfig)
+ {
+ ProgressBar = bottomProgBar,
+ DisplaySearch1 = displaySearch1 //B2017-230 provide access to global search
+ };
+ dr = frmver.ShowDialog();
if (frmver._showApplicSearchResults) //B2017-230 open global search with places that specifiy the applicabilty that the user tried to delete
{
toolsPanel.Expanded = true;
@@ -3988,7 +3789,7 @@ namespace VEPROMS
{
message = message.Replace("\r\nWould You like to open the procedure in View Only Mode?", "");
MessageBox.Show(this, message, "Procedure Already Checked Out", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- this.Cursor = Cursors.Default;
+ Cursor = Cursors.Default;
return DialogResult.None;
}
int ownerID = MySessionInfo.CheckOutItem(args.ProcedureConfig.MyProcedure.ItemID, CheckOutType.Procedure);
@@ -3998,21 +3799,13 @@ namespace VEPROMS
}
else if (args.SectionConfig != null)
{
- //// If this is a word document, close any edit sessions...
- //ItemInfo ii = null;
- //using (Section tmp = args.SectionConfig.MySection)
- //{
- // ii = ItemInfo.Get(tmp.ItemID);
- // if (!ii.IsStepSection) tc.CloseWordItem(ii);
- //}
-
frmSectionProperties frmsec = new frmSectionProperties(args.SectionConfig);
string message = string.Empty;
if (!MySessionInfo.CanCheckOutItem(args.SectionConfig.MySection.MySectionInfo.MyProcedure.ItemID, CheckOutType.Procedure, ref message))
{
message = message.Replace("\r\nWould You like to open the procedure in View Only Mode?", "");
MessageBox.Show(this, message, "Procedure Already Checked Out", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- this.Cursor = Cursors.Default;
+ Cursor = Cursors.Default;
return DialogResult.None;
}
int ownerID;
@@ -4033,152 +3826,48 @@ namespace VEPROMS
MySessionInfo.CheckInItem(ownerID);
}
}
- this.Cursor = Cursors.Default;
+ Cursor = Cursors.Default;
return dr;
}
- #endregion
- #endregion
+ #endregion
+ #endregion
- #region ColorStuff
- ///
- /// Get a System.Drawing.Color from an Argb or color name
- ///
- /// Color Name or "[(alpha,)red,green,blue]"
- ///
- private static Color cGetColor(string strColor)
- {
- // This was copied from frmFolderProperties.CS
- Color rtnColor;
- if (strColor == null || strColor.Equals(""))
- rtnColor = Color.White;
- else
- {
- if (strColor[0] == '[')
- {
- string[] parts = strColor.Substring(1, strColor.Length - 2).Split(",".ToCharArray());
- int parts_cnt = 0;
- foreach (string s in parts)
- {
- parts[parts_cnt] = parts[parts_cnt].TrimStart(' '); // remove preceeding blanks
- parts_cnt++;
- }
- if (parts_cnt == 3)
- rtnColor = Color.FromArgb(Int32.Parse(parts[0]), Int32.Parse(parts[1]), Int32.Parse(parts[2]));
- else
- rtnColor = Color.FromArgb(Int32.Parse(parts[0].Substring(2)), Int32.Parse(parts[1].Substring(2)), Int32.Parse(parts[2].Substring(2)), Int32.Parse(parts[3].Substring(2)));
- }
- else rtnColor = Color.FromName(strColor);
- }
- return rtnColor;
- }
- //private void SetupEditorColors(DisplayPanel vlnCSLAPanel1, TabPage pg)
- //{
- // // setup color
- // if (_LastFolderInfo == null)
- // {
- // // user didn't select a FolderInfo type of node.
- // // walk up the tree to find the first FolderInfo node type
- // VETreeNode tn = (VETreeNode)(tv.SelectedNode);
- // while (tn != null && tn.VEObject.GetType() != typeof(FolderInfo))
- // tn = (VETreeNode)tn.Parent;
- // _LastFolderInfo = (FolderInfo)(tn.VEObject);
- // _LastFolder = _LastFolderInfo.Get();
- // }
+ #region Progress Bar
- // if ((_LastFolderInfo.FolderConfig.Color_editbackground != null) && !(_LastFolderInfo.FolderConfig.Color_editbackground.Equals("")))
- // {
- // vlnCSLAPanel1.ActiveColor = cGetColor(_LastFolderInfo.FolderConfig.Color_editbackground);
- // }
- // if ((_LastFolderInfo.FolderConfig.Default_BkColor != null) && !(_LastFolderInfo.FolderConfig.Default_BkColor.Equals("")))
- // {
- // vlnCSLAPanel1.InactiveColor = _LastFolderInfo.FolderConfig.Default_BkColor;
- // vlnCSLAPanel1.TabColor = vlnCSLAPanel1.InactiveColor;
- // vlnCSLAPanel1.PanelColor = vlnCSLAPanel1.InactiveColor;
- // pg.BackColor = vlnCSLAPanel1.InactiveColor;
- // }
- //}
- #endregion
+ ///
+ /// Used for the status bar in the lower left corner of the main screen
+ ///
+ ///
+ ///
+ void tn_LoadingChildrenSQL(object sender, VETreeNodeEventArgs args) => ProgBarText = "Loading SQL";
- #region Table Insert Sample Code
- // TODO: for tables
- //private void btnInsTable_Click(object sender, EventArgs e)
- //{
- // Point loc = btnInsTable.DisplayRectangle.Location;
- // loc.X += 300;
- // int top = this.Top + (btnInsTable.Size.Height * 2);
- // TablePickerDlg(sender, e, loc, top);
- //}
+ ///
+ /// Used for the status bar in the lower left corner of the main screen
+ ///
+ ///
+ ///
+ void tn_LoadingChildrenValue(object sender, VETreeNodeEventArgs args) => ProgBarValue = args.Value;
- //private void TablePickerDlg(object sender, EventArgs e, Point loc, int top)
- //{
- // Accentra.Controls.TablePicker tp = new Accentra.Controls.TablePicker();
- // tp.Location = loc;
- // tp.Top += top;
- // tp.Show();
- // while (tp.Visible)
- // {
- // Application.DoEvents();
- // System.Threading.Thread.Sleep(0);
- // }
- // // This was used to display a dialog containing a table grid
- // // using a product called Source Grid - was for demo purposes only
- // //
- // //if (!tp.Cancel)
- // //{
- // // frmTable newtable = new frmTable(tp.SelectedRows, tp.SelectedColumns);
- // // newtable.Show();
- // //}
- //}
- #endregion
-
- #region Progress Bar
-
- ///
- /// Used for the status bar in the lower left corner of the main screen
- ///
- ///
- ///
- void tn_LoadingChildrenSQL(object sender, VETreeNodeEventArgs args)
- {
- ProgBarText = "Loading SQL";
- }
-
- ///
- /// Used for the status bar in the lower left corner of the main screen
- ///
- ///
- ///
- void tn_LoadingChildrenValue(object sender, VETreeNodeEventArgs args)
- {
- ProgBarValue = args.Value;
- }
-
- ///
- /// Used for the status bar in the lower left corner of the main screen
- ///
- ///
- ///
- void tn_LoadingChildrenMax(object sender, VETreeNodeEventArgs args)
+ ///
+ /// Used for the status bar in the lower left corner of the main screen
+ ///
+ ///
+ ///
+ 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...";
}
- ///
- /// Used for the status bar in the lower left corner of the main screen
- ///
- ///
- ///
- void tn_LoadingChildrenDone(object sender, VETreeNodeEventArgs args)
- {
- if (VlnSettings.DebugMode)
- ProgBarText = args.Info + " Seconds";
- else
- ProgBarText = "";
- }
+ ///
+ /// Used for the status bar in the lower left corner of the main screen
+ ///
+ ///
+ ///
+ void tn_LoadingChildrenDone(object sender, VETreeNodeEventArgs args) => ProgBarText = VlnSettings.DebugMode ? $"{args.Info} Seconds" : "";
- public int ProgBarMax
+ public int ProgBarMax
{
get { return bottomProgBar.Maximum; }
set { bottomProgBar.Maximum = value; }
@@ -4202,51 +3891,6 @@ namespace VEPROMS
#endregion
- #region Find/Replace and Search
-
- ///
- /// Find/Replace button on the ribbon
- /// Display the Find/Replace dialog
- ///
- ///
- ///
- //private void btnFindRplDlg_Click_1(object sender, EventArgs e)
- //{
- // FindReplace frmFindRepl = new FindReplace();
- // frmFindRepl.Show();
- //}
-
- ///
- /// Global Search button on the ribbon
- /// Opens the Information Pannel and selects the Results tab
- ///
- ///
- ///
- //private void btnGlbSrch_Click(object sender, EventArgs e)
- //{
- // toolsPanel.Expanded = true;
- // toolsTabs.SelectedTab = toolstabResults;
- //}
-
- #endregion
-
- #region Similar Steps
-
- ///
- /// Similar Steps button on the ribbon
- /// Opens the Information Pannel and selects the Results tab
- ///
- ///
- ///
- private void btnSimStps_Click(object sender, EventArgs e)
- {
- //infoPanel.Expanded = true;
- //infoTabs.SelectedTab = toolstabResults;
- //btnSimStpsRslt.Checked = true;
- }
-
- #endregion
-
#region Help/About
///
@@ -4261,29 +3905,23 @@ namespace VEPROMS
about.ShowDialog();
}
- ///
- /// Volian Web button on the ribbon
- /// display the Volian web site on a pop up form
- ///
- ///
- ///
- private void btnVlnWeb_Click(object sender, EventArgs e)
- {
- //VlnWeb veWWW = new VlnWeb();
- //veWWW.Show();
- System.Diagnostics.Process sdp = System.Diagnostics.Process.Start("http://www.volian.com");
- //sdp.WaitForInputIdle();
- }
+ ///
+ /// Volian Web button on the ribbon
+ /// display the Volian web site on a pop up form
+ ///
+ ///
+ ///
+ private void btnVlnWeb_Click(object sender, EventArgs e) => _ = Process.Start("http://www.volian.com");
- #endregion
+ #endregion
- #region Ribbon
- ///
- /// This Opens the treeView or opens the selected item in the TreeView
- ///
- ///
- ///
- private void btnOpen_Click(object sender, EventArgs e)
+ #region Ribbon
+ ///
+ /// This Opens the treeView or opens the selected item in the TreeView
+ ///
+ ///
+ ///
+ private void btnOpen_Click(object sender, EventArgs e)
{
if (!epProcedures.Expanded) // If panel not expanded - expand it.
{
@@ -4294,39 +3932,34 @@ namespace VEPROMS
}
else
{
- // TODO: DeleteMe
- //VETreeNode tn = (VETreeNode)(tv.SelectedNode);
tv.OpenNode();
}
}
private void btnNew_Click(object sender, EventArgs e)
{
if (!epProcedures.Expanded) return;
- VETreeNode vtn = tv.SelectedNode as VETreeNode;
- if (vtn == null) return; // nothing was selected.
- if (btnNew.SubItems.Count > 0) return; // submenu will be displayed
+ if (!(tv.SelectedNode is VETreeNode vtn)) return; // nothing was selected.
+ if (btnNew.SubItems.Count > 0) return; // submenu will be displayed
vtn.Expand();
- // Determine type of 'new' based on tree node's object type. The
- // only options here are those that would not have created, based on
- // containers, a submenu (see the office2007buttonstartbutton1_click code)
- FolderInfo fi = vtn.VEObject as FolderInfo;
- if (fi != null)
- {
- tv.tv_NodeNew(vlnTreeView.MenuSelections.Folder);
- return;
- }
+ // Determine type of 'new' based on tree node's object type. The
+ // only options here are those that would not have created, based on
+ // containers, a submenu (see the office2007buttonstartbutton1_click code)
+ if (vtn.VEObject is FolderInfo)
+ {
+ tv.tv_NodeNew(vlnTreeView.MenuSelections.Folder);
+ return;
+ }
- DocVersionInfo dvi = vtn.VEObject as DocVersionInfo;
- if (dvi != null)
- {
- tv.tv_NodeNew(vlnTreeView.MenuSelections.Procedure);
- return;
- }
+ if (vtn.VEObject is DocVersionInfo)
+ {
+ tv.tv_NodeNew(vlnTreeView.MenuSelections.Procedure);
+ return;
+ }
- // All other types are handled with sub-menus.
+ // All other types are handled with sub-menus.
- }
+ }
///
/// Options button on the dialog that appears when the V icon is clicked (top left of application window)
@@ -4336,38 +3969,36 @@ namespace VEPROMS
///
private void btnOptions_Click(object sender, EventArgs e)
{
- frmSysOptions VeSysOpts = new frmSysOptions();
- VeSysOpts.CanChangeSeparateWindowsSetting = !tc.MoreThanOneProcedureSetIsOpen;
- VeSysOpts.ShowDialog();
- StepTabRibbon.PasteNoReturnsSetting = Properties.Settings.Default.PasteNoReturns;
- StepTabRibbon.PastePlainTextSetting = Properties.Settings.Default.PastePlainText;
- StepTabRibbon.SpecifiedVisioPath = Properties.Settings.Default.VisioPath;
- tc.SyncEnhancedDocuments = Properties.Settings.Default.SyncEnhancedDocuments;
- tc.SeparateWindows = Properties.Settings.Default.SeparateWindows;
+ frmSysOptions VeSysOpts = new frmSysOptions
+ {
+ CanChangeSeparateWindowsSetting = !tc.MoreThanOneProcedureSetIsOpen
+ };
+ VeSysOpts.ShowDialog();
+ StepTabRibbon.PasteNoReturnsSetting = Settings.Default.PasteNoReturns;
+ StepTabRibbon.PastePlainTextSetting = Settings.Default.PastePlainText;
+ StepTabRibbon.SpecifiedVisioPath = Settings.Default.VisioPath;
+ tc.SyncEnhancedDocuments = Settings.Default.SyncEnhancedDocuments;
+ tc.SeparateWindows = Settings.Default.SeparateWindows;
}
- ///
- /// Exit button on the dialog that appears when the V icon is clicked (top left of application window)
- /// note that the "V icon" is also called the Office 2007 Start Button
- ///
- ///
- ///
- private void btnExit_Click(object sender, EventArgs e)
- {
- this.Close();
- }
- #endregion
+ ///
+ /// Exit button on the dialog that appears when the V icon is clicked (top left of application window)
+ /// note that the "V icon" is also called the Office 2007 Start Button
+ ///
+ ///
+ ///
+ private void btnExit_Click(object sender, EventArgs e) => Close();
+ #endregion
- #region InfoTabRO
+ #region InfoTabRO
- private void infotabRO_Click(object sender, EventArgs e)
+ private void infotabRO_Click(object sender, EventArgs e)
{
infoPanel.Expanded = true;
infoTabs.SelectedTab = infotabRO;
displayRO.ProgressBar = bottomProgBar;
- displayRO.MyRTB = (SelectedStepTabPanel == null) ? null :
- SelectedStepTabPanel.MyStepPanel.SelectedEditItem == null ? null : SelectedStepTabPanel.MyStepPanel.SelectedEditItem.MyStepRTB;
+ displayRO.MyRTB = SelectedStepTabPanel?.MyStepPanel.SelectedEditItem?.MyStepRTB;
displayRO.LoadTree(this); //B2022-026 RO Memory reduction coding (Jakes Merge)
}
@@ -4381,19 +4012,12 @@ namespace VEPROMS
if (tc == null || tc.SelectedDisplayTabItem == null) return;
if (SelectedStepTabPanel == null) return;
displayTransition.MyRTB = SelectedStepTabPanel.MyStepPanel.SelectedEditItem.MyStepRTB;
- //displayTransition.RangeColor = global::VEPROMS.Properties.Settings.Default.TransitionRangeColor;
- // RHM - The follwing line was reseting the settings on the transtion panel to "not" show the currently selected transition.
- //displayTransition.CurTrans = null;
}
- #endregion
+ #endregion
- #region InfoTabLibDocs
- private void tabItemLibDocs_Click(object sender, EventArgs e)
- {
- displayLibDocs.RefreshLibDocPanel(tc);
- //displayLibDocs.LibDocListFillIn(tc);
- }
- private void tv_SectionShouldClose(object sender, vlnTreeSectionInfoEventArgs args)
+ #region InfoTabLibDocs
+ private void tabItemLibDocs_Click(object sender, EventArgs e) => displayLibDocs.RefreshLibDocPanel(tc);
+ private void tv_SectionShouldClose(object sender, vlnTreeSectionInfoEventArgs args)
{
if (!args.MySectionInfo.IsStepSection) tc.CloseWordItem(args.MySectionInfo, args.IsDeleting);
else
@@ -4424,7 +4048,7 @@ namespace VEPROMS
{
infoPanel.Expanded = true;
infoTabs.SelectedTab = infotabTags;
- displayTags.MyEditItem = (SelectedStepTabPanel == null) ? null : SelectedStepTabPanel.MyStepPanel.SelectedEditItem;
+ displayTags.MyEditItem = SelectedStepTabPanel?.MyStepPanel.SelectedEditItem;
displayTags.Mydvi = SelectedDVI;
}
#endregion
@@ -4434,14 +4058,15 @@ namespace VEPROMS
{
infoPanel.Expanded = true;
infoTabs.SelectedTab = infotabTags;
- displayTags.MyEditItem = (SelectedStepTabPanel == null) ? null : SelectedStepTabPanel.MyStepPanel.SelectedEditItem;
+ displayTags.MyEditItem = SelectedStepTabPanel?.MyStepPanel.SelectedEditItem;
}
#endregion
#region PanelSupport
private void tc_WordSectionClose(object sender, WordSectionEventArgs args)
{
- if (!args.MySectionInfo.IsStepSection) tc.CloseWordItem(args.MySectionInfo);
+ if (!args.MySectionInfo.IsStepSection)
+ tc.CloseWordItem(args.MySectionInfo);
}
private void tc_WordSectionDeleted(object sender, WordSectionEventArgs args)
{
@@ -4461,9 +4086,8 @@ namespace VEPROMS
// require refresh of the lib doc panel.
if (toolsTabs.SelectedTab == tabItemLibDocs && args.MyItemInfo.IsSection)
{
- SectionInfo si = args.MyItemInfo as SectionInfo;
- if (si != null && (si.MyContent.MyEntry.MyDocument.LibTitle ?? "") != "") displayLibDocs.RefreshLibDocPanel(tc);
- }
+ if (args.MyItemInfo is SectionInfo si && (si.MyContent.MyEntry.MyDocument.LibTitle ?? "") != "") displayLibDocs.RefreshLibDocPanel(tc);
+ }
displayHistory.RefreshChangeList();
}
private void tc_PanelTabDisplay(object sender, StepPanelTabDisplayEventArgs args)
@@ -4495,7 +4119,6 @@ namespace VEPROMS
{
infoPanel.Expanded = true;
infoTabs.SelectedTab = infotabTags;
- displayTags.HighlightChangeStep();
}
else if (args.PanelTabName == "Change Image Size")
{
@@ -4616,8 +4239,8 @@ namespace VEPROMS
// also change the text on the buttons to read either Find or Find/Replace
// also toggle the Replace tab on the dialog based on the user's accessibility to the procedure
bool isReviewer = !MyUserInfo.IsAllowedToEdit(tc.SelectedDisplayTabItem.MyItemInfo.MyDocVersion);
- pnl.MyStepTabPanel.MyStepTabRibbon.SetButtonAndMenuEnabling(true);
- this.dlgFindReplace.ToggleReplaceTab(isReviewer ? E_ViewMode.View : E_ViewMode.Edit);
+ pnl.MyStepTabPanel.MyStepTabRibbon.SetButtonAndMenuEnabling();
+ dlgFindReplace.ToggleReplaceTab(isReviewer ? E_ViewMode.View : E_ViewMode.Edit);
pnl.MyStepTabPanel.MyStepTabRibbon.ToggleFindReplaceToolTip(isReviewer);
}
}
@@ -4625,8 +4248,8 @@ namespace VEPROMS
private void tc_StepPanelModeChange(object sender, StepRTBModeChangeEventArgs args)
{
- this.lblEditView.Text = args.ViewMode == E_ViewMode.Edit ? "Edit" : "View";
- this.dlgFindReplace.ToggleReplaceTab(args.ViewMode);
+ lblEditView.Text = args.ViewMode == E_ViewMode.Edit ? "Edit" : "View";
+ dlgFindReplace.ToggleReplaceTab(args.ViewMode);
// C2021-021 change the tool tip for the Find and Find/Replace button based on the user's accessibility to the procedure.
// also change the text on the buttons to read either Find or Find/Replace
// B2021-044 Added a null reference check. Happend when nothing is opened but a search for Incoming Transitions was done
@@ -4637,26 +4260,6 @@ namespace VEPROMS
private ItemInfo _CurrentItem = null;
private StepRTB _LastStepRTB = null;
- //private Timer _TmrRefreshItem = null;
- //public Timer TmrRefreshItem
- //{
- // get
- // {
- // if (_TmrRefreshItem == null)
- // {
- // _TmrRefreshItem = new Timer();
- // _TmrRefreshItem.Interval = 1000; // one second
- // _TmrRefreshItem.Tick += _TmrRefreshItem_Tick;
- // }
- // return _TmrRefreshItem;
- // }
- //}
- //private StepRTB _RefreshRTB = null;
- //void _TmrRefreshItem_Tick(object sender, EventArgs e)
- //{
- // _TmrRefreshItem.Enabled = false;
- // if (_RefreshRTB != null) _RefreshRTB.Focus();
- //}
private void tc_ItemSelectedChanged(object sender, ItemSelectedChangedEventArgs args)
{
@@ -4695,12 +4298,11 @@ namespace VEPROMS
}
else
{
- lblItemID.Text = string.Format("ItemID = {0}", args.MyItemInfo.ItemID);
+ lblItemID.Text = $"ItemID = {args.MyItemInfo.ItemID}";
lblItemID.ForeColor = Color.DarkBlue;
if (_CurrentItem != args.MyItemInfo)
{
- if (_CurrentItem != null) _CurrentItem.Deleted -= new ItemInfoEvent(_CurrentItem_Deleted);
_CurrentItem = args.MyItemInfo;
}
@@ -4814,8 +4416,6 @@ namespace VEPROMS
displayHistory.MyEditItem = args.MyEditItem;
lblEditView.Text = args.MyEditItem.MyStepPanel.VwMode == E_ViewMode.Edit ? "Edit" : "View";
- _CurrentItem.Deleted -= new ItemInfoEvent(_CurrentItem_Deleted);
- _CurrentItem.Deleted += new ItemInfoEvent(_CurrentItem_Deleted);
dlgFindReplace.MyEditItem = args.MyEditItem;
SpellChecker.MyEditItem = args.MyEditItem;
}
@@ -4913,16 +4513,11 @@ namespace VEPROMS
displayRO.Enabled = displayTransition.Enabled = _LastStepRTB.EditMode;
else // going out of edit mode in a cell of the grid.
{
- if (this.ActiveControl != tc || (!_LastStepRTB.Parent.Focused && (infotabRO.IsSelected || infotabTransition.IsSelected))) return;
+ if (ActiveControl != tc || (!_LastStepRTB.Parent.Focused && (infotabRO.IsSelected || infotabTransition.IsSelected))) return;
displayRO.Enabled = displayTransition.Enabled = _LastStepRTB.EditMode;
}
}
- void _CurrentItem_Deleted(object sender)
- {
- //displayBookMarks.DeleteItemBookMarkPanel(_CurrentItem);
- }
-
#endregion
#region Annotations
@@ -4967,7 +4562,6 @@ namespace VEPROMS
infoPanel.Expanded = true;
infoTabs.SelectedTab = infotabTransition;
if (SelectedStepTabPanel == null) return;
- //displayTransition.RangeColor = global::VEPROMS.Properties.Settings.Default.TransitionRangeColor;
displayTransition.MyRTB = SelectedStepTabPanel.MyStepPanel.SelectedEditItem.MyStepRTB;
displayTransition.CurTrans = args.MyLinkText.MyTransitionInfo;
}
@@ -5014,220 +4608,168 @@ namespace VEPROMS
if (!tv.Focused && tc.SelectedDisplayTabItem != null && tc.SelectedDisplayTabItem.SelectedItemInfo != null)
tv.AdjustTree(tc.SelectedDisplayTabItem.SelectedItemInfo);
- VETreeNode vtn = tv.SelectedNode as VETreeNode;
- if (vtn == null) return;
- StepInfo stpinf = vtn.VEObject as StepInfo;
- if (stpinf == null || !stpinf.IsRNOPart) //B2017-037 is this a RNO step type element - don't allow insert before/after
- btnNew.Enabled = true;
- vtn.Expand();
+ if (!(tv.SelectedNode is VETreeNode vtn)) return;
+ if (!(vtn.VEObject is StepInfo stpinf) || !stpinf.IsRNOPart) //B2017-037 is this a RNO step type element - don't allow insert before/after
+ btnNew.Enabled = true;
+ vtn.Expand();
- // Folders can have either folders & docversions, but
- // not a mix.
- FolderInfo fi = vtn.VEObject as FolderInfo;
- if (fi != null)
- {
- // Enable/disable the New button based on the user's security settings at the current folder level
- // B2015-193
- btnNew.Enabled = UserInfo.CanCreateFolders(MyUserInfo, fi);
+ // Folders can have either folders & docversions, but
+ // not a mix.
+ if (vtn.VEObject is FolderInfo fi)
+ {
+ // Enable/disable the New button based on the user's security settings at the current folder level
+ // B2015-193
+ btnNew.Enabled = UserInfo.CanCreateFolders(MyUserInfo, fi);
- // if at top, 'VEPROMS', folder and childfolders below this only
- // option is to create a new (sub)folder, i.e. no submenu items.
- if (fi.ChildFolderCount > 0 && fi.MyParent == null) return;
+ // if at top, 'VEPROMS', folder and childfolders below this only
+ // option is to create a new (sub)folder, i.e. no submenu items.
+ if (fi.ChildFolderCount > 0 && fi.MyParent == null) return;
- // submenu folders/docversion
- if (fi.MyParent != null && UserInfo.CanCreateFolders(MyUserInfo, fi))
- {
- ButtonItem fldbbtn = new ButtonItem("fldbtn", "Folder Before");
- ButtonItem fldabtn = new ButtonItem("fldabtn", "Folder After");
- btnNew.SubItems.Add(fldbbtn);
- btnNew.SubItems.Add(fldabtn);
- fldbbtn.Click += new EventHandler(fldbbtn_Click);
- fldabtn.Click += new EventHandler(fldabtn_Click);
- }
- ButtonItem fldbtn = new ButtonItem("fldbtn", "Folder");
- btnNew.SubItems.Add(fldbtn);
- fldbtn.Click += new EventHandler(fldbtn_Click);
+ // submenu folders/docversion
+ if (fi.MyParent != null && UserInfo.CanCreateFolders(MyUserInfo, fi))
+ {
+ ButtonItem fldbbtn = new ButtonItem("fldbtn", "Folder Before");
+ ButtonItem fldabtn = new ButtonItem("fldabtn", "Folder After");
+ btnNew.SubItems.Add(fldbbtn);
+ btnNew.SubItems.Add(fldabtn);
+ fldbbtn.Click += new EventHandler(fldbbtn_Click);
+ fldabtn.Click += new EventHandler(fldabtn_Click);
+ }
+ ButtonItem fldbtn = new ButtonItem("fldbtn", "Folder");
+ btnNew.SubItems.Add(fldbtn);
+ fldbtn.Click += new EventHandler(fldbtn_Click);
- // offer adding a Working Draft only if the folder has no sub-folders and there is not already a Working Draft node
- if (fi.ChildFolderCount == 0 && fi.FolderDocVersionCount == 0)
- {
- ButtonItem dvbtn = new ButtonItem("dvbtn", "Working Draft");
- btnNew.SubItems.Add(dvbtn);
- dvbtn.Click += new EventHandler(dvbtn_Click);
- }
- return;
- }
+ // offer adding a Working Draft only if the folder has no sub-folders and there is not already a Working Draft node
+ if (fi.ChildFolderCount == 0 && fi.FolderDocVersionCount == 0)
+ {
+ ButtonItem dvbtn = new ButtonItem("dvbtn", "Working Draft");
+ btnNew.SubItems.Add(dvbtn);
+ dvbtn.Click += new EventHandler(dvbtn_Click);
+ }
+ return;
+ }
- // DocVersions can only have procedures, so no sub-menu
- DocVersionInfo dvi = vtn.VEObject as DocVersionInfo;
- if (dvi != null)
- {
- if (!UserInfo.CanEdit(MyUserInfo, dvi))
- btnNew.Enabled = false; // reviewers cannot create a new procedure B2015-193
- return;
- }
+ // DocVersions can only have procedures, so no sub-menu
+ if (vtn.VEObject is DocVersionInfo dvi)
+ {
+ if (!UserInfo.CanEdit(MyUserInfo, dvi))
+ btnNew.Enabled = false; // reviewers cannot create a new procedure B2015-193
+ return;
+ }
- // Procedures can have a section added or a new procedure before
- // or after.
- ProcedureInfo pi = vtn.VEObject as ProcedureInfo;
- if (pi != null)
- {
- // if user is a reviewer then don't allow adding new procedures
- // bug B2015-193
- if (!UserInfo.CanEdit(MyUserInfo, pi.MyDocVersion))
- {
- btnNew.Enabled = false;
- return;
- }
- ButtonItem pbbtn = new ButtonItem("pfbtn", "Procedure Before");
- ButtonItem pabtn = new ButtonItem("pabtn", "Procedure After");
- ButtonItem sctbtn = new ButtonItem("sctbtn", "Section");
- btnNew.SubItems.Add(pbbtn);
- btnNew.SubItems.Add(pabtn);
- btnNew.SubItems.Add(sctbtn);
- pbbtn.Click += new EventHandler(pbbtn_Click);
- pabtn.Click += new EventHandler(pabtn_Click);
- sctbtn.Click += new EventHandler(sctbtn_Click);
- return;
- }
+ // Procedures can have a section added or a new procedure before
+ // or after.
+ if (vtn.VEObject is ProcedureInfo pi)
+ {
+ // if user is a reviewer then don't allow adding new procedures
+ // bug B2015-193
+ if (!UserInfo.CanEdit(MyUserInfo, pi.MyDocVersion))
+ {
+ btnNew.Enabled = false;
+ return;
+ }
+ ButtonItem pbbtn = new ButtonItem("pfbtn", "Procedure Before");
+ ButtonItem pabtn = new ButtonItem("pabtn", "Procedure After");
+ ButtonItem sctbtn = new ButtonItem("sctbtn", "Section");
+ btnNew.SubItems.Add(pbbtn);
+ btnNew.SubItems.Add(pabtn);
+ btnNew.SubItems.Add(sctbtn);
+ pbbtn.Click += new EventHandler(pbbtn_Click);
+ pabtn.Click += new EventHandler(pabtn_Click);
+ sctbtn.Click += new EventHandler(sctbtn_Click);
+ return;
+ }
- // Sections can have sections before, after, new subsections & if is
- // a step section, can have steps
- SectionInfo si = vtn.VEObject as SectionInfo;
- if (si != null)
- {
- // if user is a reviewer then don't allow adding new sections
- // bug B2015-193
- if (!UserInfo.CanEdit(MyUserInfo, si.MyDocVersion))
- {
- btnNew.Enabled = false;
- return;
- }
- ButtonItem sbbtn = new ButtonItem("sbbtn", "Section Before");
- ButtonItem sabtn = new ButtonItem("sabtn", "Section After");
+ // Sections can have sections before, after, new subsections & if is
+ // a step section, can have steps
+ if (vtn.VEObject is SectionInfo si)
+ {
+ // if user is a reviewer then don't allow adding new sections
+ // bug B2015-193
+ if (!UserInfo.CanEdit(MyUserInfo, si.MyDocVersion))
+ {
+ btnNew.Enabled = false;
+ return;
+ }
+ ButtonItem sbbtn = new ButtonItem("sbbtn", "Section Before");
+ ButtonItem sabtn = new ButtonItem("sabtn", "Section After");
- btnNew.SubItems.Add(sbbtn);
- btnNew.SubItems.Add(sabtn);
- sbbtn.Click += new EventHandler(sbbtn_Click);
- sabtn.Click += new EventHandler(sabtn_Click);
+ btnNew.SubItems.Add(sbbtn);
+ btnNew.SubItems.Add(sabtn);
+ sbbtn.Click += new EventHandler(sbbtn_Click);
+ sabtn.Click += new EventHandler(sabtn_Click);
- if (si.IsStepSection)
- {
- // B2016-282: Don't allow insert of subsections off Word Section.
- if (si.ActiveFormat.PlantFormat.FormatData.SectData.UseMetaSections)
- {
- ButtonItem subbtn = new ButtonItem("subbtn", "SubSection");
- btnNew.SubItems.Add(subbtn);
- subbtn.Click += new EventHandler(subbtn_Click);
- }
- ButtonItem stpbtn = new ButtonItem("stpbtn", "New Step");
- btnNew.SubItems.Add(stpbtn);
- stpbtn.Click += new EventHandler(stpbtn_Click);
- }
- return;
- }
+ if (si.IsStepSection)
+ {
+ // B2016-282: Don't allow insert of subsections off Word Section.
+ if (si.ActiveFormat.PlantFormat.FormatData.SectData.UseMetaSections)
+ {
+ ButtonItem subbtn = new ButtonItem("subbtn", "SubSection");
+ btnNew.SubItems.Add(subbtn);
+ subbtn.Click += new EventHandler(subbtn_Click);
+ }
+ ButtonItem stpbtn = new ButtonItem("stpbtn", "New Step");
+ btnNew.SubItems.Add(stpbtn);
+ stpbtn.Click += new EventHandler(stpbtn_Click);
+ }
+ return;
+ }
- // Steps can have steps before or after only.
- StepInfo stpi = vtn.VEObject as StepInfo;
- if (stpi != null)
- {
- // if user is a reviewer then don't allow adding new procedures, sections, or steps
- // bug B2015-193
- if (!UserInfo.CanEdit(MyUserInfo, stpi.MyDocVersion))
- {
- btnNew.Enabled = false;
- return;
- }
- ButtonItem stpbbtn = new ButtonItem("stpbbtn", "New Step Before");
- ButtonItem stpabtn = new ButtonItem("stpabtn", "New Step After");
- btnNew.SubItems.Add(stpbbtn);
- btnNew.SubItems.Add(stpabtn);
- stpbbtn.Click += new EventHandler(stpbbtn_Click);
- stpabtn.Click += new EventHandler(stpabtn_Click);
- return;
- }
- btnNew.Enabled = false; // should not get this far, but just in case turn off the New button
+ // Steps can have steps before or after only.
+ if (vtn.VEObject is StepInfo stpi)
+ {
+ // if user is a reviewer then don't allow adding new procedures, sections, or steps
+ // bug B2015-193
+ if (!UserInfo.CanEdit(MyUserInfo, stpi.MyDocVersion))
+ {
+ btnNew.Enabled = false;
+ return;
+ }
+ ButtonItem stpbbtn = new ButtonItem("stpbbtn", "New Step Before");
+ ButtonItem stpabtn = new ButtonItem("stpabtn", "New Step After");
+ btnNew.SubItems.Add(stpbbtn);
+ btnNew.SubItems.Add(stpabtn);
+ stpbbtn.Click += new EventHandler(stpbbtn_Click);
+ stpabtn.Click += new EventHandler(stpabtn_Click);
+ return;
+ }
+ btnNew.Enabled = false; // should not get this far, but just in case turn off the New button
}
- void fldabtn_Click(object sender, EventArgs e)
- {
- tv.tv_NodeNew(vlnTreeView.MenuSelections.FolderAfter);
- }
+ void fldabtn_Click(object sender, EventArgs e) => tv.tv_NodeNew(vlnTreeView.MenuSelections.FolderAfter);
- void fldbbtn_Click(object sender, EventArgs e)
- {
- tv.tv_NodeNew(vlnTreeView.MenuSelections.FolderBefore);
- }
+ void fldbbtn_Click(object sender, EventArgs e) => tv.tv_NodeNew(vlnTreeView.MenuSelections.FolderBefore);
- void stpabtn_Click(object sender, EventArgs e)
- {
- tv.tv_NodeNew(vlnTreeView.MenuSelections.StepAfter);
- }
+ void stpabtn_Click(object sender, EventArgs e) => tv.tv_NodeNew(vlnTreeView.MenuSelections.StepAfter);
- void stpbbtn_Click(object sender, EventArgs e)
- {
- tv.tv_NodeNew(vlnTreeView.MenuSelections.StepBefore);
- }
+ void stpbbtn_Click(object sender, EventArgs e) => tv.tv_NodeNew(vlnTreeView.MenuSelections.StepBefore);
- void subbtn_Click(object sender, EventArgs e)
- {
- tv.tv_NodeNew(vlnTreeView.MenuSelections.Section);
- }
+ void subbtn_Click(object sender, EventArgs e) => tv.tv_NodeNew(vlnTreeView.MenuSelections.Section);
- void sabtn_Click(object sender, EventArgs e)
- {
- tv.tv_NodeNew(vlnTreeView.MenuSelections.SectionAfter);
- }
+ void sabtn_Click(object sender, EventArgs e) => tv.tv_NodeNew(vlnTreeView.MenuSelections.SectionAfter);
- void sbbtn_Click(object sender, EventArgs e)
- {
- tv.tv_NodeNew(vlnTreeView.MenuSelections.SectionBefore);
- }
+ void sbbtn_Click(object sender, EventArgs e) => tv.tv_NodeNew(vlnTreeView.MenuSelections.SectionBefore);
- void stpbtn_Click(object sender, EventArgs e)
- {
- tv.tv_NodeNew(vlnTreeView.MenuSelections.Step);
- }
+ void stpbtn_Click(object sender, EventArgs e) => tv.tv_NodeNew(vlnTreeView.MenuSelections.Step);
- void sctbtn_Click(object sender, EventArgs e)
- {
- tv.tv_NodeNew(vlnTreeView.MenuSelections.Section);
- }
+ void sctbtn_Click(object sender, EventArgs e) => tv.tv_NodeNew(vlnTreeView.MenuSelections.Section);
- void pabtn_Click(object sender, EventArgs e)
- {
- tv.tv_NodeNew(vlnTreeView.MenuSelections.ProcedureAfter);
- }
+ void pabtn_Click(object sender, EventArgs e) => tv.tv_NodeNew(vlnTreeView.MenuSelections.ProcedureAfter);
- void pbbtn_Click(object sender, EventArgs e)
- {
- tv.tv_NodeNew(vlnTreeView.MenuSelections.ProcedureBefore);
- }
+ void pbbtn_Click(object sender, EventArgs e) => tv.tv_NodeNew(vlnTreeView.MenuSelections.ProcedureBefore);
- void dvbtn_Click(object sender, EventArgs e)
- {
- tv.tv_NodeNew(vlnTreeView.MenuSelections.DocVersion);
- }
+ void dvbtn_Click(object sender, EventArgs e) => tv.tv_NodeNew(vlnTreeView.MenuSelections.DocVersion);
+
+ void fldbtn_Click(object sender, EventArgs e) => tv.tv_NodeNew(vlnTreeView.MenuSelections.Folder);
- void fldbtn_Click(object sender, EventArgs e)
- {
- tv.tv_NodeNew(vlnTreeView.MenuSelections.Folder);
- }
- private void btnSave_Click(object sender, EventArgs e)
- {
- }
#endregion
#region PanelEvents
private void infoPanel_Click(object sender, EventArgs e)
{
- displayTags.MyEditItem = (SelectedStepTabPanel == null) ? null : SelectedStepTabPanel.MyStepPanel.SelectedEditItem;
+ displayTags.MyEditItem = SelectedStepTabPanel?.MyStepPanel.SelectedEditItem;
displayTags.Mydvi = SelectedDVI;
}
- //private void tv_SectionShouldClose(object sender, vlnTreeSectionInfoEventArgs args)
- //{
- // if (!args.MySectionInfo.IsStepSection) tc.CloseWordItem(args.MySectionInfo);
- //}
private void infotabResults_Click(object sender, EventArgs e)
{
@@ -5238,7 +4780,7 @@ namespace VEPROMS
{
if (toolsPanel.Expanded)
{
- if (displaySearch1.Mydocversion == null)//!displaySearch1.OpenDocFromSearch)
+ if (displaySearch1.Mydocversion == null)
{
if (SelectedDVI != null)
{
@@ -5253,17 +4795,17 @@ namespace VEPROMS
private void toosTabReports_Click(object sender, EventArgs e)
{
toolsPanel.Expanded = true;
- InitiateDisplayReports(true);
+ InitiateDisplayReports();
}
- private void InitiateDisplayReports(bool reportFocus)
+ private void InitiateDisplayReports()
{
if (toolsPanel.Expanded)
{
if (SelectedDVI != null)
displayReports.Mydocversion = SelectedDVI;
- displayReports.advTreeProcSetsFillIn(reportFocus);
- displayReports.advTreeROFillIn(reportFocus);
+ displayReports.advTreeProcSetsFillIn();
+ displayReports.advTreeROFillIn();
displayReports.SelectReferencedObjectTab(); // to enable RO selection
}
}
@@ -5300,7 +4842,7 @@ namespace VEPROMS
myfolder = myfolder.MyParent;
}
Clipboard.Clear();
- DataObject mydo = new DataObject(DataFormats.Text, string.Format("{0} - {1}", fPath, myitem.ShortPath));
+ DataObject mydo = new DataObject(DataFormats.Text, $"{fPath} - {myitem.ShortPath}");
Clipboard.SetDataObject(mydo);
}
}
@@ -5338,19 +4880,16 @@ namespace VEPROMS
}
}
- private void expandPanelExpandedChanging(object sender, ExpandedChangeEventArgs e)
- {
- _panelExpandedChanging = true;
- }
+ private void expandPanelExpandedChanging(object sender, ExpandedChangeEventArgs e) => _panelExpandedChanging = true;
- private void toolsPanel_ExpandedChanged(object sender, ExpandedChangeEventArgs e)
+ private void toolsPanel_ExpandedChanged(object sender, ExpandedChangeEventArgs e)
{
_panelExpandedChanging = false;
expandableSplitter4.Enabled = toolsPanel.Expanded;
if (toolsPanel.Expanded)
{
InitiateSearch(true);
- InitiateDisplayReports(true);
+ InitiateDisplayReports();
}
}
@@ -5384,35 +4923,27 @@ namespace VEPROMS
scListdlg.Show();
}
- private void cmbFont_SelectedIndexChanged(object sender, EventArgs e)
+ private void cmbFont_SelectedIndexChanged(object sender, EventArgs e) => StepRTB.MyFontFamily = cmbFont.SelectedValue as FontFamily;
+
+ private void lblResolution_Click(object sender, EventArgs e)
{
- StepRTB.MyFontFamily = cmbFont.SelectedValue as FontFamily;
- }
-
-
-
- private void lblResolution_Click(object sender, EventArgs e)
- {
- if (this.WindowState != FormWindowState.Normal)
+ if (WindowState != FormWindowState.Normal)
{
- this.WindowState = FormWindowState.Normal;
+ WindowState = FormWindowState.Normal;
}
- else if (this.Size.Width != 1280)
+ else if (Size.Width != 1280)
{
- this.Size = new Size(1280, 800);
+ Size = new Size(1280, 800);
}
else
{
- this.Size = new Size(1024, 768);
+ Size = new Size(1024, 768);
}
}
- private void frmVEPROMS_Resize(object sender, EventArgs e)
- {
- lblResolution.Text = string.Format("Resolution {0} x {1}", Size.Width, Size.Height);
- }
+ private void frmVEPROMS_Resize(object sender, EventArgs e) => lblResolution.Text = $"Resolution {Size.Width} x {Size.Height}";
- private void office2007StartButton1_MouseDown(object sender, MouseEventArgs e)
+ private void office2007StartButton1_MouseDown(object sender, MouseEventArgs e)
{
// Refresh the MostRecentlyUsedList
_MyMRIList.Refresh();
@@ -5443,7 +4974,7 @@ namespace VEPROMS
{
if (mypath == null)
{
- string fmtPath = Properties.Settings.Default.FormatPath ?? "";
+ string fmtPath = Settings.Default.FormatPath ?? "";
DirectoryInfo di = null;
do
@@ -5460,8 +4991,8 @@ namespace VEPROMS
fmtPath = di.FullName;
} while (((fmtPath ?? "") == "") || (!di.Exists || !Directory.Exists(di.FullName + @"\fmtall") || !Directory.Exists(di.FullName + @"\genmacall")));
- Properties.Settings.Default.FormatPath = fbd.SelectedPath;
- Properties.Settings.Default.Save();
+ Settings.Default.FormatPath = fbd.SelectedPath;
+ Settings.Default.Save();
mypath = di.FullName;
}
@@ -5473,7 +5004,7 @@ namespace VEPROMS
Format.UpdateFormats(fmtPathAll, genmacPathAll);
Format.FormatLoaded -= new FormatEvent(Format_FormatLoaded);
- _MyLog.WarnFormat("Formats in {0} updated to {1}", Database.SelectedDatabase, fmtPathAll);
+ _MyLog.WarnFormat($"Formats in {Database.SelectedDatabase} updated to {fmtPathAll}");
}
void Format_FormatLoaded(object sender, FormatEventArgs args)
@@ -5506,14 +5037,14 @@ namespace VEPROMS
{
try
{
- frmSendErrorLog frm = new frmSendErrorLog(Properties.Settings.Default.OutlookEmail, Properties.Settings.Default["SMTPServer"].ToString(), Properties.Settings.Default["SMTPUser"].ToString(), ErrorLogFileName);
+ frmSendErrorLog frm = new frmSendErrorLog(Settings.Default.OutlookEmail, Settings.Default["SMTPServer"].ToString(), Settings.Default["SMTPUser"].ToString(), ErrorLogFileName);
if (frm.ShowDialog(this) == DialogResult.OK)
{
- Properties.Settings.Default.OutlookEmail = frm.OutlookEmail;
- Properties.Settings.Default.SMTPServer = frm.SMTPServer;
- Properties.Settings.Default.SMTPUser = frm.SMTPUser;
- Properties.Settings.Default.Save();
+ Settings.Default.OutlookEmail = frm.OutlookEmail;
+ Settings.Default.SMTPServer = frm.SMTPServer;
+ Settings.Default.SMTPUser = frm.SMTPUser;
+ Settings.Default.Save();
MessageBox.Show("PROMS Error Log successfully sent to Volian support");
}
@@ -5528,7 +5059,7 @@ namespace VEPROMS
private void btnShowErrFld_Click(object sender, EventArgs e)
{
string path = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile);
- path = path + @"\Documents\VEPROMS";
+ path += @"\Documents\VEPROMS";
if (Directory.Exists(path))
{
Process.Start("explorer.exe", path);
@@ -5538,7 +5069,7 @@ namespace VEPROMS
private void btnShowPrtFld_Click(object sender, EventArgs e)
{
string path = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile);
- path = path + @"\AppData\Local\Temp\VEPROMS";
+ path += @"\AppData\Local\Temp\VEPROMS";
if (Directory.Exists(path))
{
Process.Start("explorer.exe", path);
@@ -5550,25 +5081,25 @@ namespace VEPROMS
// C2019-024 Display the PROMS User Manual when user click on the option in the Help drop down menu
// PROMS looks for "PROMSmanual.pdf" in the executable folder. If not found, a message box will display.
- string promsUserManual = System.Windows.Forms.Application.StartupPath + @"\PROMSManual.pdf";
+ string promsUserManual = Application.StartupPath + @"\PROMSManual.pdf";
try
{
if (File.Exists(promsUserManual))
{
- System.Diagnostics.Process sdp = System.Diagnostics.Process.Start(promsUserManual);
+ System.Diagnostics.Process sdp = Process.Start(promsUserManual);
sdp.WaitForInputIdle();
}
else
{
MessageBox.Show("The PROMS User Manual is not available for viewing.\nDetails are in the error log.", "View User Manual");
- _MyLog.WarnFormat("PROMS User Manual not found: {0}", promsUserManual);
+ _MyLog.WarnFormat($"PROMS User Manual not found: {promsUserManual}");
}
}
catch (Exception ex)
{
MessageBox.Show("Could not open the PROMS User Manual.\nDetails are in the error log.", "View User Manual");
- string str = string.Format("Could not open {0}", promsUserManual);
+ string str = $"Could not open {promsUserManual}";
_MyLog.Error(str, ex);
}
}
@@ -5582,8 +5113,8 @@ namespace VEPROMS
{
lock (this)
{
- if (!this.Contains(dti))
- this.Push(dti);
+ if (!Contains(dti))
+ Push(dti);
}
}
@@ -5591,7 +5122,7 @@ namespace VEPROMS
{
lock (this)
{
- return this.Pop();
+ return Pop();
}
}
@@ -5601,7 +5132,7 @@ namespace VEPROMS
{
lock (this)
{
- return this.Count;
+ return Count;
}
}
}
@@ -5611,21 +5142,10 @@ namespace VEPROMS
public class VersionWindow
{
- private int _VersionID;
- public int VersionID
- {
- get { return _VersionID; }
- set { _VersionID = value; }
- }
+ public int VersionID { get; set; }
+ public int DBId { get; set; }
- private int _DBId;
- public int DBId
- {
- get { return _DBId; }
- set { _DBId = value; }
- }
-
- private Rectangle _MyRectangle;
+ private Rectangle _MyRectangle;
public Rectangle MyRectangle
{
get { return _MyRectangle; }
@@ -5635,17 +5155,13 @@ namespace VEPROMS
public VersionWindow(string str)
{
string[] parts = str.Split('~');
- _VersionID = int.Parse(parts[0]);
+ VersionID = int.Parse(parts[0]);
RectangleConverter rc = new RectangleConverter();
_MyRectangle = (Rectangle)rc.ConvertFromString(parts[1]);
}
- public override string ToString()
- {
- RectangleConverter rc = new RectangleConverter();
- return string.Format("{0}~{1}", _VersionID, rc.ConvertToString(_MyRectangle));
- }
- }
+ public override string ToString() => $"{VersionID}~{new RectangleConverter().ConvertToString(_MyRectangle)}";
+ }
public class VersionWindowList : List
{
@@ -5684,7 +5200,7 @@ namespace VEPROMS
{
if (vw.VersionID == versionWindow.VersionID)
{
- this.Remove(vw);
+ Remove(vw);
break;
}
}
diff --git a/PROMS/VEPROMS User Interface/frmVersionsProperties.cs b/PROMS/VEPROMS User Interface/frmVersionsProperties.cs
index 3f8617e9..605ae912 100644
--- a/PROMS/VEPROMS User Interface/frmVersionsProperties.cs
+++ b/PROMS/VEPROMS User Interface/frmVersionsProperties.cs
@@ -1,9 +1,6 @@
using System;
using System.Collections.Generic;
-using System.ComponentModel;
-using System.Data;
using System.Drawing;
-using System.Text;
using System.Windows.Forms;
using System.IO;
using VEPROMS.CSLA.Library;
@@ -28,45 +25,36 @@ namespace VEPROMS
private List _Apples;
private List _DeletedApples;
private List _Enhanced;
- private DocVersionConfig _DocVersionConfig;
- private string _OrgPDFPath; // B2024-030 used to save last PDF path
+ private readonly DocVersionConfig _DocVersionConfig;
+ private readonly string _OrgPDFPath; // B2024-030 used to save last PDF path
// Default values
private string _DefaultFormatName = null;
- private string _DefaultROPrefix = null;
- private string _DefaultImagePrefix = null;
private string _DefaultWatermark = null;
private string _DefaultChgBarType = null;
private string _DefaultChgBarLoc = null;
private string _DefaultChgBarText = null;
private string _DefaultChgBarUsrMsg1 = null;
private string _DefaultChgBarUsrMsg2 = null;
- private bool _DefaultDisableDuplex = false;
- private DisplaySearch _DisplaySearch1 = null;
-
- private bool _Initializing = false;
+ private bool _Initializing = false;
private System.IO.StreamWriter swROUpdate;
- private ProgressBarItem _ProgressBar = null;
- private RODbInfo _CurRoDbInfo = null;
+ private RODbInfo _CurRoDbInfo = null;
private ROFstInfo _SelectedROFst;
- private List NewEnhVersions = new List();
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE0044:Add readonly modifier", Justification = "Keeping Collections Not ReadOnly")]
+ private List NewEnhVersions = new List();
private bool doingNew = false;
private bool _EnhNeedToUnlink = false;
private int _InitialIndex = -2; // added as part of code change C2017-004. this also makes it consistent with section properties
private int? _cmbxformatOriginal = null;
- #endregion
+ #endregion
- #region Properties
-
- public DisplaySearch DisplaySearch1
- {
- get { return _DisplaySearch1; }
- set { _DisplaySearch1 = value; }
- }
+ #region Properties
- // For the initial release, we are assuming there will be only one rofst for a docversion. Changes will be needed here if more than 1.
- public ROFstInfo SelectedROFst
+ public DisplaySearch DisplaySearch1 { get; set; } = null;
+
+ // For the initial release, we are assuming there will be only one rofst for a docversion. Changes will be needed here if more than 1.
+ public ROFstInfo SelectedROFst
{
get
{
@@ -81,17 +69,13 @@ namespace VEPROMS
set { _SelectedROFst = value; }
}
- public ProgressBarItem ProgressBar
- {
- get { return _ProgressBar; }
- set { _ProgressBar = value; }
- }
+ public ProgressBarItem ProgressBar { get; set; } = null;
- #endregion
+ #endregion
- #region Constructors
+ #region Constructors
- public frmVersionsProperties(DocVersionConfig docVersionConfig)
+ public frmVersionsProperties(DocVersionConfig docVersionConfig)
{
_DocVersionConfig = docVersionConfig;
docVersionConfig.RefreshMyEnhancedDocuments();
@@ -103,7 +87,7 @@ namespace VEPROMS
_Initializing = false;
//build the caption
- this.Text = string.Format("{0} Properties", _DocVersionConfig.Name);
+ Text = string.Format("{0} Properties", _DocVersionConfig.Name);
}
#endregion
@@ -147,9 +131,11 @@ namespace VEPROMS
srchtxt = myGrid.GetSearchableText();
}
- List retlist = new List();
- retlist.Add(srchtxt);
- retlist.Add(xml);
+ List retlist = new List
+ {
+ srchtxt,
+ xml
+ };
return retlist;
}
@@ -164,7 +150,6 @@ namespace VEPROMS
docVersionConfigBindingSource.DataSource = _DocVersionConfig;
- //formatInfoListBindingSource.DataSource = FormatInfoList.Get();
imageCodecInfoBindingSource.DataSource = ImageCodecInfo.GetImageDecoders();
ppCmbxFormat.DataSource = null;
@@ -185,7 +170,7 @@ namespace VEPROMS
// Get the saved settings for this user
// Get setting telling us whether to display the default values on this property page
- ppCbShwDefSettings.Checked = (Settings.Default["ShowDefaultVersionProp"] != null) ? Settings.Default.ShowDefaultVersionProp : false;
+ ppCbShwDefSettings.Checked = (Settings.Default["ShowDefaultVersionProp"] != null) && Settings.Default.ShowDefaultVersionProp;
// Get the User's property page style "PropPageStyle" (this is a system wide user setting)
// 1 - Button Dialog (default)
@@ -194,7 +179,7 @@ namespace VEPROMS
{
tcVersions.TabsVisible = true;
panVerBtns.Visible = false;
- this.Width -= panVerBtns.Width;
+ Width -= panVerBtns.Width;
}
// Get the default values for the property page information
@@ -298,12 +283,14 @@ namespace VEPROMS
}
else
{
- Button btnPC = new Button();
- btnPC.Text = "Add Applicability to Working Draft";
- btnPC.Width = 250;
- btnPC.Location = new Point(25, 271);
- btnPC.Parent = tcpGeneral;
- btnPC.Click += new EventHandler(btnPC_Click);
+ Button btnPC = new Button
+ {
+ Text = "Add Applicability to Working Draft",
+ Width = 250,
+ Location = new Point(25, 271),
+ Parent = tcpGeneral
+ };
+ btnPC.Click += new EventHandler(btnPC_Click);
btnApplicability.Visible = false;
tiApplicability.Visible = false;
}
@@ -394,12 +381,14 @@ namespace VEPROMS
}
if (validEmptyEnhancedExists)
{
- Button btnEnh = new Button();
- btnEnh.Text = "Link to Enhanced Document(s)";
- btnEnh.Width = 220;
- btnEnh.Location = new Point(290, 271);
- btnEnh.Parent = tcpGeneral;
- btnEnh.Click += new EventHandler(btnEnh_Click);
+ Button btnEnh = new Button
+ {
+ Text = "Link to Enhanced Document(s)",
+ Width = 220,
+ Location = new Point(290, 271),
+ Parent = tcpGeneral
+ };
+ btnEnh.Click += new EventHandler(btnEnh_Click);
}
}
btnEnhanced.Visible = false;
@@ -425,7 +414,7 @@ namespace VEPROMS
DocVersionInfo dvi = DocVersionInfo.Get(_DocVersionConfig.MyEnhancedDocuments[0].VersionID);
DVEnhancedDocument dvedUseData = _DocVersionConfig.MyEnhancedDocuments[0];
DocVersionConfig dvc = dvi.MyConfig as DocVersionConfig;
- EnhancedMiniConfig ecfg = new EnhancedMiniConfig(0, dvi.VersionID, "?", dvi.SearchDVPath, dvedUseData.Name, dvedUseData.Type.ToString(), dvedUseData.PdfToken, dvedUseData.PdfX.ToString());
+ EnhancedMiniConfig ecfg = new EnhancedMiniConfig(0, dvi.VersionID, dvi.SearchDVPath, dvedUseData.Name, dvedUseData.Type.ToString(), dvedUseData.PdfToken, dvedUseData.PdfX.ToString());
cbxEnhVersions.Items.Add(dvi.SearchDVPath);
tbEnhName.Enabled = false;
tbEnhType.Enabled = false;
@@ -466,7 +455,7 @@ namespace VEPROMS
{
DocVersionInfo dvi = DocVersionInfo.Get(dved.VersionID);
DocVersionConfig dvc = dvi.MyConfig as DocVersionConfig;
- EnhancedMiniConfig ecfg = new EnhancedMiniConfig(0, dvi.VersionID, "?", dvi.SearchDVPath, dved.Name, dved.Type.ToString(), dved.PdfToken, dved.PdfX.ToString());
+ EnhancedMiniConfig ecfg = new EnhancedMiniConfig(0, dvi.VersionID, dvi.SearchDVPath, dved.Name, dved.Type.ToString(), dved.PdfToken, dved.PdfX.ToString());
cbxEnhVersions.Items.Add(dvi.SearchDVPath);
_Enhanced.Add(ecfg);
}
@@ -549,47 +538,6 @@ namespace VEPROMS
}
}
- private string AddSlaveNode(MiniConfig mc)
- {
- System.Xml.XmlDocument xd = new System.Xml.XmlDocument();
- xd.LoadXml(_DocVersionConfig.ToString());
- System.Xml.XmlNodeList nl = xd.SelectNodes("//Slave");
- int max = 0;
-
- foreach (System.Xml.XmlNode n in nl)
- {
- max = int.Parse(n.Attributes.GetNamedItem("index").InnerText);
- }
-
- max++;
-
- System.Xml.XmlNode nn = xd.CreateElement("Slave");
- AddSlaveAttribute(nn, "index", max.ToString());
- AddSlaveAttribute(nn, "ID", mc.ID);
- AddSlaveAttribute(nn, "Name", mc.Name);
- AddSlaveAttribute(nn, "Number", mc.Number);
- AddSlaveAttribute(nn, "Text", mc.Text);
- AddSlaveAttribute(nn, "ProcedureNumber", mc.ProcedureNumber);
- AddSlaveAttribute(nn, "SetID", mc.SetID);
- AddSlaveAttribute(nn, "SetName", mc.SetName);
- AddSlaveAttribute(nn, "OtherID", mc.OtherID);
- AddSlaveAttribute(nn, "OtherName", mc.OtherName);
- AddSlaveAttribute(nn, "OtherNumber", mc.OtherNumber);
- AddSlaveAttribute(nn, "OtherText", mc.OtherText);
-
- System.Xml.XmlNode sn = xd.SelectSingleNode("//Slaves");
- sn.AppendChild(nn);
-
- return xd.OuterXml;
- }
-
- private void AddSlaveAttribute(System.Xml.XmlNode nn, string name, string value)
- {
- System.Xml.XmlAttribute xa = nn.OwnerDocument.CreateAttribute(name);
- xa.InnerText = value;
- nn.Attributes.SetNamedItem(xa);
- }
-
private void btnVersionsPropOK_Click(object sender, EventArgs e)
{
//B2024-030 Check the PDF Location path and prompt to create the folders if needed
@@ -683,8 +631,8 @@ namespace VEPROMS
{
dved.PdfX = Convert.ToInt32(emc.PdfXOffset);
}
- catch (Exception ex)
- {
+ catch (Exception)
+ {
dved.PdfX = 10;
}
}
@@ -698,8 +646,8 @@ namespace VEPROMS
{
ipdfx = Convert.ToInt32(emc.PdfXOffset);
}
- catch (Exception ex)
- {
+ catch (Exception)
+ {
ipdfx = (emc.PdfToken == null || emc.PdfToken == "") ? 0 : 10;
}
@@ -709,8 +657,8 @@ namespace VEPROMS
{
itype = Convert.ToInt32(emc.Type);
}
- catch (Exception ex)
- {
+ catch (Exception)
+ {
itype = 1;
}
@@ -773,20 +721,20 @@ namespace VEPROMS
if (_EnhNeedToUnlink)
{
- this.Cursor = Cursors.WaitCursor;
+ Cursor = Cursors.WaitCursor;
_DocVersionConfig.MyDocVersion.MyDocVersionInfo.DoUnlinkEnhancedDocVersion();
- this.Cursor = Cursors.Default;
+ Cursor = Cursors.Default;
}
// B2019-132 update the association count for this working draft
_DocVersionConfig.MyDocVersion.MyDocVersionInfo.RefreshDocVersionAssociations();
- this.Close();
+ Close();
}
private void btnFldrPropCancel_Click(object sender, EventArgs e)
{
docVersionConfigBindingSource.CancelEdit();
- this.Close();
+ Close();
}
///
@@ -832,13 +780,15 @@ namespace VEPROMS
// Get the ro path - there is no 'default'
if (_DocVersionConfig.MyDocVersion.DocVersionAssociationCount < 0 && _DocVersionConfig.MyDocVersion.DocVersionAssociations.Count == 0)
- ;// The line above refreshes the data
+#pragma warning disable CS0642 // Possible mistaken empty statement
+ ;// The line above refreshes the data
+#pragma warning restore CS0642 // Possible mistaken empty statement
- if (_DocVersionConfig.MyDocVersion.DocVersionAssociationCount > 0)
+ if (_DocVersionConfig.MyDocVersion.DocVersionAssociationCount > 0)
{
RODbInfo rdi = RODbInfo.GetJustRODB(SelectedROFst.RODbID);
- tbRoDb.Text = string.Format("{0} ({1})", rdi.ROName, rdi.FolderPath);
+ tbRoDb.Text = $"{rdi.ROName} ({rdi.FolderPath})";
ppBtnRoToSql.Visible = ppBtnRoToSql.Enabled = CanMigrateRoAccessToSql(rdi); // C2017-003: make button visible if ro migration is doable
_CurRoDbInfo = rdi;
}
@@ -851,7 +801,7 @@ namespace VEPROMS
foreach (RODbInfo rdi in RODbInfoList.Get())
{
- int i = cmbRoDb.Items.Add(string.Format("{0} ({1})", rdi.ROName, rdi.FolderPath));
+ int i = cmbRoDb.Items.Add($"{rdi.ROName} ({rdi.FolderPath})");
if (rdi.RODbID == myrodbid)
{
@@ -958,10 +908,12 @@ namespace VEPROMS
if (tmp == null)
{
MessageBox.Show("Invalid ro fst directory, use the Property dialog to fix directory path to ro.fst.");
- frmRODbProperties dlgROProperties = new frmRODbProperties(_DocVersionConfig.MyDocVersion, rdi);
- dlgROProperties.ProgressBar = ProgressBar;
+ frmRODbProperties dlgROProperties = new frmRODbProperties(_DocVersionConfig.MyDocVersion, rdi)
+ {
+ ProgressBar = ProgressBar
+ };
- if (dlgROProperties.ShowDialog() == DialogResult.OK)
+ if (dlgROProperties.ShowDialog() == DialogResult.OK)
{
tbRoDb.Text = string.Format("{0} ({1})", SelectedROFst.MyRODb.ROName, SelectedROFst.MyRODb.FolderPath);
// only allow update if association, and the RO update was not done and/or not completed
@@ -975,7 +927,7 @@ namespace VEPROMS
cmbRoDb.Visible = ppBtnRoDbBrowse.Visible = false;
tbRoDb.Visible = btnRoDbProperties.Visible = true;
- tbRoDb.Text = string.Format("{0} ({1})", tmp.MyRODb.ROName, tmp.MyRODb.FolderPath);
+ tbRoDb.Text = $"{tmp.MyRODb.ROName} ({tmp.MyRODb.FolderPath})";
// C2017-003: See if the selected ro database has been converted to sql and if not, make visible a button to convert the data.
RODbInfo rodbi = RODbInfo.GetJustRODB(tmp.MyRODb.RODbID);
@@ -1007,12 +959,14 @@ namespace VEPROMS
private void ppBtnRoDbBrowse_Click(object sender, EventArgs e)
{
- frmRODbProperties dlgROProperties = new frmRODbProperties(_DocVersionConfig.MyDocVersion, SelectedROFst == null ? null : SelectedROFst.MyRODb);
- dlgROProperties.ParentLocation = Location;
+ frmRODbProperties dlgROProperties = new frmRODbProperties(_DocVersionConfig.MyDocVersion, SelectedROFst?.MyRODb)
+ {
+ ParentLocation = Location
+ };
- // if a user has entered a valid rodb, then this docversion will be conntected to it - change
- // to a non-editable text box and the button becomes a properties button rather than browse.
- if (dlgROProperties.ShowDialog() == DialogResult.OK)
+ // if a user has entered a valid rodb, then this docversion will be conntected to it - change
+ // to a non-editable text box and the button becomes a properties button rather than browse.
+ if (dlgROProperties.ShowDialog() == DialogResult.OK)
{
cmbRoDb.Items.Clear();
_DocVersionConfig.MyDocVersion.Reset_DocVersionAssociations();
@@ -1075,12 +1029,9 @@ namespace VEPROMS
}
- private void frmVersionsProperties_Shown(object sender, EventArgs e)
- {
- ppRTxtName.Focus();
- }
+ private void frmVersionsProperties_Shown(object sender, EventArgs e) => ppRTxtName.Focus();
- private void ppRTxtName_Leave(object sender, EventArgs e)
+ private void ppRTxtName_Leave(object sender, EventArgs e)
{
if (string.IsNullOrEmpty(ppRTxtName.Text))
{
@@ -1089,12 +1040,9 @@ namespace VEPROMS
}
}
- private void btnApplicability_Click(object sender, EventArgs e)
- {
- ProcessButtonClick(tiApplicability, btnApplicability);
- }
+ private void btnApplicability_Click(object sender, EventArgs e) => ProcessButtonClick(tiApplicability, btnApplicability);
- private void lbApplicabilities_SelectedIndexChanged(object sender, EventArgs e)
+ private void lbApplicabilities_SelectedIndexChanged(object sender, EventArgs e)
{
if (lbApplicabilities.SelectedIndex > -1)
{
@@ -1106,11 +1054,12 @@ namespace VEPROMS
private void btnNewApple_Click(object sender, EventArgs e)
{
- MiniConfig cfg = new MiniConfig();
+ MiniConfig cfg = new MiniConfig
+ {
+ Name = "New Applicability"
+ };
- cfg.Name = "New Applicability";
-
- if (_Apples == null)
+ if (_Apples == null)
{
_Apples = new List();
}
@@ -1147,7 +1096,7 @@ namespace VEPROMS
if (_showApplicSearchResults)
{
_showApplicSearchResults = false;
- _DisplaySearch1.SearchResults = null;
+ DisplaySearch1.SearchResults = null;
}
Cursor.Current = Cursors.WaitCursor;
@@ -1159,9 +1108,9 @@ namespace VEPROMS
if (MessageBox.Show(string.Format("Cannot remove an Applicability that is being use in {0} places.\n\nDo you want to view locations via Search Results?\n\nThe Search panel will open when you exit the property page.", placesUsed.Count), "Applicability In Use", MessageBoxButtons.YesNo) == DialogResult.Yes)
{
_showApplicSearchResults = true;
- _DisplaySearch1.SearchResults = placesUsed;
- _DisplaySearch1.ReportTitle = string.Format("{0} Applicability", cfg.Name);
- _DisplaySearch1.TypesSelected = string.Format("These Locations Specify The \"{0}\" Applicability", cfg.Name);
+ DisplaySearch1.SearchResults = placesUsed;
+ DisplaySearch1.ReportTitle = string.Format("{0} Applicability", cfg.Name);
+ DisplaySearch1.TypesSelected = string.Format("These Locations Specify The \"{0}\" Applicability", cfg.Name);
}
return true;
@@ -1187,7 +1136,7 @@ namespace VEPROMS
bsApples.DataSource = null;
bsApples.DataSource = _Apples;
// C2018-010: When removing an applicability, info on right side still contains old content. Do refreshes and reset datasource to fix this.
- this.lbApplicabilities.Refresh();
+ lbApplicabilities.Refresh();
if (_Apples != null && _Apples.Count > 0)
{
@@ -1204,12 +1153,9 @@ namespace VEPROMS
dlgPL.ShowDialog();
}
- private void btnEnhanced_Click(object sender, EventArgs e)
- {
- ProcessButtonClick(tiEnhanced, btnEnhanced);
- }
+ private void btnEnhanced_Click(object sender, EventArgs e) => ProcessButtonClick(tiEnhanced, btnEnhanced);
- private void lbEnhanced_SelectedIndexChanged(object sender, EventArgs e)
+ private void lbEnhanced_SelectedIndexChanged(object sender, EventArgs e)
{
if (!_Initializing && lbEnhanced.SelectedIndex > -1 && !doingNew)
{
@@ -1225,12 +1171,14 @@ namespace VEPROMS
_Initializing = true;
doingNew = true;
- // the 'New' button is only enabled for Source documents.
- EnhancedMiniConfig cfg = new EnhancedMiniConfig();
- cfg.Name = "New Enhanced";
+ // the 'New' button is only enabled for Source documents.
+ EnhancedMiniConfig cfg = new EnhancedMiniConfig
+ {
+ Name = "New Enhanced"
+ };
- // need to have a unique number for this enhanced link, find largest and then increment by 1.
- int maxtype = -1;
+ // need to have a unique number for this enhanced link, find largest and then increment by 1.
+ int maxtype = -1;
if (_DocVersionConfig.MyEnhancedDocuments != null && _DocVersionConfig.MyEnhancedDocuments.Count > 0)
{
@@ -1451,40 +1399,36 @@ namespace VEPROMS
}
}
- #region (General Tab)
+ #region (General Tab)
- ///
- /// This is the General button used on the button interface design
- ///
- /// object
- /// EventArgs
- private void btnGeneral_Click(object sender, EventArgs e)
+ ///
+ /// This is the General button used on the button interface design
+ ///
+ /// object
+ /// EventArgs
+ private void btnGeneral_Click(object sender, EventArgs e) => ProcessButtonClick(tiGeneral, btnGeneral);
+
+ #endregion
+
+ #region (Referenced Objects)
+
+ ///
+ /// This is the Referenced Objects button used on the button interface design
+ ///
+ /// object
+ /// EventArgs
+ private void btnRefObjs_Click(object sender, EventArgs e) => ProcessButtonClick(tiRefObjs, btnRefObjs);
+
+ private void btnRoDbProperties_Click(object sender, EventArgs e)
{
- ProcessButtonClick(tiGeneral, btnGeneral);
- }
+ frmRODbProperties dlgROProperties = new frmRODbProperties(_DocVersionConfig.MyDocVersion, SelectedROFst?.MyRODb)
+ {
+ ParentLocation = Location
+ };
- #endregion
-
- #region (Referenced Objects)
-
- ///
- /// This is the Referenced Objects button used on the button interface design
- ///
- /// object
- /// EventArgs
- private void btnRefObjs_Click(object sender, EventArgs e)
- {
- ProcessButtonClick(tiRefObjs, btnRefObjs);
- }
-
- private void btnRoDbProperties_Click(object sender, EventArgs e)
- {
- frmRODbProperties dlgROProperties = new frmRODbProperties(_DocVersionConfig.MyDocVersion, SelectedROFst == null ? null : SelectedROFst.MyRODb);
- dlgROProperties.ParentLocation = Location;
-
- if (dlgROProperties.ShowDialog() == DialogResult.OK)
+ if (dlgROProperties.ShowDialog() == DialogResult.OK)
{
- tbRoDb.Text = string.Format("{0} ({1})", SelectedROFst.MyRODb.ROName, SelectedROFst.MyRODb.FolderPath);
+ tbRoDb.Text = $"{SelectedROFst.MyRODb.ROName} ({SelectedROFst.MyRODb.FolderPath})";
// only allow update if association, and the RO update was not done and/or not completed
ppBtnUpRoVals.Enabled = !_DocVersionConfig.MyDocVersion.ROfstLastCompleted || _DocVersionConfig.MyDocVersion.NewerRoFst;
}
@@ -1521,7 +1465,7 @@ namespace VEPROMS
if (!File.Exists(rofstPath))
{
FinalProgressBarMessage = "No existing RO.FST";
- MessageBox.Show("No existing ro.fst in path " + rdi.FolderPath + ". Check for invalid path", "No existing RO.FST"); //B2017-125 added title to messagebox
+ MessageBox.Show($"No existing ro.fst in path {rdi.FolderPath}. Check for invalid path", "No existing RO.FST"); //B2017-125 added title to messagebox
break;
}
@@ -1581,29 +1525,26 @@ namespace VEPROMS
private void ContentInfo_StaticContentInfoChange(object sender, StaticContentInfoEventArgs args)
{
if (args.Type == "RO")
- swROUpdate.Write(string.Format("Fixed Referenced Object for {1}({4}){0}Old Text: {2}{0}New Text: {3}{0}{0}", Environment.NewLine, (sender as ItemInfo).ShortPath, args.OldValue, args.NewValue, (sender as ItemInfo).ItemID));
+ swROUpdate.Write($"Fixed Referenced Object for {(sender as ItemInfo).ShortPath}({(sender as ItemInfo).ItemID}){Environment.NewLine}Old Text: {args.OldValue}{Environment.NewLine}New Text: {args.NewValue}{Environment.NewLine}{Environment.NewLine}");
}
- #endregion
+ #endregion
- #region (Output Settings)
+ #region (Output Settings)
- ///
- /// This is the Output Settings button used on the button interface design
- ///
- /// object
- /// EventArgs
- private void btnOutputSettings_Click(object sender, EventArgs e)
- {
- ProcessButtonClick(tiOutputSettings, btnOutputSettings);
- }
+ ///
+ /// This is the Output Settings button used on the button interface design
+ ///
+ /// object
+ /// EventArgs
+ private void btnOutputSettings_Click(object sender, EventArgs e) => ProcessButtonClick(tiOutputSettings, btnOutputSettings);
- ///
- /// Selection in Watermark combo box changed.
- ///
- /// object
- /// EventArgs
- private void ppCmbxWatermark_SelectedValueChanged(object sender, EventArgs e)
+ ///
+ /// Selection in Watermark combo box changed.
+ ///
+ /// object
+ /// EventArgs
+ private void ppCmbxWatermark_SelectedValueChanged(object sender, EventArgs e)
{
if (!_Initializing)
{
@@ -1889,26 +1830,6 @@ namespace VEPROMS
deflabel.Visible = ppCbShwDefSettings.Checked && button.Visible;
}
- ///
- /// Process a change in the combo box selection
- ///
- /// Combo Box Name
- /// string containing default text
- /// button to reset to default value
- /// label containing the default
- private void ProcessCmbxSelectedValueChange(ComboBoxEx cmbx, string defstr, ButtonX button, Label deflabel)
- {
- if (cmbx.SelectedIndex > -1 && !string.IsNullOrEmpty(defstr) && defstr.Equals(cmbx.SelectedValue))
- {
- button.Visible = true;
- button.Focus();
- button.PerformClick();
- }
-
- button.Visible = cmbx.SelectedValue != null;
- deflabel.Visible = ppCbShwDefSettings.Checked && button.Visible;
- }
-
///
/// Set the watermark and default label
///
@@ -1925,34 +1846,28 @@ namespace VEPROMS
}
}
- #endregion
+ #endregion
- #region (MergedOutputSettings)
+ #region (MergedOutputSettings)
- private void btnMergedOutputSettngs_Click(object sender, EventArgs e)
- {
- ProcessButtonClick(tiMergedOutputSettings, btnMergedOutputSettngs);
- }
+ private void btnMergedOutputSettngs_Click(object sender, EventArgs e) => ProcessButtonClick(tiMergedOutputSettings, btnMergedOutputSettngs);
- #endregion
+ #endregion
- #region Library Documents
+ #region Library Documents
- ///
- /// This is the Library Documents button used on the button interface design
- ///
- /// object
- /// EventArgs
- private void btnLibDocs_Click(object sender, EventArgs e)
- {
- ProcessButtonClick(tiLibDocs, btnLibDocs);
- }
+ ///
+ /// This is the Library Documents button used on the button interface design
+ ///
+ /// object
+ /// EventArgs
+ private void btnLibDocs_Click(object sender, EventArgs e) => ProcessButtonClick(tiLibDocs, btnLibDocs);
- #endregion
+ #endregion
- #endregion
+ #endregion
- private void tbRoDb_TextChanged(object sender, EventArgs e)
+ private void tbRoDb_TextChanged(object sender, EventArgs e)
{
}
@@ -1972,10 +1887,7 @@ namespace VEPROMS
#region Fields
private static int lastindex = 0;
-
- private bool _isDeleted;
- private bool _isDirty;
- private int _index;
+ private int _index;
private int _versionID;
private string _versionPathName;
private string _name;
@@ -1983,25 +1895,17 @@ namespace VEPROMS
private string _pdfToken;
private string _pdfXOffset;
- #endregion
+ #endregion
- #region Properties
+ #region Properties
- [XmlIgnore]
- public bool IsDeleted
- {
- get { return _isDeleted; }
- set { _isDeleted = value; }
- }
+ [XmlIgnore]
+ public bool IsDeleted { get; set; }
- [XmlIgnore]
- public bool IsDirty
- {
- get { return _isDirty; }
- set { _isDirty = value; }
- }
+ [XmlIgnore]
+ public bool IsDirty { get; set; }
- [XmlAttribute("index")]
+ [XmlAttribute("index")]
public int Index
{
get { return _index; }
@@ -2063,10 +1967,10 @@ namespace VEPROMS
_type = string.Empty;
_pdfToken = string.Empty;
_pdfXOffset = string.Empty;
- _isDirty = false;
+ IsDirty = false;
}
- public EnhancedMiniConfig(int index, int versionid, string id, string versionPathName, string name, string type, string pdftoken, string pdfxoffset)
+ public EnhancedMiniConfig(int index, int versionid, string versionPathName, string name, string type, string pdftoken, string pdfxoffset)
{
_index = index;
_versionID = versionid;
@@ -2075,20 +1979,17 @@ namespace VEPROMS
_type = type;
_pdfToken = pdftoken;
_pdfXOffset = pdfxoffset;
- _isDirty = false;
+ IsDirty = false;
}
- #endregion
+ #endregion
- #region Public Methods
+ #region Public Methods
- public override string ToString()
- {
- return Name;
- }
+ public override string ToString() => Name;
- #endregion
- }
+ #endregion
+ }
#endregion
@@ -2101,10 +2002,7 @@ namespace VEPROMS
#region Fields
private static int lastindex = 0;
-
- private bool _isDeleted;
- private bool _isDirty;
- private int _index;
+ private int _index;
private string _iD;
private string _name;
private string _number;
@@ -2117,25 +2015,17 @@ namespace VEPROMS
private string _otherNumber;
private string _otherText;
- #endregion
+ #endregion
- #region Properties
+ #region Properties
- [XmlIgnore]
- public bool IsDeleted
- {
- get { return _isDeleted; }
- set { _isDeleted = value; }
- }
+ [XmlIgnore]
+ public bool IsDeleted { get; set; }
- [XmlIgnore]
- public bool IsDirty
- {
- get { return _isDirty; }
- set { _isDirty = value; }
- }
+ [XmlIgnore]
+ public bool IsDirty { get; set; }
- [XmlAttribute("index")]
+ [XmlAttribute("index")]
public int Index
{
get { return _index; }
@@ -2237,7 +2127,7 @@ namespace VEPROMS
_otherName = string.Empty;
_otherNumber = string.Empty;
_otherText = string.Empty;
- _isDirty = false;
+ IsDirty = false;
}
public MiniConfig(int index, string id, string name, string number, string text, string procedurenumber, string setid, string setname, string otherid, string othername, string othernumber, string othertext)
@@ -2254,25 +2144,19 @@ namespace VEPROMS
_otherName = othername;
_otherNumber = othernumber;
_otherText = othertext;
- _isDirty = false;
+ IsDirty = false;
}
- #endregion
+ #endregion
- #region Public Methods
+ #region Public Methods
- public override string ToString()
- {
- return Name;
- }
+ public override string ToString() => Name;
- public string MyXml
- {
- get { return GenericSerializer.StringSerialize(this); }
- }
+ public string MyXml => GenericSerializer.StringSerialize(this);
- #endregion
- }
+ #endregion
+ }
#endregion
diff --git a/PROMS/VEPROMS.CSLA.Library/Config/AnnotationConfig.cs b/PROMS/VEPROMS.CSLA.Library/Config/AnnotationConfig.cs
index feb430cd..834a7233 100644
--- a/PROMS/VEPROMS.CSLA.Library/Config/AnnotationConfig.cs
+++ b/PROMS/VEPROMS.CSLA.Library/Config/AnnotationConfig.cs
@@ -1,6 +1,4 @@
using System;
-using System.Collections.Generic;
-using System.Text;
using System.ComponentModel;
namespace VEPROMS.CSLA.Library
@@ -11,35 +9,23 @@ namespace VEPROMS.CSLA.Library
[TypeConverter(typeof(ExpandableObjectConverter))]
public class AnnotationConfig : ConfigDynamicTypeDescriptor, INotifyPropertyChanged
{
- private XMLProperties _Xp;
- private XMLProperties Xp
- {
- get { return _Xp; }
- }
+ private readonly XMLProperties _Xp;
+
public AnnotationConfig(string xml)
{
if (xml == string.Empty) xml = "";
_Xp = new XMLProperties(xml);
}
- public AnnotationConfig()
- {
- _Xp = new XMLProperties();
- }
- public override string ToString()
+ public AnnotationConfig() => _Xp = new XMLProperties();
+ public override string ToString()
{
string s = _Xp.ToString();
if (s == "" || s == "") return string.Empty;
return s;
}
- public string GetValue(string group, string item)
- {
- return _Xp[group, item];
- }
- public void SetValue(string group, string item, string newvalue)
- {
- _Xp[group, item] = newvalue;
- }
+ public string GetValue(string group, string item) => _Xp[group, item];
+ public void SetValue(string group, string item, string newvalue) => _Xp[group, item] = newvalue;
- }
+ }
}
diff --git a/PROMS/VEPROMS.CSLA.Library/Config/AnnotationTypeConfig.cs b/PROMS/VEPROMS.CSLA.Library/Config/AnnotationTypeConfig.cs
index 83511c5a..8ac17f65 100644
--- a/PROMS/VEPROMS.CSLA.Library/Config/AnnotationTypeConfig.cs
+++ b/PROMS/VEPROMS.CSLA.Library/Config/AnnotationTypeConfig.cs
@@ -1,6 +1,4 @@
using System;
-using System.Collections.Generic;
-using System.Text;
using System.ComponentModel;
namespace VEPROMS.CSLA.Library
@@ -9,12 +7,9 @@ namespace VEPROMS.CSLA.Library
[TypeConverter(typeof(ExpandableObjectConverter))]
public class AnnotationTypeConfig : ConfigDynamicTypeDescriptor, INotifyPropertyChanged
{
- private XMLProperties _Xp;
- private XMLProperties Xp
- {
- get { return _Xp; }
- }
- public AnnotationTypeConfig(string xml)
+ private readonly XMLProperties _Xp;
+
+ public AnnotationTypeConfig(string xml)
{
if (xml == string.Empty) xml = "";
_Xp = new XMLProperties(xml);
@@ -48,16 +43,16 @@ namespace VEPROMS.CSLA.Library
{
string s = _Xp["PrintableText", "XLocation"];
if (s == string.Empty) return 0;
- int tst = 0;
+ int tst;
try
{
tst = int.Parse(s);
}
- catch (Exception ex)
- {
+ catch (Exception)
+ {
return 0;
}
- return int.Parse(s);
+ return tst;
}
set
{
diff --git a/PROMS/VEPROMS.CSLA.Library/Config/AssocConfig.cs b/PROMS/VEPROMS.CSLA.Library/Config/AssocConfig.cs
index 97f03639..520ce3bf 100644
--- a/PROMS/VEPROMS.CSLA.Library/Config/AssocConfig.cs
+++ b/PROMS/VEPROMS.CSLA.Library/Config/AssocConfig.cs
@@ -1,6 +1,4 @@
using System;
-using System.Collections.Generic;
-using System.Text;
using System.ComponentModel;
namespace VEPROMS.CSLA.Library
@@ -9,21 +7,14 @@ namespace VEPROMS.CSLA.Library
[TypeConverter(typeof(ExpandableObjectConverter))]
public class AssociationConfig : ConfigDynamicTypeDescriptor, INotifyPropertyChanged
{
- #region DynamicTypeDescriptor
- internal override bool IsReadOnly
- {
- get { return _Association == null; }
- }
- #endregion
- #region XML
- private XMLProperties _Xp;
- private XMLProperties Xp
- {
- get { return _Xp; }
- }
+ #region DynamicTypeDescriptor
+ internal override bool IsReadOnly => _Association == null;
+ #endregion
+ #region XML
+ private readonly XMLProperties _Xp;
#endregion
#region Constructors
- private Association _Association;
+ private readonly Association _Association;
public AssociationConfig(Association association)
{
_Association = association;
@@ -31,7 +22,7 @@ namespace VEPROMS.CSLA.Library
if (xml == string.Empty) xml = "";
_Xp = new XMLProperties(xml);
}
- private AssociationInfo _AssociationInfo;
+ private readonly AssociationInfo _AssociationInfo;
public AssociationConfig(AssociationInfo association)
{
_AssociationInfo = association;
@@ -39,24 +30,17 @@ namespace VEPROMS.CSLA.Library
if (xml == string.Empty) xml = "";
_Xp = new XMLProperties(xml);
}
- public AssociationConfig(string xml)
- {
- _Xp = new XMLProperties(xml);
- }
- public AssociationConfig()
+ public AssociationConfig(string xml) => _Xp = new XMLProperties(xml);
+ public AssociationConfig()
{
string xml = "";
_Xp = new XMLProperties(xml);
}
- internal string GetValue(string group, string item)
- {
- return _Xp[group, item];
- }
- #endregion
- public Association MyAssociation
- { get { return _Association; } }
- #region RODefaults // From proc.ini
- [Category("Referenced Objects")]
+ internal string GetValue(string group, string item) => _Xp[group, item];
+ #endregion
+ public Association MyAssociation => _Association;
+ #region RODefaults // From proc.ini
+ [Category("Referenced Objects")]
[DisplayName("Default RO Prefix")]
[RefreshProperties(RefreshProperties.All)]
[Description("Setpoint Prefix")]
@@ -146,9 +130,8 @@ namespace VEPROMS.CSLA.Library
public override string ToString()
{
string s = _Xp.ToString();
- if (s == "" || s == "") return string.Empty;
- return s;
- }
- #endregion
- }
+ return s == "" || s == "" ? string.Empty : s;
+ }
+ #endregion
+ }
}
diff --git a/PROMS/VEPROMS.CSLA.Library/Config/ColorConfig.cs b/PROMS/VEPROMS.CSLA.Library/Config/ColorConfig.cs
index 347e5ccc..a40dbdb6 100644
--- a/PROMS/VEPROMS.CSLA.Library/Config/ColorConfig.cs
+++ b/PROMS/VEPROMS.CSLA.Library/Config/ColorConfig.cs
@@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
-using System.Text;
using System.Text.RegularExpressions;
using System.Drawing;
@@ -8,9 +7,9 @@ namespace VEPROMS.CSLA.Library
{
public static class ColorConfig
{
- private static Regex byARGB = new Regex(@"Color \[A=([0-9]*), R=([0-9]*), G=([0-9]*), B=([0-9]*)\]");
- private static Regex byName = new Regex(@"Color \[(.*)\]");
- private static Regex byRGB = new Regex(@"[0-9]*,[0-9]*,[0-9]*");
+ private static readonly Regex byARGB = new Regex(@"Color \[A=([0-9]*), R=([0-9]*), G=([0-9]*), B=([0-9]*)\]");
+ private static readonly Regex byName = new Regex(@"Color \[(.*)\]");
+ private static readonly Regex byRGB = new Regex(@"[0-9]*,[0-9]*,[0-9]*");
public static Color ColorFromString(string sColor)
{
if (sColor == string.Empty) return Color.Empty;
@@ -59,12 +58,7 @@ namespace VEPROMS.CSLA.Library
return ConvertRGBToName[tmp.Name];
return tmp;
}
- public static Color FindKnownColor(Color tmp)
- {
- if (ConvertRGBToName.ContainsKey(tmp.Name))
- return ConvertRGBToName[tmp.Name];
- return tmp;
- }
+ public static Color FindKnownColor(Color tmp) => ConvertRGBToName.ContainsKey(tmp.Name) ? ConvertRGBToName[tmp.Name] : tmp;
- }
+ }
}
diff --git a/PROMS/VEPROMS.CSLA.Library/Config/ConfigEnum.cs b/PROMS/VEPROMS.CSLA.Library/Config/ConfigEnum.cs
index 15dcad8e..9750c022 100644
--- a/PROMS/VEPROMS.CSLA.Library/Config/ConfigEnum.cs
+++ b/PROMS/VEPROMS.CSLA.Library/Config/ConfigEnum.cs
@@ -1,13 +1,8 @@
-using System;
-using System.Collections.Generic;
-using System.Text;
using System.ComponentModel;
using DescriptiveEnum;
namespace VEPROMS.CSLA.Library
{
- //class ConfigEnum
- //{
//C2022-004 Added option for Unit Specific Watermark
[TypeConverter(typeof(EnumDescConverter))]
public enum PrintWatermark : int
diff --git a/PROMS/VEPROMS.CSLA.Library/Config/DocVersionConfig.cs b/PROMS/VEPROMS.CSLA.Library/Config/DocVersionConfig.cs
index 876f711c..aaa6089d 100644
--- a/PROMS/VEPROMS.CSLA.Library/Config/DocVersionConfig.cs
+++ b/PROMS/VEPROMS.CSLA.Library/Config/DocVersionConfig.cs
@@ -1,20 +1,14 @@
using System;
using System.Collections.Generic;
-using System.Text;
using System.ComponentModel;
-using System.Drawing;
-using DescriptiveEnum;
using System.Xml;
namespace VEPROMS.CSLA.Library
{
public partial class DVEnhancedDocuments : List
{
- public void Add(string name, int type, int versionID, int pdfX, string pdfToken)
- {
- Add(new DVEnhancedDocument(name, type, versionID,pdfX,pdfToken));
- }
- public static DVEnhancedDocuments Load(XMLProperties _Xp)
+ public void Add(string name, int type, int versionID, int pdfX, string pdfToken) => Add(new DVEnhancedDocument(name, type, versionID, pdfX, pdfToken));
+ public static DVEnhancedDocuments Load(XMLProperties _Xp)
{
DVEnhancedDocuments eds = new DVEnhancedDocuments(); // B2020-060: don't return null, caused null reference later
foreach (XmlNode xn in _Xp.XmlContents.SelectNodes("//Enhanced"))
@@ -37,7 +31,7 @@ namespace VEPROMS.CSLA.Library
{
// B2018-025: If there is config data in the source pointing to a non-existent enhanced, remove
// this from the internal data structure so no errors will occur:
- XmlNode xnx = _Xp.XmlContents.SelectSingleNode(string.Format("//Enhanced[@VersionID='{0}']", dvid));
+ XmlNode xnx = _Xp.XmlContents.SelectSingleNode($"//Enhanced[@VersionID='{dvid}']");
xnx.ParentNode.RemoveChild(xnx);
}
}
@@ -71,37 +65,12 @@ namespace VEPROMS.CSLA.Library
public partial class DVEnhancedDocument
{
- private string _Name;
- public string Name
- {
- get { return _Name; }
- set { _Name = value; }
- }
- private int _Type;
- public int Type
- {
- get { return _Type; }
- set { _Type = value; }
- }
- private int _VersionID;
- public int VersionID
- {
- get { return _VersionID; }
- set { _VersionID = value; }
- }
- private int _PdfX;
- public int PdfX
- {
- get { return _PdfX; }
- set { _PdfX = value; }
- }
- private string _PdfToken;
- public string PdfToken
- {
- get { return _PdfToken; }
- set { _PdfToken = value; }
- }
- public DVEnhancedDocument() { ;}
+ public string Name { get; set; }
+ public int Type { get; set; }
+ public int VersionID { get; set; }
+ public int PdfX { get; set; }
+ public string PdfToken { get; set; }
+ public DVEnhancedDocument() { ;}
public DVEnhancedDocument(string name,int type, int versionID, int pdfX, string pdfToken)
{
Name = name;
@@ -110,23 +79,17 @@ namespace VEPROMS.CSLA.Library
PdfX = pdfX;
PdfToken = pdfToken;
}
- public override string ToString()
- {
- return string.Format("{0}.ItemID={1}", Name,VersionID);
- }
- }
+ public override string ToString() => $"{Name}.ItemID={VersionID}";
+ }
[Serializable]
[TypeConverter(typeof(ExpandableObjectConverter))]
public class DocVersionConfig : ConfigDynamicTypeDescriptor, INotifyPropertyChanged
{
- // B2018-025: Allow refresh of enhanced document data structure, RefreshMyEnhancedDocuments, and remove link data, RemoveEnhancedLink.
- public void RefreshMyEnhancedDocuments()
- {
- _MyEnhancedDocuments = null;
- }
+ // B2018-025: Allow refresh of enhanced document data structure, RefreshMyEnhancedDocuments, and remove link data, RemoveEnhancedLink.
+ public void RefreshMyEnhancedDocuments() => _MyEnhancedDocuments = null;
- public void RemoveEnhancedLink(int dvid)
+ public void RemoveEnhancedLink(int dvid)
{
// from this config, remove the link to the input dvid (DocVersionId:
XmlNode xnx = _Xp.XmlContents.SelectSingleNode(string.Format("//Enhanced[@VersionID='{0}']", dvid));
@@ -198,19 +161,12 @@ namespace VEPROMS.CSLA.Library
}
}
- #region DynamicTypeDescriptor
- internal override bool IsReadOnly
- {
- get { return _DocVersion == null; }
- }
- #endregion
+ #region DynamicTypeDescriptor
+ internal override bool IsReadOnly => _DocVersion == null;
+ #endregion
- #region XML
- private XMLProperties _Xp;
- private XMLProperties Xp
- {
- get { return _Xp; }
- }
+ #region XML
+ private readonly XMLProperties _Xp;
#endregion
#region Constructors
@@ -221,15 +177,8 @@ namespace VEPROMS.CSLA.Library
get { return _Xp.ParentLookup; }
set { _Xp.ParentLookup = value; }
}
- //private bool _AncestorLookup;
- ////PROPGRID: Hide AncestorLookup
- //[Browsable(false)]
- //public bool AncestorLookup
- //{
- // get { return _AncestorLookup; }
- // set { _AncestorLookup = value; }
- //}
- private DocVersion _DocVersion;
+
+ private readonly DocVersion _DocVersion;
public DocVersionConfig(DocVersion docVersion)
{
_DocVersion = docVersion;
@@ -251,20 +200,7 @@ namespace VEPROMS.CSLA.Library
}
return string.Empty;
}
-
- //private string Xp_LookInAncestorFolderInfo(object sender, XMLPropertiesArgs args)
- //{
- // if (args.AncestorLookup || ParentLookup)
- // {
- // for (FolderInfo folder = _DocVersionInfo.MyFolder; folder != null; folder = folder.MyParent)
- // {
- // string retval = folder.FolderConfig.GetValue(args.Group, args.Item);
- // if (retval != string.Empty) return retval;
- // }
- // }
- // return string.Empty;
- //}
- private DocVersionInfo _DocVersionInfo;
+ private readonly DocVersionInfo _DocVersionInfo;
public DocVersionConfig(DocVersionInfo docVersionInfo)
{
_DocVersionInfo = docVersionInfo;
@@ -283,18 +219,12 @@ namespace VEPROMS.CSLA.Library
string xml = "";
_Xp = new XMLProperties(xml);
}
- public string GetValue(string group, string item)
- {
- return _Xp[group, item];
- }
- public void SetValue(string group, string item, string newvalue)
- {
- _Xp[group, item] = newvalue;
- }
- #endregion
+ public string GetValue(string group, string item) => _Xp[group, item];
+ public void SetValue(string group, string item, string newvalue) => _Xp[group, item] = newvalue;
+ #endregion
- #region Local Properties
- [Category("General")]
+ #region Local Properties
+ [Category("General")]
[DisplayName("Name")]
[Description("Name")]
public string Name
@@ -376,15 +306,14 @@ namespace VEPROMS.CSLA.Library
public override string ToString()
{
string s = _Xp.ToString();
- if (s == "" || s == "") return string.Empty;
- return s;
- }
- #endregion
+ return s == "" || s == "" ? string.Empty : s;
+ }
+ #endregion
- //
+ //
- #region RODefaults // From proc.ini
- [Category("Referenced Objects")]
+ #region RODefaults // From proc.ini
+ [Category("Referenced Objects")]
[DisplayName("Default RO Prefix")]
[RefreshProperties(RefreshProperties.All)]
[Description("Setpoint Prefix")]
@@ -500,13 +429,6 @@ namespace VEPROMS.CSLA.Library
OnPropertyChanged("Print_Printer");
}
}
- //[TypeConverter(typeof(EnumDescConverter))]
- //public enum PrintWatermark : int
- //{
- // None = 0, Reference, Draft, Master, Sample,
- // [Description("Information Only")]
- // InformationOnly
- //}
[Category("Print Settings")]
[DisplayName("Watermark")]
@@ -584,23 +506,6 @@ namespace VEPROMS.CSLA.Library
OnPropertyChanged("Print_DuplexBlankPageText");
}
}
- //// Change Bar Use from 16-bit code:
- //// No Default
- //// Without Change Bars
- //// With Default Change Bars
- //// With User Specified Change Bars
- //[TypeConverter(typeof(EnumDescConverter))]
- //public enum PrintChangeBar : int
- //{
- // [Description("No Default, Select Before Printing")]
- // SelectBeforePrinting = 0,
- // [Description("Without Change Bars")]
- // Without,
- // [Description("With Default Change Bars")]
- // WithDefault,
- // [Description("Use Custom Change Bars")]
- // WithUserSpecified
- //}
[Category("Format Settings")]
[DisplayName("Change Bars")]
@@ -642,23 +547,7 @@ namespace VEPROMS.CSLA.Library
}
}
}
- //// User Specified Change Bar Location from16-bit code:
- //// With Text
- //// Outside Box
- //// AER on LEFT, RNO on Right
- //// To the Left of Text
- //[TypeConverter(typeof(EnumDescConverter))]
- //public enum PrintChangeBarLoc : int
- //{
- // [Description("With Text")]
- // WithText = 0,
- // [Description("Outside Box")]
- // OutsideBox,
- // [Description("AER on Left RNO on Right")]
- // AERleftRNOright,
- // [Description("To the Left of the Text")]
- // LeftOfText
- //}
+
[Category("Format Settings")]
[DisplayName("Change Bar Position")]
[RefreshProperties(RefreshProperties.All)]
@@ -700,26 +589,6 @@ namespace VEPROMS.CSLA.Library
}
}
- //// Change Bar Text from16-bit code:
- //// Date and Change ID
- //// Revision Number
- //// Change ID
- //// No Change Bar Message
- //// User Defined Message
- //[TypeConverter(typeof(EnumDescConverter))]
- //public enum PrintChangeBarText : int
- //{
- // [Description("Date and Change ID")]
- // DateChgID = 0,
- // [Description("Revision Number")]
- // RevNum,
- // [Description("Change ID")]
- // ChgID,
- // [Description("No Change Bar Text")]
- // None,
- // [Description("Custom Change Bar Text")]
- // UserDef
- //}
[Category("Format Settings")]
[DisplayName("Change Bar Text Type")]
[Description("Change Bar Text")]
@@ -1053,8 +922,6 @@ namespace VEPROMS.CSLA.Library
{
if (_SaveChangesToDocVersionConfig)
{
- string parval = _Xp.ParentValue("PrintSettings", "AlwaysOverwritePDF");
-
_Xp["PrintSettings", "AlwaysOverwritePDF"] = value.ToString();
OnPropertyChanged("Print_AlwaysOverwritePDF");
@@ -1081,8 +948,6 @@ namespace VEPROMS.CSLA.Library
{
if (_SaveChangesToDocVersionConfig)
{
- string parval = _Xp.ParentValue("PrintSettings", "AlwaysViewPDFAfterCreate");
-
_Xp["PrintSettings", "AlwaysViewPDFAfterCreate"] = value.ToString();
OnPropertyChanged("Print_AlwaysViewPDFAfterCreate");
@@ -1109,7 +974,7 @@ namespace VEPROMS.CSLA.Library
{
if (_SaveChangesToDocVersionConfig)
{
- string parval = _Xp.ParentValue("PrintSettings", "AddBlankPagesWhenUsingDuplexFoldouts");
+ _ = _Xp.ParentValue("PrintSettings", "AddBlankPagesWhenUsingDuplexFoldouts");
_Xp["PrintSettings", "AddBlankPagesWhenUsingDuplexFoldouts"] = value.ToString();
@@ -1135,7 +1000,7 @@ namespace VEPROMS.CSLA.Library
{
if (_SaveChangesToDocVersionConfig)
{
- string parval = _Xp.ParentValue("PrintSettings", "UnitNumberForPageList");
+ _ = _Xp.ParentValue("PrintSettings", "UnitNumberForPageList");
_Xp["PrintSettings", "UnitNumberForPageList"] = value;
@@ -1256,16 +1121,16 @@ namespace VEPROMS.CSLA.Library
{
string s = _Xp["PrintSettings", "MergedPdfsPageNumLocX"];
if (s == string.Empty) return 0.5f;
- float test = 0;
- try
+ float test;
+ try
{
test = float.Parse(s);
}
- catch (Exception ex)
- {
+ catch (Exception)
+ {
return 0.5f;
}
- return float.Parse(s);
+ return test;
}
set
{
@@ -1286,16 +1151,16 @@ namespace VEPROMS.CSLA.Library
{
string s = _Xp["PrintSettings", "MergedPdfsPageNumLocY"];
if (s == string.Empty) return 0.5f;
- float test = 0;
- try
+ float test;
+ try
{
test = float.Parse(s);
}
- catch (Exception ex)
- {
+ catch (Exception)
+ {
return 0.5f;
}
- return float.Parse(s);
+ return test;
}
set
{
@@ -1342,16 +1207,16 @@ namespace VEPROMS.CSLA.Library
{
string s = _Xp["PrintSettings", "MergedPdfsLandPageNumLocX"];
if (s == string.Empty) return Print_MergedPdfsPageNumLocX;
- float test = 0;
- try
+ float test;
+ try
{
test = float.Parse(s);
}
- catch (Exception ex)
- {
+ catch (Exception)
+ {
return 0.5f;
}
- return float.Parse(s);
+ return test;
}
set
{
@@ -1372,16 +1237,16 @@ namespace VEPROMS.CSLA.Library
{
string s = _Xp["PrintSettings", "MergedPdfsLandPageNumLocY"];
if (s == string.Empty) return Print_MergedPdfsPageNumLocY;
- float test = 0;
- try
+ float test;
+ try
{
test = float.Parse(s);
}
- catch (Exception ex)
- {
+ catch (Exception)
+ {
return 0.5f;
}
- return float.Parse(s);
+ return test;
}
set
{
@@ -1435,7 +1300,7 @@ namespace VEPROMS.CSLA.Library
if (_SaveChangesToDocVersionConfig)
{
string s = _Xp["PrintSettings", "MergedPdfsViewAfter"]; // get the original value to see if a change
- bool original = (s == string.Empty) ? false : bool.Parse(s);
+ bool original = s != string.Empty && bool.Parse(s);
if (original == value) return; // no change.
_Xp["PrintSettings", "MergedPdfsViewAfter"] = ((bool)value).ToString(); // save selected value
OnPropertyChanged("Print_MergedPdfsViewAfter");
@@ -1469,6 +1334,7 @@ namespace VEPROMS.CSLA.Library
{
if (_SelectedSlave == value) return;
_SelectedSlave = value;
+ // For Debugging:
// if(_DocVersion != null)
// Volian.Base.Library.vlnStackTrace.ShowStackLocal("SelectedSlave {0} = {1}", _DocVersion.MyDocVersionUnique, _SelectedSlave.ToString());
// else
@@ -1486,13 +1352,13 @@ namespace VEPROMS.CSLA.Library
{
string s = GetCombinedSlaveValue("Number") ?? _Xp["Unit", "Number"];// get the saved value
if (SelectedSlave > 0)
- s = _Xp["Slave[@index='" + SelectedSlave.ToString() + "']", "Number"];
+ s = _Xp[$"Slave[@index='{SelectedSlave}']", "Number"];
return s;
}
set
{
if (SelectedSlave > 0)
- _Xp["Slave[@index='" + SelectedSlave.ToString() + "']", "Number"] = value; // save selected value
+ _Xp[$"Slave[@index='{SelectedSlave}']", "Number"] = value; // save selected value
else
_Xp["Unit", "Number"] = value;
OnPropertyChanged("Unit_Number");
@@ -1505,7 +1371,7 @@ namespace VEPROMS.CSLA.Library
{
string s = "";
if (SelectedSlave > 0)
- s = _Xp["Slave[@index='" + SelectedSlave.ToString() + "']", "oldindex"];
+ s = _Xp[$"Slave[@index='{SelectedSlave}']", "oldindex"];
return s;
}
}
@@ -1520,13 +1386,13 @@ namespace VEPROMS.CSLA.Library
{
string s = GetCombinedSlaveValue("OtherNumber") ?? _Xp["Unit", "OtherNumber"];// get the saved value
if (SelectedSlave > 0)
- s = _Xp["Slave[@index='" + SelectedSlave.ToString() + "']", "OtherNumber"];
+ s = _Xp[$"Slave[@index='{SelectedSlave}']", "OtherNumber"];
return s;
}
set
{
if (SelectedSlave > 0)
- _Xp["Slave[@index='" + SelectedSlave.ToString() + "']", "OtherNumber"] = value; // save selected value
+ _Xp[$"Slave[@index='{SelectedSlave}']", "OtherNumber"] = value; // save selected value
else
_Xp["Unit", "OtherNumber"] = value;
OnPropertyChanged("Other_Unit_Number");
@@ -1543,14 +1409,14 @@ namespace VEPROMS.CSLA.Library
string s = GetCombinedSlaveValue("Name") ?? _Xp["Unit", "Name"];// get the saved value
if (SelectedSlave > 0)
- s = _Xp["Slave[@index='" + SelectedSlave.ToString() + "']", "Name"];
+ s = _Xp[$"Slave[@index='{SelectedSlave}']", "Name"];
return s;
}
set
{
if (SelectedSlave > 0)
- _Xp["Slave[@index='" + SelectedSlave.ToString() + "']", "Name"] = value; // save selected value
+ _Xp[$"Slave[@index='{SelectedSlave}']", "Name"] = value; // save selected value
else
_Xp["Unit", "Name"] = value;
@@ -1568,13 +1434,13 @@ namespace VEPROMS.CSLA.Library
{
string s = GetCombinedSlaveValue("OtherName") ?? _Xp["Unit", "OtherName"];// get the saved value
if (SelectedSlave > 0)
- s = _Xp["Slave[@index='" + SelectedSlave.ToString() + "']", "OtherName"];
+ s = _Xp[$"Slave[@index='{SelectedSlave}']", "OtherName"];
return s;
}
set
{
if (SelectedSlave > 0)
- _Xp["Slave[@index='" + SelectedSlave.ToString() + "']", "OtherName"] = value; // save selected value
+ _Xp[$"Slave[@index='{SelectedSlave}']", "OtherName"] = value; // save selected value
else
_Xp["Unit", "OtherName"] = value;
OnPropertyChanged("Other_Unit_Name");
@@ -1590,13 +1456,13 @@ namespace VEPROMS.CSLA.Library
{
string s = GetCombinedSlaveValue("Text") ?? _Xp["Unit", "Text"];// get the saved value
if (SelectedSlave > 0)
- s = _Xp["Slave[@index='" + SelectedSlave.ToString() + "']", "Text"];
+ s = _Xp[$"Slave[@index='{SelectedSlave}']", "Text"];
return s;
}
set
{
if (SelectedSlave > 0)
- _Xp["Slave[@index='" + SelectedSlave.ToString() + "']", "Text"] = value; // save selected value
+ _Xp[$"Slave[@index='{SelectedSlave}']", "Text"] = value; // save selected value
else
_Xp["Unit", "Text"] = value;
OnPropertyChanged("Unit_Text");
@@ -1612,13 +1478,13 @@ namespace VEPROMS.CSLA.Library
{
string s = GetCombinedSlaveValue("OtherText") ?? _Xp["Unit", "OtherText"];// get the saved value
if (SelectedSlave > 0)
- s = _Xp["Slave[@index='" + SelectedSlave.ToString() + "']", "OtherText"];
+ s = _Xp[$"Slave[@index='{SelectedSlave}']", "OtherText"];
return s;
}
set
{
if (SelectedSlave > 0)
- _Xp["Slave[@index='" + SelectedSlave.ToString() + "']", "OtherText"] = value; // save selected value
+ _Xp[$"Slave[@index='{SelectedSlave}']", "OtherText"] = value; // save selected value
else
_Xp["Unit", "OtherText"] = value;
OnPropertyChanged("Other_Unit_Text");
@@ -1634,13 +1500,13 @@ namespace VEPROMS.CSLA.Library
{
string s = GetCombinedSlaveValue("ID") ?? _Xp["Unit", "ID"];// get the saved value
if (SelectedSlave > 0)
- s = _Xp["Slave[@index='" + SelectedSlave.ToString() + "']", "ID"];
+ s = _Xp[$"Slave[@index='{SelectedSlave}']", "ID"];
return s;
}
set
{
if (SelectedSlave > 0)
- _Xp["Slave[@index='" + SelectedSlave.ToString() + "']", "ID"] = value; // save selected value
+ _Xp[$"Slave[@index='{SelectedSlave}']", "ID"] = value; // save selected value
else
_Xp["Unit", "ID"] = value;
OnPropertyChanged("Unit_ID");
@@ -1656,13 +1522,13 @@ namespace VEPROMS.CSLA.Library
{
string s = GetCombinedSlaveValue("OtherID") ?? _Xp["Unit", "OtherID"];// get the saved value
if (SelectedSlave > 0)
- s = _Xp["Slave[@index='" + SelectedSlave.ToString() + "']", "OtherID"];
+ s = _Xp[$"Slave[@index='{SelectedSlave}']", "OtherID"];
return s;
}
set
{
if (SelectedSlave > 0)
- _Xp["Slave[@index='" + SelectedSlave.ToString() + "']", "OtherID"] = value; // save selected value
+ _Xp[$"Slave[@index='{SelectedSlave}']", "OtherID"] = value; // save selected value
else
_Xp["Unit", "OtherID"] = value;
OnPropertyChanged("Other_Unit_ID");
@@ -1678,13 +1544,13 @@ namespace VEPROMS.CSLA.Library
{
string s = GetCombinedSlaveValue("ProcedureNumber", null) ?? _Xp["Unit", "ProcedureNumber"];// get the saved value
if (SelectedSlave > 0)
- s = _Xp["Slave[@index='" + SelectedSlave.ToString() + "']", "ProcedureNumber"];
+ s = _Xp[$"Slave[@index='{SelectedSlave}']", "ProcedureNumber"];
return s;
}
set
{
if (SelectedSlave > 0)
- _Xp["Slave[@index='" + SelectedSlave.ToString() + "']", "ProcedureNumber"] = value; // save selected value
+ _Xp[$"Slave[@index='{SelectedSlave}']", "ProcedureNumber"] = value; // save selected value
else
_Xp["Unit", "ProcedureNumber"] = value;
OnPropertyChanged("Unit_ProcedureNumber");
@@ -1700,13 +1566,13 @@ namespace VEPROMS.CSLA.Library
{
string s = GetCombinedSlaveValue("SetName", null) ?? _Xp["ProcedureSet", "Name"];// get the saved value
if (SelectedSlave > 0)
- s = _Xp["Slave[@index='" + SelectedSlave.ToString() + "']", "SetName"];
+ s = _Xp[$"Slave[@index='{SelectedSlave}']", "SetName"];
return s;
}
set
{
if (SelectedSlave > 0)
- _Xp["Slave[@index='" + SelectedSlave.ToString() + "']", "SetName"] = value; // save selected value
+ _Xp[$"Slave[@index='{SelectedSlave}']", "SetName"] = value; // save selected value
else
_Xp["ProcedureSet", "Name"] = value;
OnPropertyChanged("Unit_ProcedureSetName");
@@ -1722,557 +1588,18 @@ namespace VEPROMS.CSLA.Library
{
string s = GetCombinedSlaveValue("SetID", null) ?? _Xp["ProcedureSet", "ID"];// get the saved value
if (SelectedSlave > 0)
- s = _Xp["Slave[@index='" + SelectedSlave.ToString() + "']", "SetID"];
+ s = _Xp[$"Slave[@index='{SelectedSlave}']", "SetID"];
return s;
}
set
{
if (SelectedSlave > 0)
- _Xp["Slave[@index='" + SelectedSlave.ToString() + "']", "SetID"] = value; // save selected value
+ _Xp[$"Slave[@index='{SelectedSlave}']", "SetID"] = value; // save selected value
else
_Xp["ProcedureSet", "ID"] = value;
OnPropertyChanged("Unit_ProcedureSetID");
}
}
- #endregion
- #region DELETE_ME
- /*
- #region ColorCategory // From veproms.ini
- // Note that not all possibilities from 16-bit will be added here, until
- // it is determined how these will be used
- [Category("Color")]
- [DisplayName("ro")]
- [RefreshProperties(RefreshProperties.All)]
- [Description("ro")]
- public string Color_ro
- {
- get
- {
- return _Xp["Color", "ro"];
- }
- set
- {
- _Xp["Color", "ro"] = value;
- OnPropertyChanged("Color_ro");
- }
- }
- [Category("Color")]
- [DisplayName("editbackground")]
- [RefreshProperties(RefreshProperties.All)]
- [Description("editbackground")]
- public string Color_editbackground
- {
- get
- {
- return _Xp["Color", "editbackground"];
- }
- set
- {
- _Xp["Color", "editbackground"] = value;
- OnPropertyChanged("Color_editbackground");
- }
- }
- [Category("Color")]
- [DisplayName("black")]
- [RefreshProperties(RefreshProperties.All)]
- [Description("black")]
- public string Color_black
- {
- get
- {
- return _Xp["Color", "black"];
- }
- set
- {
- _Xp["Color", "black"] = value;
- OnPropertyChanged("Color_black");
- }
- }
- [Category("Color")]
- [DisplayName("blue")]
- [RefreshProperties(RefreshProperties.All)]
- [Description("blue")]
- public string Color_blue
- {
- get
- {
- return _Xp["Color", "blue"];
- }
- set
- {
- _Xp["Color", "blue"] = value;
- OnPropertyChanged("Color_blue");
- }
- }
- #endregion // From veproms.ini
- #region SystemPrintCategory // From veproms.ini
- [Category("System Print")]
- [DisplayName("Underline Width")]
- [RefreshProperties(RefreshProperties.All)]
- [Description("Underline Width")]
- public int SysPrint_UWidth
- {
- get
- {
- string s = _Xp["SystemPrint", "UnderlineWidth"];
- if (s == string.Empty) return 10;
- return int.Parse(_Xp["SystemPrint", "UnderlineWidth"]);
- }
- set
- {
- _Xp["SystemPrint", "UnderlineWidth"] = value.ToString();
- OnPropertyChanged("SysPrint_UWidth");
- }
- }
- [Category("System Print")]
- [DisplayName("Vertical Offset")]
- [RefreshProperties(RefreshProperties.All)]
- [Description("Vertical Offset")]
- public int SysPrint_VOffset
- {
- get
- {
- string s = _Xp["SystemPrint", "VerticalOffset"];
- if (s == string.Empty) return 0;
- return int.Parse(_Xp["SystemPrint", "VerticalOffset"]);
- }
- set
- {
- _Xp["SystemPrint", "VerticalOffset"] = value.ToString();
- OnPropertyChanged("SysPrint_VOffset");
- }
- }
- [Category("System Print")]
- [DisplayName("Stroke Width")]
- [RefreshProperties(RefreshProperties.All)]
- [Description("Stroke Width")]
- public int SysPrint_StrokeWidth
- {
- get
- {
- string s = _Xp["SystemPrint", "StrokeWidth"];
- if (s == string.Empty) return 0;
- return int.Parse(_Xp["SystemPrint", "StrokeWidth"]);
- }
- set
- {
- _Xp["SystemPrint", "StrokeWidth"] = value.ToString();
- OnPropertyChanged("SysPrint_StrokeWidth");
- }
- }
- [Category("System Print")]
- [DisplayName("Stroke Width Bold")]
- [RefreshProperties(RefreshProperties.All)]
- [Description("Stroke Width Bold")]
- public int SysPrint_StrokeWidthBold
- {
- get
- {
- string s = _Xp["SystemPrint", "StrokeWidthBold"];
- if (s == string.Empty) return 0;
- return int.Parse(_Xp["SystemPrint", "StrokeWidthBold"]);
- }
- set
- {
- _Xp["SystemPrint", "StrokeWidthBold"] = value.ToString();
- OnPropertyChanged("SysPrint_StrokeWidthBold");
- }
- }
- #endregion
- #region StartupCategory // From veproms.ini
- [Category("Startup")]
- [DisplayName("Startup MessageBox Title")]
- [RefreshProperties(RefreshProperties.All)]
- [Description("Startup MessageBox Title")]
- public string Startup_MsgTitle
- {
- get
- {
- return _Xp["Startup", "MessageBoxTitle"];
- }
- set
- {
- _Xp["Startup", "MessageBoxTitle"] = value;
- OnPropertyChanged("Startup_MsgTitle");
- }
- }
- [Category("Startup")]
- [DisplayName("Startup Message File")]
- [RefreshProperties(RefreshProperties.All)]
- [Description("Startup Message File")]
- public string Startup_MsgFile
- {
- get
- {
- return _Xp["Startup", "MessageFile"];
- }
- set
- {
- _Xp["Startup", "MessageFile"] = value;
- OnPropertyChanged("Startup_MsgFile");
- }
- }
- #endregion
- #region ProcedureListTabStopsCategory // From veproms.ini
- [Category("ProcedureListTabStops")]
- [DisplayName("Procedure Number Tab")]
- [RefreshProperties(RefreshProperties.All)]
- [Description("Procedure Number Tab")]
- public int ProcListTab_Number
- {
- get
- {
- string s = _Xp["ProcedureListTabStops", "ProcedureNumberTab"];
- if (s == string.Empty) return 75;
- return int.Parse(_Xp["ProcedureListTabStops", "ProcedureNumberTab"]);
- }
- set
- {
- _Xp["ProcedureListTabStops", "ProcedureNumberTab"] = value.ToString();
- OnPropertyChanged("ProcListTab_Number");
- }
- }
- [Category("ProcedureListTabStops")]
- [DisplayName("Procedure Title Tab")]
- [RefreshProperties(RefreshProperties.All)]
- [Description("Procedure Title Tab")]
- public int ProcListTab_Title
- {
- get
- {
- string s = _Xp["ProcedureListTabStops", "ProcedureTitleTab"];
- if (s == string.Empty) return 175;
- return int.Parse(_Xp["ProcedureListTabStops", "ProcedureTitleTab"]);
- }
- set
- {
- _Xp["ProcedureListTabStops", "ProcedureTitleTab"] = value.ToString();
- OnPropertyChanged("ProcListTab_Title");
- }
- }
- #endregion
- #region FormatCategory
- public enum FormatColumns : int
- {
- Default=0,OneColumn,TwoColumn,ThreeColumn,FourColumns
- }
- [Category("Format")]
- [DisplayName("Column Layout")]
- [RefreshProperties(RefreshProperties.All)]
- [Description("Column Layout")]
- public FormatColumns Format_Columns
- {
- get
- {
- string s = _Xp["format", "columns"];
- if (s == string.Empty) return (FormatColumns)0;
- return (FormatColumns)int.Parse(_Xp["format", "columns"]);
- //return Enum.Parse(typeof(FormatColumns),_Xp["format", "columns"]);
- }
- set
- {
- if (value == 0) _Xp["format", "columns"] = string.Empty;
- else _Xp["format", "columns"] = ((int)value).ToString();
- OnPropertyChanged("Format_Columns");
- }
- }
- [Category("Format")]
- [DisplayName("Plant Format Name")]
- [RefreshProperties(RefreshProperties.All)]
- [Description("Default Plant Format")]
- public string Format_Plant
- {
- get
- { return _Xp["format", "plant"];
- }
- set
- {
- _Xp["format", "plant"] = value;
- OnPropertyChanged("Format_Plant");
- }
- }
- #endregion
- #region DefaultsCategory // from proc.ini
- [Category("Defaults")]
- [DisplayName("Default Setpoint Prefix")]
- [RefreshProperties(RefreshProperties.All)]
- [Description("Default Setpoint Prefix")]
- public string Default_SPPrefix
- {
- get { return _Xp["default", "spprefix"]; }
- set
- {
- _Xp["default", "spprefix"] = value;
- OnPropertyChanged("Default_SPPrefix");
- }
- }
- [Category("Defaults")]
- [DisplayName("Default Image Prefix")]
- [RefreshProperties(RefreshProperties.All)]
- [Description("Default Image Prefix")]
- public string Default_IMPrefix
- {
- get { return _Xp["default", "imprefix"]; }
- set
- {
- _Xp["default", "imprefix"] = value;
- OnPropertyChanged("RO_IMPrefix");
- }
- }
- #endregion
- #region PrintSettingsCategory // From curset.dat
- [Category("Print Settings")]
- [DisplayName("Number of Copies")]
- [RefreshProperties(RefreshProperties.All)]
- [Description("Number of Copies")]
- public int Print_NumCopies
- {
- get
- {
- string s = _Xp["PrintSettings", "numcopies"];
- if (s == string.Empty) return 1;
- return int.Parse(_Xp["PrintSettings", "numcopies"]);
- }
- set
- {
- _Xp["PrintSettings", "numcopies"] = value.ToString();
- OnPropertyChanged("Print_NumCopies");
- }
- }
- public enum PrintPagination : int
- {
- Free = 0, Fixed, Auto
- }
- [Category("Print Settings")]
- [DisplayName("Pagination")]
- [RefreshProperties(RefreshProperties.All)]
- [Description("Pagination")]
- public PrintPagination Print_Pagination
- {
- get
- {
- string s = _Xp["PrintSettings", "Pagination"];
- if (s == string.Empty) return PrintPagination.Auto;
- return (PrintPagination)int.Parse(_Xp["PrintSettings", "Pagination"]);
- }
- set
- {
- if (value == PrintPagination.Auto) _Xp["PrintSettings", "Pagination"] = string.Empty;
- else _Xp["PrintSettings", "Pagination"] = ((int)value).ToString();
- OnPropertyChanged("Print_Pagination");
- }
- }
- public enum PrintWatermark : int
- {
- None = 0, Reference, Draft, Master, Sample, InformationOnly
- }
- [Category("Print Settings")]
- [DisplayName("Watermark")]
- [RefreshProperties(RefreshProperties.All)]
- [Description("Watermark")]
- public PrintWatermark Print_Watermark
- {
- get
- {
- string s = _Xp["PrintSettings", "Watermark"];
- if (s == string.Empty) return PrintWatermark.Draft;
- return (PrintWatermark)int.Parse(_Xp["PrintSettings", "Watermark"]);
- }
- set
- {
- if (value == PrintWatermark.Draft) _Xp["PrintSettings", "Watermark"] = string.Empty;
- else _Xp["PrintSettings", "Watermark"] = ((int)value).ToString();
- OnPropertyChanged("Print_Watermark");
- }
- }
- [Category("Print Settings")]
- [DisplayName("Disable Duplex Printing")]
- [RefreshProperties(RefreshProperties.All)]
- [Description("Disable Duplex Printing")]
- public bool Print_DisableDuplex
- {
- get
- {
- string s = _Xp["PrintSettings", "disableduplex"];
- if (s == string.Empty) return false;
- return bool.Parse(_Xp["PrintSettings", "disableduplex"]);
- }
- set
- {
- _Xp["PrintSettings", "disableduplex"] = value.ToString();
- OnPropertyChanged("Print_DisableDuplex");
- }
- }
- // Change Bar Use from 16-bit code:
- // No Default
- // Without Change Bars
- // With Default Change Bars
- // With User Specified Change Bars
- public enum PrintChangeBar : int
- {
- NoDefault=0, Without, WithDefault, WithUserSpecified
- }
- [Category("Print Settings")]
- [DisplayName("Change Bar")]
- [RefreshProperties(RefreshProperties.All)]
- [Description("Change Bar Use")]
- public PrintChangeBar Print_ChangeBar
- {
- get
- {
- string s = _Xp["PrintSettings", "ChangeBar"];
- if (s == string.Empty) return PrintChangeBar.NoDefault;
- return (PrintChangeBar)int.Parse(_Xp["PrintSettings", "ChangeBar"]);
- }
- set
- {
- if (value == PrintChangeBar.NoDefault) _Xp["PrintSettings", "ChangeBar"] = string.Empty;
- else _Xp["PrintSettings", "ChangeBar"] = ((int)value).ToString();
- OnPropertyChanged("Print_ChangeBar");
- }
- }
- // User Specified Change Bar Location from16-bit code:
- // With Text
- // Outside Box
- // AER on LEFT, RNO on Right
- // To the Left of Text
- public enum PrintChangeBarLoc : int
- {
- WithText = 0, OutsideBox, AERleftRNOright, LeftOfText
- }
- [Category("Print Settings")]
- [DisplayName("Change Bar Location")]
- [RefreshProperties(RefreshProperties.All)]
- [Description("User Specified Change Bar Location")]
- public PrintChangeBarLoc Print_ChangeBarLoc
- {
- get
- {
- string s = _Xp["PrintSettings", "ChangeBarLoc"];
- if (s == string.Empty) return PrintChangeBarLoc.WithText;
- return (PrintChangeBarLoc)int.Parse(_Xp["PrintSettings", "ChangeBarLoc"]);
- }
- set
- {
- if (value == PrintChangeBarLoc.WithText) _Xp["PrintSettings", "ChangeBarLoc"] = string.Empty;
- else _Xp["PrintSettings", "ChangeBarLoc"] = ((int)value).ToString();
- OnPropertyChanged("Print_ChangeBarLoc");
- }
- }
-
- // Change Bar Text from16-bit code:
- // Date and Change ID
- // Revision Number
- // Change ID
- // No Change Bar Message
- // User Defined Message
- public enum PrintChangeBarText : int
- {
- DateChgID = 0, RevNum, ChgID, None, UserDef
- }
- [Category("Print Settings")]
- [DisplayName("Change Bar Text")]
- [RefreshProperties(RefreshProperties.All)]
- [Description("Change Bar Text")]
- public PrintChangeBarText Print_ChangeBarText
- {
- get
- {
- string s = _Xp["PrintSettings", "ChangeBarText"];
- if (s == string.Empty) return PrintChangeBarText.DateChgID;
- return (PrintChangeBarText)int.Parse(_Xp["PrintSettings", "ChangeBarText"]);
- }
- set
- {
- if (value == PrintChangeBarText.DateChgID) _Xp["PrintSettings", "ChangeBarText"] = string.Empty;
- else _Xp["PrintSettings", "ChangeBarText"] = ((int)value).ToString();
- OnPropertyChanged("Print_ChangeBarText");
- }
- }
-
- [Category("Print Settings")]
- [DisplayName("User Format")]
- [RefreshProperties(RefreshProperties.All)]
- [Description("User Format")]
- public string Print_UserFormat
- {
- get
- {
- return _Xp["PrintSettings", "userformat"];
- }
- set
- {
- _Xp["PrintSettings", "userformat"] = value;
- OnPropertyChanged("Print_UserFormat");
- }
- }
-
- [Category("Print Settings")]
- [DisplayName("User Change Bar Message1")]
- [RefreshProperties(RefreshProperties.All)]
- [Description("User Change Bar Message1")]
- public string Print_UserCBMess1
- {
- get
- {
- return _Xp["PrintSettings", "usercbmess1"];
- }
- set
- {
- _Xp["PrintSettings", "usercbmess1"] = value;
- OnPropertyChanged("Print_UserCBMess1");
- }
- }
-
- [Category("Print Settings")]
- [DisplayName("User Change Bar Message2")]
- [RefreshProperties(RefreshProperties.All)]
- [Description("User Change Bar Message2")]
- public string Print_UserCBMess2
- {
- get
- {
- return _Xp["PrintSettings", "usercbmess2"];
- }
- set
- {
- _Xp["PrintSettings", "usercbmess2"] = value;
- OnPropertyChanged("Print_UserCBMess2");
- }
- }
- #endregion
-[Category("Defaults")]
-[DisplayName("Default BackColor")]
-[RefreshProperties(RefreshProperties.All)]
-[Description("Default Background Color")]
-public Color Default_BkColor
-{
-get
-{
-//return _Xp["default", "BkColor"];
-string sColor = _Xp["default", "BkColor"];
-if (sColor == string.Empty) sColor = "White";
-if (sColor[0] == '[')
-{
-string[] parts = sColor.Substring(1, sColor.Length - 2).Split(",".ToCharArray());
-return Color.FromArgb(Int32.Parse(parts[0]), Int32.Parse(parts[1]), Int32.Parse(parts[2]));
-}
-else return Color.FromName(sColor);
-}
-set
-{
-if (value.IsNamedColor) _Xp["default", "BkColor"] = value.Name;
-else
-{
-_Xp["default", "BkColor"] = string.Format("[{0},{1},{2}]", value.R, value.G, value.B);
-}
-OnPropertyChanged("Default_BkColor");
-
-}
-}
-}
-}
-*/
#endregion
#region Slave
public void AddSlave(string xml)
@@ -2281,16 +1608,16 @@ OnPropertyChanged("Default_BkColor");
xd.LoadXml(xml);
XmlNode pn = _Xp.XmlContents.SelectSingleNode("//Slaves");
XmlNode nn = _Xp.XmlContents.ImportNode(xd.DocumentElement, true);
- if (pn == null)
- {
- pn = _Xp.XmlContents.CreateElement("Slaves");
- _Xp.XmlContents.DocumentElement.AppendChild(pn);
- }
+ if (pn == null)
+ {
+ pn = _Xp.XmlContents.CreateElement("Slaves");
+ _Xp.XmlContents.DocumentElement.AppendChild(pn);
+ }
pn.AppendChild(nn);
}
public void RemoveSlave(int index)
{
- XmlNode dd = _Xp.XmlContents.SelectSingleNode("//Slave[@index='" + index.ToString() + "']");
+ XmlNode dd = _Xp.XmlContents.SelectSingleNode($"//Slave[@index='{index}']");
dd?.ParentNode?.RemoveChild(dd);
}
public int MaxSlaveIndex
@@ -2315,22 +1642,19 @@ OnPropertyChanged("Default_BkColor");
foreach (XmlNode nd in nl)
{
string ss = nd.Attributes.GetNamedItem("index").InnerText;
- s += sep + _Xp["Slave[@index='" + ss + "']", item];
+ s += $"{sep}{_Xp[$"Slave[@index='{ss}']", item]}";
sep = ",";
}
return s;
}
return defaultValue;
}
- private string GetCombinedSlaveValue(string item)
- {
- return GetCombinedSlaveValue(item, "0");
- }
- //end added by jcb to fix master issue byron/braidwood
- #endregion
- #region Enhanced
- // C2019-045: For enhanced procedures, allow modifications of number & text.
- [Category("Enhanced Settings")]
+ private string GetCombinedSlaveValue(string item) => GetCombinedSlaveValue(item, "0");
+ //end added by jcb to fix master issue byron/braidwood
+ #endregion
+ #region Enhanced
+ // C2019-045: For enhanced procedures, allow modifications of number & text.
+ [Category("Enhanced Settings")]
[Browsable(false)]
[DisplayName("AllowMods")]
[RefreshProperties(RefreshProperties.All)]
diff --git a/PROMS/VEPROMS.CSLA.Library/Config/DocumentConfig.cs b/PROMS/VEPROMS.CSLA.Library/Config/DocumentConfig.cs
index 49a88a0e..b6cab99f 100644
--- a/PROMS/VEPROMS.CSLA.Library/Config/DocumentConfig.cs
+++ b/PROMS/VEPROMS.CSLA.Library/Config/DocumentConfig.cs
@@ -1,9 +1,5 @@
using System;
-using System.Collections.Generic;
-using System.Text;
using System.ComponentModel;
-using System.Drawing;
-using System.Text.RegularExpressions;
namespace VEPROMS.CSLA.Library
{
@@ -12,15 +8,11 @@ namespace VEPROMS.CSLA.Library
public class DocumentConfig : ConfigDynamicTypeDescriptor, INotifyPropertyChanged
{
#region XML
- private XMLProperties _Xp;
- private XMLProperties Xp
- {
- get { return _Xp; }
- }
+ private readonly XMLProperties _Xp;
#endregion
#region Constructors
public Document _Document;
- private DocumentInfo _DocumentInfo;
+ private readonly DocumentInfo _DocumentInfo;
public DocumentConfig(Document document)
{
_Document = document;
@@ -35,13 +27,10 @@ namespace VEPROMS.CSLA.Library
if (xml == string.Empty) xml = "";
_Xp = new XMLProperties(xml);
}
- internal string GetValue(string group, string item)
- {
- return _Xp[group, item];
- }
- #endregion
- #region Properties
- [Category("General")]
+ internal string GetValue(string group, string item) => _Xp[group, item];
+ #endregion
+ #region Properties
+ [Category("General")]
[DisplayName("Name")]
[Description("Name")]
public string Name
@@ -100,48 +89,13 @@ namespace VEPROMS.CSLA.Library
OnPropertyChanged("History_OriginalFileName");
}
}
- // RHM 20110415 - These are now stored in the PDF table.
- //[Category("Printing")]
- //[DisplayName("Length")]
- //[Description("Length of Document in Full and Partial Pages")]
- //public float Printing_Length
- //{
- // get
- // {
- // string s = _Xp["Printing", "Length"];// get the saved value
-
- // return float.Parse(s);
- // }
- // set
- // {
- // _Xp["Printing", "Length"] = string.Format("{0:0.0000}", value);
- // OnPropertyChanged("Printing_Length");
- // }
- //}
- //[Category("Printing")]
- //[DisplayName("Color")]
- //[Description("Color of Document Text")]
- //public Color Printing_Color
- //{
- // get
- // {
- // string sColor = _Xp["Printing", "Color"];
- // return ColorConfig.ColorFromString(sColor);
- // }
- // set
- // {
- // _Xp["Printing", "Color"] = value.ToString();
- // OnPropertyChanged("Printing_Color");
- // }
- //}
#endregion
#region ToString
public override string ToString()
{
string s = _Xp.ToString();
- if (s == "" || s == "") return string.Empty;
- return s;
- }
- #endregion
- }
+ return s == "" || s == "" ? string.Empty : s;
+ }
+ #endregion
+ }
}
diff --git a/PROMS/VEPROMS.CSLA.Library/Config/DynamicProperties.cs b/PROMS/VEPROMS.CSLA.Library/Config/DynamicProperties.cs
index 61bc8b2c..c755a75d 100644
--- a/PROMS/VEPROMS.CSLA.Library/Config/DynamicProperties.cs
+++ b/PROMS/VEPROMS.CSLA.Library/Config/DynamicProperties.cs
@@ -1,17 +1,13 @@
using System;
-using System.Collections.Generic;
-using System.Text;
using System.ComponentModel;
-using System.Xml;
using System.Xml.Serialization;
-using System.Xml.Schema;
namespace VEPROMS.CSLA.Library
{
public class DynamicPropertyDescriptor : PropertyDescriptor
{
- private PropertyDescriptor _BasePropertyDescriptor;
- private ConfigDynamicTypeDescriptor _Instance;
+ private readonly PropertyDescriptor _BasePropertyDescriptor;
+ private readonly ConfigDynamicTypeDescriptor _Instance;
public DynamicPropertyDescriptor(ConfigDynamicTypeDescriptor instance, PropertyDescriptor basePropertyDescriptor)
: base(basePropertyDescriptor)
@@ -37,16 +33,15 @@ namespace VEPROMS.CSLA.Library
{ _BasePropertyDescriptor.SetValue(component, value); }
}
[Serializable()]
- public class ConfigDynamicTypeDescriptor //: ICustomTypeDescriptor//, ISupportInitialize
+ public class ConfigDynamicTypeDescriptor
{
#region Events
public event PropertyChangedEventHandler PropertyChanged;
protected void OnPropertyChanged(String info)
{
_IsDirty = true;
- if (PropertyChanged != null)
- PropertyChanged(this, new PropertyChangedEventArgs(info));
- }
+ PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(info));
+ }
[NonSerialized]
private bool _IsDirty = false;
[XmlIgnore]
@@ -57,54 +52,11 @@ namespace VEPROMS.CSLA.Library
set { _IsDirty = value; }
}
#endregion
- [NonSerialized]
- private PropertyDescriptorCollection dynamicProps;
private bool _IsReadOnly = false;
internal virtual bool IsReadOnly
{
get { return _IsReadOnly; }
set { _IsReadOnly = value; }
}
- public ConfigDynamicTypeDescriptor() { }
- #region "TypeDescriptor Implementation"
- public String GetClassName()
- { return TypeDescriptor.GetClassName(this, true); }
- public AttributeCollection GetAttributes()
- { return TypeDescriptor.GetAttributes(this, true); }
- public String GetComponentName()
- { return TypeDescriptor.GetComponentName(this, true); }
- public TypeConverter GetConverter()
- { return TypeDescriptor.GetConverter(this, true); }
- public EventDescriptor GetDefaultEvent()
- { return TypeDescriptor.GetDefaultEvent(this, true); }
- public PropertyDescriptor GetDefaultProperty()
- { return TypeDescriptor.GetDefaultProperty(this, true); }
- public object GetEditor(Type editorBaseType)
- { return TypeDescriptor.GetEditor(this, editorBaseType, true); }
- public EventDescriptorCollection GetEvents(Attribute[] attributes)
- { return TypeDescriptor.GetEvents(this, attributes, true); }
- public EventDescriptorCollection GetEvents()
- { return TypeDescriptor.GetEvents(this, true); }
- public PropertyDescriptorCollection GetProperties(Attribute[] attributes)
- {
- return GetProperties();
- }
- public PropertyDescriptorCollection GetProperties()
- {
- if (dynamicProps == null)
- {
- PropertyDescriptorCollection baseProps = TypeDescriptor.GetProperties(this, true);
- dynamicProps = new PropertyDescriptorCollection(null);
-
- foreach (PropertyDescriptor oProp in baseProps)
- {
- dynamicProps.Add(new DynamicPropertyDescriptor(this, oProp));
- }
- }
- return dynamicProps;
- }
- public object GetPropertyOwner(PropertyDescriptor pd)
- { return this; }
- #endregion
}
}
diff --git a/PROMS/VEPROMS.CSLA.Library/Config/EnumDescConverter.cs b/PROMS/VEPROMS.CSLA.Library/Config/EnumDescConverter.cs
index cd05d4a7..ec3a5715 100644
--- a/PROMS/VEPROMS.CSLA.Library/Config/EnumDescConverter.cs
+++ b/PROMS/VEPROMS.CSLA.Library/Config/EnumDescConverter.cs
@@ -13,8 +13,6 @@
using System;
using System.ComponentModel;
-using System.Drawing;
-using System.Drawing.Design;
using System.Reflection;
using System.Collections;
using System.Data;
@@ -97,26 +95,26 @@ namespace DescriptiveEnum
public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destinationType)
{
- if(value is Enum && destinationType == typeof(string))
+ if(value is Enum myenum && destinationType == typeof(string))
{
- return EnumDescConverter.GetEnumDescription((Enum)value);
+ return EnumDescConverter.GetEnumDescription(myenum);
}
- if(value is string && destinationType == typeof(string))
+ if(value is string mystr && destinationType == typeof(string))
{
- return EnumDescConverter.GetEnumDescription(myVal, (string)value);
+ return EnumDescConverter.GetEnumDescription(myVal, mystr);
}
return base.ConvertTo (context, culture, value, destinationType);
}
public override object ConvertFrom(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value)
{
- if(value is string)
+ if(value is string mystr)
{
- return EnumDescConverter.GetEnumValue(myVal, (string)value);
+ return EnumDescConverter.GetEnumValue(myVal, mystr);
}
- if(value is Enum)
+ if(value is Enum myenum)
{
- return EnumDescConverter.GetEnumDescription((Enum)value);
+ return EnumDescConverter.GetEnumDescription(myenum);
}
return base.ConvertFrom (context, culture, value);
}
@@ -125,7 +123,8 @@ namespace DescriptiveEnum
return true;
}
- public override TypeConverter.StandardValuesCollection GetStandardValues(ITypeDescriptorContext context)
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE0059:Unnecessary assignment of a value", Justification = "Keeping attributes for future extensions")]
+ public override TypeConverter.StandardValuesCollection GetStandardValues(ITypeDescriptorContext context)
{
ArrayList values = new ArrayList();
FieldInfo[] fis = myVal.GetFields();
@@ -133,7 +132,6 @@ namespace DescriptiveEnum
{
DescriptionAttribute[] attributes =(DescriptionAttribute[])fi.GetCustomAttributes(
typeof(DescriptionAttribute), false);
- //if (attributes.Length > 0)
if (fi.Name != "value__")
values.Add(fi.GetValue(fi.Name));
}
diff --git a/PROMS/VEPROMS.CSLA.Library/Config/EnumDetail.cs b/PROMS/VEPROMS.CSLA.Library/Config/EnumDetail.cs
index d983be55..4e31f1ca 100644
--- a/PROMS/VEPROMS.CSLA.Library/Config/EnumDetail.cs
+++ b/PROMS/VEPROMS.CSLA.Library/Config/EnumDetail.cs
@@ -1,6 +1,4 @@
using System;
-using System.Collections.Generic;
-using System.Text;
using System.Reflection;
using System.ComponentModel;
@@ -8,23 +6,13 @@ namespace VEPROMS.CSLA.Library
{
public class EnumDetail
{
- private T _EValue;
- public T EValue
- {
- get { return _EValue; }
- set { _EValue = value; }
- }
- private string _Name;
+ public T EValue { get; set; }
- public string Name
+ public string Name { get; set; }
+ public EnumDetail(string name, T eValue)
{
- get { return _Name; }
- set { _Name = value; }
- }
- public EnumDetail(string name, T eValue)
- {
- _Name = name;
- _EValue = eValue;
+ Name = name;
+ EValue = eValue;
}
public static EnumDetail[] Details()
{
diff --git a/PROMS/VEPROMS.CSLA.Library/Config/FolderConfig.cs b/PROMS/VEPROMS.CSLA.Library/Config/FolderConfig.cs
index 940b84d4..270ce63b 100644
--- a/PROMS/VEPROMS.CSLA.Library/Config/FolderConfig.cs
+++ b/PROMS/VEPROMS.CSLA.Library/Config/FolderConfig.cs
@@ -1,29 +1,18 @@
using System;
-using System.Collections.Generic;
-using System.Text;
using System.ComponentModel;
using System.Drawing;
-using DescriptiveEnum;
namespace VEPROMS.CSLA.Library
{
[Serializable]
[TypeConverter(typeof(ExpandableObjectConverter))]
- //public class FolderConfig : INotifyPropertyChanged
public class FolderConfig : ConfigDynamicTypeDescriptor, INotifyPropertyChanged
{
- #region DynamicTypeDescriptor
- internal override bool IsReadOnly
- {
- get { return _Folder == null; }
- }
- #endregion
- #region XML
- private XMLProperties _Xp;
- private XMLProperties Xp
- {
- get { return _Xp; }
- }
+ #region DynamicTypeDescriptor
+ internal override bool IsReadOnly => _Folder == null;
+ #endregion
+ #region XML
+ private readonly XMLProperties _Xp;
#endregion
#region Constructors
//PROPGRID: Hide ParentLookup
@@ -33,19 +22,8 @@ namespace VEPROMS.CSLA.Library
get { return _Xp.ParentLookup; }
set { _Xp.ParentLookup = value; }
}
- //PROPGRID: Hide AncestorLookup
- //PROPGRID: Needed to comment out [NonSerialized] in order to hide this field from the property grid
- //[NonSerialized]
- //[Browsable(false)]
- //private bool _AncestorLookup;
- //[Browsable(false)]
- //public bool AncestorLookup
- //{
- // get { return _AncestorLookup; }
- // set { _AncestorLookup = value; }
- //}
- private Folder _Folder;
- private FolderInfo _FolderInfo;
+ private readonly Folder _Folder;
+ private readonly FolderInfo _FolderInfo;
public FolderConfig(Folder folder)
{
_Folder = folder;
@@ -75,18 +53,6 @@ namespace VEPROMS.CSLA.Library
return false;
}
}
- //private string Xp_LookInAncestorFolderInfo(object sender, XMLPropertiesArgs args)
- //{
- // if (args.AncestorLookup || ParentLookup)
- // {
- // for (FolderInfo folder = _FolderInfo.MyParent; folder != null; folder = folder.MyParent)
- // {
- // string retval = folder.FolderConfig.GetValue(args.Group, args.Item);
- // if (retval != string.Empty) return retval;
- // }
- // }
- // return string.Empty;
- //}
public FolderConfig(FolderInfo folderInfo)
{
_FolderInfo = folderInfo;
@@ -100,21 +66,12 @@ namespace VEPROMS.CSLA.Library
if (xml == string.Empty) xml = "";
_Xp = new XMLProperties(xml);
}
- public FolderConfig()
- {
- _Xp = new XMLProperties("");
- }
- public string GetValue(string group, string item)
- {
- return _Xp[group, item];
- }
- public void SetValue(string group, string item, string newvalue)
- {
- _Xp[group, item] = newvalue;
- }
- #endregion
- #region Local Properties
- [Category("General")]
+ public FolderConfig() => _Xp = new XMLProperties("");
+ public string GetValue(string group, string item) => _Xp[group, item];
+ public void SetValue(string group, string item, string newvalue) => _Xp[group, item] = newvalue;
+ #endregion
+ #region Local Properties
+ [Category("General")]
[DisplayName("Name")]
[Description("Name")]
public string Name
@@ -189,7 +146,6 @@ namespace VEPROMS.CSLA.Library
if (_Folder != null)
{
_Folder.MyFormat = FormatList.ToFormat(value);
- //_Folder.ActiveFormat = null;
}
}
}
@@ -206,24 +162,17 @@ namespace VEPROMS.CSLA.Library
return null;
}
}
- public Folder MyFolder
- { get { return _Folder; } }
- public FolderInfo MyFolderInfo
- { get { return _FolderInfo; } }
- #endregion
- #region ToString
- public override string ToString()
+ public Folder MyFolder => _Folder;
+ public FolderInfo MyFolderInfo => _FolderInfo;
+ #endregion
+ #region ToString
+ public override string ToString()
{
string s = _Xp.ToString();
- if (s == "" || s == "") return string.Empty;
- return s;
- }
- #endregion
- #region GraphicsCategory // From veproms.ini
- public bool CanWrite(string str)
- {
- return true;
- }
+ return s == "" || s == "" ? string.Empty : s;
+ }
+ #endregion
+ #region GraphicsCategory // From veproms.ini
[Category("Referenced Objects")]
[DisplayName("Graphic File Extension")]
[RefreshProperties(RefreshProperties.All)]
@@ -304,103 +253,6 @@ namespace VEPROMS.CSLA.Library
}
}
#endregion
- //#region ColorCategory // From veproms.ini
- //// ** Note that not all possibilities from 16-bit will be added here, until
- //// ** it is determined how these will be used
- //// ** If this is used (unhidden), then we need to add logic to blank setting if the value
- //// ** we are saving is the same as the parent's value.
-
- ////PROPGRID: Hide Editor Color for ROs
- //[Category("Editor Settings")]
- //[Browsable(false)]
- //[DisplayName("Step Editor Colors - Referenced Objects")]
- //[RefreshProperties(RefreshProperties.All)]
- //[Description("Color used to highlight an RO in procedure text")]
- //public string Color_ro
- //{
- // get
- // {
- // return _Xp["Color", "ro"];
- // }
- // set
- // {
- // _Xp["Color", "ro"] = value;
- // OnPropertyChanged("Color_ro");
- // }
- //}
- ////PROPGRID: Hide Editor Color for Transitions
- //[Category("Editor Settings")]
- //[Browsable(false)]
- //[DisplayName("Step Editor Colors - Transitions")]
- //[RefreshProperties(RefreshProperties.All)]
- //[Description("Color used to highlight a Transition in procedure text")]
- //public string Color_transition
- //{
- // get
- // {
- // return _Xp["Color", "transition"];
- // }
- // set
- // {
- // _Xp["Color", "transition"] = value;
- // OnPropertyChanged("Color_transition");
- // }
- //}
- ////PROPGRID: Hide Active Text Background Color
- //[Category("Editor Settings")]
- //[Browsable(false)]
- //[DisplayName("Step Editor Colors - Active Background")]
- //[RefreshProperties(RefreshProperties.All)]
- //[Description("editbackground")]
- //public string Color_editbackground
- //{
- // get
- // {
- // return _Xp["Color", "editbackground"];
- // }
- // set
- // {
- // _Xp["Color", "editbackground"] = value;
- // OnPropertyChanged("Color_editbackground");
- // }
- //}
- ////PROPGRID: Hide color setting for Black
- //[Category("Color")]
- //[Browsable(false)]
- //[DisplayName("black")]
- //[RefreshProperties(RefreshProperties.All)]
- //[Description("black")]
- //public string Color_black
- //{
- // get
- // {
- // return _Xp["Color", "black"];
- // }
- // set
- // {
- // _Xp["Color", "black"] = value;
- // OnPropertyChanged("Color_black");
- // }
- //}
- ////PROPGRID: Hide Color Setting for Blue
- //[Category("Color")]
- //[Browsable(false)]
- //[DisplayName("blue")]
- //[RefreshProperties(RefreshProperties.All)]
- //[Description("blue")]
- //public string Color_blue
- //{
- // get
- // {
- // return _Xp["Color", "blue"];
- // }
- // set
- // {
- // _Xp["Color", "blue"] = value;
- // OnPropertyChanged("Color_blue");
- // }
- //}
- //#endregion // From veproms.ini
#region SystemPrintCategory // From veproms.ini
[Category("Print Settings")]
[DisplayName("Override Underline Thickness (dots)")]
@@ -635,20 +487,6 @@ namespace VEPROMS.CSLA.Library
}
#endregion
#region FormatCategory
- //[TypeConverter(typeof(EnumDescConverter))]
- //public enum FormatColumns : int
- //{
- // [Description("Format Default")]
- // Default = 0,
- // [Description("Single Column")]
- // OneColumn,
- // [Description("Dual Column")]
- // TwoColumn,
- // [Description("Triple Column")]
- // ThreeColumn,
- // [Description("Quad Column")]
- // FourColumns
- //}
[Category("Editor Settings")]
[DisplayName("Step Editor Columns")]
[RefreshProperties(RefreshProperties.All)]
@@ -726,10 +564,6 @@ namespace VEPROMS.CSLA.Library
OnPropertyChanged("Print_NumCopies");
}
}
- //public enum PrintPagination : int
- //{
- // Free = 0, Fixed, Auto
- //}
[Category("Print Settings")]
[DisplayName("Pagination")]
[RefreshProperties(RefreshProperties.All)]
@@ -767,13 +601,6 @@ namespace VEPROMS.CSLA.Library
OnPropertyChanged("Print_Pagination");
}
}
- //[TypeConverter(typeof(EnumDescConverter))]
- //public enum PrintWatermark : int
- //{
- // None = 0, Reference, Draft, Master, Sample,
- // [Description("Information Only")]
- // InformationOnly
- //}
[Category("Print Settings")]
[DisplayName("Watermark")]
@@ -812,23 +639,6 @@ namespace VEPROMS.CSLA.Library
OnPropertyChanged("Print_Watermark");
}
}
- // Change Bar Use from 16-bit code:
- // No Default
- // Without Change Bars
- // With Default Change Bars
- // With User Specified Change Bars
- //[TypeConverter(typeof(EnumDescConverter))]
- //public enum PrintChangeBar : int
- //{
- // [Description("Select Before Printing")]
- // SelectBeforePrinting = 0,
- // [Description("Without Change Bars")]
- // Without,
- // [Description("With Default Change Bars")]
- // WithDefault,
- // [Description("Use Custom Change Bars")]
- // WithUserSpecified
- //}
[Category("Format Settings")]
[DisplayName("Change Bar")]
[RefreshProperties(RefreshProperties.All)]
@@ -866,24 +676,6 @@ namespace VEPROMS.CSLA.Library
OnPropertyChanged("Print_ChangeBar");
}
}
- // User Specified Change Bar Location from16-bit code:
- // With Text
- // Outside Box
- // AER on LEFT, RNO on Right
- // To the Left of Text
- //[TypeConverter(typeof(EnumDescConverter))]
- //public enum PrintChangeBarLoc : int
- //{
- // [Description("With Text")]
- // WithText = 0,
- // [Description("Outside Box")]
- // OutsideBox,
- // [Description("AER on Left RNO on Right")]
- // AERleftRNOright,
- // [Description("To the Left of the Text")]
- // LeftOfText
- //}
-
[Category("Format Settings")]
[DisplayName("Change Bar Position")]
[RefreshProperties(RefreshProperties.All)]
@@ -922,26 +714,6 @@ namespace VEPROMS.CSLA.Library
}
}
- // Change Bar Text from16-bit code:
- // Date and Change ID
- // Revision Number
- // Change ID
- // No Change Bar Message
- // User Defined Message
- //[TypeConverter(typeof(EnumDescConverter))]
- //public enum PrintChangeBarText : int
- //{
- // [Description("Date and Change ID")]
- // DateChgID = 0,
- // [Description("Revision Number")]
- // RevNum,
- // [Description("Change ID")]
- // ChgID,
- // [Description("No Change Bar Text")]
- // None,
- // [Description("Custom Change Bar Text")]
- // UserDef
- //}
[Category("Format Settings")]
[DisplayName("Change bar Text Type")]
[RefreshProperties(RefreshProperties.All)]
diff --git a/PROMS/VEPROMS.CSLA.Library/Config/FormatConfig.cs b/PROMS/VEPROMS.CSLA.Library/Config/FormatConfig.cs
index d5617806..30707a17 100644
--- a/PROMS/VEPROMS.CSLA.Library/Config/FormatConfig.cs
+++ b/PROMS/VEPROMS.CSLA.Library/Config/FormatConfig.cs
@@ -1,15 +1,10 @@
using System;
using System.Collections.Generic;
-using System.Collections.ObjectModel;
-using System.Text;
using System.ComponentModel;
-using DescriptiveEnum;
using System.Xml;
using System.Xml.Serialization;
using System.Xml.Schema;
-using System.Windows.Forms;
using Volian.Base.Library;
-using System.Drawing;
namespace VEPROMS.CSLA.Library
{
@@ -28,13 +23,6 @@ namespace VEPROMS.CSLA.Library
get { return false; }
}
#endregion
- #region XML
- private XMLProperties _Xp;
- private XMLProperties Xp
- {
- get { return _Xp; }
- }
- #endregion
#region Attributes
[XmlAttribute("Name")]
private string _Name;
@@ -69,27 +57,14 @@ namespace VEPROMS.CSLA.Library
}
#endregion Elements
#region Constructors
- private Format _Format;
- private FormatInfo _FormatInfo;
- public FormatConfig(string xml)
- {
- if (xml == string.Empty) xml = "";
- }
- public FormatConfig(FormatInfo fi)
- {
- _FormatInfo = fi;
- }
- public FormatConfig(Format f)
- {
- _Format = f;
- }
- public FormatConfig()
- {
- PlantFormat = new PlantFormatx();
- }
- #endregion Constructors
- #region Serialize
- public string ConvertToString()
+ private readonly Format _Format;
+ private readonly FormatInfo _FormatInfo;
+ public FormatConfig(FormatInfo fi) => _FormatInfo = fi;
+ public FormatConfig(Format f) => _Format = f;
+ public FormatConfig() => PlantFormat = new PlantFormatx();
+ #endregion Constructors
+ #region Serialize
+ public string ConvertToString()
{
return GenericSerializer.StringSerialize(this);
}
@@ -131,11 +106,8 @@ namespace VEPROMS.CSLA.Library
{
}
- public override string ToString()
- {
- return "Plant Format";
- }
- }
+ public override string ToString() => "Plant Format";
+ }
#endregion PlantFormat
#region FormatData
// FormatData maps to the PlantFormat/Format data and contains properties & data objects that are implemented for the user to
@@ -202,11 +174,8 @@ namespace VEPROMS.CSLA.Library
{
ReplaceStrData = new ReplaceStrData();
}
- public override string ToString()
- {
- return "Format Data";
- }
- }
+ public override string ToString() => "Format Data";
+ }
#endregion FormatData
#region Flags
[Serializable]
@@ -242,27 +211,15 @@ namespace VEPROMS.CSLA.Library
[Editor(typeof(PropGridCollEditor), typeof(System.Drawing.Design.UITypeEditor))]
public class ReplaceStrData : List
{
- [Browsable(false)]
- public int Capacity { get { return base.Capacity; } }
- [Browsable(false)]
- public int Count { get { return base.Count; } }
- public ReplaceStr this[int index]
- {
- get { return (ReplaceStr)base[index]; }
- }
- public string ConvertToString()
- {
- return GenericSerializer.StringSerialize(this);
- }
- public override string ToString()
- {
- return "Replace Words List Count = " + base.Count.ToString();
- }
- public static ReplaceStrData Get(string xml)
- {
- return GenericSerializer.StringDeserialize(xml);
- }
- }
+ [Browsable(false)]
+ public new int Capacity => base.Capacity;
+ [Browsable(false)]
+ public new int Count => base.Count;
+ public new ReplaceStr this[int index] => (ReplaceStr)base[index];
+ public string ConvertToString() => GenericSerializer.StringSerialize(this);
+ public override string ToString() => $"Replace Words List Count = {base.Count}";
+ public static ReplaceStrData Get(string xml) => GenericSerializer.StringDeserialize(xml);
+ }
#endregion ReplaceStrData
#region ReplaceStr
@@ -303,19 +260,10 @@ namespace VEPROMS.CSLA.Library
public ReplaceStr()
{
}
- public string ConvertToString()
- {
- return GenericSerializer.StringSerialize(this);
- }
- public override string ToString()
- {
- return ReplaceWord;
- }
- public static ReplaceStr Get(string xml)
- {
- return GenericSerializer.StringDeserialize(xml);
- }
- }
+ public string ConvertToString() => GenericSerializer.StringSerialize(this);
+ public override string ToString() => ReplaceWord;
+ public static ReplaceStr Get(string xml) => GenericSerializer.StringDeserialize(xml);
+ }
#endregion ReplaceStr
#region CheckOffHeaders (list)
[Serializable]
@@ -323,23 +271,14 @@ namespace VEPROMS.CSLA.Library
[Editor(typeof(PropGridCollEditor), typeof(System.Drawing.Design.UITypeEditor))]
public class CheckOffHeaderList : List
{
- [Browsable(false)]
- public int Capacity { get { return base.Capacity; } }
- [Browsable(false)]
- public int Count { get { return base.Count; } }
- public CheckOffHeader this[int index]
- {
- get { return (CheckOffHeader)base[index]; }
- }
- public string ConvertToString()
- {
- return GenericSerializer.StringSerialize(this);
- }
- public override string ToString()
- {
- return "CheckOffHeader Count = " + base.Count.ToString();
- }
- }
+ [Browsable(false)]
+ public new int Capacity => base.Capacity;
+ [Browsable(false)]
+ public new int Count { get { return base.Count; } }
+ public new CheckOffHeader this[int index] => (CheckOffHeader)base[index];
+ public string ConvertToString() => GenericSerializer.StringSerialize(this);
+ public override string ToString() => $"CheckOffHeader Count = {base.Count}";
+ }
#endregion CheckOffHeaders
#region CheckOffHeader
[Serializable]
@@ -382,15 +321,9 @@ namespace VEPROMS.CSLA.Library
public CheckOffHeader()
{
}
- public string ConvertToString()
- {
- return GenericSerializer.StringSerialize(this);
- }
- public override string ToString()
- {
- return CheckOffHeading;
- }
- }
+ public string ConvertToString() => GenericSerializer.StringSerialize(this);
+ public override string ToString() => CheckOffHeading;
+ }
#endregion CheckOffHeader
#region CheckOffs (list)
[Serializable]
@@ -399,22 +332,13 @@ namespace VEPROMS.CSLA.Library
public class CheckOffList : List
{
[Browsable(false)]
- public int Capacity { get { return base.Capacity; } }
+ public new int Capacity { get { return base.Capacity; } }
[Browsable(false)]
- public int Count { get { return base.Count; } }
- public CheckOff this[int index]
- {
- get { return (CheckOff)base[index]; }
- }
- public string ConvertToString()
- {
- return GenericSerializer.StringSerialize(this);
- }
- public override string ToString()
- {
- return "CheckOff Count = " + base.Count.ToString();
- }
- }
+ public new int Count { get { return base.Count; } }
+ public new CheckOff this[int index] => (CheckOff)base[index];
+ public string ConvertToString() => GenericSerializer.StringSerialize(this);
+ public override string ToString() => $"CheckOff Count = {base.Count}";
+ }
#endregion CheckOffs
#region CheckOff
[Serializable]
@@ -457,15 +381,9 @@ namespace VEPROMS.CSLA.Library
public CheckOff()
{
}
- public string ConvertToString()
- {
- return GenericSerializer.StringSerialize(this);
- }
- public override string ToString()
- {
- return MenuItem;
- }
- }
+ public string ConvertToString() => GenericSerializer.StringSerialize(this);
+ public override string ToString() => MenuItem;
+ }
#endregion CheckOff
#region ShwRplWds
[Serializable]
@@ -508,15 +426,9 @@ namespace VEPROMS.CSLA.Library
public ShwRplWds()
{
}
- public string ConvertToString()
- {
- return GenericSerializer.StringSerialize(this);
- }
- public override string ToString()
- {
- return MenuItem;
- }
- }
+ public string ConvertToString() => GenericSerializer.StringSerialize(this);
+ public override string ToString() => MenuItem;
+ }
#endregion ShwRplWds
#region StepData (list)
[Serializable]
@@ -525,26 +437,14 @@ namespace VEPROMS.CSLA.Library
public class StepData : List
{
[Browsable(false)]
- public int Capacity { get { return base.Capacity; } }
+ public new int Capacity { get { return base.Capacity; } }
[Browsable(false)]
- public int Count { get { return base.Count; } }
- public Step this[int index]
- {
- get { return (Step)base[index]; }
- }
- public string ConvertToString()
- {
- return GenericSerializer.StringSerialize(this);
- }
- public override string ToString()
- {
- return "Step Count = " + base.Count.ToString();
- }
- public static StepData Get(string xml)
- {
- return GenericSerializer.StringDeserialize(xml);
- }
- }
+ public new int Count { get { return base.Count; } }
+ public new Step this[int index] => (Step)base[index];
+ public string ConvertToString() => GenericSerializer.StringSerialize(this);
+ public override string ToString() => $"Step Count = {base.Count}";
+ public static StepData Get(string xml) => GenericSerializer.StringDeserialize(xml);
+ }
#endregion StepData
#region Step
[Serializable]
@@ -577,28 +477,16 @@ namespace VEPROMS.CSLA.Library
public Step()
{
}
- public string ConvertToString()
- {
- return GenericSerializer.StringSerialize(this);
- }
- public override string ToString()
- {
- return Type;
- }
- public static Step Get(string xml)
- {
- return GenericSerializer.StringDeserialize(xml);
- }
- }
+ public string ConvertToString() => GenericSerializer.StringSerialize(this);
+ public override string ToString() => Type;
+ public static Step Get(string xml) => GenericSerializer.StringDeserialize(xml);
+ }
#endregion Step
#region FontDesc
[Serializable]
[TypeConverter(typeof(ExpandableObjectConverter))]
public class FontDesc
{
- // The Font object allows the conversion from a windows font back/forth from a string. This is how the
- // data is stored in the database, i.e. a string representing the font.
- private Font _Font;
[XmlAttribute("Font")]
[Browsable(false)]
public string Font
@@ -633,19 +521,10 @@ namespace VEPROMS.CSLA.Library
public FontDesc()
{
}
- public string ConvertToString()
- {
- return GenericSerializer.StringSerialize(this);
- }
- public override string ToString()
- {
- return "FontDescription";
- }
- public static FontDesc Get(string xml)
- {
- return GenericSerializer.StringDeserialize(xml);
- }
- }
+ public string ConvertToString() => GenericSerializer.StringSerialize(this);
+ public override string ToString() => "FontDescription";
+ public static FontDesc Get(string xml) => GenericSerializer.StringDeserialize(xml);
+ }
#endregion Font
#region DocStyles
[Serializable]
@@ -654,22 +533,13 @@ namespace VEPROMS.CSLA.Library
public class DocStyles : List
{
[Browsable(false)]
- public int Capacity { get { return base.Capacity; } }
+ public new int Capacity { get { return base.Capacity; } }
[Browsable(false)]
- public int Count { get { return base.Count; } }
- public DocStyle this[int index]
- {
- get { return (DocStyle)base[index]; }
- }
- public string ConvertToString()
- {
- return GenericSerializer.StringSerialize(this);
- }
- public override string ToString()
- {
- return "Section Type Count = " + base.Count.ToString();
- }
- }
+ public new int Count { get { return base.Count; } }
+ public new DocStyle this[int index] => (DocStyle)base[index];
+ public string ConvertToString() => GenericSerializer.StringSerialize(this);
+ public override string ToString() => $"Section Type Count = {base.Count}";
+ }
#endregion DocStyles
#region DocStyle
[Serializable]
@@ -702,15 +572,9 @@ namespace VEPROMS.CSLA.Library
public DocStyle()
{
}
- public string ConvertToString()
- {
- return GenericSerializer.StringSerialize(this);
- }
- public override string ToString()
- {
- return Name;
- }
- }
+ public string ConvertToString() => GenericSerializer.StringSerialize(this);
+ public override string ToString() => Name;
+ }
#endregion DocStyle
#region Layout
[Serializable]
@@ -752,18 +616,12 @@ namespace VEPROMS.CSLA.Library
public Layout()
{
}
- public string ConvertToString()
- {
- return GenericSerializer.StringSerialize(this);
- }
- public override string ToString()
- {
- return "Layout";
- }
- #region IXmlSerializable members
- // The read & write for these is necessary since they are within same xml element, and one may be empty, so
- // no attribute should be listed in the xml.
- public void WriteXml(XmlWriter writer)
+ public string ConvertToString() => GenericSerializer.StringSerialize(this);
+ public override string ToString() => "Layout";
+ #region IXmlSerializable members
+ // The read & write for these is necessary since they are within same xml element, and one may be empty, so
+ // no attribute should be listed in the xml.
+ public void WriteXml(XmlWriter writer)
{
if (LeftMargin != null) writer.WriteAttributeString("LeftMargin", LeftMargin.ToString());
if (PageLength != null) writer.WriteAttributeString("PageLength", PageLength.ToString());
@@ -780,12 +638,9 @@ namespace VEPROMS.CSLA.Library
}
}
- public XmlSchema GetSchema()
- {
- return (null);
- }
- #endregion
- }
+ public XmlSchema GetSchema() => (null);
+ #endregion
+ }
#endregion Layout
}
}
diff --git a/PROMS/VEPROMS.CSLA.Library/Config/ImageConfig.cs b/PROMS/VEPROMS.CSLA.Library/Config/ImageConfig.cs
index ae9eb0cd..e06a0db1 100644
--- a/PROMS/VEPROMS.CSLA.Library/Config/ImageConfig.cs
+++ b/PROMS/VEPROMS.CSLA.Library/Config/ImageConfig.cs
@@ -7,21 +7,14 @@ namespace VEPROMS.CSLA.Library
[TypeConverter(typeof(ExpandableObjectConverter))]
public class ImageConfig : ConfigDynamicTypeDescriptor, INotifyPropertyChanged
{
- #region DynamicTypeDescriptor
- internal override bool IsReadOnly
- {
- get { return _ImageInfo == null; }
- }
- #endregion
- #region XML
- private XMLProperties _Xp;
- private XMLProperties Xp
- {
- get { return _Xp; }
- }
+ #region DynamicTypeDescriptor
+ internal override bool IsReadOnly => _ImageInfo == null;
+ #endregion
+ #region XML
+ private readonly XMLProperties _Xp;
#endregion
#region Constructors
- private ImageInfo _ImageInfo;
+ private readonly ImageInfo _ImageInfo;
public ImageConfig(ImageInfo imageInfo)
{
if (imageInfo == null)
@@ -40,13 +33,10 @@ namespace VEPROMS.CSLA.Library
string xml = "";
_Xp = new XMLProperties(xml);
}
- internal string GetValue(string group, string item)
- {
- return _Xp[group, item];
- }
- #endregion
- #region Local Properties
- [Category("Image")]
+ internal string GetValue(string group, string item) => _Xp[group, item];
+ #endregion
+ #region Local Properties
+ [Category("Image")]
[Browsable(false)]
[DisplayName("DataSize")]
[RefreshProperties(RefreshProperties.All)]
@@ -57,16 +47,16 @@ namespace VEPROMS.CSLA.Library
{
string s = _Xp["Image", "DataSize"];
if (s == string.Empty) return 0;
- int tst = 0;
+ int tst;
try
{
tst = int.Parse(s);
}
- catch (Exception ex)
+ catch (Exception)
{
return 0;
}
- return int.Parse(s);
+ return tst;
}
set
{
@@ -87,16 +77,16 @@ namespace VEPROMS.CSLA.Library
{
string s = _Xp["Image", "Width"];
if (s == string.Empty) return 0;
- int tst = 0;
+ int tst;
try
{
tst = int.Parse(s);
}
- catch (Exception ex)
+ catch (Exception)
{
return 0;
}
- return int.Parse(s);
+ return tst;
}
set
{
@@ -117,16 +107,16 @@ namespace VEPROMS.CSLA.Library
{
string s = _Xp["Image", "Height"];
if (s == string.Empty) return 0;
- int tst = 0;
+ int tst;
try
{
tst = int.Parse(s);
}
- catch (Exception ex)
+ catch (Exception)
{
return 0;
}
- return int.Parse(s);
+ return tst;
}
set
{
@@ -141,9 +131,8 @@ namespace VEPROMS.CSLA.Library
public override string ToString()
{
string s = _Xp.ToString();
- if (s == "" || s == "") return string.Empty;
- return s;
- }
- #endregion
- }
+ return s == "" || s == "" ? string.Empty : s;
+ }
+ #endregion
+ }
}
diff --git a/PROMS/VEPROMS.CSLA.Library/Config/ProcConfig.cs b/PROMS/VEPROMS.CSLA.Library/Config/ProcConfig.cs
index d3a5468f..4c2efe56 100644
--- a/PROMS/VEPROMS.CSLA.Library/Config/ProcConfig.cs
+++ b/PROMS/VEPROMS.CSLA.Library/Config/ProcConfig.cs
@@ -1,8 +1,5 @@
using System;
-using System.Collections.Generic;
-using System.Text;
using System.ComponentModel;
-using DescriptiveEnum;
using System.Xml;
namespace VEPROMS.CSLA.Library
@@ -11,18 +8,11 @@ namespace VEPROMS.CSLA.Library
[TypeConverter(typeof(ExpandableObjectConverter))]
public class ProcedureConfig : ConfigDynamicTypeDescriptor, INotifyPropertyChanged, IItemConfig
{
- #region DynamicTypeDescriptor
- internal override bool IsReadOnly
- {
- get { return _Procedure == null; }
- }
- #endregion
- #region XML
- private XMLProperties _Xp;
- private XMLProperties Xp
- {
- get { return _Xp; }
- }
+ #region DynamicTypeDescriptor
+ internal override bool IsReadOnly => _Procedure == null;
+ #endregion
+ #region XML
+ private readonly XMLProperties _Xp;
#endregion
#region Constructors
//PROPGRID: Hide ParentLookup
@@ -32,24 +22,14 @@ namespace VEPROMS.CSLA.Library
get { return _Xp.ParentLookup; }
set { _Xp.ParentLookup = value; }
}
- //PROPGRID: Needed to comment out [NonSerialized] in order to hide AncestorLookup from property grid
- //[NonSerialized]
- //private bool _AncestorLookup;
- ////PROPGRID: Hide AncestorLookup
- //[Browsable(false)]
- //public bool AncestorLookup
- //{
- // get { return _AncestorLookup; }
- // set { _AncestorLookup = value; }
- //}
- private Procedure _Procedure;
- private ProcedureInfo _ProcedureInfo;
+ private readonly Procedure _Procedure;
+ private readonly ProcedureInfo _ProcedureInfo;
public ProcedureConfig(Procedure procedure)
{
_Procedure = procedure;
string xml = procedure.MyContent.Config;
- if (xml == string.Empty)
- xml = "";
+ if (xml == string.Empty)
+ xml = "";
_Xp = new XMLProperties(xml);
// Correct Slaves nodes for Parent Child
ValidateSlaves(_Xp.XmlContents, _Procedure.MyProcedureInfo.MyDocVersion.MultiUnitCount);
@@ -74,7 +54,7 @@ namespace VEPROMS.CSLA.Library
}
for (int i = 1; i <= unitCount; i++)
{
- XmlNode xnc = xn.SelectSingleNode(string.Format("Slave[@index='{0}']", i));
+ XmlNode xnc = xn.SelectSingleNode($"Slave[@index='{i}']");
if (xnc == null) // Missing Required Slave Node (index=i) - Add it.
{
XmlElement xec = xd.CreateElement("Slave");
@@ -98,9 +78,8 @@ namespace VEPROMS.CSLA.Library
retval = proc.ProcedureConfig.GetValue(args.Group, args.Item);
if (retval != string.Empty) return retval;
}
- DocVersionInfo docVersion = proc.ActiveParent as DocVersionInfo;
- if (docVersion == null) return string.Empty;
- retval = docVersion.DocVersionConfig.GetValue(args.Group, args.Item);
+ if (!(proc.ActiveParent is DocVersionInfo docVersion)) return string.Empty;
+ retval = docVersion.DocVersionConfig.GetValue(args.Group, args.Item);
if (retval != string.Empty) return retval;
for (FolderInfo folder = docVersion.MyFolder; folder != null; folder = folder.MyParent)
{
@@ -110,36 +89,19 @@ namespace VEPROMS.CSLA.Library
}
return string.Empty;
}
- //private string Xp_LookInAncestorFolderInfo(object sender, XMLPropertiesArgs args)
- //{
- // if (args.AncestorLookup || ParentLookup)
- // {
-
- // DocVersionInfo docVersion = (DocVersionInfo)_Procedure.ActiveParent;
- // string retval = docVersion.DocVersionConfig.GetValue(args.Group, args.Item);
- // if (retval != string.Empty) return retval;
- // for (FolderInfo folder = docVersion.MyFolder; folder != null; folder = folder.MyParent)
- // {
- // retval = folder.FolderConfig.GetValue(args.Group, args.Item);
- // if (retval != string.Empty) return retval;
- // }
- // }
- // return string.Empty;
- //}
public ProcedureConfig(ProcedureInfo procedureInfo)
{
_ProcedureInfo = procedureInfo;
string xml = procedureInfo.MyContent.Config;
- if (xml == string.Empty)
- xml = "";
- _Xp = new XMLProperties(xml);
+ if (xml == string.Empty)
+ xml = "";
+ _Xp = new XMLProperties(xml);
// Fix Slaves nodes for Parent Child
ValidateSlaves(_Xp.XmlContents, _ProcedureInfo.MyDocVersion.MultiUnitCount);
_Xp.AncestorLookup = true;
if (procedureInfo.ActiveParent != null) _Xp.LookInAncestor += new XMLPropertiesEvent(Xp_LookInAncestorFolder);
}
private int _SelectedSlave = 0;
- //[Browsable(false)]
public int SelectedSlave
{
get { return _SelectedSlave; }
@@ -150,19 +112,9 @@ namespace VEPROMS.CSLA.Library
if (xml == string.Empty) xml = "";
_Xp = new XMLProperties(xml);
}
- //public ProcedureConfig()
- //{
- // _Xp = new XMLProperties();
- //}
- public string GetValue(string group, string item)
- {
- return _Xp[group, item];
- }
- public void SetValue(string group, string item, string newvalue)
- {
- _Xp[group, item] = newvalue;
- }
- public int GetItemId()
+ public string GetValue(string group, string item) => _Xp[group, item];
+ public void SetValue(string group, string item, string newvalue) => _Xp[group, item] = newvalue;
+ public int GetItemId()
{
if (_Procedure != null) return _Procedure.ItemID;
if (_ProcedureInfo != null) return _ProcedureInfo.ItemID;
@@ -193,19 +145,16 @@ namespace VEPROMS.CSLA.Library
[Description("Old Sequence")]
public string OldSequence
{
- get { return (_Procedure != null ? _Procedure.MyContent.MyZContent.OldStepSequence : (_ProcedureInfo.MyContent.MyZContent == null ? null : _ProcedureInfo.MyContent.MyZContent.OldStepSequence)); }
+ get { return (_Procedure != null ? _Procedure.MyContent.MyZContent.OldStepSequence : (_ProcedureInfo.MyContent.MyZContent?.OldStepSequence)); }
set { if (_Procedure != null) _Procedure.MyContent.MyZContent.OldStepSequence = value; }
}
- [Category("Identification")]
- //PROPGRID: Hide Dirty
- [Browsable(false)]
- [DisplayName("Dirty")]
- [Description("Dirty")]
- public bool Dirty
- {
- get { return (_Procedure != null ? _Procedure.IsDirty : false); }
- }
- [Category("Format Settings")]
+ [Category("Identification")]
+ //PROPGRID: Hide Dirty
+ [Browsable(false)]
+ [DisplayName("Dirty")]
+ [Description("Dirty")]
+ public bool Dirty => _Procedure != null && _Procedure.IsDirty;
+ [Category("Format Settings")]
[DisplayName("Format")]
[Description("Format")]
[TypeConverter(typeof(FormatList))]
@@ -222,7 +171,6 @@ namespace VEPROMS.CSLA.Library
if (_Procedure != null)
{
_Procedure.MyContent.MyFormat = FormatList.ToFormat(value); // Can only be set if _DocVersion is set
- //_Procedure.ActiveFormat = null;
}
}
}
@@ -261,12 +209,11 @@ namespace VEPROMS.CSLA.Library
public override string ToString()
{
string s = _Xp.ToString();
- if (s == "" || s == "") return string.Empty;
- return s;
- }
- #endregion
- #region DelProcReason
- [Category("General")]
+ return s == "" || s == "" ? string.Empty : s;
+ }
+ #endregion
+ #region DelProcReason
+ [Category("General")]
[DisplayName("DelProcReason")]
[RefreshProperties(RefreshProperties.All)]
[Description("Delete Procedure Reason")]
@@ -283,19 +230,6 @@ namespace VEPROMS.CSLA.Library
}
#endregion
#region FormatCategory
- //[TypeConverter(typeof(EnumDescConverter))]
- //public enum FormatColumns : int
- //{
- // Default = 0,
- // [Description("Single Column")]
- // OneColumn,
- // [Description("Dual Column")]
- // TwoColumn,
- // [Description("Triple Column")]
- // ThreeColumn,
- // [Description("Quad Column")]
- // FourColumns
- //}
[Category("General")]
[DisplayName("Default Column Mode")]
[RefreshProperties(RefreshProperties.All)]
@@ -375,13 +309,13 @@ namespace VEPROMS.CSLA.Library
{
string s = _Xp["Procedure", "Rev"];
if (SelectedSlave > 0)
- s = _Xp["Slave[@index='" + SelectedSlave.ToString() + "']", "Rev"];
+ s = _Xp[$"Slave[@index='{SelectedSlave}']", "Rev"];
return s;
}
set
{
if (SelectedSlave > 0)
- _Xp["Slave[@index='" + SelectedSlave.ToString() + "']", "Rev"] = value; // save selected value
+ _Xp[$"Slave[@index='{SelectedSlave}']", "Rev"] = value; // save selected value
else
_Xp["Procedure", "Rev"] = value;
OnPropertyChanged("Print_Rev");
@@ -399,13 +333,13 @@ namespace VEPROMS.CSLA.Library
{
string s = _Xp["Procedure", "RevDate"];
if (SelectedSlave > 0)
- s = _Xp["Slave[@index='" + SelectedSlave.ToString() + "']", "RevDate"];
+ s = _Xp[$"Slave[@index='{SelectedSlave}']", "RevDate"];
return s;
}
set
{
if (SelectedSlave > 0)
- _Xp["Slave[@index='" + SelectedSlave.ToString() + "']", "RevDate"] = value; // save selected value
+ _Xp[$"Slave[@index='{SelectedSlave}']", "RevDate"] = value; // save selected value
else
_Xp["Procedure", "RevDate"] = value;
OnPropertyChanged("Print_RevDate");
@@ -443,7 +377,7 @@ namespace VEPROMS.CSLA.Library
{
string s = _Xp["Procedure", "ChangeBarDate"];
if (SelectedSlave > 0)
- s = _Xp["Slave[@index='" + SelectedSlave.ToString() + "']", "ChangeBarDate"];
+ s = _Xp[$"Slave[@index='{SelectedSlave}']", "ChangeBarDate"];
else
{
if (s != "")
@@ -470,7 +404,7 @@ namespace VEPROMS.CSLA.Library
set
{
if (SelectedSlave > 0)
- _Xp["Slave[@index='" + SelectedSlave.ToString() + "']", "ChangeBarDate"] = value; // save selected value
+ _Xp[$"Slave[@index='{SelectedSlave}']", "ChangeBarDate"] = value; // save selected value
else
_Xp["Procedure", "ChangeBarDate"] = value;
OnPropertyChanged("Print_ChangeBarDate");
@@ -487,13 +421,13 @@ namespace VEPROMS.CSLA.Library
{
string s = _Xp["Procedure", "ReviewDate"];
if (SelectedSlave > 0)
- s = _Xp["Slave[@index='" + SelectedSlave.ToString() + "']", "ReviewDate"];
+ s = _Xp[$"Slave[@index='{SelectedSlave}']", "ReviewDate"];
return s;
}
set
{
if (SelectedSlave > 0)
- _Xp["Slave[@index='" + SelectedSlave.ToString() + "']", "ReviewDate"] = value; // save selected value
+ _Xp[$"Slave[@index='{SelectedSlave}']", "ReviewDate"] = value; // save selected value
else
_Xp["Procedure", "ReviewDate"] = value;
OnPropertyChanged("Print_ReviewDate");
@@ -519,12 +453,6 @@ namespace VEPROMS.CSLA.Library
OnPropertyChanged("Print_NumCopies");
}
}
- //public enum PrintPagination : int
- //{
- // Free = 0, Fixed,
- // [Description("Automatic")]
- // Auto
- //}
[Category("Print Settings")]
[DisplayName("Pagination")]
[RefreshProperties(RefreshProperties.All)]
@@ -562,13 +490,6 @@ namespace VEPROMS.CSLA.Library
OnPropertyChanged("Print_Pagination");
}
}
- //[TypeConverter(typeof(EnumDescConverter))]
- //public enum PrintWatermark : int
- //{
- // None = 0, Reference, Draft, Master, Sample,
- // [Description("Information Only")]
- // InformationOnly
- //}
[Category("Print Settings")]
[DisplayName("Watermark")]
[RefreshProperties(RefreshProperties.All)]
@@ -623,29 +544,12 @@ namespace VEPROMS.CSLA.Library
set
{
string s = _Xp["PrintSettings", "NotInMergeAll"]; // get the original value to see if a change
- bool original = (s==string.Empty) ? false : bool.Parse(s);
+ bool original = s != string.Empty && bool.Parse(s);
if (original == value) return;
_Xp["PrintSettings", "NotInMergeAll"] = ((bool)value).ToString(); // save selected value
OnPropertyChanged("Print_NotInMergeAll");
}
}
- // Change Bar Use from 16-bit code:
- // No Default
- // Without Change Bars
- // With Default Change Bars
- // With User Specified Change Bars
- //[TypeConverter(typeof(EnumDescConverter))]
- //public enum PrintChangeBar : int
- //{
- // [Description("Select Before Printing")]
- // SelectBeforePrinting = 0,
- // [Description("Without Change Bars")]
- // Without,
- // [Description("With Default Change Bars")]
- // WithDefault,
- // [Description("Use Custom Change Bars")]
- // WithUserSpecified
- //}
[Category("Format Settings")]
[DisplayName("Change Bar")]
[RefreshProperties(RefreshProperties.All)]
@@ -683,23 +587,6 @@ namespace VEPROMS.CSLA.Library
OnPropertyChanged("Print_ChangeBar");
}
}
- // User Specified Change Bar Location from16-bit code:
- // With Text
- // Outside Box
- // AER on LEFT, RNO on Right
- // To the Left of Text
- //[TypeConverter(typeof(EnumDescConverter))]
- //public enum PrintChangeBarLoc : int
- //{
- // [Description("With Text")]
- // WithText = 0,
- // [Description("Outside Box")]
- // OutsideBox,
- // [Description("AER on Left RNO on Right")]
- // AERleftRNOright,
- // [Description("To the Left of the Text")]
- // LeftOfText
- //}
[Category("Format Settings")]
[DisplayName("Change Bar Position")]
[RefreshProperties(RefreshProperties.All)]
@@ -737,27 +624,6 @@ namespace VEPROMS.CSLA.Library
OnPropertyChanged("Print_ChangeBarLoc");
}
}
-
- // Change Bar Text from16-bit code:
- // Date and Change ID
- // Revision Number
- // Change ID
- // No Change Bar Message
- // User Defined Message
- //[TypeConverter(typeof(EnumDescConverter))]
- //public enum PrintChangeBarText : int
- //{
- // [Description("Date and Change ID")]
- // DateChgID = 0,
- // [Description("Revision Number")]
- // RevNum,
- // [Description("Change ID")]
- // ChgID,
- // [Description("No Change Bar Text")]
- // None,
- // [Description("Custom Change Bar Text")]
- // UserDef
- //}
[Category("Format Settings")]
[DisplayName("Change Bar Text Type")]
[RefreshProperties(RefreshProperties.All)]
diff --git a/PROMS/VEPROMS.CSLA.Library/Config/RODbConfig.cs b/PROMS/VEPROMS.CSLA.Library/Config/RODbConfig.cs
index 1a57e980..7439ad9b 100644
--- a/PROMS/VEPROMS.CSLA.Library/Config/RODbConfig.cs
+++ b/PROMS/VEPROMS.CSLA.Library/Config/RODbConfig.cs
@@ -1,10 +1,6 @@
using System;
-using System.Collections.Generic;
-using System.Text;
using System.ComponentModel;
-using System.Drawing;
using System.IO;
-using DescriptiveEnum;
namespace VEPROMS.CSLA.Library
{
@@ -12,21 +8,14 @@ namespace VEPROMS.CSLA.Library
[TypeConverter(typeof(ExpandableObjectConverter))]
public class RODbConfig : ConfigDynamicTypeDescriptor, INotifyPropertyChanged
{
- #region DynamicTypeDescriptor
- internal override bool IsReadOnly
- {
- get { return _RODb == null; }
- }
- #endregion
- #region XML
- private XMLProperties _Xp;
- private XMLProperties Xp
- {
- get { return _Xp; }
- }
+ #region DynamicTypeDescriptor
+ internal override bool IsReadOnly => _RODb == null;
+ #endregion
+ #region XML
+ private readonly XMLProperties _Xp;
#endregion
#region Constructors
- private RODb _RODb;
+ private readonly RODb _RODb;
public RODbConfig(RODb roDb)
{
_RODb = roDb;
@@ -34,7 +23,7 @@ namespace VEPROMS.CSLA.Library
if (xml == string.Empty) xml = "";
_Xp = new XMLProperties(xml);
}
- private RODbInfo _RODbInfo;
+ private readonly RODbInfo _RODbInfo;
public RODbConfig(RODbInfo roDbInfo)
{
_RODbInfo = roDbInfo;
@@ -52,13 +41,10 @@ namespace VEPROMS.CSLA.Library
string xml = "";
_Xp = new XMLProperties(xml);
}
- internal string GetValue(string group, string item)
- {
- return _Xp[group, item];
- }
- #endregion
- #region Local Properties
- [Category("General")]
+ internal string GetValue(string group, string item) => _Xp[group, item];
+ #endregion
+ #region Local Properties
+ [Category("General")]
[DisplayName("ROName")]
[Description("ROName")]
public string ROName
@@ -71,22 +57,20 @@ namespace VEPROMS.CSLA.Library
[Description("FolderPath")]
public string FolderPath
{
- get { return (_RODb != null ? _RODb.FolderPath : _RODbInfo != null?_RODbInfo.FolderPath:null); }
+ get { return (_RODb != null ? _RODb.FolderPath : _RODbInfo?.FolderPath); }
set { if (_RODb != null) _RODb.FolderPath = value; }
}
- public RODb MyRODb
- { get { return _RODb; } }
- #endregion
- #region ToString
- public override string ToString()
+ public RODb MyRODb => _RODb;
+ #endregion
+ #region ToString
+ public override string ToString()
{
string s = _Xp.ToString();
- if (s == "" || s == "") return string.Empty;
- return s;
- }
- #endregion
- #region RODefaults
- [Category("Referenced Objects")]
+ return s == "" || s == "" ? string.Empty : s;
+ }
+ #endregion
+ #region RODefaults
+ [Category("Referenced Objects")]
[DisplayName("Graphic File Extension")]
[RefreshProperties(RefreshProperties.All)]
[Description("Default File Extension")]
@@ -98,38 +82,41 @@ namespace VEPROMS.CSLA.Library
// look in roapp.ini in the FolderPath directory;
// look in top folder's config
// set to Volian default, i.e. "TIF".
- string s = GetRoAppIniValue("ROAPP", "Extention");
+ string s = GetRoAppIniValue("Extention");
if (s == null || s == string.Empty)
- s = TopFolderConfigValue("Graphics", "defaultext");
+ s = TopFolderConfigValue();
if (s == null || s == string.Empty)
return s = "TIF";
return s;
}
}
- private string GetRoAppIniValue(string p, string p_2)
- {
- if (FolderPath == null) return null;
- string inipath = FolderPath + @"\roapp.ini";
- if (!File.Exists(inipath)) return null;
- StreamReader myReader = new StreamReader(inipath);
- string sLine;
- int indx = -1;
- while ((sLine = myReader.ReadLine()) != null)
- {
- if (sLine.Length > 0 && sLine.Substring(0, 1) != ";")
- {
- if ((indx = sLine.ToLower().IndexOf(p_2.ToLower())) >= 0)
- {
- indx = sLine.IndexOf("=", indx + 9);
- return sLine.Substring(indx + 1, sLine.Length - indx - 1).Trim();
- }
- }
- }
- myReader.Close();
- return null;
- }
- private string TopFolderConfigValue(string p, string p_2)
+ private string GetRoAppIniValue(string p_2)
+ {
+ if (FolderPath == null) return null;
+ string inipath = FolderPath + @"\roapp.ini";
+ if (!File.Exists(inipath)) return null;
+ using (StreamReader myReader = new StreamReader(inipath))
+ {
+ string sLine;
+ int indx = -1;
+ while ((sLine = myReader.ReadLine()) != null)
+ {
+ if (sLine.Length > 0 && sLine.Substring(0, 1) != ";")
+ {
+ if ((indx = sLine.ToLower().IndexOf(p_2.ToLower())) >= 0)
+ {
+ indx = sLine.IndexOf("=", indx + 9);
+ return sLine.Substring(indx + 1, sLine.Length - indx - 1).Trim();
+ }
+ }
+ }
+ myReader.Close();
+ }
+
+ return null;
+ }
+ private string TopFolderConfigValue()
{
FolderInfo fi = FolderInfo.GetTop();
return fi.FolderConfig.Graphics_defaultext;
@@ -145,9 +132,9 @@ namespace VEPROMS.CSLA.Library
}
public string GetDefaultGraphicExtensionLocation()
{
- string s = GetRoAppIniValue("ROAPP", "Extention");
+ string s = GetRoAppIniValue("Extention");
if (s != null && s != string.Empty) return "Default Extension found in roapp.ini";
- s = TopFolderConfigValue("Graphics", "defaultext");
+ s = TopFolderConfigValue();
if (s != null && s != string.Empty) return "Default Extension defined in veproms properties";
return "Used program default";
}
diff --git a/PROMS/VEPROMS.CSLA.Library/Config/ROFSTLookup.cs b/PROMS/VEPROMS.CSLA.Library/Config/ROFSTLookup.cs
index fe72f0f8..663c84f3 100644
--- a/PROMS/VEPROMS.CSLA.Library/Config/ROFSTLookup.cs
+++ b/PROMS/VEPROMS.CSLA.Library/Config/ROFSTLookup.cs
@@ -159,16 +159,13 @@ namespace VEPROMS.CSLA.Library
private int _totalRoCnt = 0;
private double _pctComplete = 0;
- #endregion
+ #endregion
- #region Properties
+ #region Properties
- public int RofstID
- {
- get { return _rofstID; }
- }
+ public int RofstID => _rofstID;
- public DocVersionInfo MyDocVersionInfo
+ public DocVersionInfo MyDocVersionInfo
{
get { return _myDocVersionInfo; }
set
@@ -178,14 +175,11 @@ namespace VEPROMS.CSLA.Library
}
}
- // C2021-065 see if we need to get the RO information for the "Other" Child applicability value
- public int SelectedSlave
- {
- get { return (!string.IsNullOrEmpty(_otherChild)) ? Convert.ToInt32(_otherChild) : _selectedSlave; }
- }
+ // C2021-065 see if we need to get the RO information for the "Other" Child applicability value
+ public int SelectedSlave => (!string.IsNullOrEmpty(_otherChild)) ? Convert.ToInt32(_otherChild) : _selectedSlave;
- //C2021-065 used by Barakah Alarms so that we get ROLookUp for the Other applicability
- public string OtherChild
+ //C2021-065 used by Barakah Alarms so that we get ROLookUp for the Other applicability
+ public string OtherChild
{
get { return _otherChild; }
set { _otherChild = value; }
@@ -237,16 +231,13 @@ namespace VEPROMS.CSLA.Library
set { _autoCombineSingleRetValues = value; }
}
- public bool ShowLoadingStatus
- {
- get { return _showLoadingStatus; }
- }
+ public bool ShowLoadingStatus => _showLoadingStatus;
- #endregion
+ #endregion
- #region Constructors
+ #region Constructors
- public ROFSTLookup(int rofstID, DocVersionInfo dvi, string otherChild, bool showLoadingStatus = true)
+ public ROFSTLookup(int rofstID, DocVersionInfo dvi, string otherChild, bool showLoadingStatus = true)
{
// Set Fields/Properties
_rofstID = rofstID;
@@ -321,31 +312,19 @@ namespace VEPROMS.CSLA.Library
return RofstDataSearch(_rofstID, value, searchTypeID, onlyRoid16, maxNumRecords);
}
- public ROFSTLookup.rochild[] GetRoChildrenByID(int id, int dbiID, bool loadChildren = false, bool loadAllChildren = false)
- {
- return RofstDataGetChildrenByID(_rofstID, dbiID, id, loadChildren, loadAllChildren);
- }
+ public ROFSTLookup.rochild[] GetRoChildrenByID(int id, int dbiID, bool loadChildren = false, bool loadAllChildren = false) => RofstDataGetChildrenByID(_rofstID, dbiID, id, loadChildren, loadAllChildren);
- public ROFSTLookup.rochild[] GetRoChildrenByRoid(string roid, bool loadChildren = false, bool loadAllChildren = false)
- {
- return RofstDataGetChildrenByRoid(_rofstID, roid, loadChildren, loadAllChildren);
- }
+ public ROFSTLookup.rochild[] GetRoChildrenByRoid(string roid, bool loadChildren = false, bool loadAllChildren = false) => RofstDataGetChildrenByRoid(_rofstID, roid, loadChildren, loadAllChildren);
- public ROFSTLookup.rochild[] GetRoChildrenByType(E_ROValueType valueTypes, bool loadChildren = false, bool loadAllChildren = false)
- {
- return RofstDataGetRoChildrenByType(_rofstID, valueTypes, loadChildren, loadAllChildren);
- }
+ public ROFSTLookup.rochild[] GetRoChildrenByType(E_ROValueType valueTypes, bool loadChildren = false, bool loadAllChildren = false) => RofstDataGetRoChildrenByType(_rofstID, valueTypes, loadChildren, loadAllChildren);
- #endregion
+ #endregion
- #region (RO Database Info)
+ #region (RO Database Info)
- public int GetRODatabaseTitleIndex(string roid)
- {
- return Convert.ToInt32("0x" + roid.Substring(0, 4), 16);
- }
+ public int GetRODatabaseTitleIndex(string roid) => Convert.ToInt32("0x" + roid.Substring(0, 4), 16);
- public string GetRODatabaseTitle(int idx)
+ public string GetRODatabaseTitle(int idx)
{
ROFSTLookup.rodbi rd = RofstDataGetDatabaseByID(_rofstID, idx);
return (!string.IsNullOrEmpty(rd.dbiTitle) ? rd.dbiTitle : "RO Database Title Not Found");
@@ -358,16 +337,13 @@ namespace VEPROMS.CSLA.Library
return (rd.dbiID > 0) ? rd : RofstDataGetDatabaseByID(_rofstID, 1, loadChildren, loadAllChildren);
}
- public ROFSTLookup.rodbi[] GetRODatabaseList(bool loadChildren = false, bool loadAllChildren = false)
- {
- return RofstDataGetDatabases(_rofstID, loadChildren, loadAllChildren);
- }
+ public ROFSTLookup.rodbi[] GetRODatabaseList(bool loadChildren = false, bool loadAllChildren = false) => RofstDataGetDatabases(_rofstID, loadChildren, loadAllChildren);
- #endregion
+ #endregion
- #region (RO Info By AccPageID)
+ #region (RO Info By AccPageID)
- public string FormatAccPageKey(string accPageID)
+ public string FormatAccPageKey(string accPageID)
{
string accPageBase = string.Empty;
string accPageExt = string.Empty;
@@ -527,12 +503,9 @@ namespace VEPROMS.CSLA.Library
return (!string.IsNullOrEmpty(retval)) ? retval.Replace("\r\n", @"\par ") : retval;
}
- public List GetValueDifferences(int originalRofstID, ref List delList)
- {
- return RofstDataGetValueDifferences(originalRofstID, _rofstID, ref delList);
- }
+ public List GetValueDifferences(int originalRofstID, ref List delList) => RofstDataGetValueDifferences(originalRofstID, _rofstID, ref delList);
- public List