Added DisplayApplicability class to display applicability of individual items
of a procedure in step properties panel
This commit is contained in:
parent
b3c31db10d
commit
50c04033ac
144
PROMS/Volian.Controls.Library/DisplayApplicability.Designer.cs
generated
Normal file
144
PROMS/Volian.Controls.Library/DisplayApplicability.Designer.cs
generated
Normal file
@ -0,0 +1,144 @@
|
|||||||
|
namespace Volian.Controls.Library
|
||||||
|
{
|
||||||
|
partial class DisplayApplicability
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Required designer variable.
|
||||||
|
/// </summary>
|
||||||
|
private System.ComponentModel.IContainer components = null;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Clean up any resources being used.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||||
|
protected override void Dispose(bool disposing)
|
||||||
|
{
|
||||||
|
if (disposing && (components != null))
|
||||||
|
{
|
||||||
|
components.Dispose();
|
||||||
|
}
|
||||||
|
base.Dispose(disposing);
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Component Designer generated code
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Required method for Designer support - do not modify
|
||||||
|
/// the contents of this method with the code editor.
|
||||||
|
/// </summary>
|
||||||
|
private void InitializeComponent()
|
||||||
|
{
|
||||||
|
this.gpMode = new DevComponents.DotNetBar.Controls.GroupPanel();
|
||||||
|
this.gpItem = new DevComponents.DotNetBar.Controls.GroupPanel();
|
||||||
|
this.SuspendLayout();
|
||||||
|
//
|
||||||
|
// gpMode
|
||||||
|
//
|
||||||
|
this.gpMode.AutoSize = true;
|
||||||
|
this.gpMode.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
|
||||||
|
this.gpMode.CanvasColor = System.Drawing.SystemColors.Control;
|
||||||
|
this.gpMode.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.Office2007;
|
||||||
|
this.gpMode.Dock = System.Windows.Forms.DockStyle.Top;
|
||||||
|
this.gpMode.Location = new System.Drawing.Point(0, 0);
|
||||||
|
this.gpMode.Name = "gpMode";
|
||||||
|
this.gpMode.Padding = new System.Windows.Forms.Padding(10, 10, 10, 30);
|
||||||
|
this.gpMode.Size = new System.Drawing.Size(324, 40);
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
this.gpMode.Style.BackColor2SchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground2;
|
||||||
|
this.gpMode.Style.BackColorGradientAngle = 90;
|
||||||
|
this.gpMode.Style.BackColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground;
|
||||||
|
this.gpMode.Style.BorderBottom = DevComponents.DotNetBar.eStyleBorderType.Solid;
|
||||||
|
this.gpMode.Style.BorderBottomWidth = 1;
|
||||||
|
this.gpMode.Style.BorderColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder;
|
||||||
|
this.gpMode.Style.BorderLeft = DevComponents.DotNetBar.eStyleBorderType.Solid;
|
||||||
|
this.gpMode.Style.BorderLeftWidth = 1;
|
||||||
|
this.gpMode.Style.BorderRight = DevComponents.DotNetBar.eStyleBorderType.Solid;
|
||||||
|
this.gpMode.Style.BorderRightWidth = 1;
|
||||||
|
this.gpMode.Style.BorderTop = DevComponents.DotNetBar.eStyleBorderType.Solid;
|
||||||
|
this.gpMode.Style.BorderTopWidth = 1;
|
||||||
|
this.gpMode.Style.Class = "";
|
||||||
|
this.gpMode.Style.CornerDiameter = 4;
|
||||||
|
this.gpMode.Style.CornerType = DevComponents.DotNetBar.eCornerType.Rounded;
|
||||||
|
this.gpMode.Style.TextAlignment = DevComponents.DotNetBar.eStyleTextAlignment.Center;
|
||||||
|
this.gpMode.Style.TextColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelText;
|
||||||
|
this.gpMode.Style.TextLineAlignment = DevComponents.DotNetBar.eStyleTextAlignment.Near;
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
this.gpMode.StyleMouseDown.Class = "";
|
||||||
|
this.gpMode.StyleMouseDown.CornerType = DevComponents.DotNetBar.eCornerType.Square;
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
this.gpMode.StyleMouseOver.Class = "";
|
||||||
|
this.gpMode.StyleMouseOver.CornerType = DevComponents.DotNetBar.eCornerType.Square;
|
||||||
|
this.gpMode.TabIndex = 0;
|
||||||
|
this.gpMode.Text = "Viewing Mode";
|
||||||
|
//
|
||||||
|
// gpItem
|
||||||
|
//
|
||||||
|
this.gpItem.AutoSize = true;
|
||||||
|
this.gpItem.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
|
||||||
|
this.gpItem.CanvasColor = System.Drawing.SystemColors.Control;
|
||||||
|
this.gpItem.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.Office2007;
|
||||||
|
this.gpItem.Dock = System.Windows.Forms.DockStyle.Top;
|
||||||
|
this.gpItem.Location = new System.Drawing.Point(0, 40);
|
||||||
|
this.gpItem.Name = "gpItem";
|
||||||
|
this.gpItem.Padding = new System.Windows.Forms.Padding(10, 10, 10, 30);
|
||||||
|
this.gpItem.Size = new System.Drawing.Size(324, 40);
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
this.gpItem.Style.BackColor2SchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground2;
|
||||||
|
this.gpItem.Style.BackColorGradientAngle = 90;
|
||||||
|
this.gpItem.Style.BackColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground;
|
||||||
|
this.gpItem.Style.BorderBottom = DevComponents.DotNetBar.eStyleBorderType.Solid;
|
||||||
|
this.gpItem.Style.BorderBottomWidth = 1;
|
||||||
|
this.gpItem.Style.BorderColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder;
|
||||||
|
this.gpItem.Style.BorderLeft = DevComponents.DotNetBar.eStyleBorderType.Solid;
|
||||||
|
this.gpItem.Style.BorderLeftWidth = 1;
|
||||||
|
this.gpItem.Style.BorderRight = DevComponents.DotNetBar.eStyleBorderType.Solid;
|
||||||
|
this.gpItem.Style.BorderRightWidth = 1;
|
||||||
|
this.gpItem.Style.BorderTop = DevComponents.DotNetBar.eStyleBorderType.Solid;
|
||||||
|
this.gpItem.Style.BorderTopWidth = 1;
|
||||||
|
this.gpItem.Style.Class = "";
|
||||||
|
this.gpItem.Style.CornerDiameter = 4;
|
||||||
|
this.gpItem.Style.CornerType = DevComponents.DotNetBar.eCornerType.Rounded;
|
||||||
|
this.gpItem.Style.TextAlignment = DevComponents.DotNetBar.eStyleTextAlignment.Center;
|
||||||
|
this.gpItem.Style.TextColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelText;
|
||||||
|
this.gpItem.Style.TextLineAlignment = DevComponents.DotNetBar.eStyleTextAlignment.Near;
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
this.gpItem.StyleMouseDown.Class = "";
|
||||||
|
this.gpItem.StyleMouseDown.CornerType = DevComponents.DotNetBar.eCornerType.Square;
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
this.gpItem.StyleMouseOver.Class = "";
|
||||||
|
this.gpItem.StyleMouseOver.CornerType = DevComponents.DotNetBar.eCornerType.Square;
|
||||||
|
this.gpItem.TabIndex = 1;
|
||||||
|
this.gpItem.Text = "Item Mode";
|
||||||
|
//
|
||||||
|
// DisplayApplicability
|
||||||
|
//
|
||||||
|
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||||
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
|
this.Controls.Add(this.gpItem);
|
||||||
|
this.Controls.Add(this.gpMode);
|
||||||
|
this.Name = "DisplayApplicability";
|
||||||
|
this.Size = new System.Drawing.Size(324, 656);
|
||||||
|
this.ResumeLayout(false);
|
||||||
|
this.PerformLayout();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private DevComponents.DotNetBar.Controls.GroupPanel gpMode;
|
||||||
|
private DevComponents.DotNetBar.Controls.GroupPanel gpItem;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
380
PROMS/Volian.Controls.Library/DisplayApplicability.cs
Normal file
380
PROMS/Volian.Controls.Library/DisplayApplicability.cs
Normal file
@ -0,0 +1,380 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.Drawing;
|
||||||
|
using System.Data;
|
||||||
|
using System.Text;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
using VEPROMS.CSLA.Library;
|
||||||
|
|
||||||
|
namespace Volian.Controls.Library
|
||||||
|
{
|
||||||
|
public partial class DisplayApplicability : UserControl
|
||||||
|
{
|
||||||
|
public delegate void DisplayApplicabilityEvent(object sender, EventArgs args);
|
||||||
|
public event DisplayApplicabilityEvent ApplicabilityViewModeChanged;
|
||||||
|
private void OnApplicabilityViewModeChanged()
|
||||||
|
{
|
||||||
|
if (ApplicabilityViewModeChanged != null)
|
||||||
|
ApplicabilityViewModeChanged(this, new EventArgs());
|
||||||
|
}
|
||||||
|
private DisplayTabItem _MyDisplayTabItem = null;
|
||||||
|
public DisplayTabItem MyDisplayTabItem
|
||||||
|
{
|
||||||
|
get { return _MyDisplayTabItem; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_MyDisplayTabItem = value;
|
||||||
|
gpMode.Controls.Clear();
|
||||||
|
gpItem.Controls.Clear();
|
||||||
|
MyCheckBoxes.Clear();
|
||||||
|
if (_MyDisplayTabItem != null)
|
||||||
|
{
|
||||||
|
DocVersionConfig dcfg = _MyDisplayTabItem.MyItemInfo.MyDocVersion.MyConfig as DocVersionConfig;
|
||||||
|
List<string> names = new List<string>();
|
||||||
|
for (int n = 1; n <= dcfg.Unit_Count; n++)
|
||||||
|
{
|
||||||
|
dcfg.SelectedSlave = n;
|
||||||
|
names.Add(dcfg.Unit_Name);
|
||||||
|
}
|
||||||
|
// string[] names = dcfg.Unit_Name.Split(',');
|
||||||
|
int apple = -1;
|
||||||
|
if(_MyDisplayTabItem.MyStepTabPanel != null)
|
||||||
|
apple = _MyDisplayTabItem.MyStepTabPanel.MyStepPanel.ApplDisplayMode;
|
||||||
|
AddViewMode("Master", "-1", apple == -1);
|
||||||
|
int i = 0;
|
||||||
|
foreach (string name in names)
|
||||||
|
{
|
||||||
|
i++;
|
||||||
|
AddViewMode(name.Trim(), i.ToString(), apple == i);
|
||||||
|
}
|
||||||
|
AddItemMode("All", "-1");
|
||||||
|
i = 0;
|
||||||
|
foreach (string name in names)
|
||||||
|
AddItemMode(name.Trim(), (++i).ToString());
|
||||||
|
AddItemMode("None", "0");
|
||||||
|
if (_MyDisplayTabItem.MyStepTabPanel != null)
|
||||||
|
MyItemInfo = _MyDisplayTabItem.MyStepTabPanel.MyStepPanel.SelectedItemInfo;
|
||||||
|
else
|
||||||
|
MyItemInfo = _MyDisplayTabItem.MyItemInfo;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public int ViewMode
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
foreach (Control c in gpMode.Controls)
|
||||||
|
{
|
||||||
|
RadioButton rb = c as RadioButton;
|
||||||
|
if (rb.Checked)
|
||||||
|
return int.Parse(rb.Tag.ToString());
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private Dictionary<int, CheckBox> MyCheckBoxes = new Dictionary<int, CheckBox>();
|
||||||
|
private string _MyApplicability = string.Empty;
|
||||||
|
public string MyApplicability
|
||||||
|
{
|
||||||
|
get { return _MyApplicability; }
|
||||||
|
set { _MyApplicability = value; }
|
||||||
|
}
|
||||||
|
|
||||||
|
//private ProcedureInfo _MyProcedureInfo;
|
||||||
|
//public ProcedureInfo MyProcedureInfo
|
||||||
|
//{
|
||||||
|
//get { return _MyProcedureInfo; }
|
||||||
|
//set
|
||||||
|
//{
|
||||||
|
// _MyProcedureInfo = value;
|
||||||
|
// if (_MyProcedureInfo != null && _MyProcedureInfo.IsProcedure)
|
||||||
|
// {
|
||||||
|
// DocVersionConfig cfg = new DocVersionConfig(_MyProcedureInfo.MyDocVersion);
|
||||||
|
// if (cfg.Unit_Name == string.Empty)
|
||||||
|
// this.Visible = false;
|
||||||
|
// else
|
||||||
|
// {
|
||||||
|
// string[] names = cfg.Unit_Name.Split(',');
|
||||||
|
// gpMode.Controls.Clear();
|
||||||
|
// gpItem.Controls.Clear();
|
||||||
|
// MyCheckBoxes.Clear();
|
||||||
|
// AddViewMode("Master", "-1", true);
|
||||||
|
// int i = 0;
|
||||||
|
// foreach (string name in names)
|
||||||
|
// {
|
||||||
|
// AddViewMode(name.Trim(), (++i).ToString());
|
||||||
|
// }
|
||||||
|
// AddItemMode("All", "-1");
|
||||||
|
// i = 0;
|
||||||
|
// foreach (string name in names)
|
||||||
|
// AddItemMode(name.Trim(), (++i).ToString());
|
||||||
|
// AddItemMode("None", "0");
|
||||||
|
// //if(!this.Visible)
|
||||||
|
// // this.Visible = true;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
//}
|
||||||
|
private void AddItemMode(string name, string value)
|
||||||
|
{
|
||||||
|
CheckBox cb = new CheckBox();
|
||||||
|
cb.BackColor = Color.Transparent;
|
||||||
|
cb.Text = name;
|
||||||
|
cb.Tag = value;
|
||||||
|
cb.Dock = DockStyle.Top;
|
||||||
|
gpItem.Controls.Add(cb);
|
||||||
|
cb.BringToFront();
|
||||||
|
cb.CheckedChanged += new EventHandler(cb_CheckedChanged);
|
||||||
|
MyCheckBoxes.Add(value == null ? -1 : int.Parse(value), cb);
|
||||||
|
}
|
||||||
|
private void cb_CheckedChanged(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
UnwireCheckboxes(false);
|
||||||
|
CheckBox cb = sender as CheckBox;
|
||||||
|
CheckState cs = cb.CheckState;
|
||||||
|
switch (cb.Tag.ToString())
|
||||||
|
{
|
||||||
|
case "-1":
|
||||||
|
if (cs == CheckState.Checked)
|
||||||
|
{
|
||||||
|
SetCheckboxes(CheckState.Checked);
|
||||||
|
MyCheckBoxes[0].CheckState = CheckState.Unchecked;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
SetCheckboxes(CheckState.Unchecked);
|
||||||
|
MyCheckBoxes[0].CheckState = CheckState.Checked;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case "0":
|
||||||
|
if (cs == CheckState.Unchecked)
|
||||||
|
SetCheckboxes(CheckState.Checked);
|
||||||
|
else
|
||||||
|
SetCheckboxes(CheckState.Unchecked);
|
||||||
|
cb.CheckState = cs;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
if (AllNumbered(CheckState.Checked))
|
||||||
|
{
|
||||||
|
MyCheckBoxes[-1].CheckState = CheckState.Checked;
|
||||||
|
MyCheckBoxes[0].CheckState = CheckState.Unchecked;
|
||||||
|
}
|
||||||
|
else if (AllNumbered(CheckState.Unchecked))
|
||||||
|
{
|
||||||
|
MyCheckBoxes[-1].CheckState = CheckState.Unchecked;
|
||||||
|
MyCheckBoxes[0].CheckState = CheckState.Checked;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
MyCheckBoxes[-1].CheckState = CheckState.Unchecked;
|
||||||
|
MyCheckBoxes[0].CheckState = CheckState.Unchecked;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
WireCheckboxes();
|
||||||
|
MyApplicability = string.Empty;
|
||||||
|
string sep = string.Empty;
|
||||||
|
foreach (int i in MyCheckBoxes.Keys)
|
||||||
|
{
|
||||||
|
if (i < 0 && MyCheckBoxes[i].CheckState == CheckState.Checked)
|
||||||
|
{
|
||||||
|
MyApplicability = i.ToString();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
else if (i == 0 && MyCheckBoxes[i].CheckState == CheckState.Checked)
|
||||||
|
{
|
||||||
|
MyApplicability = i.ToString();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (MyCheckBoxes[i].CheckState == CheckState.Checked)
|
||||||
|
{
|
||||||
|
MyApplicability += sep + i.ToString();
|
||||||
|
sep = ",";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//IItemConfig cfg = MyItemInfo.MyConfig as IItemConfig;
|
||||||
|
//cfg.MasterSlave_Applicability.SetFlags(MyApplicability);
|
||||||
|
//Content c = Content.Get(MyItemInfo.MyContent.ContentID);
|
||||||
|
//c.Save();
|
||||||
|
//foreach (TransitionInfo ti in MyItemInfo.ItemTransitions_ToID)
|
||||||
|
//{
|
||||||
|
// if (!ti.MyItemToID.IsApplicable(MyApplicability))
|
||||||
|
// {
|
||||||
|
// MessageBox.Show("you can't do this");
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
List<InvalidTransition> invalidTrans = WillTransitionsBeValidCommand.Execute(MyItemInfo.ItemID, MyApplicability);
|
||||||
|
if (invalidTrans.Count == 0)
|
||||||
|
{
|
||||||
|
StepConfig sc = MyItemInfo.MyConfig as StepConfig;
|
||||||
|
sc.MasterSlave_Applicability = Volian.Base.Library.BigNum.MakeBigNum(MyApplicability);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
sb.AppendLine("Changing the applicability for this step will invalidate a transition in the following steps...");
|
||||||
|
sb.AppendLine();
|
||||||
|
foreach (InvalidTransition inv in invalidTrans)
|
||||||
|
sb.AppendLine(string.Format("From {0} to {1}", inv.SrcStep, inv.TgtStep));
|
||||||
|
MessageBox.Show(sb.ToString());
|
||||||
|
MyItemInfo = MyItemInfo;
|
||||||
|
}
|
||||||
|
//using (Content cnt = Content.Get(MyItemInfo.MyContent.ContentID))
|
||||||
|
//{
|
||||||
|
// cnt.DTS = DateTime.Now;
|
||||||
|
// cnt.UserID = Volian.Base.Library.VlnSettings.UserID;
|
||||||
|
// //cnt.Save();
|
||||||
|
//}
|
||||||
|
|
||||||
|
//using (Step s = Step.Get(MyItemInfo.ItemID))
|
||||||
|
//{
|
||||||
|
// IItemConfig cfg = new StepConfig(s);
|
||||||
|
// cfg.MasterSlave_Applicability = new Volian.Base.Library.BigNum(MyApplicability);
|
||||||
|
// s.MyContent.Config = cfg.ToString();
|
||||||
|
// s.Save();
|
||||||
|
//}
|
||||||
|
}
|
||||||
|
private bool AllNumbered(CheckState checkState)
|
||||||
|
{
|
||||||
|
foreach (CheckBox cb in MyCheckBoxes.Values)
|
||||||
|
if (int.Parse(cb.Tag.ToString()) > 0 && cb.CheckState != checkState)
|
||||||
|
return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
private void SetCheckboxes(CheckState cs)
|
||||||
|
{
|
||||||
|
foreach (CheckBox cb in MyCheckBoxes.Values)
|
||||||
|
cb.CheckState = cs;
|
||||||
|
}
|
||||||
|
private ItemInfo _MyItemInfo;
|
||||||
|
public ItemInfo MyItemInfo
|
||||||
|
{
|
||||||
|
get { return _MyItemInfo; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (_MyItemInfo != null)
|
||||||
|
{
|
||||||
|
MyApplicability = string.Empty;
|
||||||
|
string sep = string.Empty;
|
||||||
|
foreach (int i in MyCheckBoxes.Keys)
|
||||||
|
{
|
||||||
|
if (i < 0 && MyCheckBoxes[i].CheckState == CheckState.Checked)
|
||||||
|
{
|
||||||
|
MyApplicability = i.ToString();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
else if (i == 0 && MyCheckBoxes[i].CheckState == CheckState.Checked)
|
||||||
|
{
|
||||||
|
MyApplicability = i.ToString();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (MyCheckBoxes[i].CheckState == CheckState.Checked)
|
||||||
|
{
|
||||||
|
MyApplicability += sep + i.ToString();
|
||||||
|
sep = ",";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
_MyItemInfo = value;
|
||||||
|
if (_MyItemInfo != null)
|
||||||
|
{
|
||||||
|
if (this.Visible == false) return;
|
||||||
|
IItemConfig cfg = _MyItemInfo.MyConfig as IItemConfig;
|
||||||
|
List<int> apples = cfg.MasterSlave_Applicability.GetFlags();
|
||||||
|
UnwireCheckboxes(true);
|
||||||
|
if (apples.Count == 0)
|
||||||
|
{
|
||||||
|
SetCheckboxes(CheckState.Checked);
|
||||||
|
MyCheckBoxes[0].CheckState = CheckState.Unchecked;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
foreach (int apple in apples)
|
||||||
|
{
|
||||||
|
if(apple < MyCheckBoxes.Count)
|
||||||
|
MyCheckBoxes[apple].CheckState = CheckState.Checked;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
WireCheckboxes();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void WireCheckboxes()
|
||||||
|
{
|
||||||
|
foreach (CheckBox cb in MyCheckBoxes.Values)
|
||||||
|
cb.CheckedChanged += new EventHandler(cb_CheckedChanged);
|
||||||
|
}
|
||||||
|
private void UnwireCheckboxes(bool reset)
|
||||||
|
{
|
||||||
|
foreach (CheckBox cb in MyCheckBoxes.Values)
|
||||||
|
{
|
||||||
|
cb.CheckedChanged -= new EventHandler(cb_CheckedChanged);
|
||||||
|
if(reset)
|
||||||
|
cb.CheckState = CheckState.Unchecked;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void DisableCheckboxes()
|
||||||
|
{
|
||||||
|
foreach (CheckBox cb in MyCheckBoxes.Values)
|
||||||
|
cb.Enabled = false;
|
||||||
|
}
|
||||||
|
private void EnableCheckboxes()
|
||||||
|
{
|
||||||
|
foreach (CheckBox cb in MyCheckBoxes.Values)
|
||||||
|
cb.Enabled = true;
|
||||||
|
}
|
||||||
|
private void AddViewMode(string name, string value)
|
||||||
|
{
|
||||||
|
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);
|
||||||
|
rb.BringToFront();
|
||||||
|
rb.Checked = selected;
|
||||||
|
rb.CheckedChanged += new EventHandler(rb_CheckedChanged);
|
||||||
|
}
|
||||||
|
private void rb_CheckedChanged(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
RadioButton rb = sender as RadioButton;
|
||||||
|
if (rb.Checked)
|
||||||
|
{
|
||||||
|
if (int.Parse(rb.Tag.ToString()) > 0)
|
||||||
|
{
|
||||||
|
DisableCheckboxes();
|
||||||
|
MyCheckBoxes[int.Parse(rb.Tag.ToString())].Enabled = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
EnableCheckboxes();
|
||||||
|
OnApplicabilityViewModeChanged();
|
||||||
|
EditItem ei = MyDisplayTabItem.MyStepTabPanel.SelectedEditItem;
|
||||||
|
while (ei.Enabled == false)
|
||||||
|
ei = ei.MyParentEditItem ?? ei.MyPreviousEditItem;
|
||||||
|
ei.MyStepRTB.Focus();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public DisplayApplicability()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
this.VisibleChanged += new EventHandler(DisplayApplicability_VisibleChanged);
|
||||||
|
}
|
||||||
|
|
||||||
|
void DisplayApplicability_VisibleChanged(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
MyItemInfo = MyItemInfo;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
120
PROMS/Volian.Controls.Library/DisplayApplicability.resx
Normal file
120
PROMS/Volian.Controls.Library/DisplayApplicability.resx
Normal file
@ -0,0 +1,120 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<root>
|
||||||
|
<!--
|
||||||
|
Microsoft ResX Schema
|
||||||
|
|
||||||
|
Version 2.0
|
||||||
|
|
||||||
|
The primary goals of this format is to allow a simple XML format
|
||||||
|
that is mostly human readable. The generation and parsing of the
|
||||||
|
various data types are done through the TypeConverter classes
|
||||||
|
associated with the data types.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
... ado.net/XML headers & schema ...
|
||||||
|
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||||
|
<resheader name="version">2.0</resheader>
|
||||||
|
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||||
|
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||||
|
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||||
|
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||||
|
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||||
|
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||||
|
</data>
|
||||||
|
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||||
|
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||||
|
<comment>This is a comment</comment>
|
||||||
|
</data>
|
||||||
|
|
||||||
|
There are any number of "resheader" rows that contain simple
|
||||||
|
name/value pairs.
|
||||||
|
|
||||||
|
Each data row contains a name, and value. The row also contains a
|
||||||
|
type or mimetype. Type corresponds to a .NET class that support
|
||||||
|
text/value conversion through the TypeConverter architecture.
|
||||||
|
Classes that don't support this are serialized and stored with the
|
||||||
|
mimetype set.
|
||||||
|
|
||||||
|
The mimetype is used for serialized objects, and tells the
|
||||||
|
ResXResourceReader how to depersist the object. This is currently not
|
||||||
|
extensible. For a given mimetype the value must be set accordingly:
|
||||||
|
|
||||||
|
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||||
|
that the ResXResourceWriter will generate, however the reader can
|
||||||
|
read any of the formats listed below.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.binary.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.soap.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||||
|
value : The object must be serialized into a byte array
|
||||||
|
: using a System.ComponentModel.TypeConverter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
-->
|
||||||
|
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||||
|
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||||
|
<xsd:element name="root" msdata:IsDataSet="true">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:choice maxOccurs="unbounded">
|
||||||
|
<xsd:element name="metadata">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="assembly">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:attribute name="alias" type="xsd:string" />
|
||||||
|
<xsd:attribute name="name" type="xsd:string" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="data">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="resheader">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:choice>
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:schema>
|
||||||
|
<resheader name="resmimetype">
|
||||||
|
<value>text/microsoft-resx</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="version">
|
||||||
|
<value>2.0</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="reader">
|
||||||
|
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="writer">
|
||||||
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
</root>
|
Loading…
x
Reference in New Issue
Block a user