Esempio n. 1
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
            };

            // 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;
            this.viewLoadedParamsReference.AddExtensionMenuItem(this.linterMenuItem);
        }
Esempio n. 2
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;
        }