コード例 #1
0
        public void Loaded(ViewLoadedParams p)
        {
            DisposeWindow = false;
            var mainViewModel = new GitHubForDynamoWPF.ViewModels.MainViewModel(p, p.DynamoWindow, UniqueId, Name);

            gitHubWindow = new GitHubForDynamoWPF.Views.MainView(mainViewModel)
            {
                Title       = this.Name,
                Owner       = p.DynamoWindow,
                DataContext = mainViewModel
            };

            // When closing, actually hide the window so it is kept on the background
            gitHubWindow.Closing += (sender, args) =>
            {
                if (!DisposeWindow)
                {
                    args.Cancel = true;
                    (sender as Window).Hide();
                }
            };

            gitHubMenuItem = new MenuItem
            {
                Header = this.Name
            };

            gitHubMenuItem.Click += (sender, args) =>
            {
                gitHubWindow.Show();
            };

            p.AddSeparator(MenuBarType.Packages, new Separator());
            p.AddMenuItem(MenuBarType.Packages, gitHubMenuItem);
        }
コード例 #2
0
        public void DependencyRegenCrashingDynamoTest()
        {
            RaiseLoadedEvent(this.View);
            var extensionManager = View.viewExtensionManager;

            extensionManager.Add(viewExtension);
            // Open a random dyf, as a result two Workspace Model will exist under DynamoModel
            Open(@"pkgs\EvenOdd2\dyf\EvenOdd.dyf");

            var loadedParams = new ViewLoadedParams(View, ViewModel);

            viewExtension.pmExtension = this.Model.ExtensionManager.Extensions.OfType <PackageManagerExtension>().FirstOrDefault();
            viewExtension.Loaded(loadedParams);

            var homeWorkspaceModel = ViewModel.Model.Workspaces.OfType <HomeWorkspaceModel>().FirstOrDefault();

            // This is equivalent to uninstall the package
            var package = viewExtension.pmExtension.PackageLoader.LocalPackages.Where(x => x.Name == "Dynamo Samples").FirstOrDefault();

            package.LoadState.SetScheduledForDeletion();

            // Closing the dyf will trigger DependencyRegen of HomeWorkspaceModel.
            // The HomeWorkspaceModel does not contain any dependency info since it's empty
            // but DependencyRegen() call on it should not crash
            Assert.DoesNotThrow(() => viewExtension.DependencyView.DependencyRegen(homeWorkspaceModel));
        }
コード例 #3
0
 public void Loaded(ViewLoadedParams p)
 {
     viewLoadedParams = p;
     controller       = new LibraryViewController(p.DynamoWindow, p.CommandExecutive);
     controller.AddLibraryView();
     //controller.ShowDetailsView("583d8ad8fdef23aa6e000037");
 }
コード例 #4
0
        public void Loaded(ViewLoadedParams p)
        {
            // Specify the text displayed on the menu item
            viewportMenuItem = new MenuItem {
                Header = "Launch Viewport"
            };

            // Define the behavior when menu item is clicked
            viewportMenuItem.Click += (sender, args) =>
            {
                // Instantiate a viewModel and window
                var viewModel = new ViewportWindowViewModel(p);
                var window    = new ViewportWindow(viewModel)
                {
                    // Set the data context for the main grid in the window
                    // This refers to the main grid also seen in our xaml file
                    MainGrid = { DataContext = viewModel },

                    // Set the owner of the window to the Dynamo window.
                    Owner = p.DynamoWindow
                };

                // Show a modeless window.
                window.Show();
            };

            // add the menu item to our loaded parameters
            p.AddMenuItem(MenuBarType.View, viewportMenuItem);
        }
コード例 #5
0
        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);
        }
