This commit is contained in:
@@ -87,6 +87,7 @@ namespace VEPROMS
|
||||
SaveMRU();
|
||||
//Settings.Default.Save();
|
||||
}
|
||||
|
||||
private void ShutDownRibbons()
|
||||
{
|
||||
rtabEdit.Visible = false;
|
||||
@@ -95,6 +96,7 @@ namespace VEPROMS
|
||||
rtabTools.Visible = false;
|
||||
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
|
||||
@@ -106,18 +108,8 @@ namespace VEPROMS
|
||||
_MyBookMarks = MostRecentItemList.GetMRILst((System.Collections.Specialized.StringCollection)(Properties.Settings.Default["BookMarks"]));
|
||||
SetupMRU();
|
||||
SetupBookMarks();
|
||||
SetupAnnotations();
|
||||
}
|
||||
|
||||
private void SetupAnnotations()
|
||||
{
|
||||
cbAnnoType.DisplayMember = "Name";
|
||||
cbAnnoType.DataSource = AnnotationTypeInfoList.Get();
|
||||
lbResults.MouseMove += new MouseEventHandler(lbResults_MouseMove);
|
||||
|
||||
cbGridAnnoType.DisplayMember = "Name";
|
||||
cbGridAnnoType.ValueMember = "TypeId";
|
||||
cbGridAnnoType.DataSource = AnnotationTypeInfoList.Get().Clone();
|
||||
CtrlAnnotationSearch.SetupAnnotationSearch(ctrlAnnotationDetails, tc);
|
||||
ctrlAnnotationDetails.SetupAnnotations(CtrlAnnotationSearch);
|
||||
}
|
||||
|
||||
#region MRU
|
||||
@@ -193,79 +185,65 @@ namespace VEPROMS
|
||||
/// <param name="node">VETreeNode</param>
|
||||
void SetupNodes(VETreeNode node)
|
||||
{
|
||||
//if (!node.Equals(_LastTreeNode))
|
||||
//{
|
||||
_LastTreeNode = node;
|
||||
_LastFolderInfo = null;
|
||||
_LastFolder = null;
|
||||
_LastDocVersion = null;
|
||||
_LastProcedure = null;
|
||||
_LastSection = null;
|
||||
_LastStep = null;
|
||||
epAnnotations.Expanded = false;
|
||||
rtxbComment.Text = "";
|
||||
epAnnotations.TitleStyle.BackColor1.Color = _CommentTitleBckColor;
|
||||
if (_MyMRIList.Add(node.VEObject) != null)
|
||||
SetupMRU();
|
||||
if (node.VEObject.GetType() == typeof(FolderInfo))
|
||||
{
|
||||
_LastFolderInfo = (FolderInfo)(_LastTreeNode.VEObject);
|
||||
_LastFolder = _LastFolderInfo.Get();
|
||||
}
|
||||
else if (node.VEObject.GetType() == typeof(DocVersionInfo))
|
||||
{
|
||||
_LastDocVersionInfo = (DocVersionInfo)(node.VEObject);
|
||||
_LastDocVersion = _LastDocVersionInfo.Get();
|
||||
}
|
||||
else if (node.VEObject.GetType() == typeof(ProcedureInfo))
|
||||
{
|
||||
_LastProcedureInfo = (ProcedureInfo)(_LastTreeNode.VEObject);
|
||||
_LastProcedure = _LastProcedureInfo.Get();
|
||||
_LastTreeNode = node;
|
||||
_LastFolderInfo = null;
|
||||
_LastFolder = null;
|
||||
_LastDocVersion = null;
|
||||
_LastProcedure = null;
|
||||
_LastSection = null;
|
||||
_LastStep = null;
|
||||
epAnnotations.Expanded = false;
|
||||
epAnnotations.TitleStyle.BackColor1.Color = _CommentTitleBckColor;
|
||||
if (_MyMRIList.Add(node.VEObject) != null)
|
||||
SetupMRU();
|
||||
if (node.VEObject.GetType() == typeof(FolderInfo))
|
||||
{
|
||||
_LastFolderInfo = (FolderInfo)(_LastTreeNode.VEObject);
|
||||
_LastFolder = _LastFolderInfo.Get();
|
||||
}
|
||||
else if (node.VEObject.GetType() == typeof(DocVersionInfo))
|
||||
{
|
||||
_LastDocVersionInfo = (DocVersionInfo)(node.VEObject);
|
||||
_LastDocVersion = _LastDocVersionInfo.Get();
|
||||
}
|
||||
else if (node.VEObject.GetType() == typeof(ProcedureInfo))
|
||||
{
|
||||
_LastProcedureInfo = (ProcedureInfo)(_LastTreeNode.VEObject);
|
||||
_LastProcedure = _LastProcedureInfo.Get();
|
||||
|
||||
tc.OpenItem((ItemInfo)_LastProcedureInfo);
|
||||
// Display any annotations
|
||||
//itemAnnotationsBindingSource.DataSource = _LastProcedureInfo.ItemAnnotations;
|
||||
}
|
||||
else if (node.VEObject.GetType() == typeof(SectionInfo))
|
||||
{
|
||||
_LastSectionInfo = (SectionInfo)(_LastTreeNode.VEObject);
|
||||
_LastSection = _LastSectionInfo.Get();
|
||||
tc.OpenItem((ItemInfo)_LastSectionInfo);
|
||||
// Display any annotations
|
||||
//itemAnnotationsBindingSource.DataSource = _LastSectionInfo.ItemAnnotations;
|
||||
}
|
||||
else if (node.VEObject.GetType() == typeof(StepInfo))
|
||||
{
|
||||
_LastStepInfo = (StepInfo)(_LastTreeNode.VEObject);
|
||||
_LastStep = _LastStepInfo.Get();
|
||||
tc.OpenItem((ItemInfo)_LastStepInfo);
|
||||
// Display any annotations
|
||||
//itemAnnotationsBindingSource.DataSource = _LastStepInfo.ItemAnnotations;
|
||||
#region Sample Display Table Code
|
||||
// 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();
|
||||
//}
|
||||
#endregion
|
||||
}
|
||||
//break;
|
||||
//default:
|
||||
//break;
|
||||
tc.OpenItem((ItemInfo)_LastProcedureInfo);
|
||||
}
|
||||
else if (node.VEObject.GetType() == typeof(SectionInfo))
|
||||
{
|
||||
_LastSectionInfo = (SectionInfo)(_LastTreeNode.VEObject);
|
||||
_LastSection = _LastSectionInfo.Get();
|
||||
tc.OpenItem((ItemInfo)_LastSectionInfo);
|
||||
}
|
||||
else if (node.VEObject.GetType() == typeof(StepInfo))
|
||||
{
|
||||
_LastStepInfo = (StepInfo)(_LastTreeNode.VEObject);
|
||||
_LastStep = _LastStepInfo.Get();
|
||||
tc.OpenItem((ItemInfo)_LastStepInfo);
|
||||
#region Sample Display Table Code
|
||||
// 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();
|
||||
//}
|
||||
SetCaption((VETreeNode)node);
|
||||
//}
|
||||
#endregion
|
||||
}
|
||||
SetCaption((VETreeNode)node);
|
||||
}
|
||||
|
||||
private void SetCaption(VETreeNode tn)
|
||||
@@ -375,10 +353,12 @@ namespace VEPROMS
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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
|
||||
@@ -389,6 +369,7 @@ namespace VEPROMS
|
||||
{
|
||||
tmrTreeView.Enabled = true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This event is fired from the timer after the treeview click event completes
|
||||
/// </summary>
|
||||
@@ -401,6 +382,7 @@ 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')
|
||||
@@ -410,6 +392,7 @@ namespace VEPROMS
|
||||
e.Handled = true;
|
||||
}
|
||||
}
|
||||
|
||||
private void tv_BeforeExpand(object sender, TreeViewCancelEventArgs e)
|
||||
{
|
||||
VETreeNode tn = ((VETreeNode)e.Node);
|
||||
@@ -418,12 +401,13 @@ namespace VEPROMS
|
||||
tn.LoadingChildernValue += new VETreeNodeEvent(tn_LoadingChildernValue);
|
||||
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
|
||||
|
||||
@@ -1156,181 +1140,67 @@ namespace VEPROMS
|
||||
displayTransition.CurTrans = null;
|
||||
}
|
||||
#endregion
|
||||
private AnnotationInfoList _Annotations;
|
||||
private ItemInfo _CurrentItem = null;
|
||||
|
||||
private void tc_ItemSelectedChanged(object sender, ItemSelectedChangedEventArgs args)
|
||||
{
|
||||
//CurrentAnnotation = null;
|
||||
if (args == null)
|
||||
{
|
||||
_CurrentItem = null;
|
||||
CurrentAnnotation = null;
|
||||
_Annotations = null;
|
||||
itemAnnotationsBindingSource.DataSource = _Annotations;
|
||||
AnnotationPanelView();
|
||||
ctrlAnnotationDetails.CurrentAnnotation = null;
|
||||
ctrlAnnotationDetails.Annotations = null;
|
||||
infotabRO.Visible = infotabTransition.Visible = infotabTags.Visible = false;
|
||||
return;
|
||||
}
|
||||
if (_CurrentItem != args.MyItemInfo)
|
||||
_CurrentItem = args.MyItemInfo; //tc.SelectedDisplayTabItem.MyItemInfo;
|
||||
//vlnStackTrace.ShowStack("enter tc_ItemSelectedChanged {0}", _CurrentItem);
|
||||
if (args.MyStepItem == null)
|
||||
{
|
||||
infotabRO.Visible = infotabTransition.Visible = false;
|
||||
infotabTags.Visible = true;
|
||||
//vlnStackTrace.ShowStack("enter tc_ItemSelectedChanged {0}", _CurrentItem);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_CurrentItem != args.MyItemInfo)
|
||||
_CurrentItem = args.MyItemInfo;
|
||||
//vlnStackTrace.ShowStack("enter tc_ItemSelectedChanged {0}", _CurrentItem);
|
||||
infotabRO.Visible = infotabTransition.Visible = infotabTags.Visible = true;
|
||||
displayTransition.MyRTB = args.MyStepItem.MyStepRTB;
|
||||
displayRO.MyRTB = args.MyStepItem.MyStepRTB;
|
||||
}
|
||||
UpdateAnnotationGrid();
|
||||
}
|
||||
private void UpdateAnnotationGrid()
|
||||
{
|
||||
//ShowItemAnnotations("UpdateAnnotationGrid before RefreshItemAnnotations");
|
||||
//_CurrentItem.RefreshItemAnnotations();
|
||||
//ShowItemAnnotations("UpdateAnnotationGrid");
|
||||
_LoadingGrid = true;
|
||||
_Annotations = _CurrentItem.ItemAnnotations;
|
||||
itemAnnotationsBindingSource.DataSource = _Annotations;
|
||||
AnnotationPanelView();
|
||||
if ((CurrentAnnotation == null || (_CurrentItem.ItemID != CurrentAnnotation.ItemID)))
|
||||
{
|
||||
if (_Annotations != null && _Annotations.Count > 0)
|
||||
CurrentAnnotation = _Annotations[0];
|
||||
else
|
||||
CurrentAnnotation = null;
|
||||
//InitializeAnnotation();
|
||||
}
|
||||
FindCurrentAnnotation();
|
||||
_LoadingGrid = false;
|
||||
}
|
||||
private void FindCurrentAnnotation()
|
||||
{
|
||||
int row = 0;
|
||||
if (CurrentAnnotation != null)
|
||||
{
|
||||
if (_Annotations != null)
|
||||
if (args.MyStepItem == null)
|
||||
{
|
||||
foreach (AnnotationInfo ai in _Annotations)
|
||||
{
|
||||
if (ai.AnnotationID == CurrentAnnotation.AnnotationID)
|
||||
{
|
||||
row = _Annotations.IndexOf(ai) + 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
infotabRO.Visible = infotabTransition.Visible = false;
|
||||
infotabTags.Visible = true;
|
||||
//vlnStackTrace.ShowStack("enter tc_ItemSelectedChanged {0}", _CurrentItem);
|
||||
}
|
||||
else
|
||||
{
|
||||
//vlnStackTrace.ShowStack("enter tc_ItemSelectedChanged {0}", _CurrentItem);
|
||||
infotabRO.Visible = infotabTransition.Visible = infotabTags.Visible = true;
|
||||
displayTransition.MyRTB = args.MyStepItem.MyStepRTB;
|
||||
displayRO.MyRTB = args.MyStepItem.MyStepRTB;
|
||||
}
|
||||
}
|
||||
//Console.WriteLine("Row = {0}", row);
|
||||
c1AnnotationGrid.Select(row, 0, true);
|
||||
ctrlAnnotationDetails.UpdateAnnotationGrid(_CurrentItem);
|
||||
AnnotationPanelView();
|
||||
}
|
||||
//private void ShowItemAnnotations(string title)
|
||||
//{
|
||||
// Console.WriteLine("{0} CurrentItem {1} {2} ItemAnnotationsCount {3}", title, _CurrentItem.ItemID, _CurrentItem.MyItemInfoUnique, _CurrentItem.ItemAnnotationCount);
|
||||
//}
|
||||
//private void itemAnnotationsBindingSource_DataSourceChanged(object sender, EventArgs e)
|
||||
//{
|
||||
//_LoadingGrid = true;
|
||||
//Console.WriteLine("itemAnnotationsBindingSource_DataSourceChanged 1");
|
||||
//AnnotationInfoList myAnnotations = itemAnnotationsBindingSource.DataSource as AnnotationInfoList;
|
||||
//Console.WriteLine("itemAnnotationsBindingSource_DataSourceChanged 2");
|
||||
//AnnotationPannelView(_Annotations);
|
||||
//Console.WriteLine("itemAnnotationsBindingSource_DataSourceChanged 3");
|
||||
//_LoadingGrid = false;
|
||||
//}
|
||||
|
||||
#region Annotations
|
||||
/// <summary>
|
||||
/// Display or hide the Annotation Details panel
|
||||
/// </summary>
|
||||
private void AnnotationPanelView()
|
||||
{
|
||||
if (_Annotations != null && _Annotations.Count != 0)
|
||||
if (ctrlAnnotationDetails.Annotations != null && ctrlAnnotationDetails.Annotations.Count != 0)
|
||||
{
|
||||
if (Settings.Default.AutoPopUpAnnotations) //cbAnnotationPopup.Checked
|
||||
epAnnotations.Expanded = true;
|
||||
else
|
||||
epAnnotations.TitleStyle.BackColor1.Color = Color.Yellow;
|
||||
rtxbComment.SelectionStart = rtxbComment.TextLength;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!btnAnnoDetailsPushPin.Checked)
|
||||
epAnnotations.Expanded = false;
|
||||
epAnnotations.TitleStyle.BackColor1.Color = _CommentTitleBckColor;
|
||||
rtxbComment.Text = null;
|
||||
ctrlAnnotationDetails.AnnotationText = null;
|
||||
}
|
||||
}
|
||||
|
||||
private AnnotationInfo _CurrentAnnotation = null;
|
||||
private AnnotationInfo CurrentAnnotation
|
||||
{
|
||||
get { return _CurrentAnnotation; }
|
||||
set
|
||||
{
|
||||
if (_CurrentAnnotation == null && value == null) return; // No Change
|
||||
if (_CurrentAnnotation != null && value != null)
|
||||
if (_CurrentAnnotation.AnnotationID == value.AnnotationID) return; // No Change
|
||||
//vlnStackTrace.ShowStack("CurrentAnnotation = '{0}' Old = '{1}'", value, _CurrentAnnotation);
|
||||
if (_CurrentAnnotation != null || _AddingAnnotation)
|
||||
{
|
||||
//if (_CurrentAnnotation.TypeID != (int)cbGridAnnoType.SelectedValue) SaveAnnotation();
|
||||
//else if (_CurrentAnnotation.RtfText != string.Empty && _CurrentAnnotation.RtfText != rtxbComment.Rtf)
|
||||
// SaveAnnotation();
|
||||
//else if (_CurrentAnnotation.RtfText == string.Empty && _CurrentAnnotation.SearchText != rtxbComment.Text)
|
||||
if (AnnotationDirty)
|
||||
SaveAnnotation();
|
||||
}
|
||||
_CurrentAnnotation = value;
|
||||
InitializeAnnotation();
|
||||
}
|
||||
}
|
||||
|
||||
private void SaveAnnotation()
|
||||
{
|
||||
if (cbGridAnnoType.SelectedIndex == -1) return;
|
||||
if (rtxbComment.Text == string.Empty) return;
|
||||
using (AnnotationType annotationType = AnnotationType.Get((int)cbGridAnnoType.SelectedValue))
|
||||
{
|
||||
if (_AddingAnnotation)
|
||||
{
|
||||
_AddingAnnotation = false;
|
||||
using (Item myItem = _CurrentItem.Get())
|
||||
{
|
||||
using (Annotation annotation = Annotation.MakeAnnotation(myItem, annotationType, rtxbComment.Rtf, rtxbComment.Text, ""))
|
||||
{
|
||||
CurrentAnnotation = AnnotationInfo.Get(annotation.AnnotationID);
|
||||
annotation.DTS = DateTime.Now;
|
||||
annotation.Save();
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
using (Annotation annotation = CurrentAnnotation.Get())
|
||||
{
|
||||
annotation.RtfText = rtxbComment.Rtf;
|
||||
annotation.SearchText = rtxbComment.Text;
|
||||
annotation.MyAnnotationType = annotationType;
|
||||
annotation.DTS = DateTime.Now;
|
||||
//Console.WriteLine("Before Annotation Type = {0} ({1})", CurrentAnnotation.MyAnnotationType, CurrentAnnotation.MyAnnotationType.AnnotationTypeAnnotations.Count);
|
||||
//Console.WriteLine("Before Annotation Type = {0}", CurrentAnnotation.MyAnnotationType);
|
||||
annotation.Save();
|
||||
//Console.WriteLine("After Annotation Type = {0} ({1})", CurrentAnnotation.MyAnnotationType, CurrentAnnotation.MyAnnotationType.AnnotationTypeAnnotations.Count);
|
||||
}
|
||||
}
|
||||
}
|
||||
AnnotationDirty = false;
|
||||
UpdateAnnotationGrid();
|
||||
//UpdateAnnotationSearchResults();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private void btnSave_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void tc_LinkActiveChanged(object sender, StepPanelLinkEventArgs args)
|
||||
{
|
||||
// determine if any infotabs are visisble, and if it is the Transition,
|
||||
@@ -1340,12 +1210,14 @@ 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;
|
||||
@@ -1357,6 +1229,7 @@ namespace VEPROMS
|
||||
displayRO.MyRTB = dtp.MyStepPanel.SelectedStepItem.MyStepRTB;
|
||||
displayRO.CurROLink = null;
|
||||
}
|
||||
|
||||
private void tc_LinkModifyTran(object sender, StepPanelLinkEventArgs args)
|
||||
{
|
||||
infoPanel.Expanded = true;
|
||||
@@ -1379,211 +1252,10 @@ namespace VEPROMS
|
||||
displayRO.CurROLink = args.MyLinkText.RoUsageid; // this is wrong - use for now.
|
||||
}
|
||||
|
||||
private bool _LoadingList = false;
|
||||
private void cbAnnoType_SelectedValueChanged(object sender, EventArgs e)
|
||||
{
|
||||
UpdateAnnotationSearchResults();
|
||||
}
|
||||
|
||||
private void UpdateAnnotationSearchResults()
|
||||
{
|
||||
AnnotationTypeInfo ati = cbAnnoType.SelectedValue as AnnotationTypeInfo;
|
||||
_LoadingList = true;
|
||||
lbResults.DisplayMember = "SearchText";
|
||||
lbResults.DataSource = ati.AnnotationTypeAnnotations;
|
||||
lbResults.SelectedIndex = -1;
|
||||
LastResultsMouseOverIndex = -1;
|
||||
_LoadingList = false;
|
||||
}
|
||||
|
||||
private int LastResultsMouseOverIndex = -1;
|
||||
void lbResults_MouseMove(object sender, MouseEventArgs e)
|
||||
{
|
||||
int ResultsMouseOverIndex = lbResults.IndexFromPoint(e.Location);
|
||||
if (ResultsMouseOverIndex != -1 && ResultsMouseOverIndex != LastResultsMouseOverIndex)
|
||||
{
|
||||
AnnotationInfo ai = lbResults.Items[ResultsMouseOverIndex] as AnnotationInfo;
|
||||
|
||||
toolTip1.SetToolTip(lbResults, ai.MyItem.Path);
|
||||
LastResultsMouseOverIndex = ResultsMouseOverIndex;
|
||||
}
|
||||
}
|
||||
private void lbResults_SelectedValueChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (!_LoadingList)
|
||||
{
|
||||
//AnnotationInfo ai = lbResults.SelectedValue as AnnotationInfo;
|
||||
//if(ai != null)
|
||||
// tc.OpenItem(ai.MyItem);
|
||||
CurrentAnnotation = lbResults.SelectedValue as AnnotationInfo;
|
||||
if (CurrentAnnotation != null)
|
||||
{
|
||||
tc.OpenItem(CurrentAnnotation.MyItem);
|
||||
}
|
||||
FindCurrentAnnotation();
|
||||
}
|
||||
}
|
||||
private void lbxBookMarks_Click(object sender, EventArgs e)
|
||||
{
|
||||
MostRecentItem itm = lbxBookMarks.SelectedValue as MostRecentItem;
|
||||
tc.OpenItem(itm.MyItemInfo);
|
||||
}
|
||||
private void cbGridAnnoType_Validating(object sender, CancelEventArgs e)
|
||||
{
|
||||
//try
|
||||
//{
|
||||
// //bool test1 = c1AnnotationGrid.IsCellSelected(c1AnnotationGrid.RowSel, c1AnnotationGrid.ColSel);
|
||||
// //bool test2 = c1AnnotationGrid.IsCellValid(c1AnnotationGrid.RowSel, c1AnnotationGrid.ColSel);
|
||||
// //AnnotationTypeInfo celldat = (AnnotationTypeInfo)c1AnnotationGrid.GetData(c1AnnotationGrid.RowSel, c1AnnotationGrid.ColSel);
|
||||
// AnnotationTypeInfo newcelldat = (AnnotationTypeInfo)cbGridAnnoType.SelectedItem;
|
||||
|
||||
// AnnotationInfo ani = ((AnnotationInfoList)itemAnnotationsBindingSource.DataSource)[c1AnnotationGrid.RowSel - 1] as AnnotationInfo;
|
||||
// Annotation ano = ani.Get();
|
||||
// if (ano.TypeID != newcelldat.TypeID)
|
||||
// {
|
||||
// ano.Update(newcelldat.TypeID);
|
||||
// //btnCancelAnnoation.Enabled = true;
|
||||
// c1AnnotationGrid.Refresh();
|
||||
// }
|
||||
//}
|
||||
//catch (Exception ex)
|
||||
//{
|
||||
// log.ErrorFormat("Error saving Annotation Type Change: {0}", ex.Message);
|
||||
//}
|
||||
}
|
||||
private void epAnnotations_Layout(object sender, LayoutEventArgs e)
|
||||
{
|
||||
//cbGridAnnoType.Visible = false;
|
||||
}
|
||||
//private void btnSaveAnnoation_Click(object sender, EventArgs e)
|
||||
//{
|
||||
// AnnotationInfoList ail = (AnnotationInfoList)itemAnnotationsBindingSource.DataSource;
|
||||
// foreach (AnnotationInfo ai in ail)
|
||||
// {
|
||||
// Annotation ano = ai.Get();
|
||||
// ano.CommitChanges();
|
||||
// }
|
||||
// btnCancelAnnoation.Enabled = false;
|
||||
//}
|
||||
private bool _AddingAnnotation = false;
|
||||
private void btnAddAnnotation_Click(object sender, EventArgs e)
|
||||
{
|
||||
c1AnnotationGrid.Row = -1;
|
||||
CurrentAnnotation = null;
|
||||
_AddingAnnotation = true;
|
||||
//InitializeAnnotation();
|
||||
}
|
||||
private bool _LoadingAnnotation = false;
|
||||
private bool _LoadingGrid = false;
|
||||
private void c1AnnotationGrid_EnterCell(object sender, EventArgs e)
|
||||
{
|
||||
if (!_LoadingGrid) // Only set the Current Annotation when not loading the grid
|
||||
{
|
||||
if ((_Annotations != null) && (c1AnnotationGrid.Row > 0))
|
||||
CurrentAnnotation = _Annotations[c1AnnotationGrid.Row - 1];
|
||||
else
|
||||
CurrentAnnotation = null;
|
||||
}
|
||||
//InitializeAnnotation();
|
||||
}
|
||||
private void InitializeAnnotation()
|
||||
{
|
||||
//vlnCSLAStackTrace.ShowStack("InitializeAnnotation - CurrentAnnotation = {0}", CurrentAnnotation);
|
||||
_LoadingAnnotation = true;
|
||||
if (CurrentAnnotation == null)
|
||||
{
|
||||
cbGridAnnoType.SelectedIndex = -1;
|
||||
rtxbComment.Text = "";
|
||||
}
|
||||
else
|
||||
{
|
||||
cbGridAnnoType.SelectedValue = CurrentAnnotation.TypeID;
|
||||
if (CurrentAnnotation.RtfText != "")
|
||||
rtxbComment.Rtf = CurrentAnnotation.RtfText;
|
||||
else
|
||||
rtxbComment.Text = CurrentAnnotation.SearchText;
|
||||
}
|
||||
_LoadingAnnotation = false;
|
||||
AnnotationDirty = false;
|
||||
if (!_LoadingGrid)
|
||||
{
|
||||
rtxbComment.SelectionStart = rtxbComment.TextLength; // Position the cursor at the end of the current text
|
||||
rtxbComment.Focus(); // Set the focus to the comment text
|
||||
}
|
||||
}
|
||||
private bool _AnnotationDirty = false;
|
||||
private bool AnnotationDirty
|
||||
{
|
||||
get { return _AnnotationDirty; }
|
||||
set
|
||||
{
|
||||
btnRemoveAnnotation.Enabled = btnAddAnnotation.Enabled = !value;
|
||||
btnSaveAnnotation.Enabled = btnCancelAnnoation.Enabled = value;
|
||||
_AddingAnnotation = value && (CurrentAnnotation == null);
|
||||
_AnnotationDirty = value;
|
||||
}
|
||||
}
|
||||
|
||||
private void rtxbComment_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (!_LoadingAnnotation)
|
||||
{
|
||||
AnnotationDirty = true;
|
||||
}
|
||||
}
|
||||
|
||||
private void btnCancelAnnoation_Click(object sender, EventArgs e)
|
||||
{
|
||||
InitializeAnnotation();
|
||||
}
|
||||
|
||||
private void cbGridAnnoType_SelectedValueChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (!_LoadingAnnotation)
|
||||
{
|
||||
AnnotationDirty = true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void btnSaveAnnotation_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (cbGridAnnoType.SelectedIndex == -1)
|
||||
{
|
||||
MessageBox.Show("You Must Select an Annotation Type", "Annotation Type Not Selected", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
|
||||
cbGridAnnoType.Focus();
|
||||
return;
|
||||
}
|
||||
if (rtxbComment.Text == string.Empty)
|
||||
{
|
||||
MessageBox.Show("You Must Enter Annotation Text", "Annotation Text Is Blank", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
|
||||
rtxbComment.Focus();
|
||||
return;
|
||||
}
|
||||
SaveAnnotation();
|
||||
}
|
||||
|
||||
private void btnRemoveAnnotation_Click(object sender, EventArgs e)
|
||||
{
|
||||
using (Annotation annotation = CurrentAnnotation.Get())
|
||||
{
|
||||
//ShowItemAnnotations("btnRemoveAnnotation_Click Start");
|
||||
//annotation.DTS = DateTime.Now;
|
||||
//annotation.Save();
|
||||
//ShowItemAnnotations("btnRemoveAnnotation_Click After Change Save");
|
||||
annotation.Delete();
|
||||
_LoadingList = true;
|
||||
annotation.Save();
|
||||
_LoadingList = false;
|
||||
CurrentAnnotation = null;
|
||||
//ShowItemAnnotations("btnRemoveAnnotation_Click After Delete Save");
|
||||
//c1AnnotationGrid.Row = -1;
|
||||
//ShowItemAnnotations("btnRemoveAnnotation_Click Before Update Grid");
|
||||
UpdateAnnotationGrid();
|
||||
//ShowItemAnnotations("After UpdateAnnotationGrid After Update Grid");
|
||||
UpdateAnnotationSearchResults();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user