Esempio n. 1
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);
        }
Esempio n. 2
0
        public override void Loaded(ViewLoadedParams p)
        {
            // Use dynamic object type of ViewLoadedParams to dynamically call its methods.
            dynamic dp = (dynamic)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 },
                Owner             = p.DynamoWindow
            };

            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);
                }
            };

            // Add this view extension's menu item to the Extensions tab or View tab accordingly.
            var dynamoMenuItems    = p.dynamoMenu.Items.OfType <MenuItem>();
            var extensionsMenuItem = dynamoMenuItems.Where(item => item.Header.ToString() == "_Extensions");

            if (extensionsMenuItem.Count() > 0)
            {
                dp.AddExtensionMenuItem(TuneUpMenuItem);
            }
            else
            {
                dp.AddMenuItem(MenuBarType.View, TuneUpMenuItem);
            }
        }
Esempio n. 3
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 = "Open Tune Up"
            };
            TuneUpMenuItem.Click += (sender, args) =>
            {
                p.AddToExtensionsSideBar(this, TuneUpView);
                ViewModel.EnableProfiling();
            };
            p.AddMenuItem(MenuBarType.View, TuneUpMenuItem);
        }