コード例 #6
0
        public void Loaded(ViewLoadedParams viewLoadedParams)
        {
            if (viewLoadedParams == null)
            {
                throw new ArgumentNullException(nameof(viewLoadedParams));
            }

            this.ViewModel.MessageLogged += OnViewModelMessageLogged;

            this.viewLoadedParamsReference = viewLoadedParams;

            // Add a button to Dynamo View menu to manually show the window
            this.documentationBrowserMenuItem = new MenuItem {
                Header = Resources.MenuItemText, IsCheckable = true
            };
            this.documentationBrowserMenuItem.Checked   += MenuItemCheckHandler;
            this.documentationBrowserMenuItem.Unchecked += MenuItemUnCheckedHandler;
            this.viewLoadedParamsReference.AddMenuItem(MenuBarType.View, this.documentationBrowserMenuItem);


            DynamoView.CloseExtension += OnCloseExtension;

            // subscribe to the documentation open request event from Dynamo
            this.viewLoadedParamsReference.RequestOpenDocumentationLink += HandleRequestOpenDocumentationLink;

            // subscribe to property changes of DynamoViewModel so we can show/hide the browser on StartPage display
            (viewLoadedParams.DynamoWindow.DataContext as DynamoViewModel).PropertyChanged += HandleStartPageVisibilityChange;
        }
コード例 #7
0
ファイル: Data.cs プロジェクト: brencass/Binoculars
        /// <summary>
        /// The general data collecting method
        /// </summary>
        /// <param name="vlp">View Loaded Parameters from Dynamo</param>
        public static void Collect(ViewLoadedParams vlp)
        {
            // @todo if user does not consent, don't store..
            // @todo provide a visual clue to the user that we are in the process of gathering data/geolocating IP which is delaying startup..

            // Dynamo StartupParams
            Data.dynamoVersion = vlp.StartupParams.DynamoVersion.ToString();

            // @todo Determine whether the script is run from DynamoPlayer..

            // Store the local environment data
            Data.user         = Environment.UserName;
            Data.computerName = Environment.MachineName;

            // @todo Define the revitVersion, leave blank or null if opened from any other environment (Sandbox, Civil3D etc)
            Data.revitVersion = "2019.0.2";

            // Request the IP and geolocation from ipinfo.io
            WebClient client = new WebClient();

            client.Headers.Set("Accept", "application/json");
            var json = client.DownloadString("https://ipinfo.io");
            // @todo We need to check the request was actually sent successfully and gracefully deal with cases where the API is unavailable

            // Parse the JSON
            JObject ipinfo = JObject.Parse(json);

            // Store geolocation data
            Data.ip      = (string)ipinfo["ip"];
            Data.latlng  = (string)ipinfo["loc"];
            Data.city    = (string)ipinfo["city"];
            Data.country = (string)ipinfo["country"];
        }
コード例 #8
0
        public void Loaded(ViewLoadedParams viewLoadedParams)
        {
            try
            {
                var dynamoViewModel = viewLoadedParams.DynamoWindow.DataContext as DynamoViewModel;
                //var speckleWatchHandler = new SpeckleWatchHandler(dynamoViewModel.PreferenceSettings);

                if (dynamoViewModel.Model is RevitDynamoModel rdm)
                {
                    rdm.RevitDocumentChanged += Rdm_RevitDocumentChanged;
                    Globals.RevitDocument     = DocumentManager.Instance.GetType().GetProperty("CurrentDBDocument").GetValue(DocumentManager.Instance);
                }
                //sets a read-only property using reflection WatchHandler
                //typeof(DynamoViewModel).GetProperty("WatchHandler").SetValue(dynamoViewModel, speckleWatchHandler);
            }
            catch (Exception e)
            {
            }

            //initialize telemetry and logging
            if (Globals.RevitDocument != null)
            {
                Setup.Init(Applications.DynamoRevit);
            }
            else
            {
                Setup.Init(Applications.DynamoSandbox);
            }
        }
