C2026-043-Tech-Debt_v1 - Stash 1
This commit is contained in:
@@ -13,15 +13,11 @@ namespace Volian.Controls.Library
|
||||
public event ItemInfoEvent AfterRemove;
|
||||
internal void OnAfterRemove(object sender)
|
||||
{
|
||||
if (AfterRemove != null) AfterRemove(sender);
|
||||
}
|
||||
private int _MaxItems = 10;
|
||||
public int MaxItems
|
||||
{
|
||||
get { return _MaxItems; }
|
||||
set { _MaxItems = value; }
|
||||
}
|
||||
public new MostRecentItem Add(MostRecentItem myMRI)
|
||||
AfterRemove?.Invoke(sender);
|
||||
}
|
||||
|
||||
public int MaxItems { get; set; } = 10;
|
||||
public new MostRecentItem Add(MostRecentItem myMRI)
|
||||
{
|
||||
Refresh();
|
||||
MostRecentItem tmp = null;
|
||||
@@ -53,20 +49,19 @@ namespace Volian.Controls.Library
|
||||
// when a delete item occurs.
|
||||
void MyItemInfo_BeforeDelete(object sender)
|
||||
{
|
||||
ItemInfo ii = sender as ItemInfo;
|
||||
if (ii != null)
|
||||
{
|
||||
MostRecentItem tmp = null;
|
||||
// Look for the ItemID
|
||||
foreach (MostRecentItem mri in this)
|
||||
if (mri.ItemID == ii.ItemID)
|
||||
tmp = mri;
|
||||
// If it exists - remove it
|
||||
if (tmp != null)
|
||||
Remove(tmp);
|
||||
OnAfterRemove(null);
|
||||
}
|
||||
}
|
||||
if (sender is ItemInfo ii)
|
||||
{
|
||||
MostRecentItem tmp = null;
|
||||
// Look for the ItemID
|
||||
foreach (MostRecentItem mri in this)
|
||||
if (mri.ItemID == ii.ItemID)
|
||||
tmp = mri;
|
||||
// If it exists - remove it
|
||||
if (tmp != null)
|
||||
Remove(tmp);
|
||||
OnAfterRemove(null);
|
||||
}
|
||||
}
|
||||
public MostRecentItem Add(int itemID)
|
||||
{
|
||||
ItemInfo tmp = ItemInfo.Get(itemID);
|
||||
@@ -101,9 +96,11 @@ namespace Volian.Controls.Library
|
||||
|
||||
public static MostRecentItemList GetMRILst(System.Collections.Specialized.StringCollection list, int maxItems)
|
||||
{
|
||||
MostRecentItemList mril = new MostRecentItemList();
|
||||
mril.MaxItems = maxItems;
|
||||
if (list != null)
|
||||
MostRecentItemList mril = new MostRecentItemList
|
||||
{
|
||||
MaxItems = maxItems
|
||||
};
|
||||
if (list != null)
|
||||
for (int i = list.Count - 1; i >= 0;i-- )// Add in reverse order so first is last and last is first
|
||||
mril.Add(list[i]);
|
||||
return mril;
|
||||
@@ -127,28 +124,21 @@ namespace Volian.Controls.Library
|
||||
get
|
||||
{
|
||||
if (_MyItemInfo == null)
|
||||
_MyItemInfo = ItemInfo.Get(_ItemID);
|
||||
_MyItemInfo = ItemInfo.Get(ItemID);
|
||||
return _MyItemInfo;
|
||||
}
|
||||
set
|
||||
{
|
||||
_ItemID = value.ItemID;
|
||||
ItemID = value.ItemID;
|
||||
_MyItemInfo = value;
|
||||
_MenuTitle = GetMenuTitle();
|
||||
_ToolTip = GetToolTip(_MyItemInfo);
|
||||
}
|
||||
}
|
||||
internal void Refresh()
|
||||
{
|
||||
MyItemInfo = MyItemInfo;
|
||||
}
|
||||
private int _ItemID;
|
||||
public int ItemID
|
||||
{
|
||||
get { return _ItemID; }
|
||||
set { _ItemID = value; }
|
||||
}
|
||||
private string _MenuTitle;
|
||||
internal void Refresh() => MyItemInfo = MyItemInfo;
|
||||
|
||||
public int ItemID { get; set; }
|
||||
private string _MenuTitle;
|
||||
public string MenuTitle
|
||||
{
|
||||
get
|
||||
@@ -159,11 +149,8 @@ namespace Volian.Controls.Library
|
||||
}
|
||||
set { _MenuTitle = value; }
|
||||
}
|
||||
private string GetMenuTitle()
|
||||
{
|
||||
return MyItemInfo.Path;
|
||||
}
|
||||
private string _ToolTip;
|
||||
private string GetMenuTitle() => MyItemInfo.Path;
|
||||
private string _ToolTip;
|
||||
public string ToolTip
|
||||
{
|
||||
get
|
||||
@@ -177,10 +164,9 @@ namespace Volian.Controls.Library
|
||||
private static string GetToolTip(ItemInfo item)
|
||||
{
|
||||
// reset active parent if null
|
||||
// if (MyItemInfo.MyProcedure.ActiveParent == null) MyItemInfo.MyProcedure.ActiveParent = null;
|
||||
DocVersionInfo tmp = (DocVersionInfo)(item.MyProcedure.ActiveParent);
|
||||
StringBuilder sb = new StringBuilder();
|
||||
int indent = BuildPath(tmp.MyFolder, ref sb);
|
||||
_ = BuildPath(tmp.MyFolder, ref sb); //indent
|
||||
return sb.ToString();
|
||||
}
|
||||
private static int BuildPath(FolderInfo folderInfo, ref StringBuilder sb)
|
||||
@@ -192,7 +178,7 @@ namespace Volian.Controls.Library
|
||||
}
|
||||
public override string ToString()
|
||||
{
|
||||
return string.Format("{0}~{1}~{2}", _ItemID, MenuTitle, ToolTip);
|
||||
return string.Format("{0}~{1}~{2}", ItemID, MenuTitle, ToolTip);
|
||||
}
|
||||
private static ItemInfo GetCorrectItemInfoType(int itemId)
|
||||
{
|
||||
@@ -228,9 +214,6 @@ namespace Volian.Controls.Library
|
||||
}
|
||||
return _RetainBadMRIs == 2;
|
||||
}
|
||||
public MostRecentItem(ItemInfo myItem)
|
||||
{
|
||||
MyItemInfo = myItem;
|
||||
}
|
||||
}
|
||||
public MostRecentItem(ItemInfo myItem) => MyItemInfo = myItem;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user