This commit is contained in:
parent
438fed8c7d
commit
0637a08e83
75
PROMS/VEPROMS User Interface/frmPSI.Designer.cs
generated
Normal file
75
PROMS/VEPROMS User Interface/frmPSI.Designer.cs
generated
Normal file
@ -0,0 +1,75 @@
|
|||||||
|
namespace VEPROMS
|
||||||
|
{
|
||||||
|
partial class frmPSI
|
||||||
|
{
|
||||||
|
/// <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 Windows Form 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.btnOk = new System.Windows.Forms.Button();
|
||||||
|
this.btnCancel = new System.Windows.Forms.Button();
|
||||||
|
this.SuspendLayout();
|
||||||
|
//
|
||||||
|
// btnOk
|
||||||
|
//
|
||||||
|
this.btnOk.DialogResult = System.Windows.Forms.DialogResult.OK;
|
||||||
|
this.btnOk.Location = new System.Drawing.Point(12, 222);
|
||||||
|
this.btnOk.Name = "btnOk";
|
||||||
|
this.btnOk.Size = new System.Drawing.Size(75, 23);
|
||||||
|
this.btnOk.TabIndex = 0;
|
||||||
|
this.btnOk.Text = "Ok";
|
||||||
|
this.btnOk.UseVisualStyleBackColor = true;
|
||||||
|
this.btnOk.Click += new System.EventHandler(this.btnOk_Click);
|
||||||
|
//
|
||||||
|
// btnCancel
|
||||||
|
//
|
||||||
|
this.btnCancel.Location = new System.Drawing.Point(109, 222);
|
||||||
|
this.btnCancel.Name = "btnCancel";
|
||||||
|
this.btnCancel.Size = new System.Drawing.Size(75, 23);
|
||||||
|
this.btnCancel.TabIndex = 1;
|
||||||
|
this.btnCancel.Text = "Cancel";
|
||||||
|
this.btnCancel.UseVisualStyleBackColor = true;
|
||||||
|
this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click);
|
||||||
|
//
|
||||||
|
// frmPSI
|
||||||
|
//
|
||||||
|
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F);
|
||||||
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
|
this.AutoSize = true;
|
||||||
|
this.ClientSize = new System.Drawing.Size(374, 257);
|
||||||
|
this.Controls.Add(this.btnCancel);
|
||||||
|
this.Controls.Add(this.btnOk);
|
||||||
|
this.Name = "frmPSI";
|
||||||
|
this.Text = "frmPSI";
|
||||||
|
this.ResumeLayout(false);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private System.Windows.Forms.Button btnOk;
|
||||||
|
private System.Windows.Forms.Button btnCancel;
|
||||||
|
}
|
||||||
|
}
|
149
PROMS/VEPROMS User Interface/frmPSI.cs
Normal file
149
PROMS/VEPROMS User Interface/frmPSI.cs
Normal file
@ -0,0 +1,149 @@
|
|||||||
|
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.Controls.Library;
|
||||||
|
|
||||||
|
namespace VEPROMS
|
||||||
|
{
|
||||||
|
public partial class frmPSI : Form
|
||||||
|
{
|
||||||
|
private ProcedureInfo _MyProcedureInfo;
|
||||||
|
private StepTabRibbon _MyStepTabRibbon;
|
||||||
|
private Dictionary<string, StepRTB> _DicStepRtb;
|
||||||
|
private Dictionary<string, CheckBox> _DicCheckBox;
|
||||||
|
public frmPSI(ProcedureInfo pi)
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
_DicStepRtb = new Dictionary<string, StepRTB>();
|
||||||
|
_DicCheckBox = new Dictionary<string, CheckBox>();
|
||||||
|
InitializeSpecificControls(pi);
|
||||||
|
_MyStepTabRibbon = new StepTabRibbon();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void InitializeSpecificControls(ProcedureInfo pi)
|
||||||
|
{
|
||||||
|
_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);
|
||||||
|
int maxx = 0;
|
||||||
|
int maxy = 0;
|
||||||
|
foreach (PsiLabel 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.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;
|
||||||
|
}
|
||||||
|
ProcedureConfig procConfig = pi.MyConfig as ProcedureConfig;
|
||||||
|
foreach (PsiField fld in psiDialogDef.FieldList)
|
||||||
|
{
|
||||||
|
if (fld.type.ToLower() == "text")
|
||||||
|
{
|
||||||
|
StepRTB tb = new StepRTB();
|
||||||
|
tb.Font = new Font("Arial", tb.Font.Size);
|
||||||
|
string mystr = tb.FontTable;
|
||||||
|
_DicStepRtb.Add(fld.name, tb);
|
||||||
|
tb.MyItemInfo = pi as ItemInfo;
|
||||||
|
tb.FieldToEdit = E_FieldToEdit.PSI;
|
||||||
|
tb.Enter += new System.EventHandler(this.FieldStepRTB_Enter);
|
||||||
|
// see if config has data for this field, i.e. search for the 'name'
|
||||||
|
string val = procConfig.GetValue("PSI", fld.name);
|
||||||
|
DisplayText dt = new DisplayText(val, new VE_Font("Arial", 10, E_Style.None), false);
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
sb.Append(@"{\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\fnil\fcharset2 Arial;}");
|
||||||
|
sb.Append(@"{\f1\fnil\fcharset0 Arial Unicode MS;}}{\colortbl ;\red255\green0\blue0;}");
|
||||||
|
sb.Append(@"\viewkind4\uc1\pard\sl-240\slmult0\fs" + (int)(this.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.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;
|
||||||
|
}
|
||||||
|
if (fld.type.ToLower()== "logical")
|
||||||
|
{
|
||||||
|
CheckBox cb = new CheckBox();
|
||||||
|
_DicCheckBox.Add(fld.name, cb);
|
||||||
|
cb.Text = fld.text;
|
||||||
|
cb.Location = new Point((int)fld.x * 2, (int)fld.y * 2);
|
||||||
|
cb.Visible = true;
|
||||||
|
string val = procConfig.GetValue("PSI", fld.name);
|
||||||
|
cb.Checked = val.ToUpper()[0] == 'Y' ? true : false;
|
||||||
|
this.Controls.Add(cb);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (psiDialogDef.ButtonsOnBottom.ToUpper() == "NO")
|
||||||
|
{
|
||||||
|
btnOk.Location = new Point(maxx+20, 30);
|
||||||
|
btnCancel.Location = new Point(maxx + 20, 60);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
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;
|
||||||
|
|
||||||
|
// loop through all of the fields (Text & logical)
|
||||||
|
bool isDirty = false;
|
||||||
|
foreach (PsiField fld in psiDialogDef.FieldList)
|
||||||
|
{
|
||||||
|
if (fld.type.ToLower() == "text")
|
||||||
|
{
|
||||||
|
StepRTB cur = _DicStepRtb[fld.name];
|
||||||
|
string rtf = cur.Rtf;
|
||||||
|
string newval = DisplayText.StaticStripRtfCommands(rtf);
|
||||||
|
// compare to original and if different, save in proc config.
|
||||||
|
string oldval = procConfig.GetValue("PSI", fld.name);
|
||||||
|
if (oldval != newval)
|
||||||
|
{
|
||||||
|
isDirty = true;
|
||||||
|
procConfig.SetValue("PSI", fld.name, newval);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (fld.type.ToLower() == "logical")
|
||||||
|
{
|
||||||
|
CheckBox cur = _DicCheckBox[fld.name];
|
||||||
|
string newval = cur.Checked ? "Y" : "N";
|
||||||
|
string oldval = procConfig.GetValue("PSI", fld.name);
|
||||||
|
if (newval != oldval)
|
||||||
|
{
|
||||||
|
isDirty = true;
|
||||||
|
procConfig.SetValue("PSI", fld.name, newval);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (isDirty)
|
||||||
|
{
|
||||||
|
using (Procedure proc = _MyProcedureInfo.Get())
|
||||||
|
{
|
||||||
|
proc.MyContent.Config = procConfig.ToString();
|
||||||
|
proc.Save();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
DialogResult = DialogResult.OK;
|
||||||
|
this.Close();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void btnCancel_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
DialogResult = DialogResult.Cancel;
|
||||||
|
this.Close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
120
PROMS/VEPROMS User Interface/frmPSI.resx
Normal file
120
PROMS/VEPROMS User Interface/frmPSI.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>
|
@ -154,6 +154,7 @@ namespace VEPROMS
|
|||||||
cmbFont.SelectedIndex = -1;
|
cmbFont.SelectedIndex = -1;
|
||||||
VETreeNode tn = VETreeNode.GetFolder(1);
|
VETreeNode tn = VETreeNode.GetFolder(1);
|
||||||
tv.Nodes.Add(tn);
|
tv.Nodes.Add(tn);
|
||||||
|
tv.NodePSI += new vlnTreeViewPSIEvent(tv_NodePSI);
|
||||||
tv.NodeOpenProperty += new vlnTreeViewPropertyEvent(tv_NodeOpenProperty);
|
tv.NodeOpenProperty += new vlnTreeViewPropertyEvent(tv_NodeOpenProperty);
|
||||||
tv.NodeSelect += new Volian.Controls.Library.vlnTreeViewEvent(tv_NodeSelect);
|
tv.NodeSelect += new Volian.Controls.Library.vlnTreeViewEvent(tv_NodeSelect);
|
||||||
tv.NodeNew += new vlnTreeViewEvent(tv_NodeNew);
|
tv.NodeNew += new vlnTreeViewEvent(tv_NodeNew);
|
||||||
@ -176,6 +177,15 @@ namespace VEPROMS
|
|||||||
this.Activated += new EventHandler(frmVEPROMS_Activated);
|
this.Activated += new EventHandler(frmVEPROMS_Activated);
|
||||||
VlnSettings.StepTypeToolType = Settings.Default.StepTypeToolTip;
|
VlnSettings.StepTypeToolType = Settings.Default.StepTypeToolTip;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DialogResult tv_NodePSI(object sender, vlnTreeEventArgs args)
|
||||||
|
{
|
||||||
|
VETreeNode vNode = (VETreeNode)args.Node;
|
||||||
|
IVEDrillDownReadOnly veObj = vNode.VEObject;
|
||||||
|
ProcedureInfo myProc = veObj as ProcedureInfo;
|
||||||
|
frmPSI fpsi = new frmPSI(myProc);
|
||||||
|
return fpsi.ShowDialog();
|
||||||
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Activate tmrTreeView so that the newly created Step recieves focus
|
/// Activate tmrTreeView so that the newly created Step recieves focus
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user