/// <summary> /// /// </summary> private void FillCategories() { IGlobal global = _patch.PcgRoot.Global; if (global == null) { Model.Common.Synth.MemoryAndFactory.IPcgMemory masterPcgMemory = MasterFiles.MasterFiles.Instances.FindMasterPcg(_patch.Root.Model); if (masterPcgMemory == null) { // Only number is shown, therefore disable it labelCategory.IsEnabled = false; comboBoxCategory.Items.Add(_patch.CategoryAsName); comboBoxCategory.SelectedIndex = 0; comboBoxCategory.IsEnabled = false; labelSubCategory.IsEnabled = false; if (_patch.PcgRoot.HasSubCategories) { // Only number is shown, therefore disable it comboBoxSubCategory.Items.Add(_patch.SubCategoryAsName); comboBoxSubCategory.SelectedIndex = 0; comboBoxSubCategory.IsEnabled = false; } } else { IGlobal masterGlobal = masterPcgMemory.Global; FillCategoryComboboxes(masterGlobal); } } else { if (_patch.PcgRoot.AreCategoriesEditable) { FillCategoryComboboxes(global); } else { labelCategory.Visibility = Visibility.Hidden; comboBoxCategory.Visibility = Visibility.Hidden; labelSubCategory.Visibility = Visibility.Hidden; comboBoxSubCategory.Visibility = Visibility.Hidden; } } }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void ComboBoxCategorySelectionChanged(object sender, SelectionChangedEventArgs e) { if (_patch.PcgRoot.HasSubCategories) { if (_patch.PcgRoot.Global == null) { Model.Common.Synth.MemoryAndFactory.IPcgMemory masterPcgMemory = MasterFiles.MasterFiles.Instances.FindMasterPcg(_patch.Root.Model); if (masterPcgMemory != null) { IGlobal masterGlobal = masterPcgMemory.Global; FillSubcategoryCombobox(masterGlobal); } } else { FillSubcategoryCombobox(_patch.PcgRoot.Global); } } }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void ButtonOkClick(object sender, RoutedEventArgs e) { if (_ok) { // Set name. _patch.Name = textBoxName.Text; // Set category. Model.Common.Synth.MemoryAndFactory.IPcgMemory memory = _patch.PcgRoot; if ((memory.AreCategoriesEditable) && (comboBoxCategory.IsEnabled)) { IParameter param = _patch.GetParam(ParameterNames.CombiParameterName.Category); if (param != null) { param.Value = comboBoxCategory.SelectedIndex; if (_patch.PcgRoot.HasSubCategories) { _patch.GetParam(ParameterNames.CombiParameterName.SubCategory).Value = comboBoxSubCategory.SelectedIndex; } } } // Set favorite. if (threeStateCheckBoxIsFavorite.IsVisible && memory.AreFavoritesSupported) { _patch.GetParam(ParameterNames.CombiParameterName.Favorite).Value = threeStateCheckBoxIsFavorite.IsChecked; } _patch.Update("ContentChanged"); } DialogResult = true; Close(); }
/// <summary> /// /// </summary> private void ReassignClearProgram() { Model.Common.Synth.MemoryAndFactory.IPcgMemory root = Combi.PcgRoot; Model.Common.Synth.Meta.IPatch assignedClearProgram = root.AssignedClearProgram ?? root.ProgramBanks[0][0]; AssignedClearProgram = $"{assignedClearProgram.Id} {assignedClearProgram.Name}"; }