コード例 #1
0
 private void OpenEditWindow()
 {
     AnimeEditWindow win = new AnimeEditWindow(anime, parent.DBModel);
     window.DialogResult = false;
     parent.Message = "Switched to editing mode.";
     win.ShowDialog();
 }
コード例 #2
0
ファイル: MainWindowVM.cs プロジェクト: mcgamer0070/AniMoCity
        private void createCommands()
        {
            //View Interaction logic
            LogOut = new RelayCommand<object>(o => { openLogIn(); });
            Filter = new RelayCommand<object>(openFilter);
            ListWin = new RelayCommand<object>(o => { openNewList(); });
            RangeWin = new RelayCommand<object>(o => { openRangeFilter(); });


            //Other logics
            Search = new RelayCommand<object>(search);
            SelectedAnimeChanged = new RelayCommand<object>(theSelectedAnimeChanged);
            ListPosChanged = new RelayCommand<object>(updateSelectedIndexList);
            DeleteList = new RelayCommand<object>(o => { removeList(); }, o => true);
            RemoveAnime = new RelayCommand<object>(o => { removeAnime(); });
            AnimeDetails = new RelayCommand<object>(o => { openAnimeDetails(); });

            AddAnimeCommand = new RelayCommand<object>(o =>
            {
                int newId = dbModel.a_animes.Max(x => x.a_id) + 1;
                a_animes newAnime = new a_animes()
                {
                    a_id = newId,
                    a_title = "Default",
                    a_image = "",
                    a_type = "NO",
                    a_summary = "Default"
                };

                dbModel.a_animes.Add(newAnime);
                message = "The anime was added.";
                dbModel.SaveChanges();
                AnimeEditWindow vim = new AnimeEditWindow(db: dbModel, animeToChange: newAnime, newAnime: true);
                vim.ShowDialog();
            });
        }