コード例 #1
0
        public static async Task <bool> ShowEditGameDialog(this MetroWindow window, GameStats game)
        {
            if (game == null)
            {
                return(false);
            }
            var dialog = new AddGameDialog(game);
            await window.ShowMetroDialogAsync(dialog, new MetroDialogSettings { AffirmativeButtonText = "save", NegativeButtonText = "cancel" });

            var result = await dialog.WaitForButtonPressAsync();

            await window.HideMetroDialogAsync(dialog);

            if (result == null)
            {
                return(false);
            }
            DeckStatsList.Save();
            Core.MainWindow.DeckPickerList.UpdateDecks();
            return(true);
        }
コード例 #2
0
        public static async Task <bool> ShowAddGameDialog(this MetroWindow window, Deck deck)
        {
            if (deck == null)
            {
                return(false);
            }
            var dialog = new AddGameDialog(deck);
            await window.ShowMetroDialogAsync(dialog, new MetroDialogSettings { AffirmativeButtonText = "save", NegativeButtonText = "cancel" });

            var game = await dialog.WaitForButtonPressAsync();

            await window.HideMetroDialogAsync(dialog);

            if (game == null)
            {
                return(false);
            }
            deck.DeckStats.AddGameResult(game);
            DeckStatsList.Save();
            Core.MainWindow.DeckPickerList.UpdateDecks(forceUpdate: new[] { deck });
            return(true);
        }