Skip to content

Commit

Permalink
自動登録画面のアイテムドラッグを少し変更
Browse files Browse the repository at this point in the history
少しエラー抑制コードを追加してみた。
2ch_EDCB/43/578でエラーが出るとの報告ありますが、再現しないので状況不明です。
  • Loading branch information
tkntrec committed Jun 12, 2015
1 parent 2b10c8d commit 03991e0
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions EpgTimer/EpgTimer/UserCtrlView/ListBoxDragMoverView.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ public void SaveOrder_handler(object sender, ExecutedRoutedEventArgs e)
//移動関連
object cursorObj = null;
object dragItem = null;
List<object> dragItems = null;
List<object> dragItems = new List<object>();
DispatcherTimer notifyTimer = new DispatcherTimer();

public void listBoxItem_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
Expand Down Expand Up @@ -294,7 +294,7 @@ public void DragRelease()
this.OnDrag = false;
this.cursorObj = null;
this.dragItem = null;
this.dragItems = null;
this.dragItems = new List<object>();
EraseDropLine();
ClearDropLineData();
}
Expand Down Expand Up @@ -322,8 +322,8 @@ private void DrawDropLine()
{
//とりあえずインデックスで管理する。
var boxItem = this.listBox.ItemContainerGenerator.ContainerFromIndex(i) as ListBoxItem;
back_Brush.Add(boxItem.BorderBrush);
back_Thickness.Add(boxItem.BorderThickness);
back_Brush.Add(boxItem != null ? boxItem.BorderBrush : null);
back_Thickness.Add(boxItem != null ? boxItem.BorderThickness : new Thickness());
}
}

Expand All @@ -337,7 +337,8 @@ private void DrawDropLine()
}
private void EraseDropLine()
{
if (back_Brush != null)
if (back_Brush != null && 0 <= back_ListItem && back_ListItem < back_Brush.Count &&
back_ListItem < this.listBox.Items.Count)
{
var boxItem = this.listBox.ItemContainerGenerator.ContainerFromIndex(back_ListItem) as ListBoxItem;
if (boxItem == null) return;
Expand Down

0 comments on commit 03991e0

Please sign in to comment.