private void AddClick(object sender, RoutedEventArgs e) { if (EditWindow.Add(this)) { Refresh(); } }
// ---------------------------------------------------------------------- public static bool Add(Window parent) { var window = new EditWindow(); window.Owner = parent; window.Title = "Add..."; window.NameText.Text = ""; window.DescriptionText.Text = ""; window.NameText.Focus(); window.item = null; return(window.ShowDialog() == true); }
private void EditClick(object sender, RoutedEventArgs e) { var item = ListView.SelectedItem; if (item != null) { var id = (item as Game).Id; var editing = connection.Query <Game>(id).FirstOrDefault(); var details = connection.Query <HistoryGame>(v => v.GameId == editing.Id); if (EditWindow.Edit(this, editing, details)) { Refresh(); } } }
public static bool Edit(Window parent, Game item, IEnumerable <HistoryGame> details) { var window = new EditWindow(); window.Owner = parent; window.Title = "Edit..."; window.NameText.Text = item.Name; window.DescriptionText.Text = item.Description; foreach (var row in details) { window.SaveListBox.Items.Add(row.Timestamp.ToString("yyyy/MM/dd HH:mm:ss")); } window.NameText.Focus(); window.item = item; return(window.ShowDialog() == true); }