C2025-027-Develop-a-way-to-filter-annotations-so-the-user-can-view-only-the-types-they-want-to-see-EP #544
Binary file not shown.
@ -316,10 +316,10 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
|
||||
//return a list of items based on the ROsource specified in the EPFormat File
|
||||
public Dictionary<int, string> getROList(AnnotationInfo currAnn)
|
||||
public List<ROListItem> getROList(AnnotationInfo currAnn, bool includeblank)
|
||||
{
|
||||
if (string.IsNullOrEmpty(rosource))
|
||||
return new Dictionary<int, string>();
|
||||
return new List<ROListItem>();
|
||||
|
||||
try
|
||||
{
|
||||
@ -329,8 +329,11 @@ namespace VEPROMS.CSLA.Library
|
||||
string roid = FormatRoidKey(rosource, false);
|
||||
rochild[] children = lookup.GetRoChildrenByRoid(roid);
|
||||
|
||||
|
||||
return children.Select(x => new { x.ID, x.title }).ToDictionary(t => t.ID, t => t.title);
|
||||
List<ROListItem> mylist = children.Select(x => new ROListItem(x.title, x.roid)).ToList();
|
||||
if (includeblank)
|
||||
mylist.Insert(0, new ROListItem("", ""));
|
||||
|
||||
return mylist;
|
||||
}
|
||||
catch (Exception Ex)
|
||||
{
|
||||
@ -339,5 +342,18 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
//C2025-023 - Electronic Procedures - Modifications to PROMS
|
||||
// class to handle return of RO Lists
|
||||
#region EPFormatFiles
|
||||
public class ROListItem
|
||||
{
|
||||
public string Text { get; private set; }
|
||||
public string Value { get; private set; }
|
||||
public ROListItem(string _text, string _value)
|
||||
{
|
||||
Text = _text; Value = _value;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
||||
|
52
PROMS/Volian.Controls.Library/ListBoxMulti.cs
Normal file
52
PROMS/Volian.Controls.Library/ListBoxMulti.cs
Normal file
@ -0,0 +1,52 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace Volian.Controls.Library
|
||||
{
|
||||
//Class to handle bug in Windows WinForms ListBox
|
||||
// that autoselects first item when no items are selected
|
||||
public partial class ListBoxMulti : ListBox
|
||||
{
|
||||
public ListBoxMulti()
|
||||
{
|
||||
Visible = true;
|
||||
SelectionMode = SelectionMode.MultiSimple;
|
||||
|
||||
SelectedIndexChanged += lb_SelectedIndexChanged;
|
||||
|
||||
Disposed += ListBoxMulti_Disposed;
|
||||
}
|
||||
|
||||
//singleselectedindex
|
||||
// will help to fix bug in Winforms ListBox
|
||||
// that autoselects first item when no items are selected
|
||||
// -1 = multi or set to this after 1st initialization
|
||||
// if this = 0 and only 1 item selected,
|
||||
// that means item was autoselected, so clear all items.
|
||||
public int singleselectedindex { get; set; }
|
||||
private void lb_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
ListBoxMulti tmp = (ListBoxMulti)sender;
|
||||
|
||||
if (tmp.SelectedItems.Count == 1 && tmp.singleselectedindex == 0)
|
||||
{
|
||||
tmp.ClearSelected();
|
||||
}
|
||||
else if (tmp.SelectedItems.Count == 1)
|
||||
tmp.singleselectedindex = tmp.SelectedIndex;
|
||||
else
|
||||
tmp.singleselectedindex = -1;
|
||||
|
||||
}
|
||||
|
||||
//remove event when get rid of object
|
||||
private void ListBoxMulti_Disposed(object sender, EventArgs e)
|
||||
{
|
||||
SelectedIndexChanged -= lb_SelectedIndexChanged;
|
||||
}
|
||||
}
|
||||
}
|
@ -603,10 +603,6 @@ namespace Volian.Controls.Library
|
||||
}
|
||||
public void SetGridContextMenu()
|
||||
{
|
||||
//C2025-023 - Electronic Procedures - Modifications to PROMS
|
||||
//Only show EP menu if an EP Annotation Type Exists
|
||||
btnEPDesignation.Visible = EPFormatFile.IsEPAnnotationType();
|
||||
|
||||
if (rtabTableGridTools.Visible)
|
||||
_ContextMenuBar.SetContextMenuEx(MyFlexGrid, btnCMGrid);
|
||||
}
|
||||
@ -774,43 +770,6 @@ namespace Volian.Controls.Library
|
||||
//C1.Win.C1FlexGrid.CellRange cr = MyFlexGrid.GetEvenSelection();
|
||||
//rbnBorderSelectionPanel.InitializeBorder(MyFlexGrid.MyBorders, cr.r1, cr.c1, cr.r2, cr.c2);
|
||||
rbnBorderSelectionPanel.InitializeBorder(MyFlexGrid, MyFlexGrid.Selection);
|
||||
|
||||
SetEPbuttonImages();
|
||||
|
||||
}
|
||||
|
||||
//C2025-023 - Electronic Procedures - Modifications to PROMS
|
||||
//Set which EP items are selected to show in the UI
|
||||
void SetEPbuttonImages()
|
||||
{
|
||||
if (EPFormatFile.IsEPAnnotationType())
|
||||
{
|
||||
VlnFlexGrid.EPinputtype myEPInput = MyFlexGrid.GetEPinputtype();
|
||||
Bitmap cb_Btmp = createTextBitmap('\u2713');
|
||||
switch (myEPInput)
|
||||
{
|
||||
case VlnFlexGrid.EPinputtype.none:
|
||||
btnEP_None.Image = cb_Btmp;
|
||||
btnEP_Text.Image = null;
|
||||
btnEP_Check.Image = null;
|
||||
break;
|
||||
case VlnFlexGrid.EPinputtype.textbox:
|
||||
btnEP_None.Image = null;
|
||||
btnEP_Text.Image = cb_Btmp;
|
||||
btnEP_Check.Image = null;
|
||||
break;
|
||||
case VlnFlexGrid.EPinputtype.checkbox:
|
||||
btnEP_None.Image = null;
|
||||
btnEP_Text.Image = null;
|
||||
btnEP_Check.Image = cb_Btmp;
|
||||
break;
|
||||
case VlnFlexGrid.EPinputtype.multi:
|
||||
btnEP_None.Image = null;
|
||||
btnEP_Text.Image = null;
|
||||
btnEP_Check.Image = null;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
void _MyEditItem_Leave(object sender, EventArgs e)
|
||||
{
|
||||
@ -4589,35 +4548,6 @@ namespace Volian.Controls.Library
|
||||
//MyFlexGrid.ListStyles();
|
||||
}
|
||||
}
|
||||
|
||||
//C2025-023 - Electronic Procedures - Modifications to PROMS
|
||||
//if button selected, set the Cell's UserData
|
||||
//then save the Grid
|
||||
|
||||
private void btnEP_None_Click(object sender, EventArgs e)
|
||||
{
|
||||
MyFlexGrid.SetEPinputtype(VlnFlexGrid.EPinputtype.none);
|
||||
SetEPbuttonImages();
|
||||
GridItem tmp = MyEditItem as GridItem;
|
||||
tmp.SaveContents();
|
||||
}
|
||||
|
||||
private void btnEP_Text_Click(object sender, EventArgs e)
|
||||
{
|
||||
MyFlexGrid.SetEPinputtype(VlnFlexGrid.EPinputtype.textbox);
|
||||
SetEPbuttonImages();
|
||||
GridItem tmp = MyEditItem as GridItem;
|
||||
tmp.SaveContents();
|
||||
}
|
||||
|
||||
private void btnEP_check_Click(object sender, EventArgs e)
|
||||
{
|
||||
MyFlexGrid.SetEPinputtype(VlnFlexGrid.EPinputtype.checkbox);
|
||||
SetEPbuttonImages();
|
||||
GridItem tmp = MyEditItem as GridItem;
|
||||
tmp.SaveContents();
|
||||
}
|
||||
|
||||
#endregion
|
||||
#region Table Grid Border
|
||||
private void btnTblDgnTableBorderNone_Click(object sender, EventArgs e)
|
||||
@ -4878,8 +4808,8 @@ namespace Volian.Controls.Library
|
||||
if (MyEditItem != null) MyEditItem.SaveCurrentAndContents();
|
||||
OnTimeCriticalActionSummaryRequest(new StepTabRibbonEventArgs(MyItemInfo.MyProcedure));
|
||||
}
|
||||
}
|
||||
public class StepTabRibbonEventArgs : EventArgs
|
||||
}
|
||||
public class StepTabRibbonEventArgs : EventArgs
|
||||
{
|
||||
public StepTabRibbonEventArgs() { ; }
|
||||
public StepTabRibbonEventArgs(ItemInfo proc)
|
||||
|
BIN
PROMS/Volian.Controls.Library/StepTabRibbon.designer.cs
generated
BIN
PROMS/Volian.Controls.Library/StepTabRibbon.designer.cs
generated
Binary file not shown.
File diff suppressed because it is too large
Load Diff
149
PROMS/Volian.Controls.Library/TablePropertiesControl.Designer.cs
generated
Normal file
149
PROMS/Volian.Controls.Library/TablePropertiesControl.Designer.cs
generated
Normal file
@ -0,0 +1,149 @@
|
||||
|
||||
namespace Volian.Controls.Library
|
||||
{
|
||||
partial class TablePropertiesControl
|
||||
{
|
||||
/// <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.lbl_Rows = new System.Windows.Forms.Label();
|
||||
this.lbl_Cols = new System.Windows.Forms.Label();
|
||||
this.NumRows = new System.Windows.Forms.NumericUpDown();
|
||||
this.NumCols = new System.Windows.Forms.NumericUpDown();
|
||||
this.dataview = new System.Windows.Forms.DataGridView();
|
||||
this.lbltitle = new System.Windows.Forms.Label();
|
||||
((System.ComponentModel.ISupportInitialize)(this.NumRows)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.NumCols)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.dataview)).BeginInit();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// lbl_Rows
|
||||
//
|
||||
this.lbl_Rows.AutoSize = true;
|
||||
this.lbl_Rows.Location = new System.Drawing.Point(0, 34);
|
||||
this.lbl_Rows.Name = "lbl_Rows";
|
||||
this.lbl_Rows.Size = new System.Drawing.Size(89, 13);
|
||||
this.lbl_Rows.TabIndex = 0;
|
||||
this.lbl_Rows.Text = "Number of Rows:";
|
||||
//
|
||||
// lbl_Cols
|
||||
//
|
||||
this.lbl_Cols.AutoSize = true;
|
||||
this.lbl_Cols.Location = new System.Drawing.Point(0, 56);
|
||||
this.lbl_Cols.Name = "lbl_Cols";
|
||||
this.lbl_Cols.Size = new System.Drawing.Size(102, 13);
|
||||
this.lbl_Cols.TabIndex = 1;
|
||||
this.lbl_Cols.Text = "Number of Columns:";
|
||||
//
|
||||
// NumRows
|
||||
//
|
||||
this.NumRows.Location = new System.Drawing.Point(114, 32);
|
||||
this.NumRows.Minimum = new decimal(new int[] {
|
||||
1,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
this.NumRows.Name = "NumRows";
|
||||
this.NumRows.Size = new System.Drawing.Size(47, 20);
|
||||
this.NumRows.TabIndex = 3;
|
||||
this.NumRows.Value = new decimal(new int[] {
|
||||
1,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
this.NumRows.ValueChanged += new System.EventHandler(this.NumRows_ValueChanged);
|
||||
//
|
||||
// NumCols
|
||||
//
|
||||
this.NumCols.Location = new System.Drawing.Point(114, 54);
|
||||
this.NumCols.Minimum = new decimal(new int[] {
|
||||
1,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
this.NumCols.Name = "NumCols";
|
||||
this.NumCols.Size = new System.Drawing.Size(47, 20);
|
||||
this.NumCols.TabIndex = 4;
|
||||
this.NumCols.Value = new decimal(new int[] {
|
||||
1,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
this.NumCols.ValueChanged += new System.EventHandler(this.NumCols_ValueChanged);
|
||||
//
|
||||
// dataview
|
||||
//
|
||||
this.dataview.AllowUserToAddRows = false;
|
||||
this.dataview.AllowUserToDeleteRows = false;
|
||||
this.dataview.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.dataview.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
this.dataview.ColumnHeadersVisible = false;
|
||||
this.dataview.Location = new System.Drawing.Point(3, 73);
|
||||
this.dataview.Name = "dataview";
|
||||
this.dataview.Size = new System.Drawing.Size(316, 150);
|
||||
this.dataview.TabIndex = 5;
|
||||
this.dataview.CellEndEdit += new System.Windows.Forms.DataGridViewCellEventHandler(this.dataview_CellEndEdit);
|
||||
//
|
||||
// lbltitle
|
||||
//
|
||||
this.lbltitle.AutoSize = true;
|
||||
this.lbltitle.Font = new System.Drawing.Font("Microsoft Sans Serif", 10F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.lbltitle.Location = new System.Drawing.Point(3, 4);
|
||||
this.lbltitle.Name = "lbltitle";
|
||||
this.lbltitle.Size = new System.Drawing.Size(0, 17);
|
||||
this.lbltitle.TabIndex = 6;
|
||||
//
|
||||
// TablePropertiesControl
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.Controls.Add(this.lbltitle);
|
||||
this.Controls.Add(this.dataview);
|
||||
this.Controls.Add(this.NumCols);
|
||||
this.Controls.Add(this.NumRows);
|
||||
this.Controls.Add(this.lbl_Cols);
|
||||
this.Controls.Add(this.lbl_Rows);
|
||||
this.Name = "TablePropertiesControl";
|
||||
this.Size = new System.Drawing.Size(319, 252);
|
||||
((System.ComponentModel.ISupportInitialize)(this.NumRows)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.NumCols)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.dataview)).EndInit();
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.Label lbl_Rows;
|
||||
private System.Windows.Forms.Label lbl_Cols;
|
||||
private System.Windows.Forms.NumericUpDown NumRows;
|
||||
private System.Windows.Forms.NumericUpDown NumCols;
|
||||
private System.Windows.Forms.DataGridView dataview;
|
||||
private System.Windows.Forms.Label lbltitle;
|
||||
}
|
||||
}
|
240
PROMS/Volian.Controls.Library/TablePropertiesControl.cs
Normal file
240
PROMS/Volian.Controls.Library/TablePropertiesControl.cs
Normal file
@ -0,0 +1,240 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace Volian.Controls.Library
|
||||
{
|
||||
//C2025-023 Electronic Procedures
|
||||
//Control for designating which cells in a table require EP input
|
||||
public partial class TablePropertiesControl : UserControl
|
||||
{
|
||||
//defines the type of possible inputs from an EP viewer
|
||||
public enum EPinputtype
|
||||
{
|
||||
none,
|
||||
textbox,
|
||||
checkbox
|
||||
};
|
||||
|
||||
private DataTable values;
|
||||
private BindingSource bindingSource = null;
|
||||
private int totalrows = 1;
|
||||
private int totalcols = 1;
|
||||
public readonly string epname;
|
||||
private bool IsInitializing;
|
||||
|
||||
//initialization / data will be in the format:
|
||||
// totalnumrows,totalnumcols;(row,col):value|(row,col):value...
|
||||
public TablePropertiesControl(string name, string title, string initialvalues)
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
IsInitializing = true;
|
||||
|
||||
epname = name;
|
||||
lbltitle.Text = title;
|
||||
initializevalues(initialvalues);
|
||||
bindingSource = new BindingSource(values, "");
|
||||
dataview.DataSource = bindingSource;
|
||||
dataview.AutoGenerateColumns = false;
|
||||
|
||||
Load += new EventHandler(FormLoad_setDefaults);
|
||||
}
|
||||
|
||||
//initialization / data will be in the format:
|
||||
// totalnumrows,totalnumcols;(row,col):value|(row,col):value...
|
||||
private void initializevalues(string initialvalues)
|
||||
{
|
||||
values = new DataTable("values");
|
||||
|
||||
if (!string.IsNullOrEmpty(initialvalues))
|
||||
{
|
||||
string[] grp = initialvalues.Split(';');
|
||||
string[] total = grp[0].Split(',');
|
||||
initializedt(int.Parse(total[0]), int.Parse(total[1]));
|
||||
|
||||
string[] ivs = grp[1].Split('|');
|
||||
//pair will be of format:
|
||||
//(row,col):value
|
||||
foreach (string pair in ivs)
|
||||
{
|
||||
Match m = Regex.Match(pair, @"\(([\d]),([\d])\):([\w]+)");
|
||||
if (m.Success)
|
||||
{
|
||||
int row = int.Parse(m.Groups[1].Value);
|
||||
int col = int.Parse(m.Groups[2].Value);
|
||||
string v = m.Groups[3].Value;
|
||||
values.Rows[row][col] = v;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
values.AcceptChanges();
|
||||
}
|
||||
else
|
||||
{
|
||||
initializedt(1, 1);
|
||||
}
|
||||
}
|
||||
|
||||
//initialize the blank datatable
|
||||
private void initializedt(int numrows, int numcols)
|
||||
{
|
||||
totalrows = numrows;
|
||||
totalcols = numcols;
|
||||
|
||||
for (int c = 0; c < totalcols; c++)
|
||||
{
|
||||
values.Columns.Add(new DataColumn($"Column{c}") { DefaultValue = "none" });
|
||||
}
|
||||
|
||||
for (int rw = 0; rw < totalrows; rw++)
|
||||
{
|
||||
values.Rows.Add();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void FormLoad_setDefaults(object sender, EventArgs e)
|
||||
{
|
||||
BindingSource bindingSourceDropDown = new BindingSource();
|
||||
bindingSourceDropDown.DataSource = Enum.GetNames(typeof(EPinputtype));
|
||||
|
||||
//in order to achieve a dropdown of possible values need
|
||||
//to remove the auto-inserted columns
|
||||
//that were auto-generated of type type text
|
||||
//when values was bound to the datagrid
|
||||
for (int c = 0; c < totalcols; c++)
|
||||
{
|
||||
dataview.Columns.RemoveAt(c);
|
||||
var cName = new DataGridViewComboBoxColumn();
|
||||
cName.DataSource = bindingSourceDropDown;
|
||||
cName.DefaultCellStyle.NullValue = "none";
|
||||
dataview.Columns.Insert(c, cName);
|
||||
}
|
||||
|
||||
NumRows.Value = totalrows;
|
||||
NumCols.Value = totalcols;
|
||||
IsInitializing = false;
|
||||
setDataViewtoValues();
|
||||
|
||||
}
|
||||
|
||||
//set the display cells to match the values in the datatable for initialization
|
||||
//and resize of the dataviewgrid
|
||||
void setDataViewtoValues()
|
||||
{
|
||||
if (!IsInitializing)
|
||||
{
|
||||
for (int c = 0; c < totalcols; c++)
|
||||
{
|
||||
for (int rw = 0; rw < totalrows; rw++)
|
||||
{
|
||||
dataview.Rows[rw].Cells[c].Value = values.Rows[rw][c];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Get storage string for storing table values in db
|
||||
// data will be returned in the format:
|
||||
// totalnumrows,totalnumcols;(row,col):value|(row,col):value...
|
||||
public string GetStorageValue()
|
||||
{
|
||||
//force any in progress editing to commit.
|
||||
((BindingSource)dataview.DataSource).EndEdit();
|
||||
|
||||
StringBuilder bldr = new StringBuilder();
|
||||
bldr.Append($"{totalrows},{totalcols}");
|
||||
List<string> points = new List<string>();
|
||||
for (int rw = 0; rw < values.Rows.Count; rw++)
|
||||
{
|
||||
for (int col = 0; col < values.Columns.Count; col++)
|
||||
{
|
||||
if ((string) values.Rows[rw][col] != "none")
|
||||
points.Add($"({rw},{col}):{values.Rows[rw][col]}");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (points.Count > 0)
|
||||
{
|
||||
bldr.Append(";");
|
||||
bldr.Append(string.Join("|", points));
|
||||
}
|
||||
|
||||
return bldr.ToString();
|
||||
}
|
||||
|
||||
private void NumRows_ValueChanged(object sender, EventArgs e)
|
||||
{
|
||||
int endNumRows = (int)NumRows.Value;
|
||||
int curNumRows = totalrows;
|
||||
|
||||
//remove rows till equal
|
||||
while (curNumRows > endNumRows)
|
||||
{
|
||||
values.Rows.RemoveAt(curNumRows - 1);
|
||||
curNumRows--;
|
||||
}
|
||||
//add rows till equal
|
||||
while (curNumRows < endNumRows)
|
||||
{
|
||||
values.Rows.Add();
|
||||
curNumRows++;
|
||||
}
|
||||
|
||||
totalrows = endNumRows;
|
||||
setDataViewtoValues();
|
||||
}
|
||||
|
||||
private void NumCols_ValueChanged(object sender, EventArgs e)
|
||||
{
|
||||
int endNumCols = (int)NumCols.Value;
|
||||
int curNumCols = totalcols;
|
||||
|
||||
BindingSource bindingSourceDropDown = new BindingSource();
|
||||
bindingSourceDropDown.DataSource = Enum.GetNames(typeof(EPinputtype));
|
||||
|
||||
//remove cols till equal
|
||||
while (curNumCols > endNumCols)
|
||||
{
|
||||
values.Columns.RemoveAt(curNumCols - 1);
|
||||
dataview.Columns.RemoveAt(curNumCols - 1);
|
||||
curNumCols--;
|
||||
}
|
||||
//add cols till equal
|
||||
while (curNumCols < endNumCols)
|
||||
{
|
||||
values.Columns.Add(new DataColumn($"Column{curNumCols + 1}") { DefaultValue = "none"});
|
||||
if (dataview.Columns.Count > curNumCols) dataview.Columns.RemoveAt(curNumCols);
|
||||
var cName = new DataGridViewComboBoxColumn();
|
||||
cName.DataSource = bindingSourceDropDown;
|
||||
cName.DefaultCellStyle.NullValue = "none";
|
||||
dataview.Columns.Add(cName);
|
||||
|
||||
curNumCols++;
|
||||
}
|
||||
|
||||
totalcols = endNumCols;
|
||||
setDataViewtoValues();
|
||||
}
|
||||
|
||||
//set the datatable value to match the changed datagridview value
|
||||
//for some reason despite being bound, does not automatically update
|
||||
// (it may be that datatable as a bindingsource does not implement INotifyProperty
|
||||
// and thus needs manually set like this)
|
||||
private void dataview_CellEndEdit(object sender, DataGridViewCellEventArgs e)
|
||||
{
|
||||
values.Rows[e.RowIndex][e.ColumnIndex] = (string) dataview.Rows[e.RowIndex].Cells[e.ColumnIndex].Value;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
120
PROMS/Volian.Controls.Library/TablePropertiesControl.resx
Normal file
120
PROMS/Volian.Controls.Library/TablePropertiesControl.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=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
@ -166,13 +166,6 @@ namespace Volian.Controls.Library
|
||||
{
|
||||
if (this.TableCellEditor.Text.Contains("<NewID>"))
|
||||
return false;
|
||||
//C2025-023 - Electronic Procedures - Modifications to PROMS
|
||||
//To handle if EP designation changed so will save in the DB
|
||||
if (IsUserDataDirty)
|
||||
{
|
||||
IsUserDataDirty = false;
|
||||
return true;
|
||||
}
|
||||
XmlDocument XdOld = new XmlDocument();
|
||||
oldXml = _ReplaceTextFont.Replace(oldXml, "$1" + FontChangeFmt + "$4"); // B2021-032: use original font
|
||||
XdOld.LoadXml(AdjustHeightAndWidthForDPI(oldXml));
|
||||
@ -335,7 +328,7 @@ namespace Volian.Controls.Library
|
||||
XmlNodeList nl = xd.SelectNodes("C1FlexGrid/Styles/Style/Definition");
|
||||
string data = string.Empty;
|
||||
foreach (XmlNode xn in nl)
|
||||
{
|
||||
{
|
||||
string str = xn.InnerText;
|
||||
string[] splStr = str.Split(';');
|
||||
foreach (string s in splStr)
|
||||
@ -859,10 +852,7 @@ namespace Volian.Controls.Library
|
||||
if (Row >= cr.r1 && Row <= cr.r2)
|
||||
{
|
||||
int cellHeight = GetCellHeight(Row, c);
|
||||
//C2025-023 - Electronic Procedures - Modifications to PROMS
|
||||
//Userdata will now contain: height, EP Designation
|
||||
string tmpUD = $"{cr.UserData}";
|
||||
int dataHeight = (cr.UserData == null) ? cellHeight : int.Parse(tmpUD.Split(',')[0]);
|
||||
int dataHeight = (cr.UserData == null) ? cellHeight : (int)cr.UserData;
|
||||
int ud = dataHeight / (Rows.DefaultSize - 3);
|
||||
//if (cellHeight < dataHeight)
|
||||
// Console.WriteLine("r {0}, c {1}, cell{2}, data{3}", Row, c, cellHeight, dataHeight);
|
||||
@ -1253,24 +1243,11 @@ namespace Volian.Controls.Library
|
||||
if (_tableCellEditor._initializingEdit || !_tableCellEditor.Visible) return;
|
||||
int curHeight = GetCellHeight(Row, Col);//(Rows[Row].Height == -1) ? Rows.DefaultSize : Rows[Row].Height;
|
||||
CellRange cr = GetMergedRange(Row, Col);
|
||||
//C2025-023 - Electronic Procedures - Modifications to PROMS
|
||||
//Userdata will now contain: height, EP Designation
|
||||
string tmpUD = $"{cr.UserData}";
|
||||
int oH = cr.UserData == null ? curHeight : int.Parse(tmpUD.Split(',')[0]);
|
||||
int oH = cr.UserData == null ? curHeight : (int)cr.UserData;
|
||||
int nH = _tableCellEditor.Height; //.ContentsRectangle.Height;
|
||||
int nW = _tableCellEditor.Width; // Width
|
||||
int Hadj = (nH - curHeight);//oH);
|
||||
string tmp = $"{cr.UserData}";
|
||||
int comma = tmp.IndexOf(',');
|
||||
if (comma != -1)
|
||||
{
|
||||
cr.UserData = $"{_tableCellEditor.Height},{tmp.Substring(comma + 1)}";
|
||||
}
|
||||
else
|
||||
{
|
||||
cr.UserData = _tableCellEditor.Height;
|
||||
}
|
||||
|
||||
cr.UserData = _tableCellEditor.Height; //.ContentsRectangle.Height;
|
||||
//int cellHeight = GetCellHeight(Row, Col);
|
||||
//int cellheightNLines = cellHeight / (Rows.DefaultSize - 3);
|
||||
//int nHNLines = nH / (Rows.DefaultSize - 3);
|
||||
@ -1394,18 +1371,7 @@ namespace Volian.Controls.Library
|
||||
{
|
||||
_rtf.Width = e.Bounds.Width - 1; // This has also been -3 which matchs the rener command
|
||||
CellRange cr = GetMergedRange(e.Row, e.Col);
|
||||
//C2025-023 - Electronic Procedures - Modifications to PROMS
|
||||
//Userdata will now contain: height, EP Designation
|
||||
string tmp = $"{cr.UserData}";
|
||||
int comma = tmp.IndexOf(',');
|
||||
if (comma != -1)
|
||||
{
|
||||
cr.UserData = $"{_rtf.Height},{tmp.Substring(comma + 1)}";
|
||||
}
|
||||
else
|
||||
{
|
||||
cr.UserData = _rtf.Height;
|
||||
}
|
||||
cr.UserData = _rtf.Height;
|
||||
int hAdjust = 0;
|
||||
int hDiff = e.Bounds.Height - _rtf.Height;
|
||||
if (hDiff < 0)
|
||||
@ -2646,84 +2612,6 @@ namespace Volian.Controls.Library
|
||||
CellRange cr = this.Selection;
|
||||
cr.Clear(ClearFlags.Content);
|
||||
}
|
||||
|
||||
public enum EPinputtype
|
||||
{
|
||||
none,
|
||||
textbox,
|
||||
checkbox,
|
||||
multi
|
||||
};
|
||||
private bool IsUserDataDirty = false;
|
||||
|
||||
//C2025-023 - Electronic Procedures - Modifications to PROMS
|
||||
//Userdata will now contain: height, EP Designation
|
||||
//For Electronic Procedures to set the Electronic Procedure input type
|
||||
//for when cells in a table will need a textbox or checkbox in the EP viewer
|
||||
public void SetEPinputtype(EPinputtype EPtype)
|
||||
{
|
||||
CellRange cr = this.Selection;
|
||||
|
||||
for (int r = cr.r1; r <= cr.r2; r++)
|
||||
for (int c = cr.c1; c <= cr.c2; c++)
|
||||
{
|
||||
CellRange cr_single = GetCellRange(r, c);
|
||||
string tmpUD = $"{cr_single.UserData}";
|
||||
string height = cr_single.UserData == null ? $"{GetCellHeight(r, c)}" : tmpUD.Split(',')[0];
|
||||
|
||||
if (EPtype == EPinputtype.none)
|
||||
cr_single.UserData = int.Parse(height);
|
||||
else
|
||||
cr_single.UserData = $"{height},{EPtype}";
|
||||
}
|
||||
|
||||
//save the changes
|
||||
Select(cr);
|
||||
IsUserDataDirty = true;
|
||||
}
|
||||
|
||||
//C2025-023 - Electronic Procedures - Modifications to PROMS
|
||||
//Userdata will now contain: height, EP Designation
|
||||
//For Electronic Procedures get the Electronic Procedure input type
|
||||
//for when cells in a table will need a textbox or checkbox in the EP viewer
|
||||
public EPinputtype GetEPinputtype()
|
||||
{
|
||||
EPinputtype result = EPinputtype.none;
|
||||
|
||||
CellRange cr = this.Selection;
|
||||
|
||||
for (int r = cr.r1; r <= cr.r2; r++)
|
||||
for (int c = cr.c1; c <= cr.c2; c++)
|
||||
{
|
||||
CellRange cr_single = GetCellRange(r, c);
|
||||
string tmpUD = $"{cr_single.UserData}";
|
||||
int comma = tmpUD.IndexOf(',');
|
||||
if (comma != -1)
|
||||
{
|
||||
EPinputtype newresult = (EPinputtype) Enum.Parse(typeof(EPinputtype), tmpUD.Substring(comma + 1));
|
||||
//if first cell, overwrite none
|
||||
if (result == EPinputtype.none && r == cr.r1 && c == cr.c1)
|
||||
{
|
||||
result = newresult;
|
||||
}
|
||||
else if (result != newresult)
|
||||
{
|
||||
result = EPinputtype.multi;
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
else if (result != EPinputtype.none)
|
||||
{
|
||||
result = EPinputtype.multi;
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
|
||||
}
|
||||
|
||||
public void SetupCellUserData()
|
||||
{
|
||||
for (int r = 0; r < Rows.Count; r++)
|
||||
@ -2737,19 +2625,7 @@ namespace Volian.Controls.Library
|
||||
_rtf.Width = Cols[c].Width;
|
||||
_rtf.Rtf = rtfText;
|
||||
CellRange cr = GetCellRange(r, c);
|
||||
|
||||
//C2025-023 - Electronic Procedures - Modifications to PROMS
|
||||
//Userdata will now contain: height, EP Designation
|
||||
string tmp = $"{cr.UserData}";
|
||||
int comma = tmp.IndexOf(',');
|
||||
if (comma != -1)
|
||||
{
|
||||
cr.UserData = $"{_rtf.ContentsRectangle.Height},{tmp.Substring(comma + 1)}";
|
||||
}
|
||||
else
|
||||
{
|
||||
cr.UserData = _rtf.ContentsRectangle.Height;
|
||||
}
|
||||
cr.UserData = _rtf.ContentsRectangle.Height;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -280,6 +280,9 @@
|
||||
<DependentUpon>ImageItem.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="LinkText.cs" />
|
||||
<Compile Include="ListBoxMulti.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="PreviewMultiLineRO.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
@ -380,6 +383,12 @@
|
||||
</Compile>
|
||||
<Compile Include="RomanNumeral.cs" />
|
||||
<Compile Include="RTBAPI.cs" />
|
||||
<Compile Include="TablePropertiesControl.cs">
|
||||
<SubType>UserControl</SubType>
|
||||
</Compile>
|
||||
<Compile Include="TablePropertiesControl.Designer.cs">
|
||||
<DependentUpon>TablePropertiesControl.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="TransPanel.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
@ -525,6 +534,9 @@
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="TablePropertiesControl.resx">
|
||||
<DependentUpon>TablePropertiesControl.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="vlnExpander.resx">
|
||||
<DependentUpon>vlnExpander.cs</DependentUpon>
|
||||
<SubType>Designer</SubType>
|
||||
|
@ -24,6 +24,10 @@ namespace Volian.Controls.Library
|
||||
private Dictionary<string, CheckBox> _DicCheckBox;
|
||||
private Dictionary<string, ComboBox> _DicComboBox;
|
||||
private Dictionary<string, ComboBox> _DicSingleRO;
|
||||
private Dictionary<string, ListBoxMulti> _DicMultiRO;
|
||||
private TablePropertiesControl _TablePropControl;
|
||||
|
||||
private string multiseparator = ",";
|
||||
|
||||
public frmEPAnnotationDetails(AnnotationInfo currAnn)
|
||||
{
|
||||
@ -32,6 +36,7 @@ namespace Volian.Controls.Library
|
||||
_DicCheckBox = new Dictionary<string, CheckBox>();
|
||||
_DicComboBox = new Dictionary<string, ComboBox>();
|
||||
_DicSingleRO = new Dictionary<string, ComboBox>();
|
||||
_DicMultiRO = new Dictionary<string, ListBoxMulti>();
|
||||
InitializeSpecificControls(currAnn);
|
||||
_MyStepTabRibbon = new StepTabRibbon();
|
||||
}
|
||||
@ -108,9 +113,11 @@ namespace Volian.Controls.Library
|
||||
cmb.Visible = true;
|
||||
string tmp = EP.text;
|
||||
string[] tmps = tmp.Split(",".ToCharArray());
|
||||
foreach (string t in tmps) cmb.Items.Add(t);
|
||||
foreach (string t in tmps) cmb.Items.Add(t.Trim());
|
||||
string val = MyConfig.GetValue("EP", EP.name);
|
||||
if (val != null && val != "") cmb.SelectedItem = val;
|
||||
cmb.DropDownWidth = TextRenderer.MeasureText(tmps.OrderByDescending(x => x.Length).First(), cmb.Font).Width + SystemInformation.VerticalScrollBarWidth;
|
||||
cmb.Width = cmb.DropDownWidth;
|
||||
_DicComboBox.Add(EP.name, cmb);
|
||||
panelEP.Controls.Add(cmb, 1, panelEP.RowCount - 1);
|
||||
}
|
||||
@ -118,28 +125,83 @@ namespace Volian.Controls.Library
|
||||
{
|
||||
ComboBox cmb = new ComboBox();
|
||||
cmb.Visible = true;
|
||||
cmb.DisplayMember = "Value";
|
||||
cmb.ValueMember = "Key";
|
||||
Dictionary<int, string> tmps = EP.getROList(currAnn);
|
||||
//foreach (var t in tmps)
|
||||
// cmb.Items.Add(t);
|
||||
|
||||
tmps.Add(-1, "");
|
||||
cmb.DataSource = new BindingSource(tmps, null);
|
||||
string val = MyConfig.GetValue("EP", EP.name);
|
||||
if (val != null && val != "" && int.TryParse(val, out int n))
|
||||
cmb.SelectedValue = n;
|
||||
else
|
||||
cmb.SelectedValue = -1;
|
||||
//cmb.SelectedItem = null;
|
||||
List<ROListItem> tmps = EP.getROList(currAnn, true);
|
||||
cmb.DisplayMember = "Text";
|
||||
cmb.ValueMember = "Value";
|
||||
cmb.DataSource = tmps;
|
||||
cmb.DropDownStyle = ComboBoxStyle.DropDownList;
|
||||
cmb.DropDownWidth = TextRenderer.MeasureText(tmps.OrderByDescending(x => x.Text.Length).First().Text, cmb.Font).Width + SystemInformation.VerticalScrollBarWidth;
|
||||
cmb.Width = cmb.DropDownWidth;
|
||||
|
||||
_DicSingleRO.Add(EP.name, cmb);
|
||||
panelEP.Controls.Add(cmb, 1, panelEP.RowCount - 1);
|
||||
}
|
||||
if (EP.type.ToLower() == "romulti")
|
||||
{
|
||||
ListBoxMulti lb = new ListBoxMulti();
|
||||
|
||||
List<ROListItem> tmps = EP.getROList(currAnn, false);
|
||||
lb.DisplayMember = "Text";
|
||||
lb.ValueMember = "Value";
|
||||
lb.Width = TextRenderer.MeasureText(tmps.OrderByDescending(x => x.Text.Length).First().Text, lb.Font).Width + SystemInformation.VerticalScrollBarWidth;
|
||||
|
||||
lb.DataSource = tmps;
|
||||
_DicMultiRO.Add(EP.name, lb);
|
||||
panelEP.Controls.Add(lb, 1, panelEP.RowCount - 1);
|
||||
|
||||
}
|
||||
//note will allow only 1 tableproperties control since it is a 1:1 match with the table that is in the step
|
||||
if (EP.type.ToLower() == "tableinput" && _TablePropControl == null)
|
||||
{
|
||||
string val = MyConfig.GetValue("EP", EP.name);
|
||||
_TablePropControl = new TablePropertiesControl(EP.name, EP.text, val);
|
||||
_TablePropControl.Anchor = AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top;
|
||||
panelEP.Controls.Add(_TablePropControl, 1, panelEP.RowCount - 1);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Load += new EventHandler(Form1Load_setDefaults);
|
||||
}
|
||||
|
||||
private void FieldStepRTB_Enter(object sender, EventArgs e)
|
||||
void Form1Load_setDefaults(object sender, EventArgs e)
|
||||
{
|
||||
foreach (KeyValuePair<string, ComboBox> pair in _DicSingleRO)
|
||||
{
|
||||
string val = MyConfig.GetValue("EP", pair.Key);
|
||||
if (val != null && val != "")
|
||||
pair.Value.SelectedValue = val;
|
||||
else
|
||||
pair.Value.SelectedValue = "";
|
||||
}
|
||||
|
||||
foreach (KeyValuePair<string, ListBoxMulti> pair in _DicMultiRO)
|
||||
{
|
||||
//clear all items at start in case items were autoselected - bug in Winforms ListBox
|
||||
pair.Value.ClearSelected();
|
||||
string val = MyConfig.GetValue("EP", pair.Key);
|
||||
if (val != null && val != "")
|
||||
{
|
||||
var selectedvalues = val.Split(multiseparator.ToCharArray());
|
||||
foreach (string item in selectedvalues)
|
||||
{
|
||||
string text = ((List<ROListItem>)pair.Value.DataSource).First(x => x.Value == item).Text;
|
||||
pair.Value.SetSelected(pair.Value.FindString(text), true);
|
||||
}
|
||||
}
|
||||
|
||||
//set this to -1 after initial setting of values
|
||||
//this will help to fix bug in Winforms ListBox
|
||||
//that autoselects first item when no items are selected
|
||||
pair.Value.singleselectedindex = -1;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void FieldStepRTB_Enter(object sender, EventArgs e)
|
||||
{
|
||||
_MyStepTabRibbon.MyStepRTB = (StepRTB)sender;
|
||||
}
|
||||
@ -154,8 +216,7 @@ namespace Volian.Controls.Library
|
||||
{
|
||||
StepRTB cur = _DicStepRtb[EP.name];
|
||||
string rtf = cur.Rtf;
|
||||
string newval = DisplayText.StaticStripRtfCommands(rtf, false); // C2020-001: added 'false'
|
||||
// compare to original and if different, save in proc config.
|
||||
string newval = DisplayText.StaticStripRtfCommands(rtf, false);
|
||||
string oldval = MyConfig.GetValue("EP", EP.name);
|
||||
if (oldval != newval)
|
||||
{
|
||||
@ -190,12 +251,34 @@ namespace Volian.Controls.Library
|
||||
ComboBox cmbcur = _DicSingleRO[EP.name];
|
||||
string newval = cmbcur.SelectedValue.ToString();
|
||||
string oldval = MyConfig.GetValue("EP", EP.name);
|
||||
if (newval == "-1") newval = "";
|
||||
if (newval != oldval)
|
||||
{
|
||||
isDirty = true;
|
||||
MyConfig.SetValue("EP", EP.name, newval);
|
||||
}
|
||||
}
|
||||
else if (EP.type.ToLower() == "romulti")
|
||||
{
|
||||
ListBoxMulti lbcur = _DicMultiRO[EP.name];
|
||||
string newvalues = String.Join(multiseparator, lbcur.SelectedItems.OfType<ROListItem>().Select(item => item.Value));
|
||||
string oldvalues = MyConfig.GetValue("EP", EP.name);
|
||||
if (newvalues != oldvalues)
|
||||
{
|
||||
isDirty = true;
|
||||
MyConfig.SetValue("EP", EP.name, newvalues);
|
||||
}
|
||||
}
|
||||
else if (EP.type.ToLower() == "tableinput" && EP.name == _TablePropControl.epname)
|
||||
{
|
||||
string newvalues = _TablePropControl.GetStorageValue();
|
||||
string oldvalues = MyConfig.GetValue("EP", EP.name);
|
||||
if (newvalues != oldvalues)
|
||||
{
|
||||
isDirty = true;
|
||||
MyConfig.SetValue("EP", EP.name, newvalues);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (isDirty)
|
||||
{
|
||||
@ -209,8 +292,6 @@ namespace Volian.Controls.Library
|
||||
annotation.Save();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
DialogResult = DialogResult.OK;
|
||||
Close();
|
||||
@ -229,6 +310,13 @@ namespace Volian.Controls.Library
|
||||
{
|
||||
tb.Enter -= FieldStepRTB_Enter;
|
||||
}
|
||||
}
|
||||
|
||||
foreach (ListBoxMulti lb in _DicMultiRO.Values)
|
||||
{
|
||||
lb.Dispose();
|
||||
}
|
||||
|
||||
Load -= Form1Load_setDefaults;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user