コード例 #9
0
        /// <summary>
        /// Method that is called when Dynamo has finished loading and the UI is ready to be interacted with.
        /// </summary>
        /// <param name="vlp">
        /// Parameters that provide references to Dynamo commands, settings, events and
        /// Dynamo UI items like menus or the background preview. This object is supplied by Dynamo itself.
        /// </param>
        public void Loaded(ViewLoadedParams vlp)
        {
            // Display a MessageBox to the user
            // @todo Use a view framework to improve the UI/UX
            string message = "By pressing OK you agreeing to Binoculars 🔍 data collection.";
            string title   = "Terms of Use Agreement";

            MessageBox.Show(message, title, MessageBoxButton.OK, MessageBoxImage.Exclamation);

            // Collect the environment variables
            Data.Collect(vlp);

            // hold a reference to the Dynamo params to be used later
            _viewLoadedParams = vlp;

            var dynamoViewModel = vlp.DynamoWindow.DataContext as DynamoViewModel;

            // we can register our own events that will be triggered when specific things happen in Dynamo
            // a reference to the ReadyParams is needed to do this, so we pass it on
            Events.Register(dynamoViewModel.Model);

            // Add Revit data, if run from inside Revit
            // 10x Brendan Cassidy https://knowledge.autodesk.com/community/screencast/2f26aab4-bbdb-4935-84e1-bdd0e012a1dc
            if (dynamoViewModel.HostName.ToLower().Contains("revit"))
            {
                //Autodesk.Revit.DB.Document doc = RevitServices.Persistence.DocumentManager.Instance.CurrentDBDocument;
                //Autodesk.Revit.UI.UIApplication uiapp = RevitServices.Persistence.DocumentManager.Instance.CurrentUIApplication;
                //Autodesk.Revit.ApplicationServices.Application app = uiapp.Application;

                Data.revit_build = Utils.GetRevitData();
            }

            // we can now add custom menu items to Dynamo's UI
            BinocularsMenuItems();
        }
コード例 #10
0
        public void Loaded(ViewLoadedParams p)
        {
            if (publishViewModel == null || inviteViewModel == null)
            {
                return;
            }

            publishViewModel.Workspaces            = p.WorkspaceModels;
            publishViewModel.CurrentWorkspaceModel = p.CurrentWorkspaceModel;

            dynamoMenu        = p.dynamoMenu;
            extensionMenuItem = GenerateMenuItem();
            p.AddMenuItem(MenuBarType.File, extensionMenuItem, 11);

            manageCustomizersMenuItem = GenerateManageCustomizersMenuItem();
            p.AddMenuItem(MenuBarType.File, manageCustomizersMenuItem, 12);

            inviteMenuItem = GenerateInviteMenuItem();
            p.AddMenuItem(MenuBarType.File, inviteMenuItem, 11);

            p.AddSeparator(MenuBarType.File, separator, 14);

            p.CurrentWorkspaceChanged += (ws) =>
            {
                publishViewModel.CurrentWorkspaceModel = ws;

                var isEnabled = ws is HomeWorkspaceModel && publishModel.HasAuthProvider;
                extensionMenuItem.IsEnabled = isEnabled;
            };
        }
コード例 #11
0
        public void Loaded(ViewLoadedParams p)
        {
            biltMenuItem = new MenuItem {
                Header = "BILT EUR 2018"
            };
            var VM = p.DynamoWindow.DataContext as DynamoViewModel;

            extensionMenuItem = new MenuItem {
                Header = "designtech Sample Extension"
            };
            extensionMenuItem.Click += (sender, args) =>
            {
                var viewModel = new dtSampleWindowViewModel(p);
                var window    = new dtSampleWindow
                {
                    // Set the data context for the main grid in the window.
                    MainGrid = { DataContext = viewModel },

                    // Set the owner of the window to the Dynamo window.
                    Owner = p.DynamoWindow
                };
                window.Left = window.Owner.Left + 400;
                window.Top  = window.Owner.Top + 200;
                window.Show();
            };
            biltMenuItem.Items.Add(extensionMenuItem);
            p.dynamoMenu.Items.Add(biltMenuItem);
        }
コード例 #12
0
        //private SimpleSearch dependencyViewExtension;

        public SimpleSearch(ViewLoadedParams p)
        {
            InitializeComponent();
            this.DataContext = this;
            currentWorkspace = p.CurrentWorkspaceModel as WorkspaceModel;
            loadedParams     = p;
            //grid view to add the dynamo info to the list
            GridView grid = new GridView();
            //column to contain simple node names
            GridViewColumn col0 = new GridViewColumn();

            col0.Width = 20;
            col0.DisplayMemberBinding = new System.Windows.Data.Binding("Weight");
            grid.Columns.Add(col0);
            GridViewColumn col1 = new GridViewColumn();

            col1.Width  = 200;
            col1.Header = "Node Name";
            col1.DisplayMemberBinding = new System.Windows.Data.Binding("Name");
            grid.Columns.Add(col1);
            //column to contain full node names
            GridViewColumn col2 = new GridViewColumn();

            col2.Width  = 200;
            col2.Header = "Node Full Name";
            col2.DisplayMemberBinding = new System.Windows.Data.Binding("FullCategoryName");
            grid.Columns.Add(col2);
            //bind the list view to the grid
            this.ResultsList.View = grid;
            _searchTextBox        = SearchTextBox;
        }
