Example #1
0
        protected override async void OnExecuted(EventArgs e)
        {
            base.OnExecuted(e);

            var dialog = ToolboxApp.Services.Get <SettingsDialog>();

            ToolboxUI.Activate(dialog);

            await dialog.ShowAsync(Application.Instance.MainForm);
        }
Example #2
0
        private Control CreateCenterPanel()
        {
            _attachedPropertiesPouch = ToolboxApp.Services.Get <AttachedPropertiesPouch>();
            _propertiesPouch         = ToolboxApp.Services.Get <PropertiesPouch>();
            _eventsPouch             = ToolboxApp.Services.Get <EventsPouch>();
            var toolbelt = ToolboxApp.Services.Get <Toolbelt>();

            toolbelt.Add(_propertiesPouch);
            toolbelt.Add(_attachedPropertiesPouch);
            toolbelt.Add(_eventsPouch);
            ToolboxUI.Activate(toolbelt);

            return(toolbelt.View);
        }
Example #3
0
        public void Add(ToolbeltPouch pouch)
        {
            if (pouch == null)
            {
                throw new ArgumentNullException(nameof(pouch));
            }

            if (_pouches.Contains(pouch))
            {
                return;
            }

            ToolboxUI.Activate(pouch);
            _pouches.Add(pouch);
        }
Example #4
0
        private Control CreateLeftPanel()
        {
            _filesFolderPouch = ToolboxApp.Services.Get <FilesFolderPouch>();
            _vtPouch          = ToolboxApp.Services.Get <VisualTreePouch>();

            ToolboxUI.Activate(_filesFolderPouch);
            ToolboxUI.Activate(_vtPouch);

            _leftSplit = new Splitter
            {
                FixedPanel       = SplitterFixedPanel.Panel1,
                Orientation      = Orientation.Horizontal,
                RelativePosition = DefaultLeftSplitterPosition,
                Panel1           = _filesFolderPouch.View,
                Panel2           = _vtPouch.View
            };


            return(_leftSplit);
        }
Example #5
0
        /// <summary>
        /// Update the workspace to reflect that the toolbox has connected to a design surface.
        /// </summary>
        /// <returns></returns>
        private Control CreateConnectedWorkspaceView()
        {
            var statusbar = new StatusBar();
            var layout    = new TableLayout(1, 2);

            _centerSplit = new Splitter
            {
                Panel1           = CreateLeftPanel(),
                Panel2           = CreateCenterPanel(),
                FixedPanel       = SplitterFixedPanel.Panel1,
                Orientation      = Orientation.Horizontal,
                RelativePosition = DefaultCenterSplitterPosition,
            };

            ToolboxUI.Activate(statusbar);

            layout.Add(_centerSplit, 0, 0, true, true);
            layout.Add(statusbar.View, 0, 1, true, false);

            Title = AppResource.Title_connected;
            return(layout);
        }
Example #6
0
        private async Task OnTreeViewSelectionChanged(object sender, EventArgs e)
        {
            var tv = sender as TreeView;

            var selected = tv?.SelectedItem as TreeItem;

            if (selected == null)
            {
                return;
            }

            Type panelType;

            /*
             *  The top level tree items "settings groups." This can be determined by inspecting the Tag property.
             *  If it contains the text "Group," it's a group. Otherwise, it should contain the type of the panel to instantiate.
             */

            if (selected.Tag.Equals(GroupTag))
            {
                var child = selected.Children[0] as TreeItem;
                if (child == null)
                {
                    ToolboxApp.Log.Warn(SettingsResource.A_child_was_not_found_for_the_settings_group, selected.Text);
                    return;
                }

                // When the group tree item is selected, we will show the settings panel for the fist child.
                panelType = child.Tag as Type;
            }
            else
            {
                panelType = selected.Tag as Type;
            }


            if (panelType == null)
            {
                return;
            }
            Control view;

            // Prevent a panel object from being created again and losing it's unsaved contents.
            if (_panelCache.ContainsKey(panelType))
            {
                view = _panelCache[panelType].View;
            }
            else
            {
                // Each settings panel can have it's own dependencies injected
                var panel = ToolboxUI.Create(panelType) as XenForm;

                if (panel == null)
                {
                    throw new ActivationException(String.Format(SettingsResource.The_panel_couldnt_be_activated,
                                                                selected.Text, typeof(XenVisualElement).FullName));
                }

                // Build the panel and cache it for future retrievel.
                ToolboxUI.Activate(panel);
                _panelCache[panelType] = panel;
                await panel.ShowFormAsync();

                view = panel.View;
            }

            _settingsPanelContainer.Content = view;
        }
Example #7
0
 public static T Activate <T>(this T element) where T : XenVisualElement
 {
     return(ToolboxUI.Activate(element));
 }