Ejemplo n.º 1
0
        /// <summary>
        /// Handles the <c>DockingWindowDeserializing</c> event of the <see cref="layoutSerializer"/> control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="DockingWindowDeserializingEventArgs"/> instance containing the event data.</param>
        private void OnLayoutSerializerDockingWindowDeserializing(object sender, DockingWindowDeserializingEventArgs e)
        {
            // If windows are auto-creating...
            if ((windowDeserializationBehavior == DockingWindowDeserializationBehavior.AutoCreate) && (e.Window != null))
            {
                // The e.Node property contains the XML data and the e.Window property contains the associated DocumentWindow or ToolWindow, if any...
                //   The window may have been retrieved from the DockSite, or automatically created (when using DockingWindowDeserializationBehavior.AutoCreate)
                if (e.Node.Name == "programmaticToolWindow1")
                {
                    this.InitializeProgrammaticToolWindow1(e.Window as ToolWindow);

                    // Change the menu item's header
                    activeProgrammaticToolWindow1.Header = "Activate Programmatic ToolWindow 1";
                }
                else if (e.Node.Name == "programmaticToolWindow2")
                {
                    // NOTE: We don't need to initialize "programmaticToolWindow2", because it is a custom ToolWindow that sets the appropriate properties when constructed.

                    // Change the menu item's header
                    activeProgrammaticToolWindow2.Header = "Activate Programmatic ToolWindow 2";
                }
            }
        }
Ejemplo n.º 2
0
        private void OnLayoutSerializerDockingWindowDeserializing(object sender, DockingWindowDeserializingEventArgs e)
        {
            var viewModel = (MainViewModel)DataContext;

            if (e.Node.SerializationId.StartsWith("Tool"))
            {
                if (e.Node.SerializationId.StartsWith("ToolCustomPanel"))
                {
                    var panelViewModel = new CustomPanelToolViewModel(StepBro.Core.Main.ServiceManager);
                    panelViewModel.SerializationId = e.Node.SerializationId;
                    viewModel.AddCustomPanel(panelViewModel, false);
                    e.Window = dockSite.ContainerFromToolItem(panelViewModel);
                }
            }
            else
            {
                if (e.Node.IsOpen)
                {
                    var docViewModel = viewModel.OpenDocumentWindow(e.Node.SerializationId, false);
                    e.Window = dockSite.ContainerFromDocumentItem(docViewModel);
                }
            }
            System.Diagnostics.Debug.WriteLine($"DockingWindowDeserializing: {e.Node.SerializationId}");
        }