This commit is contained in:
Jsj
2008-04-24 14:40:55 +00:00
parent ab1e767684
commit bfb3abe47b
6 changed files with 422 additions and 309 deletions

View File

@@ -42,6 +42,7 @@ namespace VEPROMS
Color _CommentTitleBckColor;
StepRTB _MyRTB;
VETreeNode _PrevBookMark = null;
string _PathToROs = @"G:\PROMSDAT\VEHLP\RO\RO.FST";
public frmVEPROMS()
{
@@ -68,8 +69,8 @@ namespace VEPROMS
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;
_CommentTitleBckColor = epAnnotations.TitleStyle.BackColor1.Color;
epAnnotations.Expanded = false;
infoPanel.Expanded = false;
}
@@ -108,6 +109,12 @@ namespace VEPROMS
cbAnnoType.DataSource = AnnotationTypeInfoList.Get();
cbAnnoType.DisplayMember = "Name";
lbResults.MouseMove += new MouseEventHandler(lbResults_MouseMove);
//comboBox1.DataSource = AnnotationTypeInfo.AllList(); //AnnotationType.AllTypes();
////comboBox1.DataSource = AnnotationTypeInfoList.Get();
//comboBox1.DisplayMember = "_Name";
foreach (AnnotationTypeInfo item in cbAnnoType.Items)
cbGridAnnoType.Items.Add(item);
c1AnnotationGrid.Cols[0].Editor = cbGridAnnoType;
}
#region MRU
@@ -192,9 +199,9 @@ namespace VEPROMS
_LastProcedure = null;
_LastSection = null;
_LastStep = null;
epComments.Expanded = false;
epAnnotations.Expanded = false;
rtxbComment.Text = "";
epComments.TitleStyle.BackColor1.Color = _CommentTitleBckColor;
epAnnotations.TitleStyle.BackColor1.Color = _CommentTitleBckColor;
if (_MyMRIList.Add(node.VEObject) != null)
SetupMRU();
if (node.VEObject.GetType() == typeof(FolderInfo))
@@ -213,38 +220,24 @@ namespace VEPROMS
_LastProcedure = _LastProcedureInfo.Get();
tc.OpenItem((ItemInfo)_LastProcedureInfo);
if (_LastProcedureInfo.ItemAnnotationCount > 0)
{
if (!cbCmntDontPopup.Checked)
epComments.Expanded = true;
rtxbComment.Text = _LastProcedureInfo.ItemAnnotations[0].SearchText;
}
// 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);
if (_LastSectionInfo.ItemAnnotationCount > 0)
{
if (!cbCmntDontPopup.Checked)
epComments.Expanded = true;
rtxbComment.Text = _LastSectionInfo.ItemAnnotations[0].SearchText;
}
// 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);
//if (_LastStepInfo.ItemAnnotationCount > 0)
//{
// if (!cbCmntDontPopup.Checked)
// epComments.Expanded = true;
// rtxbComment.Text = _LastStepInfo.ItemAnnotations[0].SearchText;
// Display any annotations
itemAnnotationsBindingSource.DataSource = _LastStepInfo.ItemAnnotations;
// epComments.TitleStyle.BackColor1.Color = Color.Yellow;
//}
#region Sample Display Table Code
// display an exiting table in that rtf grid thing
//if ((_LastStepInfo.MyContent.Type == 20007) || (_LastStepInfo.MyContent.Type == 20009))
@@ -1136,7 +1129,7 @@ namespace VEPROMS
infoTabs.SelectedTab = infotabRO;
StepTabPanel dtp = ((DisplayTabItem)tc.SelectedDisplayTabItem).MyStepTabPanel;
if (dtp == null) return;
ROFST rofst = new ROFST("g:\\vehlp\\ro\\ro.fst");
ROFST rofst = new ROFST(_PathToROs); //"g:\\vehlp\\ro\\ro.fst");
displayRO.MyROFST = rofst;
displayRO.MyRTB = dtp.MyStepPanel.SelectedStepItem.MyStepRTB;
}
@@ -1176,19 +1169,65 @@ namespace VEPROMS
private void itemAnnotationsBindingSource_DataSourceChanged(object sender, EventArgs e)
{
AnnotationInfoList myAnnotations = itemAnnotationsBindingSource.DataSource as AnnotationInfoList;
if (myAnnotations != null && myAnnotations.Count != 0)
AnnotationPannelView(myAnnotations);
}
private void AnnotationPannelView(AnnotationInfoList ail)
{
int selectedAnnoID = -1;
int selectedAnno = 0;
if (ail != null && ail.Count != 0)
{
if (!cbCmntDontPopup.Checked)
epComments.Expanded = true;
rtxbComment.Text = myAnnotations[0].SearchText;
if (!cbAnnotationDontPopup.Checked)
epAnnotations.Expanded = true;
else
epAnnotations.TitleStyle.BackColor1.Color = Color.Yellow;
if (lbResults != null && lbResults.SelectedIndex > -1)
{
selectedAnnoID = ((AnnotationInfo)lbResults.SelectedItem).AnnotationID;
foreach (AnnotationInfo ai in ail)
{
if (ai.AnnotationID != selectedAnnoID)
selectedAnno++;
else
break;
}
if (selectedAnno >= ail.Count)
selectedAnno = 0;
}
//rtxbComment.Text = ail[0].SearchText;
rtxbComment.Text = ail[selectedAnno].SearchText;
if (epAnnotations.Expanded)
{
//epAnnotations.PerformClick();
//epAnnotations.SelectNextControl(rtxbComment, false, false, false, false);
//rtxbComment.Focus();
//c1AnnotationGrid.SelectionMode = C1.Win.C1FlexGrid.SelectionModeEnum.Cell;
c1AnnotationGrid.Focus();
//c1AnnotationGrid.Select();
//C1.Win.C1FlexGrid.CellRange cr = c1AnnotationGrid.GetCellRange(selectedAnno, 3);
//c1AnnotationGrid.Select(cr, true);
//c1AnnotationGrid.Controls[3].Select();
//c1AnnotationGrid.ShowCell(selectedAnno+1,3);
//SendKeys.Flush();
c1AnnotationGrid.Select(selectedAnno + 1, 3, true);
//c1AnnotationGrid.AccessibilityObject.Select(AccessibleSelection.TakeFocus);
//SendKeys.Send("{RIGHT}");
//SendKeys.Flush();
rtxbComment.Focus();
}
}
else
{
if (!cbCmntDontPopup.Checked)
epComments.Expanded = false;
if (!cbAnnotationDontPopup.Checked)
epAnnotations.Expanded = false;
epAnnotations.TitleStyle.BackColor1.Color = _CommentTitleBckColor;
rtxbComment.Text = null;
}
}
private void btnSave_Click(object sender, EventArgs e)
{
@@ -1212,7 +1251,7 @@ namespace VEPROMS
{
infoPanel.Expanded = true;
infoTabs.SelectedTab = infotabRO;
ROFST rofst = new ROFST("g:\\vehlp\\ro\\ro.fst");
ROFST rofst = new ROFST(_PathToROs); //"g:\\vehlp\\ro\\ro.fst");
displayRO.MyROFST = rofst;
StepTabPanel dtp = ((DisplayTabItem)tc.SelectedDisplayTabItem).MyStepTabPanel;
if (dtp == null) return;
@@ -1233,7 +1272,7 @@ namespace VEPROMS
{
infoPanel.Expanded = true;
infoTabs.SelectedTab = infotabRO;
ROFST rofst = new ROFST("g:\\vehlp\\ro\\ro.fst");
ROFST rofst = new ROFST(_PathToROs); //"g:\\vehlp\\ro\\ro.fst");
displayRO.MyROFST = rofst;
StepTabPanel dtp = ((DisplayTabItem)tc.SelectedDisplayTabItem).MyStepTabPanel;
if (dtp == null) return;
@@ -1280,5 +1319,49 @@ namespace VEPROMS
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);
btnSaveAnnoation.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 buttonX1_Click(object sender, EventArgs e)
{
AnnotationInfoList ail = (AnnotationInfoList)itemAnnotationsBindingSource.DataSource;
foreach (AnnotationInfo ai in ail)
{
Annotation ano = ai.Get();
ano.CommitChanges();
}
btnSaveAnnoation.Enabled = false;
}
}
}