public override void Loaded(ViewLoadedParams viewLoadedParams)
        {
            DependencyView = new WorkspaceDependencyView(this, viewLoadedParams);
            // when a package is loaded update the DependencyView
            // as we may have installed a missing package.

            pmExtension.PackageLoader.PackgeLoaded += (package) =>
            {
                DependencyView.DependencyRegen(viewLoadedParams.CurrentWorkspaceModel as WorkspaceModel);
            };

            // Adding a button in view menu to refresh and show manually
            workspaceReferencesMenuItem = new MenuItem {
                Header = Resources.MenuItemString, IsCheckable = true, IsChecked = false
            };
            workspaceReferencesMenuItem.Click += (sender, args) =>
            {
                if (workspaceReferencesMenuItem.IsChecked)
                {
                    // Refresh dependency data
                    DependencyView.DependencyRegen(viewLoadedParams.CurrentWorkspaceModel as WorkspaceModel);
                    viewLoadedParams.AddToExtensionsSideBar(this, DependencyView);
                    workspaceReferencesMenuItem.IsChecked = true;
                }
                else
                {
                    viewLoadedParams.CloseExtensioninInSideBar(this);
                    workspaceReferencesMenuItem.IsChecked = false;
                }
            };
            viewLoadedParams.AddExtensionMenuItem(workspaceReferencesMenuItem);
        }
Example #2
0
 private void OnLinterManagerPropertyChange(object sender, System.ComponentModel.PropertyChangedEventArgs e)
 {
     if (e.PropertyName == nameof(linterManager.AvailableLinters))
     {
         viewLoadedParamsReference.AddExtensionMenuItem(this.linterMenuItem);
     }
 }
Example #3
0
        public override void Loaded(ViewLoadedParams viewLoadedParams)
        {
            this.linterManager             = (viewLoadedParams.DynamoWindow.DataContext as DynamoViewModel).Model.LinterManager;
            this.viewLoadedParamsReference = viewLoadedParams;
            this.linterViewModel           = new LinterViewModel(linterManager, viewLoadedParamsReference);
            this.linterView = new LinterView()
            {
                DataContext = linterViewModel
            };
            viewLoadedParams.ViewExtensionOpenRequest += OnViewExtensionOpenRequest;

            // Add a button to Dynamo View menu to manually show the window
            this.linterMenuItem = new MenuItem {
                Header = Resources.MenuItemText, IsCheckable = true
            };
            this.linterMenuItem.Checked   += MenuItemCheckHandler;
            this.linterMenuItem.Unchecked += MenuItemUnCheckedHandler;
            if (linterManager.AvailableLinters.Count > 1)
            {
                viewLoadedParamsReference.AddExtensionMenuItem(this.linterMenuItem);
            }

            this.linterManager.PropertyChanged += OnLinterManagerPropertyChange;
        }