Ejemplo n.º 1
0
        private LayoutAnchorable DockView(IAMLEditorView view)
        {
            var plugin = new LayoutAnchorable()
            {
                Content  = view,
                CanClose = view.CanClose
            };

            switch (view.InitialDockPosition)
            {
            case DockPositionEnum.DockContent:
                DocumentPane.Children.Add(plugin);
                break;

            case DockPositionEnum.DockContentMaximized:
                DocumentPane.Children.Add(plugin);
                break;

            case DockPositionEnum.DockLeft:
                LeftTabSide.Children.Add(plugin);
                break;

            case DockPositionEnum.DockRight:
                RightTabSide.Children.Add(plugin);
                break;

            case DockPositionEnum.DockBottom:
                BottomTabSide.Children.Add(plugin);
                break;

            case DockPositionEnum.DockTop:
                TopTabSide.Children.Add(plugin);
                break;

            case DockPositionEnum.Floating:
                FloatingPane.Children.Add(plugin);
                break;
            }

            plugin.Title = view.DisplayName;

            if (MainViewModel.Instance.Plugins.Contains(view))
            {
                plugin.IsActive = true;
            }

            if (plugin.CanClose)
            {
                plugin.Closed += PluginClosed;
            }


            if (view is ISupportsSelection iSelection)
            {
                iSelection.Selected += PlugInSelectionHandler;
            }

            return(plugin);
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Activation handler for PlugIns, defining multiple views
 /// </summary>
 /// <param name="sender">The sender.</param>
 /// <param name="editorView">The editor view.</param>
 private void MultipleView_ViewAdded(object sender, IAMLEditorView editorView)
 {
     this.Dispatcher.BeginInvoke(DispatcherPriority.Background, new Action(() =>
     {
         var pluginWindow = DockView(editorView);
         if (pluginWindow != null && pluginWindow.Content is IAMLEditorPlugin plugin)
         {
             plugin.PluginTerminated += PluginTerminated;
         }
     }));
 }
Ejemplo n.º 3
0
        /// <summary>
        /// Activation handler for PlugIns, defining multiple views
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="editorView">The editor view.</param>
        private void MultipleView_ViewAdded(object sender, IAMLEditorView editorView)
        {
            var plugin = _mainModel.Plugins.FirstOrDefault(p => p.Plugin.PackageName == editorView.PackageName);

            if (plugin == null)
            {
                return;
            }
            plugin.AddView(editorView);

            if (editorView is INotifyViewActivation iNotify)
            {
                iNotify.ViewActivated += INotify_ViewActivated;
            }
        }