internal ViewStartupParams(DynamoViewModel dynamoVM) : base(dynamoVM.Model.AuthenticationManager.AuthProvider, dynamoVM.Model.PathManager, dynamoVM.Model.CustomNodeManager) { dynamoViewModel = dynamoVM; }
public CodeBlockEditor(NodeViewModel nodeViewModel) { InitializeComponent(); this.nodeViewModel = nodeViewModel; this.dynamoViewModel = nodeViewModel.DynamoViewModel; this.DataContext = nodeViewModel.NodeModel; this.nodeModel = nodeViewModel.NodeModel as CodeBlockNodeModel; // Register text editing events this.InnerTextEditor.TextChanged += InnerTextEditor_TextChanged; this.InnerTextEditor.TextArea.LostFocus += TextArea_LostFocus; // the code block should not be in focus upon undo/redo actions on node if (this.nodeModel.ShouldFocus) { this.Loaded += (obj, args) => this.InnerTextEditor.TextArea.Focus(); } // Register auto-completion callbacks this.InnerTextEditor.TextArea.TextEntering += OnTextAreaTextEntering; this.InnerTextEditor.TextArea.TextEntered += OnTextAreaTextEntered; InitializeSyntaxHighlighter(); }
public virtual void OnRequestAboutWindow(DynamoViewModel vm) { if (RequestAboutWindow != null) { RequestAboutWindow(vm); } }
public PackageDownloadHandle(DynamoViewModel dynamoViewModel, Greg.Responses.PackageHeader header, PackageVersion version) { this.dynamoViewModel = dynamoViewModel; this.Header = header; this.DownloadPath = ""; this.VersionName = version.version; }
public InstalledPackagesViewModel(DynamoViewModel dynamoViewModel, PackageLoader model) { this.Model = model; this.dynamoViewModel = dynamoViewModel; InitializeLocalPackages(); }
public CrashPrompt(CrashPromptArgs args, DynamoViewModel dynamoViewModel) { InitializeComponent(); productName = dynamoViewModel.BrandingResourceProvider.ProductName; Title = string.Format(Wpf.Properties.Resources.CrashPromptDialogTitle, productName); txtOverridingText.Text = string.Format(Wpf.Properties.Resources.CrashPromptDialogCrashMessage, productName); if (args.HasDetails()) { this.details = args.Details; this.CrashDetailsContent.Text = args.Details; this.btnDetails.Visibility = Visibility.Visible; } if (args.IsFilePath()) { folderPath = Path.GetDirectoryName(args.FilePath); btnOpenFolder.Visibility = Visibility.Visible; } if (args.IsDefaultTextOverridden()) { string overridingText = args.OverridingText; if (args.IsFilePath()) overridingText = overridingText.Replace("[FILEPATH]", args.FilePath); ConvertFormattedTextIntoTextblock(this.txtOverridingText, overridingText); } }
public override void Cleanup() { try { preloader = null; DynamoSelection.Instance.ClearSelection(); if (ViewModel == null) return; var shutdownParams = new DynamoViewModel.ShutdownParams( shutdownHost: false, allowCancellation: false); ViewModel.PerformShutdownSequence(shutdownParams); ViewModel.RequestUserSaveWorkflow -= RequestUserSaveWorkflow; ViewModel = null; } catch (Exception ex) { Console.WriteLine(ex.StackTrace); } base.Cleanup(); }
public GalleryViewModel(DynamoViewModel dynamoViewModel) { dvm = dynamoViewModel; var pathManager = dynamoViewModel.Model.PathManager; var galleryFilePath = pathManager.GalleryFilePath; var galleryDirectory = Path.GetDirectoryName(galleryFilePath); var version = dynamoViewModel.Model.UpdateManager.ProductVersion; DynamoVersion = string.Format(Properties.Resources.GalleryDynamoVersion, version.FileMajor, version.FileMinor, version.FileBuild); contents = GalleryContents.Load(galleryFilePath).GalleryUiContents; //Set image path relative to gallery Directory SetImagePath(galleryDirectory); currentContent = contents.FirstOrDefault(); if (currentContent != null) //if contents is not empty { currentContent.IsCurrent = true; } MoveNextCommand = new DelegateCommand(p => MoveIndex(true), o => contents.Count > 1); MovePrevCommand = new DelegateCommand(p => MoveIndex(false), o => contents.Count > 1); CloseGalleryCommand = new DelegateCommand(p => dvm.CloseGalleryCommand.Execute(null), o => true); }
protected AbstractMutator(Random rand) { this.Rand = rand; this.Controller = dynSettings.Controller; this.DynamoViewModel = Controller.DynamoViewModel; this.DynamoModel = Controller.DynamoModel; }
public AboutWindow(DynamoViewModel dynamoViewModel) { InitializeComponent(); InstallNewUpdate = false; PreviewKeyDown += new KeyEventHandler(HandleEsc); DataContext = dynamoViewModel; }
public UsageReportingAgreementPrompt(IBrandingResourceProvider resourceProvider, DynamoViewModel dynamoViewModel) { InitializeComponent(); Title = resourceProvider.GetString(Wpf.Interfaces.ResourceNames.ConsentForm.Title); ConsentFormImageRectangle.Fill = new ImageBrush( resourceProvider.GetImageSource(Wpf.Interfaces.ResourceNames.ConsentForm.Image)); viewModel = dynamoViewModel; var instrumentationFile = "InstrumentationConsent.rtf"; if (viewModel.Model.PathManager.ResolveDocumentPath(ref instrumentationFile)) InstrumentationContent.File = instrumentationFile; var googleAnalyticsFile = "GoogleAnalyticsConsent.rtf"; if (viewModel.Model.PathManager.ResolveDocumentPath(ref googleAnalyticsFile)) GoogleAnalyticsContent.File = googleAnalyticsFile; AcceptUsageReportingTextBlock.Text = string.Format(Wpf.Properties.Resources.ConsentFormInstrumentationCheckBoxContent, dynamoViewModel.BrandingResourceProvider.ProductName); AcceptUsageReportingCheck.IsChecked = UsageReportingManager.Instance.IsUsageReportingApproved; AcceptAnalyticsReportingCheck.IsChecked = UsageReportingManager.Instance.IsAnalyticsReportingApproved; }
public AboutWindow(DynamoLogger logger, DynamoViewModel model) { InitializeComponent(); this.logger = logger; this.InstallNewUpdate = false; this.PreviewKeyDown += new KeyEventHandler(HandleEsc); this.DataContext = model; }
public CrashPrompt(DynamoViewModel dynamoViewModel) { InitializeComponent(); this.CrashDetailsContent.Text = "Unknown error"; productName = dynamoViewModel.BrandingResourceProvider.ProductName; Title = string.Format(Wpf.Properties.Resources.CrashPromptDialogTitle, productName); txtOverridingText.Text = string.Format(Wpf.Properties.Resources.CrashPromptDialogCrashMessage, productName); }
public PackageManagerClientViewModel(DynamoViewModel dynamoViewModel, PackageManagerClient packageManagerClient ) { this.dynamoViewModel = dynamoViewModel; this.packageManagerClient = packageManagerClient; this.CachedPackageList = new List<PackageManagerSearchElement>(); this.packageManagerClient.RequestAuthentication += dynamoViewModel.OnRequestAuthentication; }
internal ViewStartupParams(DynamoViewModel dynamoVM) : base(dynamoVM.Model.AuthenticationManager.AuthProvider, dynamoVM.Model.PathManager, new ExtensionLibraryLoader(dynamoVM.Model), dynamoVM.Model.CustomNodeManager, dynamoVM.Model.GetType().Assembly.GetName().Version) { dynamoViewModel = dynamoVM; }
public DynamoOpenFileDialog(DynamoViewModel model) { this.model = model; _dialog = new NativeFileOpenDialog(); IFileDialogCustomize customize = (IFileDialogCustomize) _dialog; customize.AddCheckButton(RunManualCheckboxId, Dynamo.Wpf.Properties.Resources.FileDialogManualMode, model.PreferenceSettings.OpenFileInManualExecutionMode); }
public AboutWindow(DynamoViewModel dynamoViewModel) { InitializeComponent(); InstallNewUpdate = false; PreviewKeyDown += new KeyEventHandler(HandleEsc); DataContext = dynamoViewModel; Title = string.Format(Dynamo.Wpf.Properties.Resources.AboutWindowTitle,dynamoViewModel.BrandingResourceProvider.ProductName); DynamoWebsiteButton.Content = string.Format(Dynamo.Wpf.Properties.Resources.AboutWindowDynamoWebsiteButton, dynamoViewModel.BrandingResourceProvider.ProductName); }
public AboutWindow(ILogger logger, DynamoViewModel model) { InitializeComponent(); this.logger = logger; InstallNewUpdate = false; PreviewKeyDown += new KeyEventHandler(HandleEsc); DataContext = model; Dispatcher.ShutdownStarted += Dispatcher_ShutdownStarted; }
public AboutWindow(DynamoViewModel dynamoViewModel) { InitializeComponent(); InstallNewUpdate = false; PreviewKeyDown += new KeyEventHandler(HandleEsc); DataContext = dynamoViewModel; #if ENABLE_DYNAMO_SCHEDULER // SCHEDULER: Temporary way to tell that scheduler is enabled. VersionNumber.Foreground = new SolidColorBrush(Colors.Yellow); #endif }
public Watch3DViewModelStartupParams(DynamoModel model, DynamoViewModel viewModel, string name) { Model = model; Scheduler = model.Scheduler; Logger = model.Logger; Preferences = model.PreferenceSettings; EngineControllerManager = model; RenderPackageFactory = viewModel.RenderPackageFactoryViewModel.Factory; ViewModel = viewModel; RenderPackageFactoryViewModel = viewModel.RenderPackageFactoryViewModel; Name = name; }
public ParameterEditor(NodeViewModel nodeViewModel) { InitializeComponent(); this.nodeViewModel = nodeViewModel; this.dynamoViewModel = nodeViewModel.DynamoViewModel; this.DataContext = nodeViewModel.NodeModel; this.InnerTextEditor.TextArea.LostFocus += OnTextAreaLostFocus; this.InnerTextEditor.TextArea.TextEntering += OnTextAreaTextEntering; this.InnerTextEditor.TextArea.TextEntered += OnTextAreaTextEntered; InitializeSyntaxHighlighter(); }
public CodeBlockEditor(NodeViewModel nodeViewModel) { InitializeComponent(); this.nodeViewModel = nodeViewModel; this.dynamoViewModel = nodeViewModel.DynamoViewModel; this.DataContext = nodeViewModel.NodeModel; // Register text editing events this.InnerTextEditor.TextChanged += InnerTextEditor_TextChanged; this.InnerTextEditor.TextArea.LostFocus += TextArea_LostFocus; this.Loaded += (obj, args) => this.InnerTextEditor.TextArea.Focus(); InitializeSyntaxHighlighter(); }
public void Regressions(RegressionTestData testData) { Exception exception = null; try { var dynamoFilePath = testData.Arguments[0].ToString(); var revitFilePath = testData.Arguments[1].ToString(); Setup(); //ensure that the incoming arguments are not empty or null //if a dyn file is found in the regression tests directory //and there is no corresponding rfa or rvt, then an empty string //or a null will be passed into here. Assert.IsNotNullOrEmpty(dynamoFilePath, "Dynamo file path is invalid or missing."); Assert.IsNotNullOrEmpty(revitFilePath, "Revit file path is invalid or missing."); //open the revit model SwapCurrentModel(revitFilePath); //open the dyn file ViewModel.OpenCommand.Execute(dynamoFilePath); //run the expression and assert that it does not //throw an error Assert.DoesNotThrow(() => ViewModel.Model.RunExpression()); var errorNodes = ViewModel.Model.Nodes.Where( x => x.State == ElementState.Error || x.State == ElementState.Warning); Assert.AreEqual(0, errorNodes.Count()); } catch (Exception ex) { exception = ex; } finally { ViewModel.Model.ShutDown(false); ViewModel = null; Teardown(); } if (exception != null) { Assert.Fail(exception.Message); } }
public override void Cleanup() { try { ViewModel.Model.ShutDown(false, null); ViewModel = null; DynamoSelection.Instance.ClearSelection(); } catch (Exception ex) { Console.WriteLine(ex.StackTrace); } base.Cleanup(); GC.Collect(); }
public PackageViewModel(DynamoViewModel dynamoViewModel, Package model) { this.dynamoViewModel = dynamoViewModel; this.Model = model; ToggleTypesVisibleInManagerCommand = new DelegateCommand(ToggleTypesVisibleInManager, CanToggleTypesVisibleInManager); GetLatestVersionCommand = new DelegateCommand(GetLatestVersion, CanGetLatestVersion); PublishNewPackageVersionCommand = new DelegateCommand(PublishNewPackageVersion, CanPublishNewPackageVersion); PublishNewPackageCommand = new DelegateCommand(PublishNewPackage, CanPublishNewPackage); UninstallCommand = new DelegateCommand(Uninstall, CanUninstall); DeprecateCommand = new DelegateCommand(this.Deprecate, CanDeprecate); UndeprecateCommand = new DelegateCommand(this.Undeprecate, CanUndeprecate); this.dynamoViewModel.Model.NodeAdded += (node) => UninstallCommand.RaiseCanExecuteChanged(); this.dynamoViewModel.Model.NodeDeleted += (node) => UninstallCommand.RaiseCanExecuteChanged(); this.dynamoViewModel.Model.WorkspaceHidden += (ws) => UninstallCommand.RaiseCanExecuteChanged(); this.dynamoViewModel.Model.Workspaces.CollectionChanged += (sender, args) => UninstallCommand.RaiseCanExecuteChanged(); }
public HomeWorkspaceViewModel(HomeWorkspaceModel model, DynamoViewModel dynamoViewModel) : base(model, dynamoViewModel) { RunSettingsViewModel = new RunSettingsViewModel(((HomeWorkspaceModel)model).RunSettings, this, dynamoViewModel); RunSettingsViewModel.PropertyChanged += RunSettingsViewModel_PropertyChanged; StartPeriodicTimerCommand = new DelegateCommand(StartPeriodicTimer, CanStartPeriodicTimer); StopPeriodicTimerCommand = new DelegateCommand(StopPeriodicTimer, CanStopPeriodicTimer); CheckAndSetPeriodicRunCapability(); var hwm = (HomeWorkspaceModel)Model; hwm.EvaluationStarted += hwm_EvaluationStarted; hwm.EvaluationCompleted += hwm_EvaluationCompleted; hwm.SetNodeDeltaState +=hwm_SetNodeDeltaState; dynamoViewModel.Model.ShutdownStarted += Model_ShutdownStarted; }
protected void StartDynamo() { DynamoPathManager.Instance.InitializeCore( Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)); DynamoPathManager.PreloadAsmLibraries(DynamoPathManager.Instance); var model = DynamoModel.Start( new DynamoModel.StartConfiguration() { StartInTestMode = true }); this.ViewModel = DynamoViewModel.Start( new DynamoViewModel.StartConfiguration() { DynamoModel = model }); }
internal AutomationSettings(DynamoViewModel vm, string commandFilePath) { this.CommandInterval = 20; // 20ms between two consecutive commands. this.PauseAfterPlayback = 10; // 10ms after playback is done. this.ExitAfterPlayback = true; // Exit Dynamo after playback. this.CurrentMode = Mode.None; if (LoadCommandFromFile(commandFilePath)) this.CurrentMode = Mode.Playback; else { this.CurrentMode = Mode.Recording; recordedCommands = new List<DynCmd.RecordableCommand>(); } this.owningViewModel = vm; if (null == this.owningViewModel) throw new ArgumentNullException("vm"); }
public EditWindow(DynamoViewModel dynamoViewModel, bool updateSourceOnTextChange = false) { InitializeComponent(); this.dynamoViewModel = dynamoViewModel; this.WindowStartupLocation = WindowStartupLocation.CenterOwner; this.editText.Focus(); // do not accept value if user closes this.Closing += (sender, args) => this.DialogResult = false; if (false != updateSourceOnTextChange) { this.editText.TextChanged += delegate { var expr = editText.GetBindingExpression(TextBox.TextProperty); if (expr != null) expr.UpdateSource(); }; } }
/// <summary> /// The class constructor. </summary> /// <param name="header">The PackageHeader object describing the element</param> public PackageManagerSearchElement(DynamoViewModel dynamoViewModel, Greg.Responses.PackageHeader header) { this.dynamoViewModel = dynamoViewModel; this.Header = header; this.Weight = header.deprecated ? 0.1 : 1; if (header.keywords != null && header.keywords.Count > 0) { this.Keywords = String.Join(" ", header.keywords); } else { this.Keywords = ""; } this.Votes = header.votes; this.IsExpanded = false; this.DownloadLatest = new DelegateCommand((Action) Execute); this.UpvoteCommand = new DelegateCommand((Action) Upvote, CanUpvote); this.DownvoteCommand = new DelegateCommand((Action) Downvote, CanDownvote); }
protected override void ExecuteCore(DynamoViewModel dynamoViewModel) { dynamoViewModel.UndoRedoImpl(this); }
/// <summary> /// The PreferencesViewModel constructor basically initialize all the ItemsSource for the corresponding ComboBox in the View (PreferencesView.xaml) /// </summary> public PreferencesViewModel(DynamoViewModel dynamoViewModel) { this.preferenceSettings = dynamoViewModel.PreferenceSettings; this.pythonScriptEditorTextOptions = dynamoViewModel.PythonScriptEditorTextOptions; this.runPreviewEnabled = dynamoViewModel.HomeSpaceViewModel.RunSettingsViewModel.RunButtonEnabled; this.homeSpace = dynamoViewModel.HomeSpace; this.dynamoViewModel = dynamoViewModel; this.installedPackagesViewModel = new InstalledPackagesViewModel(dynamoViewModel, dynamoViewModel.PackageManagerClientViewModel.PackageManagerExtension.PackageLoader); // Scan for engines AddPythonEnginesOptions(); PythonEngineManager.Instance.AvailableEngines.CollectionChanged += PythonEnginesChanged; //Sets SelectedPythonEngine. //If the setting is empty it corresponds to the default python engine var engine = PythonEnginesList.FirstOrDefault(x => x.Equals(preferenceSettings.DefaultPythonEngine)); SelectedPythonEngine = string.IsNullOrEmpty(engine) ? Res.DefaultPythonEngineNone : preferenceSettings.DefaultPythonEngine; string languages = Wpf.Properties.Resources.PreferencesWindowLanguages; LanguagesList = new ObservableCollection <string>(languages.Split(',')); SelectedLanguage = languages.Split(',').First(); FontSizeList = new ObservableCollection <string>(); FontSizeList.Add(Wpf.Properties.Resources.ScalingSmallButton); FontSizeList.Add(Wpf.Properties.Resources.ScalingMediumButton); FontSizeList.Add(Wpf.Properties.Resources.ScalingLargeButton); FontSizeList.Add(Wpf.Properties.Resources.ScalingExtraLargeButton); SelectedFontSize = Wpf.Properties.Resources.ScalingMediumButton; NumberFormatList = new ObservableCollection <string>(); NumberFormatList.Add(Wpf.Properties.Resources.DynamoViewSettingMenuNumber0); NumberFormatList.Add(Wpf.Properties.Resources.DynamoViewSettingMenuNumber00); NumberFormatList.Add(Wpf.Properties.Resources.DynamoViewSettingMenuNumber000); NumberFormatList.Add(Wpf.Properties.Resources.DynamoViewSettingMenuNumber0000); NumberFormatList.Add(Wpf.Properties.Resources.DynamoViewSettingMenuNumber00000); SelectedNumberFormat = preferenceSettings.NumberFormat; runSettingsIsChecked = preferenceSettings.DefaultRunType; RunPreviewIsChecked = preferenceSettings.ShowRunPreview; //By Default the warning state of the Visual Settings tab (Group Styles section) will be disabled isWarningEnabled = false; StyleItemsList = LoadStyles(preferenceSettings.GroupStyleItemsList); //When pressing the "Add Style" button some controls will be shown with some values by default so later they can be populated by the user AddStyleControl = new StyleItem() { GroupName = "", HexColorString = "#" + GetRandomHexStringColor() }; //This piece of code will populate all the description text for the RadioButtons in the Geometry Scaling section. optionsGeometryScale = new GeometryScalingOptions(); UpdateGeoScaleRadioButtonSelected(dynamoViewModel.ScaleFactorLog); optionsGeometryScale.DescriptionScaleRange = new ObservableCollection <string>(); optionsGeometryScale.DescriptionScaleRange.Add(string.Format(Res.ChangeScaleFactorPromptDescriptionContent, scaleRanges[GeometryScaleSize.Small].Item2, scaleRanges[GeometryScaleSize.Small].Item3)); optionsGeometryScale.DescriptionScaleRange.Add(string.Format(Res.ChangeScaleFactorPromptDescriptionContent, scaleRanges[GeometryScaleSize.Medium].Item2, scaleRanges[GeometryScaleSize.Medium].Item3)); optionsGeometryScale.DescriptionScaleRange.Add(string.Format(Res.ChangeScaleFactorPromptDescriptionContent, scaleRanges[GeometryScaleSize.Large].Item2, scaleRanges[GeometryScaleSize.Large].Item3)); optionsGeometryScale.DescriptionScaleRange.Add(string.Format(Res.ChangeScaleFactorPromptDescriptionContent, scaleRanges[GeometryScaleSize.ExtraLarge].Item2, scaleRanges[GeometryScaleSize.ExtraLarge].Item3)); SavedChangesLabel = string.Empty; SavedChangesTooltip = string.Empty; preferencesTabs = new Dictionary <string, TabSettings>(); preferencesTabs.Add("General", new TabSettings() { Name = "General", ExpanderActive = string.Empty }); preferencesTabs.Add("Features", new TabSettings() { Name = "Features", ExpanderActive = string.Empty }); preferencesTabs.Add("VisualSettings", new TabSettings() { Name = "VisualSettings", ExpanderActive = string.Empty }); preferencesTabs.Add("Package Manager", new TabSettings() { Name = "Package Manager", ExpanderActive = string.Empty }); //create a packagePathsViewModel we'll use to interact with the package search paths list. var loadPackagesParams = new LoadPackageParams { Preferences = preferenceSettings }; var customNodeManager = dynamoViewModel.Model.CustomNodeManager; var packageLoader = dynamoViewModel.Model.GetPackageManagerExtension()?.PackageLoader; PackagePathsViewModel = new PackagePathViewModel(packageLoader, loadPackagesParams, customNodeManager); WorkspaceEvents.WorkspaceSettingsChanged += PreferencesViewModel_WorkspaceSettingsChanged; PropertyChanged += Model_PropertyChanged; }
protected override void ExecuteCore(DynamoViewModel dynamoViewModel) { dynamoViewModel.DeleteModelImpl(this); }
internal bool HandleMouseMove(object sender, Point mouseCursor) { if (this.currentState == State.Connection) { // If we are currently connecting and there is an active // connector, redraw it to match the new mouse coordinates. owningWorkspace.UpdateActiveConnector(mouseCursor); } else if (this.currentState == State.WindowSelection) { // When the mouse is held down, reposition the drag selection box. double x = Math.Min(mouseDownPos.X, mouseCursor.X); double y = Math.Min(mouseDownPos.Y, mouseCursor.Y); double width = Math.Abs(mouseDownPos.X - mouseCursor.X); double height = Math.Abs(mouseCursor.Y - mouseDownPos.Y); // We perform cross selection (i.e. select a node whenever // it touches the selection box as opposed to only select // it when it is entirely within the selection box) when // mouse moves in the opposite direction (i.e. the current // mouse position is smaller than the point mouse-down // happened). // bool isCrossSelection = mouseCursor.X < mouseDownPos.X; SelectionBoxUpdateArgs args = null; args = new SelectionBoxUpdateArgs(x, y, width, height); args.SetSelectionMode(isCrossSelection); this.owningWorkspace.RequestSelectionBoxUpdate(this, args); var rect = new Rect(x, y, width, height); var command = new DynCmd.SelectInRegionCommand(rect, isCrossSelection); DynamoViewModel dynamoViewModel = dynSettings.Controller.DynamoViewModel; dynamoViewModel.ExecuteCommand(command); } else if (this.currentState == State.DragSetup) { // There are something in the selection, but none is ILocatable. if (!DynamoSelection.Instance.Selection.Any((x) => (x is ILocatable))) { SetCurrentState(State.None); return(false); } // Record and begin the drag operation for selected nodes. var operation = DynCmd.DragSelectionCommand.Operation.BeginDrag; var command = new DynCmd.DragSelectionCommand(mouseCursor, operation); DynamoViewModel dynamoViewModel = dynSettings.Controller.DynamoViewModel; dynamoViewModel.ExecuteCommand(command); SetCurrentState(State.NodeReposition); return(true); } else if (this.currentState == State.NodeReposition) { // Update the dragged nodes (note: this isn't recorded). owningWorkspace.UpdateDraggedSelection(mouseCursor); } return(false); // Mouse event not handled. }
private static bool CustomNodeHasCollisons(string nodeName, string packageName, DynamoViewModel viewModel) { var pmExtension = viewModel.Model.GetPackageManagerExtension(); if (pmExtension is null) { return(false); } var package = pmExtension.PackageLoader.LocalPackages .Where(x => x.Name == packageName) .FirstOrDefault(); if (package is null) { return(false); } var loadedNodesWithSameName = package.LoadedCustomNodes .Where(x => x.Name == nodeName) .ToList(); if (loadedNodesWithSameName.Count == 1) { return(false); } return(true); }
private void DoGraphAutoLayout(object o) { Model.DoGraphAutoLayout(); DynamoViewModel.RaiseCanExecuteUndoRedo(); }
internal NodeAutoCompleteSearchViewModel(DynamoViewModel dynamoViewModel) : base(dynamoViewModel) { // Do nothing for now, but we may off load some time consuming operation here later }
protected override void ExecuteCore(DynamoViewModel dynamoViewModel) { dynamoViewModel.OpenFileImpl(this); }
protected override void ExecuteCore(DynamoViewModel dynamoViewModel) { dynamoViewModel.ForceRunCancelImpl(this); }
/// <summary> /// Derived classes must implement this method to perform the actual /// command execution. A typical implementation of this method involves /// calling a corresponding method on DynamoViewModel by passing itself /// as the only argument. /// </summary> /// <param name="dynamoViewModel">The DynamoViewModel object on which /// this command should be executed.</param> /// protected abstract void ExecuteCore(DynamoViewModel dynamoViewModel);
protected override void ExecuteCore(DynamoViewModel dynamoViewModel) { // A PausePlaybackCommand should never be executed. throw new NotImplementedException(); }
protected override void ExecuteCore(DynamoViewModel dynamoViewModel) { dynamoViewModel.SwitchTabImpl(this); }
protected override void ExecuteCore(DynamoViewModel dynamoViewModel) { dynamoViewModel.ConvertNodesToCodeImpl(this); }
protected override void ExecuteCore(DynamoViewModel dynamoViewModel) { dynamoViewModel.UpdateModelValueImpl(this); }
protected override void ExecuteCore(DynamoViewModel dynamoViewModel) { dynamoViewModel.SendModelEventImpl(this); }
protected override void ExecuteCore(DynamoViewModel dynamoViewModel) { dynamoViewModel.MutateTestImpl(); }
private void Paste(object param) { var point = InCanvasSearchViewModel.InCanvasSearchPosition; DynamoViewModel.Model.Paste(new Point2D(point.X, point.Y), false); DynamoViewModel.RaiseCanExecuteUndoRedo(); }
protected override void ExecuteCore(DynamoViewModel dynamoViewModel) { dynamoViewModel.CreateNoteImpl(this); }
public WorkspaceViewModel(WorkspaceModel model, DynamoViewModel dynamoViewModel) { this.DynamoViewModel = dynamoViewModel; Model = model; stateMachine = new StateMachine(this); var nodesColl = new CollectionContainer { Collection = Nodes }; _workspaceElements.Add(nodesColl); var connColl = new CollectionContainer { Collection = Connectors }; _workspaceElements.Add(connColl); var notesColl = new CollectionContainer { Collection = Notes }; _workspaceElements.Add(notesColl); var errorsColl = new CollectionContainer { Collection = Errors }; _workspaceElements.Add(errorsColl); var annotationsColl = new CollectionContainer { Collection = Annotations }; _workspaceElements.Add(annotationsColl); //respond to collection changes on the model by creating new view models //currently, view models are added for notes and nodes //connector view models are added during connection Model.NodeAdded += Model_NodeAdded; Model.NodeRemoved += Model_NodeRemoved; Model.NodesCleared += Model_NodesCleared; Model.NoteAdded += Model_NoteAdded; Model.NoteRemoved += Model_NoteRemoved; Model.NotesCleared += Model_NotesCleared; Model.AnnotationAdded += Model_AnnotationAdded; Model.AnnotationRemoved += Model_AnnotationRemoved; Model.AnnotationsCleared += Model_AnnotationsCleared; Model.ConnectorAdded += Connectors_ConnectorAdded; Model.ConnectorDeleted += Connectors_ConnectorDeleted; Model.PropertyChanged += ModelPropertyChanged; DynamoSelection.Instance.Selection.CollectionChanged += RefreshViewOnSelectionChange; DynamoViewModel.CopyCommand.CanExecuteChanged += CopyPasteChanged; DynamoViewModel.PasteCommand.CanExecuteChanged += CopyPasteChanged; // sync collections foreach (NodeModel node in Model.Nodes) { Model_NodeAdded(node); } foreach (NoteModel note in Model.Notes) { Model_NoteAdded(note); } foreach (AnnotationModel annotation in Model.Annotations) { Model_AnnotationAdded(annotation); } foreach (ConnectorModel connector in Model.Connectors) { Connectors_ConnectorAdded(connector); } InCanvasSearchViewModel = new SearchViewModel(DynamoViewModel); InCanvasSearchViewModel.Visible = true; }
/// <summary> /// Call this method to execute a RecordableCommand. A RecordableCommand /// must be executed in the context of an existing DynamoViewModel. /// </summary> /// <param name="dynamoViewModel">The DynamoViewModel object this /// RecordableCommand is targeting.</param> /// internal void Execute(DynamoViewModel dynamoViewModel) { ExecuteCore(dynamoViewModel); }
public PackageManagerClientViewModel(DynamoViewModel dynamoViewModel, PackageManagerClient model) { this.dynamoViewModel = dynamoViewModel; this.Model = model; this.CachedPackageList = new List <PackageManagerSearchElement>(); }
protected override void ExecuteCore(DynamoViewModel dynamoViewModel) { dynamoViewModel.DragSelectionImpl(this); }
/// <summary> /// The PreferencesViewModel constructor basically initialize all the ItemsSource for the corresponding ComboBox in the View (PreferencesView.xaml) /// </summary> public PreferencesViewModel(DynamoViewModel dynamoViewModel) { this.preferenceSettings = dynamoViewModel.PreferenceSettings; this.pythonScriptEditorTextOptions = dynamoViewModel.PythonScriptEditorTextOptions; this.runPreviewEnabled = dynamoViewModel.HomeSpaceViewModel.RunSettingsViewModel.RunButtonEnabled; this.homeSpace = dynamoViewModel.HomeSpace; this.dynamoViewModel = dynamoViewModel; PythonEnginesList = new ObservableCollection <string>(); PythonEnginesList.Add(Wpf.Properties.Resources.DefaultPythonEngineNone); AddPythonEnginesOptions(); SelectedPythonEngine = preferenceSettings.DefaultPythonEngine; string languages = Wpf.Properties.Resources.PreferencesWindowLanguages; LanguagesList = new ObservableCollection <string>(languages.Split(',')); SelectedLanguage = languages.Split(',').First(); FontSizeList = new ObservableCollection <string>(); FontSizeList.Add(Wpf.Properties.Resources.ScalingSmallButton); FontSizeList.Add(Wpf.Properties.Resources.ScalingMediumButton); FontSizeList.Add(Wpf.Properties.Resources.ScalingLargeButton); FontSizeList.Add(Wpf.Properties.Resources.ScalingExtraLargeButton); SelectedFontSize = Wpf.Properties.Resources.ScalingMediumButton; NumberFormatList = new ObservableCollection <string>(); NumberFormatList.Add(Wpf.Properties.Resources.DynamoViewSettingMenuNumber0); NumberFormatList.Add(Wpf.Properties.Resources.DynamoViewSettingMenuNumber00); NumberFormatList.Add(Wpf.Properties.Resources.DynamoViewSettingMenuNumber000); NumberFormatList.Add(Wpf.Properties.Resources.DynamoViewSettingMenuNumber0000); NumberFormatList.Add(Wpf.Properties.Resources.DynamoViewSettingMenuNumber00000); SelectedNumberFormat = preferenceSettings.NumberFormat; runSettingsIsChecked = preferenceSettings.DefaultRunType; //By Default the warning state of the Visual Settings tab (Group Styles section) will be disabled isWarningEnabled = false; StyleItemsList = new ObservableCollection <StyleItem>(); //When pressing the "Add Style" button some controls will be shown with some values by default so later they can be populated by the user AddStyleControl = new StyleItem() { GroupName = "", HexColorString = "#" + GetRandomHexStringColor() }; //This piece of code will populate all the description text for the RadioButtons in the Geometry Scaling section. optionsGeometryScal = new GeometryScalingOptions(); //This will set the default option for the Geometry Scaling Radio Buttons, the value is comming from the DynamoViewModel optionsGeometryScal.EnumProperty = (GeometryScaleSize)GeometryScalingOptions.ConvertScaleFactorToUI(dynamoViewModel.ScaleFactorLog); optionsGeometryScal.DescriptionScaleRange = new ObservableCollection <string>(); optionsGeometryScal.DescriptionScaleRange.Add(string.Format(Res.ChangeScaleFactorPromptDescriptionContent, scaleRanges[GeometryScaleSize.Small].Item2, scaleRanges[GeometryScaleSize.Small].Item3)); optionsGeometryScal.DescriptionScaleRange.Add(string.Format(Res.ChangeScaleFactorPromptDescriptionContent, scaleRanges[GeometryScaleSize.Medium].Item2, scaleRanges[GeometryScaleSize.Medium].Item3)); optionsGeometryScal.DescriptionScaleRange.Add(string.Format(Res.ChangeScaleFactorPromptDescriptionContent, scaleRanges[GeometryScaleSize.Large].Item2, scaleRanges[GeometryScaleSize.Large].Item3)); optionsGeometryScal.DescriptionScaleRange.Add(string.Format(Res.ChangeScaleFactorPromptDescriptionContent, scaleRanges[GeometryScaleSize.ExtraLarge].Item2, scaleRanges[GeometryScaleSize.ExtraLarge].Item3)); SavedChangesLabel = string.Empty; SavedChangesTooltip = string.Empty; this.PropertyChanged += model_PropertyChanged; }
protected override void ExecuteCore(DynamoViewModel dynamoViewModel) { dynamoViewModel.MakeConnectionImpl(this); }
public WorkspaceViewModel(WorkspaceModel model, DynamoViewModel dynamoViewModel) { this.DynamoViewModel = dynamoViewModel; this.DynamoViewModel.PropertyChanged += DynamoViewModel_PropertyChanged; Model = model; stateMachine = new StateMachine(this); var nodesColl = new CollectionContainer { Collection = Nodes }; _workspaceElements.Add(nodesColl); var connColl = new CollectionContainer { Collection = Connectors }; _workspaceElements.Add(connColl); var notesColl = new CollectionContainer { Collection = Notes }; _workspaceElements.Add(notesColl); var errorsColl = new CollectionContainer { Collection = Errors }; _workspaceElements.Add(errorsColl); var annotationsColl = new CollectionContainer { Collection = Annotations }; _workspaceElements.Add(annotationsColl); //respond to collection changes on the model by creating new view models //currently, view models are added for notes and nodes //connector view models are added during connection Model.NodeAdded += Model_NodeAdded; Model.NodeRemoved += Model_NodeRemoved; Model.NodesCleared += Model_NodesCleared; Model.Notes.CollectionChanged += Notes_CollectionChanged; Model.Annotations.CollectionChanged += Annotations_CollectionChanged; Model.ConnectorAdded += Connectors_ConnectorAdded; Model.ConnectorDeleted += Connectors_ConnectorDeleted; Model.PropertyChanged += ModelPropertyChanged; DynamoSelection.Instance.Selection.CollectionChanged += (sender, e) => RefreshViewOnSelectionChange(); // sync collections foreach (NodeModel node in Model.Nodes) { Model_NodeAdded(node); } Notes_CollectionChanged(null, new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Add, Model.Notes)); Annotations_CollectionChanged(null, new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Add, Model.Annotations)); foreach (var c in Model.Connectors) { Connectors_ConnectorAdded(c); } InCanvasSearchViewModel = new SearchViewModel(DynamoViewModel); InCanvasSearchViewModel.Visible = true; }
internal NodeAutoCompleteSearchViewModel(DynamoViewModel dynamoViewModel) : base(dynamoViewModel) { // Off load some time consuming operation here InitializeDefaultAutoCompleteCandidates(); }