Updates to DropDownPanel, Baseline, & Controls

This commit is contained in:
2026-08-05 15:16:53 -04:00
parent 6f0fcdded2
commit 6d7d127b63
14 changed files with 356 additions and 453 deletions
+95 -89
View File
@@ -124,7 +124,7 @@ namespace Volian.Controls.Library
}
public override void SetActive()
{
this.BackColor = MyStepPanel.ActiveColor;
BackColor = MyStepPanel.ActiveColor;
}
public override void SetText()
{
@@ -231,7 +231,7 @@ namespace Volian.Controls.Library
private int _origCfgHt = 0; // keep track if original size was stored in cfg
private int _origCfgWd = 0;
private bool _pastedNew = false; // need this for flagging newly pasted image (may need to clear cfg)
private DisplayTags _displayTags = new DisplayTags();
private readonly DisplayTags _displayTags = new DisplayTags();
#endregion
#region Constructors
@@ -281,8 +281,8 @@ namespace Volian.Controls.Library
MyPictureBox.Width = wd;
MyPictureBox.Height = ht;
MyPictureBox.SizeMode = PictureBoxSizeMode.Zoom;
this.Width = MyPictureBox.Width + ImageMargin;
this.Height = MyPictureBox.Height + 10;
Width = MyPictureBox.Width + ImageMargin;
Height = MyPictureBox.Height + 10;
_newSizeWd = wd / (MyStepPanel.DPI / 72);
_newSizeHt = ht / (MyStepPanel.DPI / 72);
@@ -310,13 +310,10 @@ namespace Volian.Controls.Library
MyPictureBox.Width = wd;
MyPictureBox.Height = ht;
MyPictureBox.SizeMode = PictureBoxSizeMode.Zoom; // as resize matches width/height.
this.Width = MyPictureBox.Width + ImageMargin;
this.Height = MyPictureBox.Height + 10;
if (_displayTags != null)
{
// Set the Height and Width on the step properties page for the new image
_displayTags.SetNewImageHeightAndWidth(ht, wd);
}
Width = MyPictureBox.Width + ImageMargin;
Height = MyPictureBox.Height + 10;
// Set the Height and Width on the step properties page for the new image
_displayTags?.SetNewImageHeightAndWidth(ht, wd);
}
@@ -358,8 +355,8 @@ namespace Volian.Controls.Library
InsType = insType;
FileName = null;
SetupEditItem(itemInfo, myStepPanel, myParentEditItem, myChildRelation, expand, nextEditItem, false);
this.Width = 100 + ImageMargin;
this.Height = 100;
Width = 100 + ImageMargin;
Height = 100;
if (insType == ImageItem.E_ImageSource.File)
{
ImageFileDialog();
@@ -384,21 +381,22 @@ namespace Volian.Controls.Library
}
}
AdjustTableWidthAndLocation();
this.Controls.Add(this._MyPictureBox);
Controls.Add(_MyPictureBox);
AddEventHandlers();
MyStepRTB.RemoveEventHandlers();
MyStepRTB.Visible = false;
}
private void ImageFileDialog()
{
OpenFileDialog openFileDialog1 = new OpenFileDialog();
OpenFileDialog openFileDialog1 = new OpenFileDialog
{
InitialDirectory = "c:\\",
Filter = "Image files (*.jpg;*.tif;*.bmp;*.png)|*.jpg;*.tif;*.bmp;*.png|All files (*.*)|*.*",
FilterIndex = 0,
RestoreDirectory = true
};
openFileDialog1.InitialDirectory = "c:\\";
openFileDialog1.Filter = "Image files (*.jpg;*.tif;*.bmp;*.png)|*.jpg;*.tif;*.bmp;*.png|All files (*.*)|*.*";
openFileDialog1.FilterIndex = 0;
openFileDialog1.RestoreDirectory = true;
if (openFileDialog1.ShowDialog() == DialogResult.OK)
if (openFileDialog1.ShowDialog() == DialogResult.OK)
{
try
{
@@ -412,13 +410,14 @@ namespace Volian.Controls.Library
_IsDirty = true;
}
}
catch (Exception ex)
{
catch (Exception)
{
FlexibleMessageBox.Show("Could not create image, check file type.", "Error on Image File Selection");
return;
}
}
}
[System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE0060:Remove unused parameter", Justification = "Keeping img for potential future use")]
private static string GetImageFormatExtension(System.Drawing.Image img) => ("jpg"); // seems that this is the only one that works.
#endregion
#region RO_Images
@@ -471,13 +470,11 @@ namespace Volian.Controls.Library
if (val != null && val != "?")
{
string imgname = null;
int W = 0;
int H = 0;
string[] vals = val.Split("\n".ToCharArray());
W = (int)(Int32.Parse(vals[3], System.Globalization.NumberStyles.AllowHexSpecifier) * MyItemInfo.FormatStepData.Font.CharsToTwips);
int lines = Int32.Parse(vals[2], System.Globalization.NumberStyles.AllowHexSpecifier);
H = lines * 12;
try
string[] vals = val.Split("\n".ToCharArray());
int W = (int)(Int32.Parse(vals[3], System.Globalization.NumberStyles.AllowHexSpecifier) * MyItemInfo.FormatStepData.Font.CharsToTwips);
int lines = Int32.Parse(vals[2], System.Globalization.NumberStyles.AllowHexSpecifier);
int H = lines * 12;
try
{
imgname = vals[0];
ROImageInfo roImage = ROImageInfo.GetByROFstID_FileName(rofst.ROFstID, vals[0]);
@@ -492,9 +489,9 @@ namespace Volian.Controls.Library
AddROImageToScreen(W, H, imageText);
}
catch (Exception ex)
{
string msg = string.Format("Could not display image {0}.", imgname);
catch (Exception)
{
string msg = $"Could not display image {imgname}.";
FlexibleMessageBox.Show(msg);
}
}
@@ -511,9 +508,8 @@ namespace Volian.Controls.Library
ProcedureInfo proc = MyItemInfo.MyProcedure;
DocVersionInfo dvi = proc.ActiveParent as DocVersionInfo;
ROFstInfo rofst = dvi.DocVersionAssociations[0].MyROFst;
ROImageInfo roImageInfo = ROImageInfo.GetByROFstID_FileName(rofst.ROFstID, vals[0]);
if (roImageInfo == null) roImageInfo = rofst.GetROImageByFilename(vals[0], MyItemInfo);
if (roImageInfo != null)
ROImageInfo roImageInfo = ROImageInfo.GetByROFstID_FileName(rofst.ROFstID, vals[0]) ?? rofst.GetROImageByFilename(vals[0], MyItemInfo);
if (roImageInfo != null)
{
System.Drawing.Image.GetThumbnailImageAbort myCallback =
new System.Drawing.Image.GetThumbnailImageAbort(ThumbnailCallback);
@@ -526,7 +522,7 @@ namespace Volian.Controls.Library
// if there is config data that saves the resize of the image, use it, otherwise use what was passed in:
StepConfig sc = new StepConfig(MyItemInfo as StepInfo);
SizeF sizef = new Size(1, 1);
if (sc.Step_ImageHeight == null || sc.Step_ImageHeight == 0)
if (sc?.Step_ImageHeight == null || sc.Step_ImageHeight == 0)
{
sizef = new SizeF((img2.Width / img2.HorizontalResolution),
(img2.Height / img2.VerticalResolution));
@@ -555,16 +551,16 @@ namespace Volian.Controls.Library
{
// Always be sure to add the same event handlers to RemoveEventHandlers
MyItemInfo.MyContent.Changed += new VEPROMS.CSLA.Library.ContentInfoEvent(MyContent_Changed);
this.Enter += new System.EventHandler(ImageItem_Enter);
this.MyPictureBox.Enter += new System.EventHandler(ImageItem_Enter);
this.Click += new EventHandler(ImageItem_Click);
this.MyPictureBox.Click += new EventHandler(ImageItem_Click);
this.MyPictureBox.PreviewKeyDown += new PreviewKeyDownEventHandler(ImageItem_PreviewKeyDown); //note that PictureBox does not have cursorkey events
this.MyPictureBox.KeyDown += new KeyEventHandler(ImageItem_KeyDown);
this.MyStepRTB.RoInsert += new StepRTBRoEvent(MyStepRTB_RoInsert);
this.MyStepRTB.DoSaveContents += new StepRTBEvent(MyStepRTB_DoSaveContents); // for storing RO data
this.MyPictureBox.Resize += MyPictureBox_Resize;
this.MyPictureBox.MouseDown += MyPictureBox_MouseDown;
Enter += new System.EventHandler(ImageItem_Enter);
MyPictureBox.Enter += new System.EventHandler(ImageItem_Enter);
Click += new EventHandler(ImageItem_Click);
MyPictureBox.Click += new EventHandler(ImageItem_Click);
MyPictureBox.PreviewKeyDown += new PreviewKeyDownEventHandler(ImageItem_PreviewKeyDown); //note that PictureBox does not have cursorkey events
MyPictureBox.KeyDown += new KeyEventHandler(ImageItem_KeyDown);
MyStepRTB.RoInsert += new StepRTBRoEvent(MyStepRTB_RoInsert);
MyStepRTB.DoSaveContents += new StepRTBEvent(MyStepRTB_DoSaveContents); // for storing RO data
MyPictureBox.Resize += MyPictureBox_Resize;
MyPictureBox.MouseDown += MyPictureBox_MouseDown;
}
void MyPictureBox_MouseDown(object sender, MouseEventArgs e)
@@ -574,10 +570,10 @@ namespace Volian.Controls.Library
void MyPictureBox_Resize(object sender, EventArgs e)
{
if (this.Height != _MyPictureBox.Height + _MyPictureBox.Top + 7) // add in 7 to make it look good // + 10)
if (Height != _MyPictureBox.Height + _MyPictureBox.Top + 7) // add in 7 to make it look good // + 10)
{
LastMethodsPush(string.Format("MyPictureBox_Resize {0}", _MyPictureBox.Height));
this.Height = _MyPictureBox.Height + _MyPictureBox.Top + 7;
Height = _MyPictureBox.Height + _MyPictureBox.Top + 7;
LastMethodsPop();
}
}
@@ -585,16 +581,16 @@ namespace Volian.Controls.Library
{
// Always be sure to add the same event handlers to RemoveEventHandlers
MyItemInfo.MyContent.Changed -= new VEPROMS.CSLA.Library.ContentInfoEvent(MyContent_Changed);
this.Enter -= new System.EventHandler(ImageItem_Enter);
this.MyPictureBox.Enter -= new System.EventHandler(ImageItem_Enter);
this.Click -= new EventHandler(ImageItem_Click);
this.MyPictureBox.Click -= new EventHandler(ImageItem_Click);
this.MyPictureBox.PreviewKeyDown -= new PreviewKeyDownEventHandler(ImageItem_PreviewKeyDown);
this.MyPictureBox.KeyDown -= new KeyEventHandler(ImageItem_KeyDown);
this.MyStepRTB.RoInsert -= new StepRTBRoEvent(MyStepRTB_RoInsert);
this.MyStepRTB.DoSaveContents -= new StepRTBEvent(MyStepRTB_DoSaveContents);
this.MyPictureBox.Resize -= MyPictureBox_Resize;
this.MyPictureBox.MouseDown -= MyPictureBox_MouseDown;
Enter -= new System.EventHandler(ImageItem_Enter);
MyPictureBox.Enter -= new System.EventHandler(ImageItem_Enter);
Click -= new EventHandler(ImageItem_Click);
MyPictureBox.Click -= new EventHandler(ImageItem_Click);
MyPictureBox.PreviewKeyDown -= new PreviewKeyDownEventHandler(ImageItem_PreviewKeyDown);
MyPictureBox.KeyDown -= new KeyEventHandler(ImageItem_KeyDown);
MyStepRTB.RoInsert -= new StepRTBRoEvent(MyStepRTB_RoInsert);
MyStepRTB.DoSaveContents -= new StepRTBEvent(MyStepRTB_DoSaveContents);
MyPictureBox.Resize -= MyPictureBox_Resize;
MyPictureBox.MouseDown -= MyPictureBox_MouseDown;
}
void ImageItem_Click(object sender, EventArgs e)
{
@@ -675,8 +671,8 @@ namespace Volian.Controls.Library
}
void MyStepRTB_RoInsert(object sender, StepRTBRoEventArgs args)
{
int sel = MyStepRTB.SelectionStart + args.ValText.Length;
_IsDirty = true;
_ = MyStepRTB.SelectionStart + args.ValText.Length;
_IsDirty = true;
InsType = E_ImageSource.RoFigure;
MyStepRTB.UpdateStepRtb(args.LinkText, args.ValText);
HandleRoImage();
@@ -725,10 +721,12 @@ namespace Volian.Controls.Library
bool success = MyStepRTB.OrigDisplayText.Save((RichTextBox)MyStepRTB);
if (success && _newSizeHt != 0)
{
StepConfig sc = new StepConfig(MyItemInfo as StepInfo);
sc.Step_ImageWidth = (int)(_newSizeWd / (MyStepPanel.DPI / 72f));
sc.Step_ImageHeight = (int)(_newSizeHt / (MyStepPanel.DPI / 72f));
using (Item item = MyItemInfo.Get())
StepConfig sc = new StepConfig(MyItemInfo as StepInfo)
{
Step_ImageWidth = (int)(_newSizeWd / (MyStepPanel.DPI / 72f)),
Step_ImageHeight = (int)(_newSizeHt / (MyStepPanel.DPI / 72f))
};
using (Item item = MyItemInfo.Get())
{
item.MyContent.Config = sc.ToString();
item.Save();
@@ -761,9 +759,11 @@ namespace Volian.Controls.Library
ImageConfig imgCfg = null;
if (_pastedNew && compressed)
{
imgCfg = new ImageConfig();
imgCfg.Image_DataSize = origLen;
_MyItem.MyContent.MyImage.Config = imgCfg.ToString();
imgCfg = new ImageConfig
{
Image_DataSize = origLen
};
_MyItem.MyContent.MyImage.Config = imgCfg.ToString();
}
else if (_newSizeHt != 0)
{
@@ -800,10 +800,10 @@ namespace Volian.Controls.Library
// this should be saved for every piece of edited data. Note that the set of config
// item Step_MultipleChangeID has the save built in to it.
if (MyItemInfo.ActiveFormat.PlantFormat.FormatData.ProcData.ChangeBarData.ChangeIds
&& !this.MyStepPanel.MyStepTabPanel.MyDisplayTabControl.EditorialChange)
&& !MyStepPanel.MyStepTabPanel.MyDisplayTabControl.EditorialChange)
{
if (sc == null) sc = new StepConfig();
sc.Step_ChangeID = this.MyStepPanel.MyStepTabPanel.MyDisplayTabControl.ChgId;
sc.Step_ChangeID = MyStepPanel.MyStepTabPanel.MyDisplayTabControl.ChgId;
}
// We saved changes. Reset the change bar override.
// IF there is a step config remove the change bar override by setting the CBOverride value to null
@@ -813,8 +813,8 @@ namespace Volian.Controls.Library
sc.Step_CBOverride = null; // clear the change bar override
MyStepRTB.ClearUndo();
}
catch (Exception ex)
{
catch (Exception)
{
FlexibleMessageBox.Show("The image could not be saved.", "Image Save", MessageBoxButtons.OK, MessageBoxIcon.Information);
return;
}
@@ -825,8 +825,10 @@ namespace Volian.Controls.Library
{
// get filename's extension to map to imageformat:
string ext = fname.Substring(fname.LastIndexOf(".") + 1).ToUpper();
System.Drawing.Imaging.ImageFormat ifmt = System.Drawing.Imaging.ImageFormat.Gif;
switch (ext)
#pragma warning disable IDE0059 // Unnecessary assignment of a value
System.Drawing.Imaging.ImageFormat ifmt = System.Drawing.Imaging.ImageFormat.Gif;
#pragma warning restore IDE0059 // Unnecessary assignment of a value
switch (ext)
{
case ("JPG"):
ifmt = System.Drawing.Imaging.ImageFormat.Jpeg;
@@ -891,12 +893,14 @@ namespace Volian.Controls.Library
}
if (img == null)
{
OpenFileDialog openFileDialog1 = new OpenFileDialog();
openFileDialog1.InitialDirectory = "c:\\";
openFileDialog1.Filter = "Image files (*.jpg;*.tif;*.bmp;*.png)|*.jpg;*.tif;*.bmp;*.png|All files (*.*)|*.*";
openFileDialog1.FilterIndex = 0;
openFileDialog1.RestoreDirectory = true;
DialogResult dr = openFileDialog1.ShowDialog();
OpenFileDialog openFileDialog1 = new OpenFileDialog
{
InitialDirectory = "c:\\",
Filter = "Image files (*.jpg;*.tif;*.bmp;*.png)|*.jpg;*.tif;*.bmp;*.png|All files (*.*)|*.*",
FilterIndex = 0,
RestoreDirectory = true
};
DialogResult dr = openFileDialog1.ShowDialog();
if (dr == DialogResult.OK)
{
// check that it is an image
@@ -904,8 +908,8 @@ namespace Volian.Controls.Library
{
img = System.Drawing.Image.FromFile(openFileDialog1.FileName);
}
catch (Exception ex)
{
catch (Exception)
{
img = null;
}
if (img != null) filename = openFileDialog1.FileName;
@@ -939,9 +943,11 @@ namespace Volian.Controls.Library
ImageConfig imgCfg = null;
if (compressed)
{
imgCfg = new ImageConfig();
imgCfg.Image_DataSize = origLen;
_MyItem.MyContent.MyImage.Config = imgCfg.ToString();
imgCfg = new ImageConfig
{
Image_DataSize = origLen
};
_MyItem.MyContent.MyImage.Config = imgCfg.ToString();
}
_MyItem.MyContent.MyImage.Data = imgToByte;
_MyItem.MyContent.MyImage.FileName = filename;
@@ -956,13 +962,13 @@ namespace Volian.Controls.Library
public override void IdentifyMe(bool highlight)
{
if (highlight)
this.BackColor = Color.Gray;
BackColor = Color.Gray;
else
{
if (MyPictureBox.Focused || this.Focused) // If active Set BackColor to the active color
this.BackColor = MyStepPanel.ActiveColor;
if (MyPictureBox.Focused || Focused) // If active Set BackColor to the active color
BackColor = MyStepPanel.ActiveColor;
else // note that the 'inactive' color is actually MyStepPanel.PanelColor
this.BackColor = MyItemInfo.ItemAnnotationCount == 0 ? MyStepPanel.PanelColor : MyStepPanel.AnnotationColor;
BackColor = MyItemInfo.ItemAnnotationCount == 0 ? MyStepPanel.PanelColor : MyStepPanel.AnnotationColor;
}
}
#endregion
@@ -16,15 +16,20 @@ namespace Volian.Controls.Library
private EPFields myEPFields;
private AnnotationConfig MyConfig;
private StepTabRibbon _MyStepTabRibbon;
private Dictionary<string, TextBox> _DicTB;
private Dictionary<string, CheckBox> _DicCheckBox;
private Dictionary<string, ComboBox> _DicComboBox;
private Dictionary<string, ComboBox> _DicSingleRO;
private Dictionary<string, ListBoxMulti> _DicMultiRO;
private readonly StepTabRibbon _MyStepTabRibbon;
[System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE0044:Add readonly modifier", Justification = "Keeping Collections Not ReadOnly")]
private Dictionary<string, TextBox> _DicTB;
[System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE0044:Add readonly modifier", Justification = "Keeping Collections Not ReadOnly")]
private Dictionary<string, CheckBox> _DicCheckBox;
[System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE0044:Add readonly modifier", Justification = "Keeping Collections Not ReadOnly")]
private Dictionary<string, ComboBox> _DicComboBox;
[System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE0044:Add readonly modifier", Justification = "Keeping Collections Not ReadOnly")]
private Dictionary<string, ComboBox> _DicSingleRO;
[System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE0044:Add readonly modifier", Justification = "Keeping Collections Not ReadOnly")]
private Dictionary<string, ListBoxMulti> _DicMultiRO;
private TablePropertiesControl _TablePropControl;
private string multiseparator = ",";
private readonly string multiseparator = ",";
public frmEPAnnotationDetails(AnnotationInfo currAnn)
{
@@ -58,13 +63,15 @@ namespace Volian.Controls.Library
if (EP.type.ToLower() != "tableinput")
{
Label wlbl = new Label();
wlbl.Text = EP.label;
wlbl.Visible = true;
wlbl.TextAlign = ContentAlignment.MiddleLeft;
wlbl.Anchor = AnchorStyles.Left | AnchorStyles.Top;
wlbl.Width = (8 * MaxCharsInLabel) + 5;
panelEP.Controls.Add(wlbl, 0, panelEP.RowCount - 1);
Label wlbl = new Label
{
Text = EP.label,
Visible = true,
TextAlign = ContentAlignment.MiddleLeft,
Anchor = AnchorStyles.Left | AnchorStyles.Top,
Width = (8 * MaxCharsInLabel) + 5
};
panelEP.Controls.Add(wlbl, 0, panelEP.RowCount - 1);
}
if (EP.type.ToLower() == "text")
@@ -99,9 +106,11 @@ namespace Volian.Controls.Library
}
if (EP.type.ToLower() == "logical")
{
CheckBox cb = new CheckBox();
cb.Text = EP.text;
cb.Visible = true;
CheckBox cb = new CheckBox
{
Text = EP.text,
Visible = true
};
string val = MyConfig.GetValue("EP", EP.name);
cb.Checked = val != null && val != "" && val.ToUpper()[0] == 'Y';
_DicCheckBox.Add(EP.name, cb);
@@ -110,8 +119,10 @@ namespace Volian.Controls.Library
}
if (EP.type.ToLower() == "combo")
{
ComboBox cmb = new ComboBox();
cmb.Visible = true;
ComboBox cmb = new ComboBox
{
Visible = true
};
string tmp = EP.text;
string[] tmps = tmp.Split(",".ToCharArray());
foreach (string t in tmps) cmb.Items.Add(t.Trim());
@@ -124,10 +135,12 @@ namespace Volian.Controls.Library
}
if (EP.type.ToLower() == "rosingle")
{
ComboBox cmb = new ComboBox();
cmb.Visible = true;
ComboBox cmb = new ComboBox
{
Visible = true
};
List<ROListItem> tmps = EP.getROList(currAnn, true);
List<ROListItem> tmps = EP.getROList(currAnn, true);
cmb.DisplayMember = "Text";
cmb.ValueMember = "Value";
cmb.DataSource = tmps;
@@ -156,9 +169,11 @@ namespace Volian.Controls.Library
if (EP.type.ToLower() == "tableinput" && _TablePropControl == null)
{
string val = MyConfig.GetValue("EP", EP.name);
_TablePropControl = new TablePropertiesControl(EP.name, EP.label, val);
_TablePropControl.Anchor = AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top;
panelEP.Controls.Add(_TablePropControl, 1, panelEP.RowCount - 1);
_TablePropControl = new TablePropertiesControl(EP.name, EP.label, val)
{
Anchor = AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top
};
panelEP.Controls.Add(_TablePropControl, 1, panelEP.RowCount - 1);
}
@@ -13,7 +13,6 @@ namespace Volian.Controls.Library
public partial class frmImportWordContents : Form
{
LBApplicationClass _WordApp;
bool _initializing = false;
private StepRTB _MyStepRTB = null;
public StepRTB MyStepRTB
@@ -23,12 +22,10 @@ namespace Volian.Controls.Library
}
public frmImportWordContents()
{
_initializing = true;
InitializeComponent();
// C2019-021 Allow the Number field to be edited.
txbWordFile.Text = Properties.Settings.Default.ImportWordFilePath;
disableButtons();
_initializing = false;
// B2019-108 Enable/disable buttons
btnOpen.Enabled = File.Exists(txbWordFile.Text) && _WordApp == null;
}
@@ -44,14 +41,9 @@ namespace Volian.Controls.Library
btnInsertNext.Enabled = false;
btnReplaceNext.Enabled = false;
}
private void ofd_FileOk(object sender, CancelEventArgs e)
{
_initializing = true;
txbWordFile.Text = ofd.FileName;
_initializing = false;
}
private void ofd_FileOk(object sender, CancelEventArgs e) => txbWordFile.Text = ofd.FileName;
private void btnBrowse_Click(object sender, EventArgs e)
private void btnBrowse_Click(object sender, EventArgs e)
{
// if we have a word doc open, then close it and reset WordApp
if (_WordApp != null)
@@ -254,8 +246,8 @@ namespace Volian.Controls.Library
}
return retval.ToString();
}
catch (Exception ex)
{
catch (Exception)
{
return "12";
}
}
@@ -281,8 +273,7 @@ namespace Volian.Controls.Library
{
try
{
if (_WordApp != null)
_WordApp.Quit();
_WordApp?.Quit();
// B2019-108 Reset WordApp when closed.
_WordApp = null;
}
@@ -355,12 +346,11 @@ namespace Volian.Controls.Library
}
else
{
EditItem ei = MyStepRTB.Parent as EditItem;
if (ei != null)
{
ei.AddSiblingAfter();
}
}
if (MyStepRTB.Parent is EditItem ei)
{
ei.AddSiblingAfter();
}
}
}
}
@@ -380,10 +370,7 @@ namespace Volian.Controls.Library
ei = ei.MyParentEditItem;
else
ei = ei.MyPreviousEditItem;
if (ei != null)
{
ei.AddSiblingAfter();
}
ei?.AddSiblingAfter();
}
}
// C201-021 New Function Add a new High level step
@@ -402,10 +389,7 @@ namespace Volian.Controls.Library
ei = ei.MyParentEditItem;
else
ei = ei.MyPreviousEditItem;
if (ei != null)
{
ei.AddSiblingAfter();
}
ei?.AddSiblingAfter();
}
}
private EditItem GetEditItem(Control Ctrl)
@@ -556,7 +540,6 @@ namespace Volian.Controls.Library
return;
}
LoadTable2(xd.DocumentElement);
int type = 20008;
if(MyStepRTB.MyItemInfo.IsTable)
{
using( Item itm = MyStepRTB.MyItemInfo.Get())
@@ -573,7 +556,7 @@ namespace Volian.Controls.Library
{
EditItem ei = MyStepRTB.Parent as EditItem;
ei.AddChild(E_FromType.Table, 20008, TblFlexGrid);
if (ei != null) ei.SetAllTabs();
ei?.SetAllTabs();
}
}
@@ -624,7 +607,7 @@ namespace Volian.Controls.Library
int TableWidth = 0;
for (iC = 0; iC < tbl.Columns.Count; iC++)
{
TableWidth = TableWidth + Wcol[iC];
TableWidth += Wcol[iC];
}
tend = DateTime.Now; Console.WriteLine("{0} before Rollup columns", TimeSpan.FromTicks(tend.Ticks - tstart.Ticks).TotalMilliseconds); tstart = tend;
// roll up columns
@@ -649,7 +632,7 @@ namespace Volian.Controls.Library
Wcell[iR, i] = Wcell[iR, i - 1];
Wcell[iR, i - 1] = 0;
}
tmp = tmp - Wcol[iC + SpanC[iR, iC]];
tmp -= Wcol[iC + SpanC[iR, iC]];
SpanC[iR, iC]++;
}
iC = iC + SpanC[iR, iC] - 1;
@@ -13,7 +13,7 @@ namespace Volian.Controls.Library
{
public partial class frmSendErrorLog : Form
{
private string _ErrorLogPath;
private readonly string _ErrorLogPath;
public bool OutlookEmail
{
get { return rbOutlook.Checked; }
@@ -75,17 +75,21 @@ namespace Volian.Controls.Library
FileStream fs = null;
try
{
MailMessage mm = new MailMessage();
mm.From = new MailAddress(SMTPUser);
mm.To.Add("support@volian.com");
mm.Subject = $"PROMS Error Log {DateTime.Now.ToString("MM/dd/yyyy hh:mm:ss")}";
MailMessage mm = new MailMessage
{
From = new MailAddress(SMTPUser)
};
mm.To.Add("support@volian.com");
mm.Subject = $"PROMS Error Log {DateTime.Now:MM/dd/yyyy hh:mm:ss}";
mm.Body = $"{Header}\r\n\r\n{tbContent.Text}";
fs = File.Open(_ErrorLogPath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
mm.Attachments.Add(new Attachment(fs, "ErrorLog.txt"));
SmtpClient sc = new SmtpClient(SMTPServer);
sc.EnableSsl = true;
sc.Credentials = new NetworkCredential(SMTPUser, tbPassword.Text);
sc.Send(mm);
SmtpClient sc = new SmtpClient(SMTPServer)
{
EnableSsl = true,
Credentials = new NetworkCredential(SMTPUser, tbPassword.Text)
};
sc.Send(mm);
return true;
}
catch (Exception ex)
@@ -129,7 +133,7 @@ namespace Volian.Controls.Library
LBApplicationClass app = new LBApplicationClass();
LBMailItemClass msg = app.CreateMailItem();
msg.Recipients.Add("support@volian.com");
msg.Subject = $"PROMS Error Log {DateTime.Now.ToString("MM/dd/yyyy hh:mm:ss")}";
msg.Subject = $"PROMS Error Log {DateTime.Now:MM/dd/yyyy hh:mm:ss}";
msg.BodyFormat = LBOlBodyFormat.olFormatPlain;
msg.Body = $"{Header}\r\n\r\n{tbContent.Text}";
msg.AddAttachment(_ErrorLogPath);
@@ -6,8 +6,8 @@ namespace Volian.Controls.Library
{
public partial class frmViewTextFile : DevComponents.DotNetBar.Office2007Form //Form
{
string _FileName;
RichTextBoxStreamType _RTBType;
readonly string _FileName;
readonly RichTextBoxStreamType _RTBType;
public string ButtonText
{
get { return buttonX1.Text; }