internal void OnRequestPresetNamePrompt(PresetsNamePromptEventArgs e) { if (RequestPresetsNamePrompt != null) { RequestPresetsNamePrompt(e); } }
internal void OnRequestPresetNamePrompt(PresetsNamePromptEventArgs e) { if (RequestPresetsNamePrompt != null) RequestPresetsNamePrompt(e); }
/// <summary> /// Present the new preset dialogue and add a new presetModel /// to the preset set on this graph /// </summary> private void ShowNewPresetStateDialogAndMakePreset(object parameter) { var selectedNodes = GetSelectedInputNodes().ToList(); //If there are NO input nodes then show the error message if (!selectedNodes.Any()) { this.OnRequestPresetWarningPrompt(); } else { //trigger the event to request the display //of the preset name dialogue var args = new PresetsNamePromptEventArgs(); this.Model.OnRequestPresetNamePrompt(args); //Select only Input nodes for preset var ids = selectedNodes.Select(x => x.GUID).ToList(); if (args.Success) { this.ExecuteCommand(new DynamoModel.AddPresetCommand(args.Name, args.Description, ids)); } //Presets created - this will enable the Restore / Delete presets RaisePropertyChanged("EnablePresetOptions"); } }
/// <summary> /// Presents the preset name dialogue. sets eventargs.Success to true if the user enters /// a preset name/timestamp and description. /// </summary> internal void ShowNewPresetDialog(PresetsNamePromptEventArgs e) { string error = ""; do { var dialog = new PresetPrompt() { DescriptionInput = { Text = e.Description }, nameView = { Text = "" }, nameBox = { Text = e.Name }, // center the prompt Owner = this, WindowStartupLocation = WindowStartupLocation.CenterOwner }; if (dialog.ShowDialog() != true) { e.Success = false; return; } if (String.IsNullOrEmpty(dialog.Text)) { //if the name is empty, then default to the current time e.Name = System.DateTime.Now.ToString(); break; } else { error = ""; } e.Name = dialog.Text; e.Description = dialog.Description; } while (!error.Equals("")); e.Success = true; }
/// <summary> /// Handles the request for the presentation of the preset name prompt /// </summary> /// <param name="e">a parameter object contains default Name and Description, /// and Success bool returned from the dialog</param> void DynamoViewModelRequestPresetNamePrompt (PresetsNamePromptEventArgs e) { ShowNewPresetDialog(e); }
/// <summary> /// Present the new preset dialogue and add a new presetModel /// to the preset set on this graph /// </summary> private void ShowNewPresetStateDialogAndMakePreset(object parameter) { //trigger the event to request the display //of the preset name dialogue var args = new PresetsNamePromptEventArgs(); this.Model.OnRequestPresetNamePrompt(args); var IDS = DynamoSelection.Instance.Selection.OfType<NodeModel>().Select(x => x.GUID).ToList(); if (args.Success) { this.ExecuteCommand(new DynamoModel.AddPresetCommand(args.Name, args.Description, IDS)); } }