Fix Delete Item Window Issues

This commit is contained in:
Rich 2014-04-10 20:13:46 +00:00
parent 1d760eab81
commit c4a31b95ab

View File

@ -661,6 +661,7 @@ namespace Volian.Controls.Library
newFocus.AdjustLocation();
}
}
private static int xOffset = 0;
public void RemoveItem()
{
//Volian.Base.Library.VlnTimer _MyTimer = new VlnTimer();
@ -669,8 +670,19 @@ namespace Volian.Controls.Library
//ShowTops("\r\n");
int TopMostYBefore = TopMostEditItem.Top;
//_MyTimer.ActiveProcess = "DeleteItem";
EditItem newFocus = DeleteItem();
if (newFocus == null) return;
Panel pnl = new Panel();
pnl.Size = new Size(10, 10);
MyStepPanel.Controls.Add(pnl);
pnl.BackColor = Color.Red;
pnl.Location = new Point(xOffset += 15, MyStepPanel.ClientSize.Height + 10);
//Console.WriteLine("'Before Debete Item',{0},'{1}','{2}',{3},,,{4},{5}", MyID, MyItemInfo.ShortPath, MyItemInfo.DisplayText, Top, MyStepPanel.VerticalScroll.Value, MyStepPanel.DisplayRectangle.Height);
EditItem newFocus = DeleteItem();
//Console.WriteLine("'After Debete Item',{0},'{1}','{2}',{3},,,{4},{5}", MyID, MyItemInfo.ShortPath, Top, MyItemInfo.DisplayText, MyStepPanel.VerticalScroll.Value, MyStepPanel.DisplayRectangle.Height);
if (newFocus == null)
{
MyStepPanel.Controls.Remove(pnl);
return;
}
//_MyTimer.ActiveProcess = "SetFocus";
newFocus.SetFocus();
//_MyTimer.ActiveProcess = "Dispose";
@ -686,6 +698,8 @@ namespace Volian.Controls.Library
//newFocus.ShowTops("");
//_MyTimer.ShowElapsedTimes("RemoveItem");
ForceEditItemRefresh(newFocus);
//MyStepPanel.Controls.Remove(pnl);
MyStepPanel.AutoScroll = true;
}
private static void ForceEditItemRefresh(EditItem newFocus)
@ -1380,6 +1394,8 @@ namespace Volian.Controls.Library
/// <param name="e"></param>
private void EditItem_Move(object sender, EventArgs e)
{
//if (MyID == 2) Volian.Base.Library.vlnStackTrace.ShowStack("Item 2", Top);
//Console.WriteLine("'EditItem_Move',{0},'{1}','{2}',{3},{4},,{5},{6}", MyID, MyItemInfo.ShortPath, MyItemInfo.DisplayText, _LastTop, Top, MyStepPanel.VerticalScroll.Value, MyStepPanel.DisplayRectangle.Height);
int newTop = Top - MyStepPanel.TopMostEditItem.Top;
if (_LastTop == newTop) return;
_LastTop = newTop;
@ -1397,7 +1413,7 @@ namespace Volian.Controls.Library
//vlnStackTrace.ScrollInStack();
return; // If 0 - Indicates scrolling which requires no action.
}
TryAgainLater = false;
if(TryAgainLater) TryAgainLater = false;
//ShowMe("Move");
if (MyItemInfo == null)
return;
@ -1714,12 +1730,34 @@ namespace Volian.Controls.Library
// it appears that setting the top doesn't always work. The logic below checks to see if it does
// not work and trys some other things so that the EditItem will be moved to the correct place.
// As a last attempt, the EditItem is added to a list to be refreshed from a timer on MyStepPanel.
//Console.WriteLine("'Adjust1',{0},'{1}','{2}',{3},{4},{5},{6},{7}", nextEditItem.MyID, nextEditItem.MyItemInfo.ShortPath,nextEditItem.MyItemInfo.DisplayText,
// oldTop, bottom, nextEditItem.Top, MyStepPanel.VerticalScroll.Value, MyStepPanel.DisplayRectangle.Height);
nextEditItem.Top = bottom;
Application.DoEvents();
//if(nextEditItem.MyID == 760)
// Console.WriteLine("'Move760',{0},'{1}','{2}',{3},{4},{5},{6},{7}", nextEditItem.MyID, nextEditItem.MyItemInfo.ShortPath, nextEditItem.MyItemInfo.DisplayText,
// oldTop, bottom, nextEditItem.Top, MyStepPanel.VerticalScroll.Value, MyStepPanel.DisplayRectangle.Height);
//Console.WriteLine("'Adjust2',{0},'{1}','{2}',{3},{4},{5},{6},{7}", nextEditItem.MyID, nextEditItem.MyItemInfo.ShortPath, nextEditItem.MyItemInfo.DisplayText,
// oldTop, bottom, nextEditItem.Top, MyStepPanel.VerticalScroll.Value, MyStepPanel.DisplayRectangle.Height);
if (nextEditItem.Top != bottom)
{
_MyLog.InfoFormat("'TryAgainLater',{0},{1},{2},{3},{4},'{5}'",
oldTop, nextEditItem.Top, bottom, MyStepPanel.Height, nextEditItem.MyID, nextEditItem.MyItemInfo.ShortPath);
nextEditItem.TryAgainLater = true;
//Console.WriteLine("'Adjust3',{0},'{1}','{2}',{3},{4},{5},{6},{7}", nextEditItem.MyID, nextEditItem.MyItemInfo.ShortPath, nextEditItem.MyItemInfo.DisplayText,
// oldTop, bottom, nextEditItem.Top, MyStepPanel.VerticalScroll.Value, MyStepPanel.DisplayRectangle.Height);
//MyStepPanel.AutoScroll = false;
nextEditItem.Top = bottom;
//Console.WriteLine("'Adjust4',{0},'{1}','{2}',{3},{4},{5},{6},{7}", nextEditItem.MyID, nextEditItem.MyItemInfo.ShortPath, nextEditItem.MyItemInfo.DisplayText,
// oldTop, bottom, nextEditItem.Top, MyStepPanel.VerticalScroll.Value, MyStepPanel.DisplayRectangle.Height);
//MyStepPanel.AutoScroll = true;
if (nextEditItem.Top != bottom)
{
_MyLog.WarnFormat("'TryAgainLater',{0},'{1}','{2}',{3},{4},{5},{6},{7}", nextEditItem.MyID, nextEditItem.MyItemInfo.ShortPath, nextEditItem.MyItemInfo.DisplayText,
oldTop, bottom, nextEditItem.Top, MyStepPanel.VerticalScroll.Value, MyStepPanel.DisplayRectangle.Height);
//Console.WriteLine("'TryAgainLater',{0},'{1}','{2}',{3},{4},{5},{6},{7}", nextEditItem.MyID, nextEditItem.MyItemInfo.ShortPath, nextEditItem.MyItemInfo.DisplayText,
// oldTop, bottom, nextEditItem.Top, MyStepPanel.VerticalScroll.Value, MyStepPanel.DisplayRectangle.Height);
//Console.WriteLine("'TryAgainLater2','OldTop',{0},'NextEditItem',{1},'bottom',{2},'Height',{3},'ID',{4},'Location','{5}'",
//oldTop, nextEditItem.Top, bottom, MyStepPanel.Height, nextEditItem.MyID, nextEditItem.MyItemInfo.ShortPath);
nextEditItem.TryAgainLater = true;
}
}
nextEditItem.LastMethodsPop();
MyStepPanel.ItemMoving--;