This commit is contained in:
2009-07-24 11:54:20 +00:00
parent 12816c2ff0
commit b1da81e65f
5 changed files with 119 additions and 27 deletions

View File

@@ -75,6 +75,7 @@ namespace Volian.Controls.Library
{
get { return _MyDSOFramer.IsDirty; }
}
public E_ViewMode PanelViewEditMode = E_ViewMode.Edit;
#endregion
//private frmPG _frm = null;
#region Constructors
@@ -231,6 +232,12 @@ namespace Volian.Controls.Library
/// <param name="e"></param>
void _MyDSOFramer_OnSaveCompleted(object sender, AxDSOFramer._DFramerCtlEvents_OnSaveCompletedEvent e)
{
// Unfortunately, the only way to handle view mode for DSO Framer is to not save.
if (PanelViewEditMode == E_ViewMode.View)
{
MessageBox.Show("Currently in VIEW mode,\r\n cannot Save " + _MyDisplayTabItem.Tooltip);
return;
}
MyDSOFile.FullName = GetReflectiveProperty(_MyDSOFramer.ActiveDocument, "FullName");
MyDSOFile.SaveFile();
}
@@ -245,7 +252,7 @@ namespace Volian.Controls.Library
{
this.Enter -= new EventHandler(DSOTabPanel_Enter);
this.Leave -= new EventHandler(DSOTabPanel_Leave);
SaveDirty();
// SaveDirty(); // SaveDirty happens in CloseDSO(bool)
}
catch (Exception ex)
{
@@ -264,6 +271,19 @@ namespace Volian.Controls.Library
{
if (IgnoreEnter) return;
_MyTransparentPanel.SendToBack();
// Set whether this worddoc is in view/edit mode by checking whether the
// procedure is in view/edit mode (based on the steppanel. This occurs on
// the enter event so that the mode is determined any time this panel becomes
// active.
// find steptabpanel and its view/edit. If it doesn't have a steptabpanel
// use default - edit. Later when we have ownership, need to use that.
PanelViewEditMode = E_ViewMode.Edit; // default to edit
if (MyDisplayTabItem.MyItemInfo != null) // lib doc with no associated active procedure defaults to edit
{
StepTabPanel stpanel = _MyDisplayTabControl.GetProcedureTabPanel(MyDisplayTabItem.MyItemInfo);
PanelViewEditMode = (stpanel==null)? E_ViewMode.Edit : stpanel.MyStepPanel.PanelViewEditMode;
}
try
{
_MyDSOFramer.EventsEnabled = true;
@@ -313,7 +333,12 @@ namespace Volian.Controls.Library
{
if (_MyDSOFramer.IsDirty)
{
// TODO: Should be based upon Item rather than Document.
// Unfortunately, the only way to handle view mode for DSO Framer is to not save.
if (PanelViewEditMode == E_ViewMode.View)
{
MessageBox.Show("Currently in VIEW mode,\r\n cannot Save " + _MyDisplayTabItem.Tooltip);
return false;
}
//if (MessageBox.Show("Save changes to " + _MyDisplayTabItem.MyItemInfo.TabTitle + "\r\n" + _MyDisplayTabItem.MyItemInfo.TabToolTip, "Document has Changed", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
if (MessageBox.Show("Save changes to " + _MyDisplayTabItem.Text + "\r\n" + _MyDisplayTabItem.Tooltip, "Document has Changed", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
return SaveDSO();