Fixed ItemSelected so that Comment works properly.
Added code back in so that Word displays properly. Allow the same document to be opened after Word hang
This commit is contained in:
parent
52a735e08c
commit
3c79833edf
@ -112,15 +112,43 @@ namespace VEPROMS.CSLA.Library
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
private bool _Created = false;
|
||||||
|
private int _Unique = 0;
|
||||||
|
private string Unique
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
string retval = "";
|
||||||
|
if (_Unique != 0) retval = "_" + _Unique.ToString();
|
||||||
|
_Unique++;
|
||||||
|
return retval;
|
||||||
|
}
|
||||||
|
}
|
||||||
private void CreateFile()
|
private void CreateFile()
|
||||||
{
|
{
|
||||||
if (_MyDocument == null) return;
|
while (!_Created)
|
||||||
_MyFile = new FileInfo(string.Format(@"{0}\tmp_{1}." + Extension , TemporaryFolder, MyDocument.DocID));
|
CreateTemporaryFile();
|
||||||
FileStream fs = _MyFile.Create();
|
}
|
||||||
fs.Write(MyDocument.DocContent, 0, MyDocument.DocContent.Length);
|
|
||||||
fs.Close();
|
private void CreateTemporaryFile()
|
||||||
_MyFile.CreationTime = _MyDocument.DTS;
|
{
|
||||||
_MyFile.LastWriteTime = _MyDocument.DTS;
|
try
|
||||||
|
{
|
||||||
|
if (_MyDocument != null)
|
||||||
|
{
|
||||||
|
_MyFile = new FileInfo(string.Format(@"{0}\tmp_{1}{2}.{3}", TemporaryFolder, MyDocument.DocID, Unique, Extension));
|
||||||
|
FileStream fs = _MyFile.Create();
|
||||||
|
fs.Write(MyDocument.DocContent, 0, MyDocument.DocContent.Length);
|
||||||
|
fs.Close();
|
||||||
|
_MyFile.CreationTime = _MyDocument.DTS;
|
||||||
|
_MyFile.LastWriteTime = _MyDocument.DTS;
|
||||||
|
_Created = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Console.WriteLine(ex.Message);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
public void SaveFile()
|
public void SaveFile()
|
||||||
{
|
{
|
||||||
|
@ -30,6 +30,7 @@ namespace Volian.Controls.Library
|
|||||||
get { return _TabItem; }
|
get { return _TabItem; }
|
||||||
set { _TabItem = value; }
|
set { _TabItem = value; }
|
||||||
}
|
}
|
||||||
|
//private frmPG _frm = null;
|
||||||
public DSOTabPanel(DocumentInfo documentInfo, DisplayTabControl myTabControl)
|
public DSOTabPanel(DocumentInfo documentInfo, DisplayTabControl myTabControl)
|
||||||
{
|
{
|
||||||
_MyTabControl = myTabControl;
|
_MyTabControl = myTabControl;
|
||||||
@ -37,6 +38,8 @@ namespace Volian.Controls.Library
|
|||||||
SetupDSOTabPanel();
|
SetupDSOTabPanel();
|
||||||
_MyDocument = documentInfo;
|
_MyDocument = documentInfo;
|
||||||
SetupDSO();
|
SetupDSO();
|
||||||
|
//_frm = new frmPG(_MyDSOFramer);
|
||||||
|
//_frm.Show();
|
||||||
}
|
}
|
||||||
private void SetupDSOTabPanel()
|
private void SetupDSOTabPanel()
|
||||||
{
|
{
|
||||||
@ -98,15 +101,15 @@ namespace Volian.Controls.Library
|
|||||||
}
|
}
|
||||||
void DSOTabPanel_Enter(object sender, EventArgs e)
|
void DSOTabPanel_Enter(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
//try
|
try
|
||||||
//{
|
{
|
||||||
// _MyDSOFramer.EventsEnabled = true;
|
_MyDSOFramer.EventsEnabled = true;
|
||||||
// _MyDSOFramer.FrameHookPolicy = DSOFramer.dsoFrameHookPolicy.dsoResetNow;
|
_MyDSOFramer.FrameHookPolicy = DSOFramer.dsoFrameHookPolicy.dsoResetNow;
|
||||||
//}
|
}
|
||||||
//catch (Exception ex)
|
catch (Exception ex)
|
||||||
//{
|
{
|
||||||
// if (_MyLog.IsErrorEnabled) _MyLog.ErrorFormat("DSOTabPage_Enter", ex);
|
if (_MyLog.IsErrorEnabled) _MyLog.ErrorFormat("DSOTabPage_Enter", ex);
|
||||||
//}
|
}
|
||||||
_MyTabControl.OnItemSelectedChanged(this, null);
|
_MyTabControl.OnItemSelectedChanged(this, null);
|
||||||
_MyDSOFramer.Focus();
|
_MyDSOFramer.Focus();
|
||||||
}
|
}
|
||||||
|
@ -431,7 +431,10 @@ namespace Volian.Controls.Library
|
|||||||
_DisplayRTB.Top = 3;
|
_DisplayRTB.Top = 3;
|
||||||
this.Paint += new PaintEventHandler(vlnCSLARTB_Paint);
|
this.Paint += new PaintEventHandler(vlnCSLARTB_Paint);
|
||||||
this.BackColorChanged += new EventHandler(vlnCSLARTB_BackColorChanged);
|
this.BackColorChanged += new EventHandler(vlnCSLARTB_BackColorChanged);
|
||||||
_DisplayRTB.Enter += new EventHandler(_DisplayRTB_Enter);
|
//_DisplayRTB.Enter += new EventHandler(_DisplayRTB_Enter);
|
||||||
|
//_DisplayRTB.Leave += new EventHandler(_DisplayRTB_Leave);
|
||||||
|
_DisplayRTB.GotFocus += new EventHandler(_DisplayRTB_GotFocus);
|
||||||
|
_DisplayRTB.LostFocus += new EventHandler(_DisplayRTB_LostFocus);
|
||||||
_DisplayRTB.MouseClick += new MouseEventHandler(_DisplayRTB_MouseClick);
|
_DisplayRTB.MouseClick += new MouseEventHandler(_DisplayRTB_MouseClick);
|
||||||
if (item != null)
|
if (item != null)
|
||||||
{
|
{
|
||||||
@ -533,11 +536,26 @@ namespace Volian.Controls.Library
|
|||||||
{
|
{
|
||||||
_DisplayRTB.Select();
|
_DisplayRTB.Select();
|
||||||
}
|
}
|
||||||
void _DisplayRTB_Enter(object sender, EventArgs e)
|
//void _DisplayRTB_Enter(object sender, EventArgs e)
|
||||||
|
//{
|
||||||
|
// _Panel._ItemSelected = _MyItem;
|
||||||
|
// _Panel.OnItemSelectedChanged(sender, new DisplayPanelEventArgs(this, null));
|
||||||
|
//}
|
||||||
|
void _DisplayRTB_LostFocus(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
_Panel._ItemSelected = null;
|
||||||
|
_Panel.OnItemSelectedChanged(sender, null);
|
||||||
|
}
|
||||||
|
void _DisplayRTB_GotFocus(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
_Panel._ItemSelected = _MyItem;
|
_Panel._ItemSelected = _MyItem;
|
||||||
_Panel.OnItemSelectedChanged(sender, new DisplayPanelEventArgs(this, null));
|
_Panel.OnItemSelectedChanged(sender, new DisplayPanelEventArgs(this, null));
|
||||||
}
|
}
|
||||||
|
//void _DisplayRTB_Leave(object sender, EventArgs e)
|
||||||
|
//{
|
||||||
|
// _Panel._ItemSelected = null;
|
||||||
|
// _Panel.OnItemSelectedChanged(sender, null);
|
||||||
|
//}
|
||||||
public void AutoExpand()
|
public void AutoExpand()
|
||||||
{
|
{
|
||||||
Expand(_Type >= 20000);
|
Expand(_Type >= 20000);
|
||||||
@ -573,6 +591,9 @@ namespace Volian.Controls.Library
|
|||||||
public void ItemShow()
|
public void ItemShow()
|
||||||
{
|
{
|
||||||
_DisplayRTB.Focus();
|
_DisplayRTB.Focus();
|
||||||
|
int scrollValue = _Panel.VerticalScroll.Value + (Top - (_Panel.Height / 2)); // calculate scroll center for the item
|
||||||
|
if(scrollValue > _Panel.VerticalScroll.Minimum && scrollValue <= _Panel.VerticalScroll.Maximum) // If it isn't within range
|
||||||
|
_Panel.VerticalScroll.Value = scrollValue; // Center the item
|
||||||
}
|
}
|
||||||
private void vlnCSLARTB_Paint(object sender, PaintEventArgs e)
|
private void vlnCSLARTB_Paint(object sender, PaintEventArgs e)
|
||||||
{
|
{
|
||||||
|
@ -156,16 +156,28 @@ namespace Volian.Controls.Library
|
|||||||
ExpandAsNeeded(item);
|
ExpandAsNeeded(item);
|
||||||
ItemLookup[id].ItemSelect();
|
ItemLookup[id].ItemSelect();
|
||||||
}
|
}
|
||||||
|
private ItemInfo _LastItemSelected;
|
||||||
|
internal ItemInfo LastItemSelected
|
||||||
|
{
|
||||||
|
get { return _LastItemSelected; }
|
||||||
|
}
|
||||||
internal ItemInfo _ItemSelected;
|
internal ItemInfo _ItemSelected;
|
||||||
public ItemInfo ItemSelected
|
public ItemInfo ItemSelected
|
||||||
{
|
{
|
||||||
get { return _ItemSelected; }
|
get { return _ItemSelected; }
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
|
_ItemSelected = value;
|
||||||
|
if (value == null)
|
||||||
|
{
|
||||||
|
OnItemSelectedChanged(this, null);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
_LastItemSelected = value;
|
||||||
int id = value.ItemID;
|
int id = value.ItemID;
|
||||||
ExpandAsNeeded(value);
|
ExpandAsNeeded(value);
|
||||||
_ItemSelected = value;
|
|
||||||
ItemLookup[id].ItemSelect();
|
ItemLookup[id].ItemSelect();
|
||||||
|
OnItemSelectedChanged(this, new DisplayPanelEventArgs(ItemLookup[id], null));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public DisplayItem DisplayItemSelected
|
public DisplayItem DisplayItemSelected
|
||||||
@ -174,8 +186,8 @@ namespace Volian.Controls.Library
|
|||||||
}
|
}
|
||||||
public void ItemShow()
|
public void ItemShow()
|
||||||
{
|
{
|
||||||
if (_ItemSelected != null)
|
if (_LastItemSelected != null)
|
||||||
ItemLookup[_ItemSelected.ItemID].ItemShow();
|
ItemLookup[_LastItemSelected.ItemID].ItemShow();
|
||||||
}
|
}
|
||||||
private int _Scrolling = 0; // Volian Property Snippet
|
private int _Scrolling = 0; // Volian Property Snippet
|
||||||
public int Scrolling
|
public int Scrolling
|
||||||
|
@ -63,7 +63,8 @@ namespace Volian.Controls.Library
|
|||||||
}
|
}
|
||||||
void DisplayTabPanel_Enter(object sender, EventArgs e)
|
void DisplayTabPanel_Enter(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (ItemSelected != null) _MyPanel.ItemShow();
|
//if (ItemSelected != null)
|
||||||
|
_MyPanel.ItemShow();
|
||||||
}
|
}
|
||||||
private void SetupDisplayPanel()
|
private void SetupDisplayPanel()
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user