private void AddClick(object sender, RoutedEventArgs e)
 {
     if (EditWindow.Add(this))
     {
         Refresh();
     }
 }
Пример #2
0
        // ----------------------------------------------------------------------

        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 collection = liteDb.GetCollection <Game>("Games");
                var editing    = collection.FindOne(x => x.Id == id);
                if (EditWindow.Edit(this, editing))
                {
                    Refresh();
                }
            }
        }
Пример #4
0
        public static bool Edit(Window parent, Game item)
        {
            var window = new EditWindow();

            window.Owner                = parent;
            window.Title                = "Edit...";
            window.NameText.Text        = item.Name;
            window.DescriptionText.Text = item.Description;
            foreach (var row in item.TimestampList)
            {
                window.SaveListBox.Items.Add(row.ToString("yyyy/MM/dd HH:mm:ss"));
            }
            window.NameText.Focus();
            window.item = item;
            return(window.ShowDialog() == true);
        }