/// <summary> /// Creates a new root launch group. Prompts user to save if they have changes. /// </summary> private void _New() { if (_PromptForContinueIfRootIsChanged()) { Root = new LaunchGroupViewModel(new LaunchGroup()); Settings.Default.CurrentFile = null; } }
/// <summary> /// Called when a model property is changed. Used to pass through property changed events. /// </summary> protected override void OnBasePropertyChanged(string propertyName) { if (propertyName == Property <LaunchGroup> .Name(p => p.Parent)) { Parent = new LaunchGroupViewModel(Model.Parent); } base.OnBasePropertyChanged(propertyName); }
/// <summary> /// Opens the given file as the root node. /// </summary> /// <param name = "file">The file to open.</param> private void _Open(string file) { if (File.Exists(file)) { Root = new LaunchGroupViewModel(LaunchGroup.LoadFrom(file)); Settings.Default.CurrentFile = file; } else { Root = new LaunchGroupViewModel(new LaunchGroup()); } }
/// <summary> /// Called when a property on the model is changed. /// Used to pass through property changed events and /// update the parent view model instance. /// </summary> protected override void OnBasePropertyChanged(string propertyName) { if (propertyName == Property <Launcher> .Name(p => p.Parent)) { Parent = new LaunchGroupViewModel(Model.Parent); } else if (propertyName == Property <Launcher> .Name(p => p.IsValid)) { LaunchCommand.RaiseCanExecuteChanged(); } base.OnBasePropertyChanged(propertyName); }
/// <summary> /// Initializes a new instance of the <see cref = "LauncherViewModel" /> class. /// </summary> /// <param name = "launcher">The <see cref = "Launcher" /> instance to wrap.</param> public LauncherViewModel(Launcher launcher) { Model = launcher; Parent = new LaunchGroupViewModel(Model.Parent); }