This commit is contained in:
2008-08-12 11:46:26 +00:00
parent 869ff724d9
commit 5bedb853c5
11 changed files with 3826 additions and 3467 deletions

View File

@@ -8,11 +8,10 @@ using System.Drawing;
using System.Text;
using System.Windows.Forms;
using VEPROMS.CSLA.Library;
using Csla;
//using Csla;
using DevComponents;
using DevComponents.DotNetBar;
using DevComponents.DotNetBar.Rendering;
using Csla.Validation;
using VEPROMS.Properties;
using Volian.Controls.Library;
using DescriptiveEnum;
@@ -28,20 +27,8 @@ namespace VEPROMS
#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;
ItemInfo _LastItemInfo = null;
Color _CommentTitleBckColor;
StepRTB _MyRTB;
Color _CommentTitleBckColor;
VETreeNode _PrevBookMark = null;
string _PathToROs = @"G:\VEHLP\RO\RO.FST";
@@ -66,16 +53,15 @@ namespace VEPROMS
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);
tv.NodeOpenProperty += new vlnTreeViewPropertyEvent(tv_NodeOpenProperty);
tv.NodeSelect += new Volian.Controls.Library.vlnTreeViewEvent(tv_NodeSelect);
_CommentTitleBckColor = epAnnotations.TitleStyle.BackColor1.Color;
if (!btnAnnoDetailsPushPin.Checked)
epAnnotations.Expanded = false;
infoPanel.Expanded = false;
}
private void frmVEPROMS_FormClosing(object sender, FormClosingEventArgs e)
{
// Save the location and size of the VE-PROMS appication for this user
@@ -88,19 +74,12 @@ namespace VEPROMS
SaveMRU();
//Settings.Default.Save();
}
private void ShutDownRibbons()
{
//ribbonControl1.Height = 50;
}
private void frmVEPROMS_Load(object sender, EventArgs e)
{
// get the saved location and size of the VE-PROMS appication for this user
if (Settings.Default["Location"] != null) this.Location = Settings.Default.Location;
if (Settings.Default["Size"] != null) this.Size = Settings.Default.Size;
if (Settings.Default["WindowState"] != null) this.WindowState = Settings.Default.WindowState;
ShutDownRibbons();
_MyMRIList = MostRecentItemList.GetMRILst((System.Collections.Specialized.StringCollection)(Properties.Settings.Default["MRIList"]));
_MyBookMarks = MostRecentItemList.GetMRILst((System.Collections.Specialized.StringCollection)(Properties.Settings.Default["BookMarks"]));
SetupMRU();
@@ -108,7 +87,6 @@ namespace VEPROMS
CtrlAnnotationSearch.SetupAnnotationSearch(ctrlAnnotationDetails, tc);
ctrlAnnotationDetails.SetupAnnotations(CtrlAnnotationSearch);
}
#region MRU
private MostRecentItemList _MyMRIList;
private MostRecentItemList _MyBookMarks;
@@ -150,10 +128,6 @@ namespace VEPROMS
}
}
}
#if (DEBUG)
// to display a property page view
//private frmPropGrid f;
#endif
void btnItem_Click(object sender, EventArgs e)
{
@@ -184,7 +158,8 @@ namespace VEPROMS
{
epAnnotations.Expanded = false;
epAnnotations.TitleStyle.BackColor1.Color = _CommentTitleBckColor;
SetLastValues(node);
if (_MyMRIList.Add(node.VEObject) != null)
SetupMRU();
#region Sample Display Table Code
// display an exiting table in that rtf grid thing
//if ((_LastStepInfo.MyContent.Type == 20007) || (_LastStepInfo.MyContent.Type == 20009))
@@ -203,26 +178,16 @@ namespace VEPROMS
// newtable4.ShowDialog();
//}
#endregion
if (_LastItemInfo != null) tc.OpenItem(_LastItemInfo);
ItemInfo ii = node.VEObject as ItemInfo;
if (ii != null) tc.OpenItem(ii);
SetCaption(node);
}
private void SetLastValues(VETreeNode node)
// The following code is used to setup the user interface depending on what
// is selected on the tree view (see vlnTreeView.cs)
private void tv_NodeSelect(object sender, Volian.Controls.Library.vlnTreeEventArgs args)
{
SaveIfChanged();
_LastTreeNode = node;
_LastFolderInfo = _LastTreeNode.VEObject as FolderInfo;
_LastFolder = _LastFolderInfo == null ? null : _LastFolderInfo.Get();
_LastDocVersionInfo = node.VEObject as DocVersionInfo;
_LastDocVersion = _LastDocVersionInfo == null ? null : _LastDocVersionInfo.Get();
_LastProcedureInfo = _LastTreeNode.VEObject as ProcedureInfo;
_LastProcedure = _LastProcedureInfo == null ? null : _LastProcedureInfo.Get();
_LastSectionInfo = _LastTreeNode.VEObject as SectionInfo;
_LastSection = _LastSectionInfo == null ? null : _LastSectionInfo.Get();
_LastStepInfo = _LastTreeNode.VEObject as StepInfo;
_LastStep = _LastStepInfo == null ? null : _LastStepInfo.Get();
_LastItemInfo = _LastTreeNode.VEObject as ItemInfo;
SetupNodes((VETreeNode)args.Node);
}
private void SetCaption(VETreeNode tn)
{
StringBuilder caption = new StringBuilder();
@@ -238,104 +203,7 @@ namespace VEPROMS
}
this.Text = caption.ToString();
}
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() == typeof(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);
}
/// <summary>
/// When the treeview is clicked - a timer is set
/// This is done because the focus is returned to the treeview after the click event
@@ -358,17 +226,6 @@ namespace VEPROMS
VETreeNode tn = tv.SelectedNode as VETreeNode;
if (tn != null) SetupNodes(tn);
}
private void tv_KeyPress(object sender, KeyPressEventArgs e)
{
if (e.KeyChar == '\r')
{
//tv_Click(sender, new EventArgs());
OpenNode(tv.SelectedNode as VETreeNode);
e.Handled = true;
}
}
private void tv_BeforeExpand(object sender, TreeViewCancelEventArgs e)
{
VETreeNode tn = ((VETreeNode)e.Node);
@@ -378,45 +235,239 @@ namespace VEPROMS
tn.LoadingChildrenSQL += new VETreeNodeEvent(tn_LoadingChildrenSQL);
tn.LoadChildren(true);
}
void tv_NodeProperties(object sender, Volian.Controls.Library.vlnTreeEventArgs args)
{
DisplayProperties();
}
#endregion
#region Property Page and Grid
DialogResult tv_NodeOpenProperty(object sender, vlnTreePropertyEventArgs args)
{
this.Cursor = Cursors.WaitCursor;
DialogResult dr = DialogResult.Cancel;
if ((int)Settings.Default["PropPageStyle"] == (int)PropPgStyle.Grid)
{
frmPropGrid propGrid = new frmPropGrid(args.ConfigObject, args.Title);
dr = propGrid.ShowDialog();
}
else
{
if (args.FolderConfig != null)
{
frmFolderProperties frmfld = new frmFolderProperties(args.FolderConfig);
dr = frmfld.ShowDialog();
}
else if (args.DocVersionConfig != null)
{
frmVersionsProperties frmver = new frmVersionsProperties(args.DocVersionConfig);
dr = frmver.ShowDialog();
}
else if (args.ProcedureConfig != null)
{
frmProcedureProperties frmproc = new frmProcedureProperties(args.ProcedureConfig);
dr = frmproc.ShowDialog();
}
else if (args.SectionConfig != null)
{
frmSectionProperties frmsec = new frmSectionProperties(args.SectionConfig);
dr = frmsec.ShowDialog();
}
}
this.Cursor = Cursors.Default;
return dr;
}
void tv_NodeFolderProperties(object sender, Volian.Controls.Library.vlnTreeEventArgs args)
{
FolderInfo fi = ((VETreeNode)args.Node).VEObject as FolderInfo;
DialogResult dr = DialogResult.Cancel;
if (dr == DialogResult.OK) fi.Get().Save();
}
void tv_NodeDocVersionProperties(object sender, Volian.Controls.Library.vlnTreeEventArgs args)
{
this.Cursor = Cursors.WaitCursor;
DocVersionInfo dvi = ((VETreeNode)args.Node).VEObject as DocVersionInfo;
if ((int)Settings.Default["PropPageStyle"] == (int)PropPgStyle.Grid)
{
frmPropGrid propGrid = new frmPropGrid(dvi.DocVersionConfig, string.Format("{0} Properties", dvi.DocVersionConfig.Name));
if (propGrid.ShowDialog() == DialogResult.OK)
dvi.Get().Save();
}
else
{
frmVersionsProperties frmver = new frmVersionsProperties(dvi.DocVersionConfig);
if (frmver.ShowDialog() == DialogResult.OK)
dvi.Get().Save();
}
this.Cursor = Cursors.Default;
}
void tv_NodeProcProperties(object sender, Volian.Controls.Library.vlnTreeEventArgs args)
{
this.Cursor = Cursors.WaitCursor;
ProcedureInfo pi = ((VETreeNode)args.Node).VEObject as ProcedureInfo;
if ((int)Settings.Default["PropPageStyle"] == (int)PropPgStyle.Grid)
{
frmPropGrid propGrid = new frmPropGrid(pi.ProcedureConfig, string.Format("{0} {1} Properties", pi.ProcedureConfig.Number, pi.ProcedureConfig.Title));
if (propGrid.ShowDialog() == DialogResult.OK)
pi.Get().Save();
}
else
{
frmProcedureProperties frmproc = new frmProcedureProperties(pi.ProcedureConfig);
if (frmproc.ShowDialog() == DialogResult.OK)
pi.Get().Save();
}
this.Cursor = Cursors.Default;
}
void tv_NodeSectProperties(object sender, Volian.Controls.Library.vlnTreeEventArgs args)
{
this.Cursor = Cursors.WaitCursor;
SectionInfo si = ((VETreeNode)args.Node).VEObject as SectionInfo;
if ((int)Settings.Default["PropPageStyle"] == (int)PropPgStyle.Grid)
{
string title = null;
if (si.SectionConfig.Number.Length > 0)
title = string.Format("{0} {1} Properties", si.SectionConfig.Number, si.SectionConfig.Title);
else
title = string.Format("{0} Properties", si.SectionConfig.Title);
frmPropGrid propGrid = new frmPropGrid(si.SectionConfig, title);
if (propGrid.ShowDialog() == DialogResult.OK)
si.Get().Save();
}
else
{
frmSectionProperties frmsec = new frmSectionProperties(si.SectionConfig);
if (frmsec.ShowDialog() == DialogResult.OK)
si.Get().Save();
}
this.Cursor = Cursors.Default;
}
private void btnProperties_Click(object sender, EventArgs e)
{
if (tv.SelectedNode == null) MessageBox.Show("Must select a node on the Tree to get properties");
//Determine type of selected tree view node & handle based on that.
VETreeNode tn = (VETreeNode)(tv.SelectedNode);
if ((tn.VEObject as FolderInfo) != null)
tv_NodeFolderProperties(null, new vlnTreeEventArgs(tv.SelectedNode));
else if ((tn.VEObject as DocVersionInfo) != null)
tv_NodeDocVersionProperties(null, new vlnTreeEventArgs(tv.SelectedNode));
else if ((tn.VEObject as ProcedureInfo) != null)
tv_NodeProcProperties(null, new vlnTreeEventArgs(tv.SelectedNode));
else if ((tn.VEObject as SectionInfo) != null)
tv_NodeSectProperties(null, new vlnTreeEventArgs(tv.SelectedNode));
else
MessageBox.Show("Properties not available for this Tree selection");
}
/// <summary>
// 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.
/// </summary>
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
SetLastValues((VETreeNode)(tv.SelectedNode));
this.Cursor = Cursors.WaitCursor;
if ((int)Settings.Default["PropPageStyle"] == (int)PropPgStyle.Grid)
DoPropertyGrid(); // Will display a Property Grid interface
else
DoPropertyPages(); // Will display either a Button or a Tab dialog
this.Cursor = Cursors.Default;
}
// TODO: DeleteMe
//void tv_NodeProperties(object sender, Volian.Controls.Library.vlnTreeEventArgs args)
//{
// DisplayProperties();
//}
//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
// //SetLastValues((VETreeNode)(tv.SelectedNode));
// this.Cursor = Cursors.WaitCursor;
// if ((int)Settings.Default["PropPageStyle"] == (int)PropPgStyle.Grid)
// DoPropertyGrid(); // Will display a Property Grid interface
// else
// DoPropertyPages(); // Will display either a Button or a Tab dialog
// this.Cursor = Cursors.Default;
//}
/// <summary>
/// Display a Property Page for the current tree node
/// </summary>
//private void DoPropertyPages()
//{
// // Display a property page. (the ppStyle selects either a tabbed or button interface)
// VETreeNode tn = (VETreeNode)(tv.SelectedNode);
// if ((tn.VEObject as FolderInfo) != null)
// {
// FolderInfo fi = tn.VEObject as FolderInfo;
// frmFolderProperties frmfld = new frmFolderProperties(fi.FolderConfig);
// if (frmfld.ShowDialog() == DialogResult.OK)
// fi.Get().Save();
// }
// else if ((tn.VEObject as DocVersionInfo) != null)
// {
// DocVersionInfo dvi = tn.VEObject as DocVersionInfo;
// frmVersionsProperties frmver = new frmVersionsProperties(dvi.DocVersionConfig);
// if (frmver.ShowDialog() == DialogResult.OK)
// dvi.Get().Save();
// }
// else if ((tn.VEObject as ProcedureInfo) != null)
// {
// ProcedureInfo pi = tn.VEObject as ProcedureInfo;
// frmProcedureProperties frmproc = new frmProcedureProperties(pi.ProcedureConfig);
// if (frmproc.ShowDialog() == DialogResult.OK)
// pi.Get().Save();
// }
// else if ((tn.VEObject as SectionInfo) != null)
// {
// SectionInfo si = tn.VEObject as SectionInfo;
// frmSectionProperties frmsec = new frmSectionProperties(si.SectionConfig);
// if (frmsec.ShowDialog() == DialogResult.OK)
// si.Get().Save();
// }
//}
/// <summary>
/// Display a property grid for the current tree node
/// </summary>
//private void DoPropertyGrid()
//{
// // Display a property grid
// VETreeNode tn = (VETreeNode)(tv.SelectedNode);
// frmPropGrid propGrid = null;
// string title = "";
// if ((tn.VEObject as FolderInfo) != null)
// {
// FolderInfo fi = tn.VEObject as FolderInfo;
// title = string.Format("{0} Properties", fi.FolderConfig.Name);
// propGrid = new frmPropGrid(fi.FolderConfig, title);
// if (propGrid.ShowDialog() == DialogResult.OK)
// fi.Get().Save();
// }
// else if ((tn.VEObject as DocVersionInfo) != null)
// {
// DocVersionInfo dvi = tn.VEObject as DocVersionInfo;
// title = string.Format("{0} Properties", dvi.DocVersionConfig.Name);
// propGrid = new frmPropGrid(dvi.DocVersionConfig, title);
// if (propGrid.ShowDialog() == DialogResult.OK)
// dvi.Get().Save();
// }
// else if ((tn.VEObject as ProcedureInfo) != null)
// {
// ProcedureInfo pi = tn.VEObject as ProcedureInfo;
// title = string.Format("{0} {1} Properties", pi.ProcedureConfig.Number, pi.ProcedureConfig.Title);
// propGrid = new frmPropGrid(pi.ProcedureConfig, title);
// if (propGrid.ShowDialog() == DialogResult.OK)
// pi.Get().Save();
// }
// else if ((tn.VEObject as SectionInfo) != null)
// {
// SectionInfo si = tn.VEObject as SectionInfo;
// if (si.SectionConfig.Number.Length > 0)
// title = string.Format("{0} {1} Properties", si.SectionConfig.Number, si.SectionConfig.Title);
// else
// title = string.Format("{0} Properties", si.SectionConfig.Title);
// propGrid = new frmPropGrid(si.SectionConfig, title);
// if (propGrid.ShowDialog() == DialogResult.OK)
// si.Get().Save();
// }
//}
/// <summary>
/// Button from the Ribbon Bar
/// </summary>
/// <param name="sender">object</param>
/// <param name="e">EventArgs</param>
private void btnProperties_Click(object sender, EventArgs e)
{
DisplayProperties();
}
#endregion
#endregion
#region ColorStuff
/// <summary>
/// Get a System.Drawing.Color from an Argb or color name
/// </summary>
@@ -448,7 +499,6 @@ namespace VEPROMS
}
return rtnColor;
}
//private void SetupEditorColors(DisplayPanel vlnCSLAPanel1, TabPage pg)
//{
// // setup color
@@ -475,84 +525,9 @@ namespace VEPROMS
// pg.BackColor = vlnCSLAPanel1.InactiveColor;
// }
//}
/// <summary>
/// Display a Property Page for the current tree node
/// </summary>
private void DoPropertyPages()
{
// Display a property page. (the ppStyle selects either a tabbed or button interface)
//VETreeNode tn = (VETreeNode)(tv.SelectedNode);
if (_LastFolder != null)
{
frmFolderProperties frmfld = new frmFolderProperties(_LastFolder.FolderConfig);
if (frmfld.ShowDialog() == DialogResult.OK)
_LastFolder.Save();
}
else if (_LastDocVersion != null)
{
frmVersionsProperties frmver = new frmVersionsProperties(_LastDocVersion.DocVersionConfig);
if (frmver.ShowDialog() == DialogResult.OK)
_LastDocVersion.Save();
}
else if (_LastProcedure != null)
{
frmProcedureProperties frmproc = new frmProcedureProperties(_LastProcedure.ProcedureConfig);
if (frmproc.ShowDialog() == DialogResult.OK)
_LastProcedure.Save();
}
else if (_LastSection != null)
{
frmSectionProperties frmsec = new frmSectionProperties(_LastSection.SectionConfig);
if (frmsec.ShowDialog() == DialogResult.OK)
_LastSection.Save();
}
}
/// <summary>
/// Display a property grid for the current tree node
/// </summary>
private void DoPropertyGrid()
{
// Display a property grid
//VETreeNode tn = (VETreeNode)(tv.SelectedNode);
frmPropGrid propGrid = null;
string title = "";
if (_LastFolder != null)
{
title = string.Format("{0} Properties", _LastFolder.FolderConfig.Name);
propGrid = new frmPropGrid(_LastFolder.FolderConfig, title);
if (propGrid.ShowDialog() == DialogResult.OK)
_LastFolder.Save();
}
else if (_LastDocVersion != null)
{
title = string.Format("{0} Properties", _LastDocVersion.DocVersionConfig.Name);
propGrid = new frmPropGrid(_LastDocVersion.DocVersionConfig, title);
if (propGrid.ShowDialog() == DialogResult.OK)
_LastDocVersion.Save();
}
else if (_LastProcedure != null)
{
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();
}
else if (_LastSection != null)
{
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();
}
}
#endregion
#region Table Insert Sample Code
// TODO: for tables
//private void btnInsTable_Click(object sender, EventArgs e)
//{
// Point loc = btnInsTable.DisplayRectangle.Location;
@@ -782,12 +757,6 @@ namespace VEPROMS
{
_MyBookMarks.Clear();
RefreshBookMarkData();
//lbxBookMarks.Items.Clear();
//lbxBookMarks.Enabled = false;
//btnPrevPos.Enabled = false;
//btnClrBookMrks.Enabled = false;
//btnRmvCurBookMrk.Enabled = false;
//_PrevBookMark = null;
}
private void RefreshBookMarkData()
@@ -807,19 +776,11 @@ namespace VEPROMS
{
_MyBookMarks.RemoveAt(lbxBookMarks.SelectedIndex);
RefreshBookMarkData();
// lbxBookMarks.Items.RemoveAt(lbxBookMarks.SelectedIndex);
// if (lbxBookMarks.Items.Count == 0)
// {
// //lbxBookMarks.Enabled = false;
// btnPrevPos.Enabled = false;
// btnClrBookMrks.Enabled = (lbxBookMarks.Items.Count > 0);
// //btnRmvCurBookMrk.Enabled = (lbxBookMarks.SelectedIndex >= 0);
// _PrevBookMark = null;
// }
}
/// <summary>
/// Adds the given tree node to the list of bookmarks
/// TODO: Add a menu item to tree view context menu for adding to book mark list.
/// </summary>
/// <param name="bkmrk"></param>
//private void AddToBookMarkList(VETreeNode bkmrk)
@@ -838,89 +799,13 @@ namespace VEPROMS
StepTabPanel dtp = ((DisplayTabItem)tc.SelectedDisplayTabItem).MyStepTabPanel;
_MyBookMarks.Add(dtp.SelectedStepItem.MyItemInfo);
RefreshBookMarkData();
//VETreeNode tn = (VETreeNode)(tv.SelectedNode);
//AddToBookMarkList(tn);
//_PrevBookMark = tn;
//lbxBookMarks.Enabled = true;
//btnPrevPos.Enabled = true;
//btnClrBookMrks.Enabled = true;
//btnRmvCurBookMrk.Enabled = true;
}
#endregion
#region DisplayPanel
/// <summary>
/// Jump to the location referenced by the transition
/// </summary>
/// <param name="item"></param>
private void OpenTransition(ItemInfo item)
private void lbxBookMarks_Click(object sender, EventArgs e)
{
tc.OpenItem(item);
MostRecentItem itm = lbxBookMarks.SelectedValue as MostRecentItem;
tc.OpenItem(itm.MyItemInfo);
}
//private void OpenItem(ItemInfo item)
//{
// DisplayPanel vlnCSLAPanel1 = AddProcedureTab(item.MyProcedure);
// vlnCSLAPanel1.ItemSelect(item);
//}
private void vlnCSLAPanel1_LinkClicked(object sender, StepPanelLinkEventArgs args)
{
switch (args.MyLinkText.MyParsedLinkType)
{
case ParsedLinkType.ReferencedObject:
MessageBox.Show(args.MyLinkText.Roid, args.MyLinkText.MyParsedLinkType.ToString(), MessageBoxButtons.OK, MessageBoxIcon.Information);
break;
case ParsedLinkType.Transition:
case ParsedLinkType.TransitionRange:
tc.OpenItem(args.MyLinkText.MyTransitionInfo.MyItemToID);
break;
}
}
//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;
// }
//}
#endregion
#region Find/Replace and Search
/// <summary>
@@ -992,7 +877,6 @@ namespace VEPROMS
}
#endregion
#region Ribbon
/// <summary>
/// This Opens the treeView or opens the selected item in the TreeView
@@ -1004,33 +888,42 @@ namespace VEPROMS
if (!expandablePanel2.Expanded) // If panel not expanded - expand it.
{
expandablePanel2.Expanded = true;
if(tv.Nodes.Count > 0)tv.SelectedNode = tv.Nodes[0];
if(tv.Nodes.Count > 0 && tv.SelectedNode==null)
tv.SelectedNode = tv.Nodes[0];
tv.Focus();
}
else
{
VETreeNode tn = (VETreeNode)(tv.SelectedNode);
OpenNode(tn);
// TODO: DeleteMe
//VETreeNode tn = (VETreeNode)(tv.SelectedNode);
tv.OpenNode();
}
}
private void OpenNode(VETreeNode tn)
private void btnNew_Click(object sender, EventArgs e)
{
if (tn != null)
{
if (tn.VEObject.GetType() == typeof(FolderInfo) || tn.VEObject.GetType() == typeof(DocVersionInfo))
{
if (tn.Nodes.Count > 0)
{
tn.Expand();
tv.SelectedNode = tn.Nodes[0];
tv.Focus();
}
}
else
SetupNodes(tn);
}
if (!expandablePanel2.Expanded) return;
// TODO: Need vlntreeview method to determine type
tv.tv_NodeNew(vlnTreeView.MenuSelections.None);
}
// TODO: DeleteMe
//private void OpenNode(VETreeNode tn)
//{
// if (tn != null)
// {
// if (tn.VEObject.GetType() == typeof(FolderInfo) || tn.VEObject.GetType() == typeof(DocVersionInfo))
// {
// if (tn.Nodes.Count > 0)
// {
// tn.Expand();
// tv.SelectedNode = tn.Nodes[0];
// tv.Focus();
// }
// }
// else
// SetupNodes(tn);
// }
//}
/// <summary>
/// Options button on the dialog that appears when the V icon is clicked (top left of application window)
/// note that the "V icon" is also called the Office 2007 Start Button
@@ -1146,7 +1039,7 @@ namespace VEPROMS
private void btnSave_Click(object sender, EventArgs e)
{
}
#region LinkSupport
private void tc_LinkActiveChanged(object sender, StepPanelLinkEventArgs args)
{
// determine if any infotabs are visisble, and if it is the Transition,
@@ -1156,14 +1049,12 @@ namespace VEPROMS
displayTransition.CurTrans = null;
}
}
private void tc_LinkInsertTran(object sender, StepPanelLinkEventArgs args)
{
infoPanel.Expanded = true;
infoTabs.SelectedTab = infotabTransition;
displayTransition.CurTrans = null;
}
private void tc_LinkInsertRO(object sender, StepPanelLinkEventArgs args)
{
infoPanel.Expanded = true;
@@ -1175,7 +1066,6 @@ namespace VEPROMS
displayRO.MyRTB = dtp.MyStepPanel.SelectedStepItem.MyStepRTB;
displayRO.CurROLink = null;
}
private void tc_LinkModifyTran(object sender, StepPanelLinkEventArgs args)
{
infoPanel.Expanded = true;
@@ -1185,7 +1075,6 @@ namespace VEPROMS
displayTransition.MyRTB = dtp.MyStepPanel.SelectedStepItem.MyStepRTB;
displayTransition.CurTrans = args.MyLinkText.MyTransitionInfo;
}
private void tc_LinkModifyRO(object sender, StepPanelLinkEventArgs args)
{
infoPanel.Expanded = true;
@@ -1197,11 +1086,6 @@ namespace VEPROMS
displayRO.MyRTB = dtp.MyStepPanel.SelectedStepItem.MyStepRTB;
displayRO.CurROLink = args.MyLinkText.RoUsageid; // this is wrong - use for now.
}
private void lbxBookMarks_Click(object sender, EventArgs e)
{
MostRecentItem itm = lbxBookMarks.SelectedValue as MostRecentItem;
tc.OpenItem(itm.MyItemInfo);
}
#endregion
}
}