private void TargetPreFixList_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (TargetPreFixList.SelectedItem != null) { SelectedItem.Text = TargetPreFixList.SelectedItem.ToString(); } else { SelectedItem.Clear(); } }
private void DeleteBtn_Click(object sender, RoutedEventArgs e) { var text = SelectedItem.Text.Trim(); if (!string.IsNullOrEmpty(text)) { Settings.Default.TargetPreFix.Remove(text); Settings.Default.Save(); SelectedItem.Clear(); SelectedItem.Focus(); ListItem(); } }
public virtual void OnMessage(MessageEventArgs e) { switch (e.Name) { case Messages.StartLiveView: _frames = 0; _startTime = DateTime.Now; _liveViewTimer.Start(); break; case Messages.StopLiveView: _liveViewTimer.Stop(); break; case Messages.ShowMessage: MessageBox.Show(e.Param.ToString()); break; case Messages.SaveVariables: case Messages.SessionFinished: SaveVariables(e.Context.WorkFlow); break; case Messages.ThumbCreate: UpdateThumbAsync(); break; case Messages.NextPhoto: if (SelectedItem != null) { var i = FileItems.IndexOf(SelectedItem); i++; if (i < FileItems.Count) { SelectedItem = FileItems[i]; } } UpdateThumbAsync(); break; case Messages.PrevPhoto: if (SelectedItem != null) { var i = FileItems.IndexOf(SelectedItem); i--; if (i > -1) { SelectedItem = FileItems[i]; } } UpdateThumbAsync(); break; case Messages.DeletePhoto: { if (SelectedItem == null || FileItems.Count == 0) { return; } var i = FileItems.IndexOf(SelectedItem); SelectedItem.Clear(); FileItems.Remove(SelectedItem); if (i >= FileItems.Count) { i--; } if (i >= 0 && FileItems.Count > 0) { SelectedItem = FileItems[i]; } UpdateThumbAsync(); } break; case Messages.ClearPhotos: { foreach (var item in FileItems) { item.Clear(); } FileItems.Clear(); SelectedItem = null; UpdateThumbAsync(); break; } } Message?.Invoke(this, e); }