This commit is contained in:
787
PROMS/VEPROMS_UI/frmVEPROMS.cs
Normal file
787
PROMS/VEPROMS_UI/frmVEPROMS.cs
Normal file
@@ -0,0 +1,787 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Specialized;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using VEPROMS.CSLA.Library;
|
||||
using Csla;
|
||||
using DevComponents;
|
||||
using Csla.Validation;
|
||||
using VEPROMS.Properties;
|
||||
using Volian.Controls.Library;
|
||||
|
||||
[assembly: log4net.Config.XmlConfigurator(Watch = true)]
|
||||
|
||||
namespace VEPROMS
|
||||
{
|
||||
public partial class frmVEPROMS : DevComponents.DotNetBar.Office2007RibbonForm
|
||||
{
|
||||
#region Log4Net
|
||||
private static readonly log4net.ILog log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
||||
#endregion
|
||||
Folder _LastFolder = null;
|
||||
FolderInfo _LastFolderInfo = null;
|
||||
Procedure _LastProcedure = null;
|
||||
ProcedureInfo _LastProcedureInfo = null;
|
||||
DocVersion _LastDocVersion = null;
|
||||
DocVersionInfo _LastDocVersionInfo = null;
|
||||
SectionInfo _LastSectionInfo = null;
|
||||
Section _LastSection = null;
|
||||
VETreeNode _LastTreeNode = null;
|
||||
Step _LastStep = null;
|
||||
StepInfo _LastStepInfo = null;
|
||||
Color _CommentTitleBckColor;
|
||||
|
||||
VETreeNode _PrevBookMark = null;
|
||||
|
||||
public frmVEPROMS()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
// set the color of the ribbon
|
||||
// - get the color selected by user if available
|
||||
//DevComponents.DotNetBar.RibbonPredefinedColorSchemes.ChangeOffice2007ColorTable((Settings.Default["SystemColor"] != null) ? Settings.Default.SystemColor : (int)DevComponents.DotNetBar.Rendering.eOffice2007ColorScheme.Black);
|
||||
|
||||
VETreeNode tn = VETreeNode.GetFolder(1);
|
||||
tv.Nodes.Add(tn);
|
||||
tv.NodeNew += new Volian.Controls.Library.vlnTreeViewTreeNodeEvent(tv_NodeNew);
|
||||
tv.NodeDragDrop += new Volian.Controls.Library.vlnTreeViewEvent(tv_NodeDragDrop);
|
||||
tv.NodeDelete += new Volian.Controls.Library.vlnTreeViewBoolEvent(tv_NodeDelete);
|
||||
tv.NodeProperties += new Volian.Controls.Library.vlnTreeViewEvent(tv_NodeProperties);
|
||||
_CommentTitleBckColor = epComments.TitleStyle.BackColor1.Color;
|
||||
epComments.Expanded = false;
|
||||
// Need: load previously set bookmarks
|
||||
btnPrevPos.Enabled = false;
|
||||
btnClrBookMrks.Enabled = false;
|
||||
btnRmvCurBookMrk.Enabled = false;
|
||||
lbxBookMarks.Enabled = false;
|
||||
_PrevBookMark = null;
|
||||
}
|
||||
|
||||
void SetupNodes(VETreeNode node)
|
||||
{
|
||||
if (!node.Equals(_LastTreeNode))
|
||||
{
|
||||
_LastTreeNode = node;
|
||||
_LastFolderInfo = null;
|
||||
_LastFolder = null;
|
||||
_LastDocVersion = null;
|
||||
_LastProcedure = null;
|
||||
_LastSection = null;
|
||||
_LastStep = null;
|
||||
epComments.Expanded = false;
|
||||
rtxbComment.Text = "";
|
||||
epComments.TitleStyle.BackColor1.Color = _CommentTitleBckColor;
|
||||
|
||||
switch (node.VEObject.GetType().Name)
|
||||
{
|
||||
case "FolderInfo":
|
||||
_LastFolderInfo = (FolderInfo)(_LastTreeNode.VEObject);
|
||||
_LastFolder = _LastFolderInfo.Get();
|
||||
break;
|
||||
case "DocVersionInfo":
|
||||
_LastDocVersionInfo = (DocVersionInfo)(node.VEObject); //(_LastTreeNode.VEObject);
|
||||
_LastDocVersion = _LastDocVersionInfo.Get();
|
||||
break;
|
||||
case "ProcedureInfo":
|
||||
_LastProcedureInfo = (ProcedureInfo)(_LastTreeNode.VEObject);
|
||||
_LastProcedure = _LastProcedureInfo.Get();
|
||||
OpenItem((ItemInfo)_LastProcedureInfo);
|
||||
if (_LastProcedureInfo.ItemAnnotationCount > 0)
|
||||
{
|
||||
if (!cbCmntDontPopup.Checked)
|
||||
epComments.Expanded = true;
|
||||
rtxbComment.Text = _LastProcedureInfo.ItemAnnotations[0].SearchText;
|
||||
}
|
||||
break;
|
||||
case "SectionInfo":
|
||||
_LastSectionInfo = (SectionInfo)(_LastTreeNode.VEObject);
|
||||
_LastSection = _LastSectionInfo.Get();
|
||||
OpenItem((ItemInfo)_LastSectionInfo);
|
||||
if (_LastSectionInfo.ItemAnnotationCount > 0)
|
||||
{
|
||||
if (!cbCmntDontPopup.Checked)
|
||||
epComments.Expanded = true;
|
||||
rtxbComment.Text = _LastSectionInfo.ItemAnnotations[0].SearchText;
|
||||
}
|
||||
break;
|
||||
case "StepInfo":
|
||||
_LastStepInfo = (StepInfo)(_LastTreeNode.VEObject);
|
||||
_LastStep = _LastStepInfo.Get();
|
||||
OpenItem((ItemInfo)_LastStepInfo);
|
||||
if (_LastStepInfo.ItemAnnotationCount > 0)
|
||||
{
|
||||
if (!cbCmntDontPopup.Checked)
|
||||
epComments.Expanded = true;
|
||||
rtxbComment.Text = _LastStepInfo.ItemAnnotations[0].SearchText;
|
||||
itemAnnotationsBindingSource.DataSource = _LastStepInfo.ItemAnnotations;
|
||||
epComments.TitleStyle.BackColor1.Color = Color.Yellow;
|
||||
}
|
||||
// display an exiting table in that rtf grid thing
|
||||
//if ((_LastStepInfo.MyContent.Type == 20007) || (_LastStepInfo.MyContent.Type == 20009))
|
||||
//{
|
||||
// //MessageBox.Show("Source Grid");
|
||||
// //frmTable newtable1 = new frmTable(_LastStepInfo.MyContent.Text);
|
||||
// //newtable1.ShowDialog();
|
||||
// //MessageBox.Show("IGrid");
|
||||
// //frmIGrid newtable2 = new frmIGrid(_LastStepInfo.MyContent.Text);
|
||||
// //newtable2.ShowDialog();
|
||||
// //MessageBox.Show("GridView"); //standard Visual Studio Control
|
||||
// //frmGridView newtable3 = new frmGridView(_LastStepInfo.MyContent.Text);
|
||||
// //newtable3.ShowDialog();
|
||||
// MessageBox.Show("FlexCell");
|
||||
// frmFlexCell newtable4 = new frmFlexCell(_LastStepInfo.MyContent.Text);
|
||||
// newtable4.ShowDialog();
|
||||
//}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
setupRibbonTabs(node);
|
||||
}
|
||||
}
|
||||
|
||||
private void OpenItem(ItemInfo item)
|
||||
{
|
||||
DisplayPanel vlnCSLAPanel1;
|
||||
ItemInfo tmp = item;
|
||||
while (tmp.MyContent.Type >= 10000) tmp = (ItemInfo)tmp.ActiveParent;
|
||||
vlnCSLAPanel1 = AddProcedureTab(tmp);
|
||||
vlnCSLAPanel1.ItemSelect(item);
|
||||
}
|
||||
|
||||
private void setupRibbonTabs(VETreeNode node)
|
||||
{
|
||||
switch (node.VEObject.GetType().Name)
|
||||
{
|
||||
case "FolderInfo":
|
||||
rtabEdit.Visible = false;
|
||||
rtabTools.Visible = false;
|
||||
rbnPrint.Visible = false;
|
||||
ribbonControl1.SelectedRibbonTabItem = rtabHome;
|
||||
break;
|
||||
case "DocVersionInfo":
|
||||
rtabEdit.Visible = false;
|
||||
rtabTools.Visible = false;
|
||||
rbnPrint.Visible = false;
|
||||
ribbonControl1.SelectedRibbonTabItem = rtabHome;
|
||||
break;
|
||||
case "ProcedureInfo":
|
||||
rtabEdit.Visible = true;
|
||||
rtabTools.Visible = true;
|
||||
rbnPrint.Visible = true;
|
||||
ribbonControl1.SelectedRibbonTabItem = rtabEdit;
|
||||
break;
|
||||
case "SectionInfo":
|
||||
rtabEdit.Visible = true;
|
||||
rtabTools.Visible = true;
|
||||
rbnPrint.Visible = true;
|
||||
ribbonControl1.SelectedRibbonTabItem = rtabEdit;
|
||||
break;
|
||||
case "StepInfo":
|
||||
rtabEdit.Visible = true;
|
||||
rtabTools.Visible = true;
|
||||
rbnPrint.Visible = true;
|
||||
ribbonControl1.SelectedRibbonTabItem = rtabEdit;
|
||||
break;
|
||||
default:
|
||||
rtabEdit.Visible = false;
|
||||
rtabTools.Visible = false;
|
||||
rbnPrint.Visible = false;
|
||||
ribbonControl1.SelectedRibbonTabItem = rtabHome;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void tv_NodeProperties(object sender, Volian.Controls.Library.vlnTreeEventArgs args)
|
||||
{
|
||||
DisplayProperties();
|
||||
}
|
||||
|
||||
// this is used by tv_NodeProperties() and by ribbonFilePropertes_Click()
|
||||
// the type of the args parameter for these two functions is different and
|
||||
// type casting didn't work, so I put the guts in this function.
|
||||
private void DisplayProperties()
|
||||
{
|
||||
// check the user's preference on the style of poperty dialogs "PropPageStyle"
|
||||
// 1 - Button dialog interface
|
||||
// 2 - Tab dialog interface
|
||||
// 3 - Property Grid interface
|
||||
this.Cursor = Cursors.WaitCursor;
|
||||
if ((int)Settings.Default["PropPageStyle"] == 3)
|
||||
DoPropertyGrid(); // Will display a Property Grid interface
|
||||
else
|
||||
DoPropertyPages(); // Will display either a Button or a Tab dialog
|
||||
this.Cursor = Cursors.Default;
|
||||
}
|
||||
|
||||
bool tv_NodeDelete(object sender, Volian.Controls.Library.vlnTreeEventArgs args)
|
||||
{
|
||||
SetupNodes((VETreeNode)args.Node);
|
||||
if (_LastTreeNode.Nodes.Count > 0)
|
||||
{
|
||||
MessageBox.Show("Folder not empty", "Folder must be empty");
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_LastFolderInfo != null)
|
||||
{
|
||||
DialogResult result = MessageBox.Show("Are you sure you want to delete " + _LastFolderInfo.Name, "Verify Folder Delete",
|
||||
MessageBoxButtons.YesNo, MessageBoxIcon.Question);
|
||||
if (result == DialogResult.Yes)
|
||||
{
|
||||
Folder.Delete(_LastFolderInfo.FolderID);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show("Not a folder", "Only Folder can be deleted");
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
bool IsFolder(VETreeNode veTreeNode)
|
||||
{
|
||||
return (veTreeNode.VEObject.GetType().Name == "FolderInfo");
|
||||
}
|
||||
|
||||
void tv_NodeDragDrop(object sender, Volian.Controls.Library.vlnTreeEventArgs args)
|
||||
{
|
||||
VETreeNode drag = (VETreeNode)args.Node;
|
||||
VETreeNode drop = (VETreeNode)args.Destination;
|
||||
if (IsFolder(drag) && IsFolder(drop))
|
||||
{
|
||||
FolderInfo fdragi = (FolderInfo)(drag.VEObject);
|
||||
Folder fdrag = fdragi.Get();
|
||||
FolderInfo fdropi = (FolderInfo)(drop.VEObject);
|
||||
fdrag.MyParent = fdropi.Get();
|
||||
fdrag.Save();
|
||||
}
|
||||
}
|
||||
|
||||
TreeNode tv_NodeNew(object sender, Volian.Controls.Library.vlnTreeEventArgs args)
|
||||
{
|
||||
SaveIfChanged();
|
||||
FolderInfo fldi = (FolderInfo)((VETreeNode)(args.Node)).VEObject;
|
||||
_LastFolder = Folder.MakeFolder(fldi.Get(), fldi.Get().MyConnection, "New Folder", string.Empty, "Short Name", null, string.Empty, DateTime.Now, "Test");
|
||||
BrokenRulesCollection brs = _LastFolder.BrokenRulesCollection;// .BrokenRules();
|
||||
if (brs != null)
|
||||
{
|
||||
foreach (BrokenRule br in brs)
|
||||
{
|
||||
Console.WriteLine("broken rule {0}", br.Description);
|
||||
}
|
||||
}
|
||||
_LastFolderInfo = FolderInfo.Get(_LastFolder.FolderID);
|
||||
VETreeNode tn = new VETreeNode((IVEDrillDownReadOnly)_LastFolderInfo);
|
||||
SetupNodes(tn);
|
||||
return tn;
|
||||
}
|
||||
|
||||
private void SaveIfChanged()
|
||||
{
|
||||
SaveIfChanged<Folder>(_LastFolder);
|
||||
SaveIfChanged<DocVersion>(_LastDocVersion);
|
||||
SaveIfChanged2(_LastProcedure);
|
||||
SaveIfChanged2(_LastSection);
|
||||
SaveIfChanged2(_LastStep);
|
||||
if (_LastTreeNode != null) _LastTreeNode.ResetNode();
|
||||
}
|
||||
private void SaveIfChanged<T>(BusinessBase<T> tmp)
|
||||
where T : BusinessBase<T>
|
||||
{
|
||||
if (tmp == null) return;
|
||||
if (tmp.IsDirty == false) return;
|
||||
if (tmp.IsSavable)
|
||||
tmp = tmp.Save();
|
||||
else
|
||||
{
|
||||
foreach (Csla.Validation.BrokenRule br in tmp.BrokenRulesCollection)
|
||||
{
|
||||
Console.WriteLine("{0}", br.RuleName);
|
||||
}
|
||||
}
|
||||
}
|
||||
private void SaveIfChanged2(Item tmp)
|
||||
{
|
||||
SaveIfChanged<Item>(tmp);
|
||||
}
|
||||
|
||||
private void tv_BeforeExpand(object sender, TreeViewCancelEventArgs e)
|
||||
{
|
||||
VETreeNode tn = ((VETreeNode)e.Node);
|
||||
tn.LoadingChildernDone += new VETreeNodeEvent(tn_LoadingChildernDone);
|
||||
tn.LoadingChildernMax += new VETreeNodeEvent(tn_LoadingChildernMax);
|
||||
tn.LoadingChildernValue += new VETreeNodeEvent(tn_LoadingChildernValue);
|
||||
tn.LoadingChildrenSQL += new VETreeNodeEvent(tn_LoadingChildrenSQL);
|
||||
tn.LoadChildren();
|
||||
|
||||
}
|
||||
|
||||
// Used for the status bar in the lower left corner of the main screen
|
||||
void tn_LoadingChildrenSQL(object sender, VETreeNodeEventArgs args)
|
||||
{
|
||||
ProgBarText = "Loading SQL";
|
||||
}
|
||||
|
||||
// Used for the status bar in the lower left corner of the main screen
|
||||
void tn_LoadingChildernValue(object sender, VETreeNodeEventArgs args)
|
||||
{
|
||||
ProgBarValue = args.Value;
|
||||
}
|
||||
|
||||
// Used for the status bar in the lower left corner of the main screen
|
||||
void tn_LoadingChildernMax(object sender, VETreeNodeEventArgs args)
|
||||
{
|
||||
ProgBarMax = args.Value;
|
||||
ProgBarText = "Loading...";
|
||||
}
|
||||
|
||||
// Used for the status bar in the lower left corner of the main screen
|
||||
void tn_LoadingChildernDone(object sender, VETreeNodeEventArgs args)
|
||||
{
|
||||
ProgBarText = args.Info + " Seconds";
|
||||
}
|
||||
|
||||
private void tv_AfterSelect(object sender, TreeViewEventArgs e)
|
||||
{
|
||||
SaveIfChanged();
|
||||
SetupNodes((VETreeNode)e.Node);
|
||||
this.Text = "VE-PROMS - " + e.Node.Text; // build and display window caption
|
||||
|
||||
}
|
||||
|
||||
private void btnProperties_Click(object sender, EventArgs e)
|
||||
{
|
||||
DisplayProperties();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get a System.Drawing.Color from an Argb or color name
|
||||
/// </summary>
|
||||
/// <param name="strColor">Color Name or "[(alpha,)red,green,blue]"</param>
|
||||
/// <returns></returns>
|
||||
private static Color cGetColor(string strColor)
|
||||
{
|
||||
// This was copied from frmFolderProperties.CS
|
||||
Color rtnColor;
|
||||
if (strColor == null || strColor.Equals(""))
|
||||
rtnColor = Color.White;
|
||||
else
|
||||
{
|
||||
if (strColor[0] == '[')
|
||||
{
|
||||
string[] parts = strColor.Substring(1, strColor.Length - 2).Split(",".ToCharArray());
|
||||
int parts_cnt = 0;
|
||||
foreach (string s in parts)
|
||||
{
|
||||
parts[parts_cnt] = parts[parts_cnt].TrimStart(' '); // remove preceeding blanks
|
||||
parts_cnt++;
|
||||
}
|
||||
if (parts_cnt == 3)
|
||||
rtnColor = Color.FromArgb(Int32.Parse(parts[0]), Int32.Parse(parts[1]), Int32.Parse(parts[2]));
|
||||
else
|
||||
rtnColor = Color.FromArgb(Int32.Parse(parts[0].Substring(2)), Int32.Parse(parts[1].Substring(2)), Int32.Parse(parts[2].Substring(2)), Int32.Parse(parts[3].Substring(2)));
|
||||
}
|
||||
else rtnColor = Color.FromName(strColor);
|
||||
}
|
||||
return rtnColor;
|
||||
}
|
||||
|
||||
private void SetupEditorColors(DisplayPanel vlnCSLAPanel1, TabPage pg)
|
||||
{
|
||||
// setup color
|
||||
if (_LastFolderInfo == null)
|
||||
{
|
||||
// user didn't select a FolderInfo type of node.
|
||||
// walk up the tree to find the first FolderInfo node type
|
||||
VETreeNode tn = (VETreeNode)(tv.SelectedNode);
|
||||
while (tn != null && tn.VEObject.GetType().Name != "FolderInfo")
|
||||
tn = (VETreeNode)tn.Parent;
|
||||
_LastFolderInfo = (FolderInfo)(tn.VEObject);
|
||||
_LastFolder = _LastFolderInfo.Get();
|
||||
}
|
||||
|
||||
if ((_LastFolderInfo.FolderConfig.Color_editbackground != null) && !(_LastFolderInfo.FolderConfig.Color_editbackground.Equals("")))
|
||||
{
|
||||
vlnCSLAPanel1.ActiveColor = cGetColor(_LastFolderInfo.FolderConfig.Color_editbackground);
|
||||
}
|
||||
if ((_LastFolderInfo.FolderConfig.Default_BkColor != null) && !(_LastFolderInfo.FolderConfig.Default_BkColor.Equals("")))
|
||||
{
|
||||
vlnCSLAPanel1.InactiveColor = _LastFolderInfo.FolderConfig.Default_BkColor;
|
||||
vlnCSLAPanel1.TabColor = vlnCSLAPanel1.InactiveColor;
|
||||
vlnCSLAPanel1.PanelColor = vlnCSLAPanel1.InactiveColor;
|
||||
pg.BackColor = vlnCSLAPanel1.InactiveColor;
|
||||
}
|
||||
}
|
||||
|
||||
private void DoPropertyPages()
|
||||
{
|
||||
// Display a property page. (this does either a tabbed or button interface)
|
||||
VETreeNode tn = (VETreeNode)(tv.SelectedNode);
|
||||
switch (tn.VEObject.GetType().Name)
|
||||
{
|
||||
case "FolderInfo":
|
||||
frmFolderProperties frmfld = new frmFolderProperties(_LastFolder.FolderConfig);
|
||||
if (frmfld.ShowDialog() == DialogResult.OK)
|
||||
_LastFolder.Save();
|
||||
break;
|
||||
case "DocVersionInfo":
|
||||
frmVersionsProperties frmver = new frmVersionsProperties(_LastDocVersion.DocVersionConfig);
|
||||
if (frmver.ShowDialog() == DialogResult.OK)
|
||||
_LastDocVersion.Save();
|
||||
break;
|
||||
case "ProcedureInfo":
|
||||
frmProcedureProperties frmproc = new frmProcedureProperties(_LastProcedure.ProcedureConfig);
|
||||
if (frmproc.ShowDialog() == DialogResult.OK)
|
||||
_LastProcedure.Save();
|
||||
break;
|
||||
case "SectionInfo":
|
||||
frmSectionProperties frmsec = new frmSectionProperties(_LastSection.SectionConfig);
|
||||
if (frmsec.ShowDialog() == DialogResult.OK)
|
||||
_LastSection.Save();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void DoPropertyGrid()
|
||||
{
|
||||
// Display a property grid
|
||||
VETreeNode tn = (VETreeNode)(tv.SelectedNode);
|
||||
frmPropGrid propGrid = null;
|
||||
string title = "";
|
||||
switch (tn.VEObject.GetType().Name)
|
||||
{
|
||||
case "FolderInfo":
|
||||
title = string.Format("{0} Properties", _LastFolder.FolderConfig.Name);
|
||||
propGrid = new frmPropGrid(_LastFolder.FolderConfig, title);
|
||||
if ( propGrid.ShowDialog() == DialogResult.OK)
|
||||
_LastFolder.Save();
|
||||
break;
|
||||
case "DocVersionInfo":
|
||||
title = string.Format("{0} Properties", _LastDocVersion.DocVersionConfig.Name);
|
||||
propGrid = new frmPropGrid(_LastDocVersion.DocVersionConfig, title);
|
||||
if ( propGrid.ShowDialog() == DialogResult.OK)
|
||||
_LastDocVersion.Save();
|
||||
break;
|
||||
case "ProcedureInfo":
|
||||
title = string.Format("{0} {1} Properties", _LastProcedure.ProcedureConfig.Number, _LastProcedure.ProcedureConfig.Title);
|
||||
propGrid = new frmPropGrid(_LastProcedure.ProcedureConfig, title);
|
||||
if ( propGrid.ShowDialog() == DialogResult.OK)
|
||||
_LastProcedure.Save();
|
||||
break;
|
||||
case "SectionInfo":
|
||||
if (_LastSection.SectionConfig.Number.Length > 0)
|
||||
title = string.Format("{0} {1} Properties", _LastSection.SectionConfig.Number, _LastSection.SectionConfig.Title);
|
||||
else
|
||||
title = string.Format("{0} Properties", _LastSection.SectionConfig.Title);
|
||||
propGrid = new frmPropGrid(_LastSection.SectionConfig, title);
|
||||
if ( propGrid.ShowDialog() == DialogResult.OK)
|
||||
_LastSection.Save();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void btnVlnWeb_Click(object sender, EventArgs e)
|
||||
{
|
||||
VlnWeb veWWW = new VlnWeb();
|
||||
veWWW.Show();
|
||||
}
|
||||
|
||||
|
||||
private void btnInsTable_Click(object sender, EventArgs e)
|
||||
{
|
||||
Point loc = btnInsTable.DisplayRectangle.Location;
|
||||
loc.X += 300;
|
||||
int top = this.Top + (btnInsTable.Size.Height * 2);
|
||||
TablePickerDlg(sender, e, loc, top);
|
||||
}
|
||||
|
||||
private void TablePickerDlg(object sender, EventArgs e, Point loc, int top)
|
||||
{
|
||||
Accentra.Controls.TablePicker tp = new Accentra.Controls.TablePicker();
|
||||
tp.Location = loc;
|
||||
tp.Top += top;
|
||||
tp.Show();
|
||||
while (tp.Visible)
|
||||
{
|
||||
Application.DoEvents();
|
||||
System.Threading.Thread.Sleep(0);
|
||||
}
|
||||
// This was used to display a dialog containing a table grid
|
||||
// using a product called Source Grid - was for demo purposes only
|
||||
//
|
||||
//if (!tp.Cancel)
|
||||
//{
|
||||
// frmTable newtable = new frmTable(tp.SelectedRows, tp.SelectedColumns);
|
||||
// newtable.Show();
|
||||
//}
|
||||
}
|
||||
|
||||
private void btnEditMode_Click(object sender, EventArgs e)
|
||||
{
|
||||
btnEditView.Text = btnEditMode.Text;
|
||||
}
|
||||
|
||||
private void btnViewMode_Click(object sender, EventArgs e)
|
||||
{
|
||||
btnEditView.Text = btnViewMode.Text;
|
||||
}
|
||||
|
||||
private void btnInsertMode_Click(object sender, EventArgs e)
|
||||
{
|
||||
btnInsOvr.Text = btnInsertMode.Text;
|
||||
}
|
||||
|
||||
private void btnOverstrikeMode_Click(object sender, EventArgs e)
|
||||
{
|
||||
btnInsOvr.Text = btnOverstrikeMode.Text;
|
||||
}
|
||||
|
||||
private void btnMarkPrevPos_Click(object sender, EventArgs e)
|
||||
{
|
||||
btnSetBookMrk_Click(sender, e);
|
||||
}
|
||||
|
||||
private void btnPrevPos_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (_PrevBookMark != null)
|
||||
{
|
||||
VETreeNode jumpToHere = _PrevBookMark; // save current previous
|
||||
btnSetBookMrk_Click(sender, e); // save current as the new previous
|
||||
tv.SelectedNode = jumpToHere; // jump to the saved previous
|
||||
}
|
||||
}
|
||||
|
||||
private void btnSetLock_Click(object sender, EventArgs e)
|
||||
{
|
||||
btnLckUlck.Image = btnSetLock.Image;
|
||||
btnLckUlck.Text = "Locked";
|
||||
}
|
||||
|
||||
private void btnReleaseLck_Click(object sender, EventArgs e)
|
||||
{
|
||||
btnLckUlck.Image = btnReleaseLck.Image;
|
||||
btnLckUlck.Text = "Unlocked";
|
||||
}
|
||||
|
||||
private void btnBold_Click(object sender, EventArgs e)
|
||||
{
|
||||
btnBold.Checked = !btnBold.Checked;
|
||||
}
|
||||
|
||||
private void btnItalics_Click(object sender, EventArgs e)
|
||||
{
|
||||
btnItalics.Checked = !btnItalics.Checked;
|
||||
}
|
||||
|
||||
private void btnUline_Click(object sender, EventArgs e)
|
||||
{
|
||||
btnUline.Checked = !btnUline.Checked;
|
||||
}
|
||||
|
||||
private void frmVEPROMS_FormClosing(object sender, FormClosingEventArgs e)
|
||||
{
|
||||
Settings.Default.Location = this.Location;
|
||||
Settings.Default.Size = this.Size;
|
||||
Settings.Default.Save();
|
||||
}
|
||||
|
||||
private void frmVEPROMS_Load(object sender, EventArgs e)
|
||||
{
|
||||
if (Settings.Default["Location"] != null) this.Location = Settings.Default.Location;
|
||||
if (Settings.Default["Size"] != null) this.Size = Settings.Default.Size;
|
||||
}
|
||||
|
||||
private void btnFindRplDlg_Click_1(object sender, EventArgs e)
|
||||
{
|
||||
FindReplace frmFindRepl = new FindReplace();
|
||||
frmFindRepl.Show();
|
||||
|
||||
}
|
||||
|
||||
public int ProgBarMax
|
||||
{
|
||||
get { return bottomProgBar.Maximum; }
|
||||
set { bottomProgBar.Maximum = value; }
|
||||
}
|
||||
public int ProgBarValue
|
||||
{
|
||||
get { return bottomProgBar.Value; }
|
||||
set { bottomProgBar.Value = value; }
|
||||
}
|
||||
|
||||
|
||||
public string ProgBarText
|
||||
{
|
||||
get { return bottomProgBar.Text; }
|
||||
set {
|
||||
bottomProgBar.TextVisible = true;
|
||||
bottomProgBar.Text = value;
|
||||
}
|
||||
}
|
||||
|
||||
private void btnViewPrcStp_Click(object sender, EventArgs e)
|
||||
{
|
||||
btnViewTypes.Text = btnViewPrcStp.Text;
|
||||
}
|
||||
|
||||
private void btnViewBckgnd_Click(object sender, EventArgs e)
|
||||
{
|
||||
btnViewTypes.Text = btnViewBckgnd.Text;
|
||||
}
|
||||
|
||||
private void btnViewDev_Click(object sender, EventArgs e)
|
||||
{
|
||||
btnViewTypes.Text = btnViewDev.Text;
|
||||
}
|
||||
|
||||
private void btnGlbSrch_Click(object sender, EventArgs e)
|
||||
{
|
||||
infoPanel.Expanded = true;
|
||||
infoTabs.SelectedTab = infotabResults;
|
||||
btnSrchRslt.Checked = true;
|
||||
}
|
||||
|
||||
private void btnSimStps_Click(object sender, EventArgs e)
|
||||
{
|
||||
infoPanel.Expanded = true;
|
||||
infoTabs.SelectedTab = infotabResults;
|
||||
btnSimStpsRslt.Checked = true;
|
||||
}
|
||||
|
||||
private void btnClrBookMrks_Click(object sender, EventArgs e)
|
||||
{
|
||||
lbxBookMarks.Items.Clear();
|
||||
lbxBookMarks.Enabled = false;
|
||||
btnPrevPos.Enabled = false;
|
||||
btnClrBookMrks.Enabled = false;
|
||||
btnRmvCurBookMrk.Enabled = false;
|
||||
_PrevBookMark = null;
|
||||
}
|
||||
|
||||
private void btnRmvCurBookMrk_Click(object sender, EventArgs e)
|
||||
{
|
||||
lbxBookMarks.Items.RemoveAt(lbxBookMarks.SelectedIndex);
|
||||
if (lbxBookMarks.Items.Count == 0)
|
||||
{
|
||||
lbxBookMarks.Enabled = false;
|
||||
btnPrevPos.Enabled = false;
|
||||
btnClrBookMrks.Enabled = false;
|
||||
btnRmvCurBookMrk.Enabled = false;
|
||||
_PrevBookMark = null;
|
||||
}
|
||||
}
|
||||
|
||||
private void AddToBookMarkList(VETreeNode bkmrk)
|
||||
{
|
||||
if (!(lbxBookMarks.Items.Contains(bkmrk)))
|
||||
lbxBookMarks.Items.Add(bkmrk);
|
||||
}
|
||||
|
||||
|
||||
private void btnSetBookMrk_Click(object sender, EventArgs e)
|
||||
{
|
||||
VETreeNode tn = (VETreeNode)(tv.SelectedNode);
|
||||
AddToBookMarkList(tn);
|
||||
_PrevBookMark = tn;
|
||||
lbxBookMarks.Enabled = true;
|
||||
btnPrevPos.Enabled = true;
|
||||
btnClrBookMrks.Enabled = true;
|
||||
btnRmvCurBookMrk.Enabled = true;
|
||||
}
|
||||
|
||||
private void btnAbout_Click(object sender, EventArgs e)
|
||||
{
|
||||
AboutVEPROMS about = new AboutVEPROMS();
|
||||
about.ShowDialog();
|
||||
}
|
||||
|
||||
private void lbxBookMarks_DoubleClick(object sender, EventArgs e)
|
||||
{
|
||||
if (lbxBookMarks.SelectedItem != null)
|
||||
tv.SelectedNode = (VETreeNode)lbxBookMarks.SelectedItem;
|
||||
}
|
||||
|
||||
private void vlnCSLAPanel1_LinkClicked(object sender, Volian.Controls.Library.DisplayLinkEventArgs args)
|
||||
{
|
||||
switch (args.Type)
|
||||
{
|
||||
case ParsedLinkType.ReferencedObject:
|
||||
MessageBox.Show(args.Roid, args.Type.ToString(), MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
break;
|
||||
case ParsedLinkType.Transition:
|
||||
case ParsedLinkType.TransitionRange:
|
||||
OpenItem(args.MyTransition.MyItemToID);
|
||||
break;
|
||||
}
|
||||
}
|
||||
// -------------------------------------------------------
|
||||
private void OpenTransition(ItemInfo item)
|
||||
{
|
||||
OpenItem(item);
|
||||
}
|
||||
|
||||
private DisplayPanel GetPanelFromPage(TabPage tp)
|
||||
{
|
||||
return (DisplayPanel)tp.Controls["vlnCSLAPanel1"];
|
||||
}
|
||||
|
||||
private DisplayPanel AddProcedureTab(ItemInfo pi)
|
||||
{
|
||||
if (tc.TabPages.ContainsKey(pi.MyContent.Number))
|
||||
{
|
||||
tc.SelectTab(pi.MyContent.Number);
|
||||
return GetPanelFromPage(tc.SelectedTab);
|
||||
}
|
||||
else
|
||||
{
|
||||
TabPage pg = new TabPage(pi.MyContent.Number);
|
||||
pg.Name = pi.MyContent.Number;
|
||||
tc.TabPages.Add(pg);
|
||||
tc.SelectedTab = pg;
|
||||
DisplayPanel vlnCSLAPanel1 = new Volian.Controls.Library.DisplayPanel(this.components);
|
||||
pg.Controls.Add(vlnCSLAPanel1);
|
||||
//
|
||||
// vlnCSLAPanel1
|
||||
//
|
||||
vlnCSLAPanel1.ActiveColor = System.Drawing.Color.SkyBlue;
|
||||
vlnCSLAPanel1.AutoScroll = true;
|
||||
vlnCSLAPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
vlnCSLAPanel1.InactiveColor = System.Drawing.Color.Linen;
|
||||
vlnCSLAPanel1.Name = "vlnCSLAPanel1";
|
||||
vlnCSLAPanel1.PanelColor = System.Drawing.Color.LightGray;
|
||||
vlnCSLAPanel1.ProcFont = new System.Drawing.Font("Arial", 12F, System.Drawing.FontStyle.Bold);
|
||||
vlnCSLAPanel1.SectFont = new System.Drawing.Font("Arial", 10F, System.Drawing.FontStyle.Bold);
|
||||
vlnCSLAPanel1.StepFont = new System.Drawing.Font("Arial", 10F);
|
||||
vlnCSLAPanel1.TabColor = System.Drawing.Color.Beige;
|
||||
SetupEditorColors(vlnCSLAPanel1,pg); // check for overridden color values
|
||||
vlnCSLAPanel1.TabIndex = 9;
|
||||
vlnCSLAPanel1.LinkClicked += new Volian.Controls.Library.DisplayPanelLinkEvent(this.vlnCSLAPanel1_LinkClicked);
|
||||
vlnCSLAPanel1.MyItem = pi;
|
||||
return vlnCSLAPanel1;
|
||||
}
|
||||
}
|
||||
|
||||
private void btnOptions_Click(object sender, EventArgs e)
|
||||
{
|
||||
frmSysOptions VeSysOpts = new frmSysOptions();
|
||||
VeSysOpts.ShowDialog();
|
||||
|
||||
}
|
||||
|
||||
private void btnExit_Click(object sender, EventArgs e)
|
||||
{
|
||||
this.Close();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user