This commit is contained in:
parent
9541cd18f6
commit
90a4ca821f
@ -7,6 +7,7 @@ using System.Drawing;
|
|||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using VEPROMS.CSLA.Library;
|
using VEPROMS.CSLA.Library;
|
||||||
using Volian.Controls.Library;
|
using Volian.Controls.Library;
|
||||||
|
using System.Reflection;
|
||||||
|
|
||||||
|
|
||||||
namespace Volian.Controls.Library
|
namespace Volian.Controls.Library
|
||||||
@ -112,6 +113,8 @@ namespace Volian.Controls.Library
|
|||||||
//System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(WordDSOTab));
|
//System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(WordDSOTab));
|
||||||
//this._DSOFramer.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("_FC.OcxState")));
|
//this._DSOFramer.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("_FC.OcxState")));
|
||||||
((System.ComponentModel.ISupportInitialize)(this._MyDSOFramer)).EndInit();
|
((System.ComponentModel.ISupportInitialize)(this._MyDSOFramer)).EndInit();
|
||||||
|
try
|
||||||
|
{
|
||||||
this._MyDSOFramer.Open(MyDSOFile.MyFile.FullName);
|
this._MyDSOFramer.Open(MyDSOFile.MyFile.FullName);
|
||||||
this._MyDSOFramer.Menubar = false;
|
this._MyDSOFramer.Menubar = false;
|
||||||
this._MyDSOFramer.Titlebar = false;
|
this._MyDSOFramer.Titlebar = false;
|
||||||
@ -129,6 +132,27 @@ namespace Volian.Controls.Library
|
|||||||
//this.GotFocus += new EventHandler(DSOTabPanel_GotFocus);
|
//this.GotFocus += new EventHandler(DSOTabPanel_GotFocus);
|
||||||
//this.LostFocus += new EventHandler(DSOTabPanel_LostFocus);
|
//this.LostFocus += new EventHandler(DSOTabPanel_LostFocus);
|
||||||
}
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
string message = ShowException(ex);
|
||||||
|
Console.WriteLine("\r\n-------------\r\n{0}{1}{2}\r\n-------------\r\n", MyDSOFile.MyFile.FullName, ex.GetType().Name, message);
|
||||||
|
// TODO: Should output a message
|
||||||
|
// TODO: Should try to do a direct open using Word.
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private string ShowException(Exception ex)
|
||||||
|
{
|
||||||
|
string sep = "\r\n ";
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
do
|
||||||
|
{
|
||||||
|
sb.Append(sep + ex.Message);
|
||||||
|
sep += " ";
|
||||||
|
ex = ex.InnerException;
|
||||||
|
} while (ex != null);
|
||||||
|
return sb.ToString();
|
||||||
|
}
|
||||||
|
|
||||||
//void _MyDSOFramer_Leave(object sender, EventArgs e)
|
//void _MyDSOFramer_Leave(object sender, EventArgs e)
|
||||||
//{
|
//{
|
||||||
@ -189,6 +213,7 @@ namespace Volian.Controls.Library
|
|||||||
/// <param name="e"></param>
|
/// <param name="e"></param>
|
||||||
void _MyDSOFramer_OnSaveCompleted(object sender, AxDSOFramer._DFramerCtlEvents_OnSaveCompletedEvent e)
|
void _MyDSOFramer_OnSaveCompleted(object sender, AxDSOFramer._DFramerCtlEvents_OnSaveCompletedEvent e)
|
||||||
{
|
{
|
||||||
|
MyDSOFile.FullName = GetReflectiveProperty(_MyDSOFramer.ActiveDocument, "FullName");
|
||||||
MyDSOFile.SaveFile();
|
MyDSOFile.SaveFile();
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -233,6 +258,7 @@ namespace Volian.Controls.Library
|
|||||||
if (_In_DSOTabPanel_Enter) return;
|
if (_In_DSOTabPanel_Enter) return;
|
||||||
//vlnStackTrace.ShowStack("DSOTabPanel_Enter {0} DocID {1} Index {2} {3}",_In_DSOTabPanel_Enter, this._MyDocumentInfo.DocID, _MyDisplayTabControl.MyBar.SelectedDockTab, sender.GetType().FullName);
|
//vlnStackTrace.ShowStack("DSOTabPanel_Enter {0} DocID {1} Index {2} {3}",_In_DSOTabPanel_Enter, this._MyDocumentInfo.DocID, _MyDisplayTabControl.MyBar.SelectedDockTab, sender.GetType().FullName);
|
||||||
_In_DSOTabPanel_Enter = true;
|
_In_DSOTabPanel_Enter = true;
|
||||||
|
if (MyDisplayTabItem.MyItemInfo != null)
|
||||||
_MyDisplayTabControl.OnItemSelectedChanged(this,new ItemSelectedChangedEventArgs(MyDisplayTabItem.MyItemInfo));
|
_MyDisplayTabControl.OnItemSelectedChanged(this,new ItemSelectedChangedEventArgs(MyDisplayTabItem.MyItemInfo));
|
||||||
_MyDSOFramer.Focus();
|
_MyDSOFramer.Focus();
|
||||||
_In_DSOTabPanel_Enter = false;
|
_In_DSOTabPanel_Enter = false;
|
||||||
@ -250,6 +276,7 @@ namespace Volian.Controls.Library
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
_MyDSOFramer.Save();
|
_MyDSOFramer.Save();
|
||||||
|
MyDSOFile.FullName = GetReflectiveProperty(_MyDSOFramer.ActiveDocument, "FullName");
|
||||||
MyDSOFile.SaveFile();
|
MyDSOFile.SaveFile();
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
@ -269,7 +296,8 @@ namespace Volian.Controls.Library
|
|||||||
if (_MyDSOFramer.IsDirty)
|
if (_MyDSOFramer.IsDirty)
|
||||||
{
|
{
|
||||||
// TODO: Should be based upon Item rather than Document.
|
// TODO: Should be based upon Item rather than Document.
|
||||||
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.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();
|
return SaveDSO();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -326,5 +354,32 @@ namespace Volian.Controls.Library
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
#region DocumentProperties
|
||||||
|
|
||||||
|
private string GetReflectiveProperty(object objectToInspect, string propertyName)
|
||||||
|
{
|
||||||
|
string returnString = "";
|
||||||
|
//To use reflection on an object, you
|
||||||
|
// first need to get an instance
|
||||||
|
// of that object's type.
|
||||||
|
Type objectType = objectToInspect.GetType();
|
||||||
|
//After you have the object's type, you can get
|
||||||
|
// information on that type. In this case, we're
|
||||||
|
// asking the type to tell us all the
|
||||||
|
// properties that it contains.
|
||||||
|
PropertyInfo[] properties = objectType.GetProperties();
|
||||||
|
//You can then use the PropertyInfo array
|
||||||
|
// to loop through each property of the type.
|
||||||
|
foreach (PropertyInfo property in properties)
|
||||||
|
{
|
||||||
|
//The interest part of this code
|
||||||
|
// is the GetValue method. This method
|
||||||
|
// returns the value of the property.
|
||||||
|
if(property.Name == propertyName)
|
||||||
|
return property.GetValue(objectToInspect, null).ToString();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -16,6 +16,9 @@ namespace Volian.Controls.Library
|
|||||||
private StepTabPanel _MyStepTabPanel;
|
private StepTabPanel _MyStepTabPanel;
|
||||||
private string _MyKey;
|
private string _MyKey;
|
||||||
private DSOTabPanel _MyDSOTabPanel;
|
private DSOTabPanel _MyDSOTabPanel;
|
||||||
|
private DocumentInfo _MyDocumentInfo;
|
||||||
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
#region Properties
|
#region Properties
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -59,6 +62,13 @@ namespace Volian.Controls.Library
|
|||||||
get { return _MyStepTabPanel.SelectedItemInfo; }
|
get { return _MyStepTabPanel.SelectedItemInfo; }
|
||||||
set { _MyStepTabPanel.SelectedItemInfo = value; }
|
set { _MyStepTabPanel.SelectedItemInfo = value; }
|
||||||
}
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Current DocumentInfo for this page - only set if library document
|
||||||
|
/// </summary>
|
||||||
|
public DocumentInfo MyDocumentInfo
|
||||||
|
{
|
||||||
|
get { return _MyDocumentInfo; }
|
||||||
|
}
|
||||||
#endregion
|
#endregion
|
||||||
#region Constructors
|
#region Constructors
|
||||||
public DisplayTabItem(IContainer container, DisplayTabControl myDisplayTabControl, ItemInfo myItemInfo, string myKey)
|
public DisplayTabItem(IContainer container, DisplayTabControl myDisplayTabControl, ItemInfo myItemInfo, string myKey)
|
||||||
@ -69,16 +79,24 @@ namespace Volian.Controls.Library
|
|||||||
container.Add(this);
|
container.Add(this);
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
this.Click += new EventHandler(DisplayTabItem_Click);
|
this.Click += new EventHandler(DisplayTabItem_Click);
|
||||||
//this.GotFocus += new EventHandler(DisplayTabItem_GotFocus);
|
|
||||||
//this.LostFocus += new EventHandler(DisplayTabItem_LostFocus);
|
|
||||||
//this.MouseDown += new System.Windows.Forms.MouseEventHandler(DisplayTabItem_MouseDown);
|
|
||||||
//this.MouseUp += new System.Windows.Forms.MouseEventHandler(DisplayTabItem_MouseUp);
|
|
||||||
if (myItemInfo.MyContent.MyEntry == null)
|
if (myItemInfo.MyContent.MyEntry == null)
|
||||||
SetupStepTabPanel();
|
SetupStepTabPanel();
|
||||||
else
|
else
|
||||||
SetupDSOTabPanel();
|
SetupDSOTabPanel();
|
||||||
Name = string.Format("DisplayTabItem {0}", myItemInfo.ItemID);
|
Name = string.Format("DisplayTabItem {0}", myItemInfo.ItemID);
|
||||||
}
|
}
|
||||||
|
public DisplayTabItem(IContainer container, DisplayTabControl myDisplayTabControl, DocumentInfo myDocumentInfo, string myKey)
|
||||||
|
{
|
||||||
|
_MyKey = myKey;
|
||||||
|
_MyDisplayTabControl = myDisplayTabControl;
|
||||||
|
_MyDocumentInfo = myDocumentInfo;
|
||||||
|
container.Add(this);
|
||||||
|
InitializeComponent();
|
||||||
|
this.Click += new EventHandler(DisplayTabItem_Click);
|
||||||
|
SetupLibraryDocumentDSOTabPanel();
|
||||||
|
Name = string.Format("DisplayTabLibraryDocument {0}", myDocumentInfo.DocID);
|
||||||
|
}
|
||||||
|
|
||||||
protected override void OnDisplayedChanged()
|
protected override void OnDisplayedChanged()
|
||||||
{
|
{
|
||||||
//Console.WriteLine("=>=>=>=> OnDisplayedChanged");
|
//Console.WriteLine("=>=>=>=> OnDisplayedChanged");
|
||||||
@ -168,13 +186,7 @@ namespace Volian.Controls.Library
|
|||||||
Name = "tabItem Item " + _MyItemInfo.ItemID;
|
Name = "tabItem Item " + _MyItemInfo.ItemID;
|
||||||
Text = _MyItemInfo.TabTitle;
|
Text = _MyItemInfo.TabTitle;
|
||||||
Tooltip = _MyItemInfo.TabToolTip;
|
Tooltip = _MyItemInfo.TabToolTip;
|
||||||
//
|
|
||||||
//Console.WriteLine("this.Focus {0}", Name);
|
|
||||||
//this.Focus();
|
|
||||||
//Console.WriteLine("Controls.Add {0}", Name);
|
|
||||||
_MyDisplayTabControl.Controls.Add(_MyDSOTabPanel);
|
_MyDisplayTabControl.Controls.Add(_MyDSOTabPanel);
|
||||||
//Console.WriteLine("Enabled = false {0}", Name);
|
|
||||||
//_MyDisplayTabControl.MyBar.Enabled = false;
|
|
||||||
DSOTabPanel.IgnoreEnter = true;
|
DSOTabPanel.IgnoreEnter = true;
|
||||||
Console.WriteLine("AddRange {0}", Name);
|
Console.WriteLine("AddRange {0}", Name);
|
||||||
_MyDisplayTabControl.MyBar.Items.AddRange(new DevComponents.DotNetBar.BaseItem[] {
|
_MyDisplayTabControl.MyBar.Items.AddRange(new DevComponents.DotNetBar.BaseItem[] {
|
||||||
@ -182,14 +194,31 @@ namespace Volian.Controls.Library
|
|||||||
//
|
//
|
||||||
// tabPanel
|
// tabPanel
|
||||||
//
|
//
|
||||||
//Console.WriteLine("Enabled = true {0}", Name);
|
|
||||||
//_MyDisplayTabControl.MyBar.Enabled = true;
|
|
||||||
//Console.WriteLine("SelectedDisplayTabItem {0}", Name);
|
|
||||||
_MyDisplayTabControl.SelectedDisplayTabItem = this;
|
_MyDisplayTabControl.SelectedDisplayTabItem = this;
|
||||||
//Console.WriteLine("MyDisplayTabItem {0}", Name);
|
|
||||||
_MyDSOTabPanel.MyDisplayTabItem = this;
|
_MyDSOTabPanel.MyDisplayTabItem = this;
|
||||||
DSOTabPanel.IgnoreEnter = false;
|
DSOTabPanel.IgnoreEnter = false;
|
||||||
//_MyDisplayTabControl.OnItemSelectedChanged(this, new ItemSelectedChangedEventArgs(MyItemInfo));
|
}
|
||||||
|
private void SetupLibraryDocumentDSOTabPanel()
|
||||||
|
{
|
||||||
|
_MyDSOTabPanel = new DSOTabPanel(_MyDocumentInfo, _MyDisplayTabControl);
|
||||||
|
//
|
||||||
|
// tabItem
|
||||||
|
//
|
||||||
|
Control = _MyDSOTabPanel;
|
||||||
|
Name = "tabLibraryDocument " + _MyDocumentInfo.DocID;
|
||||||
|
Text = _MyDocumentInfo.LibTitle;
|
||||||
|
DocumentConfig dc = new DocumentConfig(_MyDocumentInfo);
|
||||||
|
Tooltip = dc.LibDoc_Comment;
|
||||||
|
_MyDisplayTabControl.Controls.Add(_MyDSOTabPanel);
|
||||||
|
DSOTabPanel.IgnoreEnter = true;
|
||||||
|
_MyDisplayTabControl.MyBar.Items.AddRange(new DevComponents.DotNetBar.BaseItem[] {
|
||||||
|
this});
|
||||||
|
//
|
||||||
|
// tabPanel
|
||||||
|
//
|
||||||
|
_MyDisplayTabControl.SelectedDisplayTabItem = this;
|
||||||
|
_MyDSOTabPanel.MyDisplayTabItem = this;
|
||||||
|
DSOTabPanel.IgnoreEnter = false;
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user