C2026-043-Tech-Debt_v1 - Stash 1

This commit is contained in:
2026-07-21 06:49:28 -04:00
parent 0fed1acfd8
commit 9486b37300
70 changed files with 4222 additions and 10191 deletions
@@ -1,8 +1,6 @@
using JR.Utils.GUI.Forms;
using log4net.Util;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
@@ -18,9 +16,8 @@ namespace Volian.Controls.Library
public event DisplayApplicabilityEvent ApplicabilityViewModeChanged;
private void OnApplicabilityViewModeChanged()
{
if (ApplicabilityViewModeChanged != null)
ApplicabilityViewModeChanged(this, new EventArgs());
}
ApplicabilityViewModeChanged?.Invoke(this, new EventArgs());
}
private DisplayTabItem _MyDisplayTabItem = null;
public DisplayTabItem MyDisplayTabItem
@@ -93,21 +90,21 @@ namespace Volian.Controls.Library
private DevComponents.DotNetBar.Controls.GroupPanel InitializegpSubItem() //B2026-043 Fix "Set All At Level" button.
{
DevComponents.DotNetBar.Controls.GroupPanel gpSubItem;
gpSubItem = new DevComponents.DotNetBar.Controls.GroupPanel
{
AutoSize = true,
AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink,
CanvasColor = System.Drawing.SystemColors.Control,
ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.Office2007,
DisabledBackColor = System.Drawing.Color.Empty,
Dock = System.Windows.Forms.DockStyle.Top,
Location = new System.Drawing.Point(0, 49),
Margin = new System.Windows.Forms.Padding(4),
Name = "gpSubItem",
Padding = new System.Windows.Forms.Padding(13, 12, 13, 37)
};
gpSubItem.BackColor = Color.Transparent;
gpSubItem.Style.TextAlignment = DevComponents.DotNetBar.eStyleTextAlignment.Center;
gpSubItem = new DevComponents.DotNetBar.Controls.GroupPanel
{
AutoSize = true,
AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink,
CanvasColor = System.Drawing.SystemColors.Control,
ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.Office2007,
DisabledBackColor = System.Drawing.Color.Empty,
Dock = System.Windows.Forms.DockStyle.Top,
Location = new System.Drawing.Point(0, 49),
Margin = new System.Windows.Forms.Padding(4),
Name = "gpSubItem",
Padding = new System.Windows.Forms.Padding(13, 12, 13, 37),
BackColor = Color.Transparent
};
gpSubItem.Style.TextAlignment = DevComponents.DotNetBar.eStyleTextAlignment.Center;
gpSubItem.Style.TextColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelText;
gpSubItem.Style.TextLineAlignment = DevComponents.DotNetBar.eStyleTextAlignment.Near;
gpSubItem.StyleMouseDown.CornerType = DevComponents.DotNetBar.eCornerType.Square;
@@ -118,8 +115,10 @@ namespace Volian.Controls.Library
gpSubItem.Size = new System.Drawing.Size(400, 250);
return gpSubItem;
}
private Dictionary<int, CheckBox> MyCheckBoxes = new Dictionary<int, CheckBox>();
private string _MyApplicability = string.Empty;
#pragma warning disable IDE0044 // Add readonly modifier
private Dictionary<int, CheckBox> MyCheckBoxes = new Dictionary<int, CheckBox>();
#pragma warning restore IDE0044 // Add readonly modifier
private string _MyApplicability = string.Empty;
public string MyApplicability
{
get { return _MyApplicability; }
@@ -132,15 +131,17 @@ namespace Volian.Controls.Library
private void AddItemMode(string name, string value, ref DevComponents.DotNetBar.Controls.GroupPanel gpSubItem)
{
CheckBox cb = new CheckBox();
cb.BackColor = Color.Transparent;
cb.Height = 24;
cb.Width = 75;
cb.AutoSize = true;
cb.Text = name;
cb.Tag = value;
cb.Dock = DockStyle.Top;
gpSubItem.Controls.Add(cb);
CheckBox cb = new CheckBox
{
BackColor = Color.Transparent,
Height = 24,
Width = 75,
AutoSize = true,
Text = name,
Tag = value,
Dock = DockStyle.Top
};
gpSubItem.Controls.Add(cb);
cb.BringToFront();
cb.CheckedChanged += new EventHandler(cb_CheckedChanged);
MyCheckBoxes.Add(value == null ? -1 : int.Parse(value), cb);
@@ -219,7 +220,7 @@ namespace Volian.Controls.Library
List<InvalidTransition> invalidTrans = WillTransitionsBeValidCommand.Execute(MyItemInfo.ItemID, MyApplicability);
// B2021-149: for Procedure level PC/PC, continue processing if all 'invalid' transitions are internal (query used
// return internal and external for the procedure level)
if ((!MyItemInfo.IsProcedure && invalidTrans.Count == 0) || IsProcWithNoExternalTrans(MyItemInfo, invalidTrans))
if ((!MyItemInfo.IsProcedure && invalidTrans.Count == 0) || IsProcWithNoExternalTrans(invalidTrans))
{
// C2021 - 027: Procedure level PC/PC
if (MyItemInfo.IsProcedure && MyItemInfo.ActiveFormat.PlantFormat.FormatData.ProcData.ProcAppl)
@@ -279,7 +280,7 @@ namespace Volian.Controls.Library
// C2026-023: Check for Transitions when setting Applicability to all for a level
List<InvalidTransition> invalidTrans = WillTransitionsBeValidCommand.Execute(startitm.ItemID, MasterSlave_ApplicabilityTmp.ToString());
if (IsProcWithNoExternalTrans(startitm, invalidTrans))
if (IsProcWithNoExternalTrans(invalidTrans))
{
StepConfig sc2 = startitm.MyConfig as StepConfig;
using (Content cnt = Content.Get(startitm.MyContent.ContentID))
@@ -319,7 +320,7 @@ namespace Volian.Controls.Library
}
// B2021-149: for procedure, only consider external transitions as invalid
private bool IsProcWithNoExternalTrans(ItemInfo ii, List<InvalidTransition> invalidTrans)
private bool IsProcWithNoExternalTrans(List<InvalidTransition> invalidTrans)
{
if (invalidTrans.Count == 0) return true;
foreach (InvalidTransition iT in invalidTrans)
@@ -434,18 +435,17 @@ namespace Volian.Controls.Library
foreach (CheckBox cb in MyCheckBoxes.Values)
cb.Enabled = true;
}
private void AddViewMode(string name, string value)
private void AddViewMode(string name, string value, bool selected)
{
AddViewMode(name, value, false);
}
private void AddViewMode(string name, string value, bool selected)
{
RadioButton rb = new RadioButton();
rb.BackColor = Color.Transparent;
rb.Text = name;
rb.Tag = value;
rb.Dock = DockStyle.Top;
gpMode.Controls.Add(rb);
RadioButton rb = new RadioButton
{
BackColor = Color.Transparent,
Text = name,
Tag = value,
Dock = DockStyle.Top
};
gpMode.Controls.Add(rb);
rb.BringToFront();
rb.Checked = selected;
rb.CheckedChanged += new EventHandler(rb_CheckedChanged);
@@ -469,7 +469,7 @@ namespace Volian.Controls.Library
// C2021 - 027: Procedure level PC/PC - handle procedure level too for viewing in editor
if (MyDisplayTabItem.MyStepTabPanel.SelectedItemInfo != null && MyDisplayTabItem.MyStepTabPanel.SelectedItemInfo.IsProcedure)
ei = MyDisplayTabItem.MyStepTabPanel.SelectedEditItem;
if (ei != null) ei.MyStepRTB.Focus();
ei?.MyStepRTB.Focus();
}
}
@@ -489,7 +489,7 @@ namespace Volian.Controls.Library
void DisplayApplicability_VisibleChanged(object sender, EventArgs e)
{
MyItemInfo = MyItemInfo;
gpItem.Enabled = ShowItemSelection && UserInfo.CanEdit(MyUserInfo,(MyItemInfo == null) ? null : MyItemInfo.MyDocVersion); //Can Change Applicability
gpItem.Enabled = ShowItemSelection && UserInfo.CanEdit(MyUserInfo,MyItemInfo?.MyDocVersion); //Can Change Applicability
}
}
}