コード例 #13
0
 public void Loaded(ViewLoadedParams p)
 {
     p.CurrentWorkspaceChanged += (ws) =>
     {
         Counter++;
     };
 }
コード例 #14
0
        public void Loaded(ViewLoadedParams p)
        {
            menuItem = new MenuItem {
                Header = "Browse Warnings..."
            };
            menuItem.Click += (sender, args) =>
            {
                var dynViewModel = p.DynamoWindow.DataContext as DynamoViewModel;
                var viewModel    = new WarningsWindowViewModel(p, dynViewModel);
                var window       = new WarningsWindow
                {
                    // Set the data context for the main grid in the window

                    MainGrid = { DataContext = viewModel },

                    // Set the owner of the window to the Dynamo window

                    Owner = p.DynamoWindow
                };

                window.Left = window.Owner.Left + 400;
                window.Top  = window.Owner.Top + 200;

                // Show our modeless window

                window.Show();
            };
            p.AddMenuItem(MenuBarType.View, menuItem);
        }
コード例 #15
0
        public void Loaded(ViewLoadedParams parameters)
        {
            // Save a reference to your loaded parameters.
            // You'll need these later when you want to use
            // the supplied workspaces
            vm = parameters.DynamoWindow.DataContext as DynamoViewModel;
            pandamoMenuItem = new MenuItem {
                Header = "Pandamo"
            };

            pandamoMenuItem.Click += (sender, args) =>
            {
                pandamoViewModel = new PandamoWindowViewModel(parameters);
                var window = new PandamoWindow(pandamoViewModel)
                {
                    DataContext = pandamoViewModel,
                    Owner       = parameters.DynamoWindow
                };

                // Show a modeless window.
                window.Show();
            };

            //parameters.AddSeparator(MenuBarType.View, new Separator());
            //parameters.AddMenuItem(MenuBarType.View, pandamoMenuItem);
            parameters.dynamoMenu.Items.Add(pandamoMenuItem);
            pandamoViewModel.StartServer();
        }
コード例 #16
0
 /// <summary>
 /// Method that is called when Dynamo has finished loading and the UI is ready to be interacted with.
 /// </summary>
 /// <param name="vlp">
 /// Parameters that provide references to Dynamo commands, settings, events and
 /// Dynamo UI items like menus or the background preview. This object is supplied by Dynamo itself.
 /// </param>
 public void Loaded(ViewLoadedParams vlp)
 {
     // Hold a reference to the Dynamo params to be used later
     viewLoadedParams = vlp;
     // Add custom menu items to Dynamo's UI
     MakeMenuItems();
 }
コード例 #17
0
        public void Loaded(ViewLoadedParams p)
        {
            Clustering a = new Clustering();

            // Save a reference to your loaded parameters.
            // You'll need these later when you want to use
            // the supplied workspaces

            sampleMenuItem = new MenuItem {
                Header = "Seurat Extension"
            };
            sampleMenuItem.Click += (sender, args) =>
            {
                var dynViewModel = p.DynamoWindow.DataContext as DynamoViewModel;
                var viewModel    = new SeuratExtensionWindowViewModel(p, dynViewModel);
                var window       = new SeuratExtensionWindow
                {
                    // Set the data context for the main grid in the window.
                    MainGrid = { DataContext = viewModel },

                    // Set the owner of the window to the Dynamo window.
                    Owner = p.DynamoWindow
                };

                window.Left = window.Owner.Left + 400;
                window.Top  = window.Owner.Top + 200;

                // Show a modeless window.
                window.Show();
            };
            p.AddMenuItem(MenuBarType.View, sampleMenuItem);
        }
