/// <summary> /// Adds a new child element to <see cref="ElementCollectionModel"/>. /// </summary> /// <param name="parameter"> /// Data used by the command. If the command does not require data to be passed, this object can be set to null. /// </param> /// <remarks> /// Adds a new element to the collection through <see cref="ElementCollectionViewModel.AddNewCollectionElement"/> /// and makes the new element the selected element. /// </remarks> protected override void InnerExecute(object parameter) { addedElementViewModel = ElementCollectionModel.AddNewCollectionElement(ConfigurationElementType); addedElementViewModel.PropertiesShown = true; addedElementViewModel.Select(); applicationModel.SetDirty(); }
/// <summary> /// Creates and adds a new section to the <see cref="ConfigurationSourceModel"/>. /// </summary> /// <param name="parameter"></param> /// <remarks> /// After the section has been created <see cref="CreateConfigurationSection"/>, the <see cref="SectionViewModel"/> /// may be modified during the <see cref="AfterSectionAdded"/> template method. /// </remarks> protected override void InnerExecute(object parameter) { AddedSection = configurationModel.AddSection(sectionName, CreateConfigurationSection()); AfterSectionAdded(); applicationModel.SetDirty(); OnCanExecuteChanged(); }
/// <summary> /// Executes the command to delete the element if <see cref="InnerCanExecute"/> is true. /// </summary> /// <param name="parameter">Data used by the command. If the command does not require data to be passed, this object can be set to null. /// </param> protected override void InnerExecute(object parameter) { if (InnerCanExecute(null)) { elementViewModel.Delete(); elementViewModel.Dispose(); applicationModel.SetDirty(); } }
/// <summary> /// Invoked when a property changes. /// </summary> /// <param name="propertyName"></param> protected virtual void OnPropertyChanged(string propertyName) { if (propertyName == "Value") { if (appModel != null) { appModel.SetDirty(); } } PropertyChangedEventHandler handlers = PropertyChanged; if (handlers != null) { handlers(this, new PropertyChangedEventArgs(propertyName)); } }
protected override void Arrange() { base.Arrange(); IApplicationModel applicationModel = Container.Resolve <IApplicationModel>(); applicationModel.SetDirty(); UIServiceMock.Setup(x => x.ShowWindow(It.IsAny <Window>())); UIServiceMock .Setup(x => x.ShowMessageWpf(It.IsAny <string>(), It.IsAny <string>(), System.Windows.MessageBoxButton.OKCancel)) .Returns(MessageBoxResult.OK) .Verifiable(); UIServiceMock .Setup(x => x.ShowFileDialog(It.IsAny <SaveFileDialog>())) .Returns(new FileDialogResult { FileName = "save_as.config", DialogResult = false }) .Verifiable(); }