Show message box if library document is already open

This commit is contained in:
Rich 2009-04-13 20:04:14 +00:00
parent 73bf820df0
commit ad8de088bf

View File

@ -411,7 +411,14 @@ namespace Volian.Controls.Library
EntryInfo myEntry = myItemInfo.MyContent.MyEntry;
string key = "Doc - " + myEntry.DocID;
if (_MyDisplayTabItems.ContainsKey(key)) // If document page open use it
{
pg = _MyDisplayTabItems[key];
if (pg.MyItemInfo.ItemID != myItemInfo.ItemID)
{
string msg = string.Format("{0} is already open", myItemInfo.MyContent.MyEntry.MyDocument.LibTitle);
MessageBox.Show(msg, "Library Document is Already Open", MessageBoxButtons.OK);
}
}
else
{
if (DSOTabPanel.Count > 18) // Limit the number of open document pages to 18
@ -419,8 +426,10 @@ namespace Volian.Controls.Library
MessageBox.Show("Too many Word Documents Open. Please close one of the Documents before attempting to open another");
return null;
}
if ((myItemInfo.MyContent.MyEntry.MyDocument.LibTitle ?? "") != "")
MessageBox.Show("WARNING: All edits made to this Library Document will be applied to all uses of the Document");
pg = new DisplayTabItem(this.components, this, myItemInfo, key); // Open a new document page
_MyDisplayTabItems.Add(key, pg);
_MyDisplayTabItems.Add(key, pg);
}
SelectedDisplayTabItem = pg;
pg.MyDSOTabPanel.EnterPanel();