コード例 #18
0
        public void Loaded(ViewLoadedParams p)
        {
            // Save a reference to your loaded parameters.
            // You'll need these later when you want to use
            // the supplied workspaces

            sampleMenuItem = new MenuItem {
                Header = "Show View Extension Sample Window"
            };
            sampleMenuItem.Click += (sender, args) =>
            {
                var viewModel = new SampleWindowViewModel(p);
                var window    = new SampleWindow
                {
                    // Set the data context for the main grid in the window.
                    MainGrid = { DataContext = viewModel },

                    // Set the owner of the window to the Dynamo window.
                    Owner = p.DynamoWindow
                };

                window.Left = window.Owner.Left + 400;
                window.Top  = window.Owner.Top + 200;

                // Show a modeless window.
                window.Show();
            };
            p.AddMenuItem(MenuBarType.View, sampleMenuItem);

            // JL
            this.loadedParams             = p;
            p.DynamoWindow.LayoutUpdated += DynamoWindow_ContentRendered;
        }
コード例 #19
0
        public void Loaded(ViewLoadedParams p)
        {
            // Specify the text displayed on the menu item
            rechargeMenuItem = new MenuItem {
                Header = "Show View Extension Recharge Window"
            };

            // Define the behavior when menu item is clicked
            rechargeMenuItem.Click += (sender, args) =>
            {
                // Instantiate a viewModel and window
                var viewModel = new RechargeWindowViewModel(p);
                var window    = new RechargeWindow
                {
                    // Set the data context for the main grid in the window
                    // This refers to the main grid also seen in our xaml file
                    MainGrid = { DataContext = viewModel },

                    // Set the owner of the window to the Dynamo window.
                    Owner = p.DynamoWindow
                };

                // Set the window position
                window.Left = window.Owner.Left + 400;
                window.Top  = window.Owner.Top + 200;

                // Show a modeless window.
                window.Show();
            };

            // add the menu item to our loaded parameters
            p.AddMenuItem(MenuBarType.View, rechargeMenuItem);
        }
コード例 #20
0
        public ViewportWindowViewModel(ViewLoadedParams p, string defaultPackagePath)
        {
            // Save a reference to our loaded parameters which
            // is required in order to access the workspaces
            readyParams = p;

            // TODO: This API will be obsoleted in future Dynamo releases
            // Turn off Dynamo background preview if it's enabled
            (p.BackgroundPreviewViewModel as Dynamo.Wpf.ViewModels.Watch3D.HelixWatch3DViewModel).Active = false;

            // Save a reference to the default packages directory
            PackagePath = defaultPackagePath;

            // Subscribe to NodeAdded and NodeRemoved events
            p.CurrentWorkspaceModel.NodeAdded   += CurrentWorkspaceModel_NodeAdded;
            p.CurrentWorkspaceModel.NodeRemoved += CurrentWorkspaceModel_NodeRemoved;

            // TODO: this could be dangerous if called in custom node ws
            HomeWorkspaceModel currentWS = readyParams.CurrentWorkspaceModel as HomeWorkspaceModel;

            // TODO: opening/changing WS needs more attention
            // Register all nodes that currently exist in the WS
            foreach (NodeModel node in currentWS.Nodes)
            {
                node.RenderPackagesUpdated += CurrentWorkspaceModel_UpdateViewportGeometry;
                node.PropertyChanged       += CurrentWorkspaceModel_nodePropertyChanged;
            }
        }
コード例 #21
0
        public void Loaded(ViewLoadedParams p)
        {
            viewLoadedParams = p;
            dynamoWindow     = p.DynamoWindow;
            var viewModel = dynamoWindow.DataContext as DynamoViewModel;

            logger = viewModel.Model.Logger;

            Notifications = new ObservableCollection <Logging.NotificationMessage>();

            notificationHandler = (notificationMessage) =>
            {
                Notifications.Add(notificationMessage);
                AddNotifications();
            };

            p.NotificationRecieved += notificationHandler;

            //add a new menuItem to the Dynamo mainMenu.
            notificationsMenuItem = new NotificationsMenuItem(this);
            //null out the content of the notificationsMenu to get rid of
            //the parent of the menuItem we created
            (notificationsMenuItem.MenuItem.Parent as ContentControl).Content = null;
            //place the menu into the DynamoMenu
            p.dynamoMenu.Items.Add(notificationsMenuItem.MenuItem);
        }
