示例#1
0
        private void SelectionChanged(GenreVM genrevm)
        {
            if (SelectedGenre == null) return;
            if (ShowCancel == "Visible") CancelUpdateGenre(this);
            _oldGenre = SelectedGenre.Copy();

            genrevm.ShowEdit = "Visible";
            genrevm.ShowCancel = "Hidden";
            genrevm.ShowSave = "Hidden";
            Enabled = false;
        }
示例#2
0
        private void SaveUpdateGenre(GenreVM genrevm)
        {
            if (!SelectedGenre.IsValid())
                return;
            // Save Changes
            if (_oldGenre == null)
            {
                // Insert into db
                SelectedGenre.ID = Genre.AddGenre(SelectedGenre);
            }
            else
            {
                // Update db
                Genre.UpdateGenre(SelectedGenre);
            }

            // Update GUI
            genrevm.ShowEdit = "Visible";
            genrevm.ShowCancel = "Hidden";
            genrevm.ShowSave = "Hidden";
            Enabled = false;
        }
示例#3
0
 private void EditGenre(GenreVM genrevm)
 {
     genrevm.ShowEdit = "Hidden";
     genrevm.ShowCancel = "Visible";
     genrevm.ShowSave = "Visible";
     genrevm.Enabled = true;
 }
示例#4
0
        private void DeleteGenre(GenreVM genrevm)
        {
            if (SelectedGenre == null) return;

            Genre.DeleteGenre(SelectedGenre);

            SelectedGenre = new Genre();
            Enabled = true;
            ShowEdit = "Hidden";
            ShowCancel = "Hidden";
            ShowSave = "Visible";
        }
示例#5
0
        private void CancelUpdateGenre(GenreVM genrevm)
        {
            // Reset person
            _changeNotify = false;
            SelectedGenre = _oldGenre;

            genrevm.ShowEdit = "Visible";
            genrevm.ShowCancel = "Hidden";
            genrevm.ShowSave = "Hidden";
            Enabled = false;
        }
示例#6
0
 private void AddGenre(GenreVM genrevm)
 {
     SelectedGenre = new Genre();
     _oldGenre = null;
     genrevm.ShowEdit = "Hidden";
     genrevm.ShowCancel = "Visible";
     genrevm.ShowSave = "Visible";
     genrevm.Enabled = true;
 }