コード例 #22
0
        public void Loaded(ViewLoadedParams p)
        {
            ViewModel  = new TuneUpWindowViewModel(p);
            TuneUpView = new TuneUpWindow(p, UniqueId)
            {
                // Set the data context for the main grid in the window.
                NodeAnalysisTable = { DataContext = ViewModel },
                MainGrid          = { DataContext = ViewModel }
            };

            TuneUpMenuItem = new MenuItem {
                Header = "Show TuneUp", IsCheckable = true, IsChecked = false
            };
            TuneUpMenuItem.Click += (sender, args) =>
            {
                if (TuneUpMenuItem.IsChecked)
                {
                    p.AddToExtensionsSideBar(this, TuneUpView);
                    ViewModel.EnableProfiling();
                }
                else
                {
                    p.CloseExtensioninInSideBar(this);
                }
            };
            p.AddMenuItem(MenuBarType.View, TuneUpMenuItem);
        }
        public void Loaded(ViewLoadedParams p)
        {
            // Save a reference to your loaded parameters.
            // You'll need these later when you want to use
            // the supplied workspaces
            view       = p.DynamoWindow as DynamoView;
            ksMenuItem = new MenuItem {
                Header = "Keyboard Shortcuts"
            };



            #region Shortcuts

            ksMenuItem.Click += (sender, args) =>
            {
                var viewModel = new NodeShortcutsViewModel(p);
                var window    = new NodeShortcutsWindow()
                {
                    // Set the data context for the main grid in the window.
                    sp = { DataContext = viewModel },

                    // Set the owner of the window to the Dynamo window.
                    Owner = p.DynamoWindow
                };

                window.Left = window.Owner.Left + 400;
                window.Top  = window.Owner.Top + 200;

                // Show a modeless window.
                window.Show();
            };
            p.dynamoMenu.Items.Add(ksMenuItem);
            #endregion
        }
コード例 #24
0
        public void Loaded(ViewLoadedParams p)
        {
            ViewModel = new NodePropertyPaletteWindowViewModel(p);
            NodePropertyPaletteView = new NodePropertyPaletteWindow(p, ViewModel)
            {
                // Set the data context for the main grid in the window.
                NodesTable = { DataContext = ViewModel },
                MainGrid   = { DataContext = ViewModel },
                Owner      = p.DynamoWindow
            };

            NodePropertyPaletteMenuItem = new MenuItem {
                Header = "Show NodePropertyPalette", IsCheckable = true, IsChecked = false
            };
            NodePropertyPaletteMenuItem.Click += (sender, args) =>
            {
                if (NodePropertyPaletteMenuItem.IsChecked)
                {
                    p.AddToExtensionsSideBar(this, NodePropertyPaletteView);
                }
                else
                {
                    p.CloseExtensioninInSideBar(this);
                }
            };
            p.AddMenuItem(MenuBarType.View, NodePropertyPaletteMenuItem);
        }
コード例 #25
0
        public void OnViewExtensionClosedTest()
        {
            RaiseLoadedEvent(this.View);
            var extensionManager = View.viewExtensionManager;
            WorkspaceDependencyViewExtension workspaceDependencyViewExtension = (WorkspaceDependencyViewExtension)extensionManager.ViewExtensions
                                                                                .Where(ve => ve.Name.Equals("Workspace References")).FirstOrDefault();

            // Open a graph which should bring up the Workspace References view extension window with one tab
            Open(@"pkgs\Dynamo Samples\extra\CustomRenderExample.dyn");
            Assert.AreEqual(1, View.ExtensionTabItems.Count);

            var loadedParams = new ViewLoadedParams(View, ViewModel);

            // Assert that the workspace references menu item is checked.
            Assert.IsTrue(workspaceDependencyViewExtension.workspaceReferencesMenuItem.IsChecked);

            // Closing the view extension side bar should trigger the Closed() on the workspace dependency view extension.
            // This will un-check the workspace references menu item.
            loadedParams.CloseExtensioninInSideBar(workspaceDependencyViewExtension);

            Assert.AreEqual(0, View.ExtensionTabItems.Count);

            // Assert that the workspace references menu item is un-checked.
            Assert.IsFalse(workspaceDependencyViewExtension.workspaceReferencesMenuItem.IsChecked);
        }
コード例 #26
0
ファイル: RobotsViewExtension.cs プロジェクト: visose/Robots
    public void Loaded(ViewLoadedParams viewLoadedParams)
    {
        var window = viewLoadedParams.DynamoWindow;

        _content = (Panel)window.Content;
        Instance = this;
    }
コード例 #27
0
        public void DownloadSpecifiedVersionOfPackageTest()
        {
            RaiseLoadedEvent(this.View);
            var extensionManager = View.viewExtensionManager;

            extensionManager.Add(viewExtension);

            Open(@"pkgs\Dynamo Samples\extra\CustomRenderExample.dyn");

            var loadedParams = new ViewLoadedParams(View, ViewModel);

            viewExtension.pmExtension = this.Model.ExtensionManager.Extensions.OfType <PackageManagerExtension>().FirstOrDefault();
            viewExtension.Loaded(loadedParams);

            var CurrentWorkspace = ViewModel.Model.CurrentWorkspace;

            // This is equivalent to uninstall the package
            var package = viewExtension.pmExtension.PackageLoader.LocalPackages.Where(x => x.Name == "Dynamo Samples").FirstOrDefault();

            package.LoadState.SetScheduledForDeletion();

            // Once choosing to install the specified version, info.State should reflect RequireRestart
            viewExtension.DependencyView.DependencyRegen(CurrentWorkspace);

            // Restart banner should display immediately
            Assert.AreEqual(Visibility.Visible, viewExtension.DependencyView.RestartBanner.Visibility);
            Assert.AreEqual(1, viewExtension.DependencyView.PackageDependencyTable.Items.Count);
            var newInfo = viewExtension.DependencyView.dataRows.FirstOrDefault().DependencyInfo;

            // Local loaded version was 2.0.0, but now will be update to date with dyn
            Assert.AreEqual("2.0.1", newInfo.Version.ToString());
            Assert.AreEqual(1, newInfo.Nodes.Count);
            Assert.AreEqual(newInfo.State, PackageDependencyState.RequiresRestart);
        }
コード例 #28
0
        public void Loaded(ViewLoadedParams p)
        {
            p.CurrentWorkspaceChanged += (ws) =>
            {
                Counter++;
            };

            var window = new Window();

            window.Content = new TextBlock()
            {
                Text = "Dummy"
            };
            window.Closed += (sender, args) =>
            {
                WindowClosed = true;
            };
            if (SetOwner)
            {
                window.Owner = p.DynamoWindow;
            }
            Content = window;

            p.AddToExtensionsSideBar(this, window);
        }
コード例 #29
0
        public void Loaded(ViewLoadedParams p)
        {
            menuItem = new MenuItem {
                Header = "Capture Refinery Study..."
            };
            menuItem.Click += (sender, args) =>
            {
                var dynViewModel = p.DynamoWindow.DataContext as DynamoViewModel;
                var viewModel    = new CapturefineryWindowViewModel(p, dynViewModel);
                var window       = new CapturefineryWindow
                {
                    // Set the data context for the main grid in the window

                    MainGrid = { DataContext = viewModel },

                    // Set the owner of the window to the Dynamo window

                    Owner = p.DynamoWindow
                };

                window.Left = window.Owner.Left + window.Owner.Width / 2 - window.Width / 2;
                window.Top  = window.Owner.Top + window.Owner.Height / 2 - window.Height / 2;

                // Show our modeless window

                window.Show();
            };
            p.AddMenuItem(MenuBarType.View, menuItem);
        }
コード例 #30
0
 public GroupNavigationViewModel(ReadyParams p)
 {
     readyParams = p as ViewLoadedParams;
     p.CurrentWorkspaceChanged += CurrentWorkspaceModel_WorkspaceChanged;
     p.CurrentWorkspaceChanged += ReadyParams_CurrentWorkspaceChanged;
     AddEventHandlers(p.CurrentWorkspaceModel);
 }