Exemplo n.º 1
0
 private void WindowOpened(object sender, DockingWindowEventArgs args)
 {
     if (Equals(Window, args.Window))
     {
         MenuItem.IsChecked = true;
     }
 }
Exemplo n.º 2
0
        /// <summary>
        /// Occurs after a <see cref="DockingWindow"/> has been activated.
        /// </summary>
        /// <param name="sender">The sender of the event.</param>
        /// <param name="e">The <see cref="DockingWindowEventArgs"/> that contains the event data.</param>
        private void OnDockSiteWindowActivated(object sender, DockingWindowEventArgs e)
        {
            if (!this.IsDockingWindowAValidContainer(e))
            {
                return;
            }

            // Get the region
            var region = this.Region;

            if (region == null)
            {
                return;
            }

            // Deactivate all inactive views
            foreach (var activeView in region.ActiveViews)
            {
                if ((e.Window != activeView) && (activeView != e.Window.DataContext))
                {
                    region.Deactivate(activeView);
                }
            }

            // Ensure the view is flagged active
            if (region.Views.Contains(e.Window))
            {
                region.Activate(e.Window);
            }
            else if (region.Views.Contains(e.Window.DataContext))
            {
                region.Activate(e.Window.DataContext);
            }
        }
        // ******************************************************************
        /// <summary>
        /// Handles the <c>WindowUnregistered</c> event of the <c>DockSite</c> control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="DockingWindowEventArgs"/> instance containing the event data.</param>
        private void OnDockSiteWindowUnregistered(object sender, DockingWindowEventArgs e)
        {
            DockSite dockSite = sender as DockSite;

            if (dockSite == null)
            {
                return;
            }

            // Ensure the DockingWindow exists and is generated for an item
            DockingWindow dockingWindow = e.Window;

            if (dockingWindow == null || !dockingWindow.IsContainerForItem)
            {
                return;
            }

            // Need to remove the window from the list of windows that are waiting to be opened
            IList <DockingWindow> windowsPendingOpen = dockSite.GetValue(WindowsPendingOpenProperty) as IList <DockingWindow>;

            if (windowsPendingOpen != null)
            {
                int index = windowsPendingOpen.IndexOf(dockingWindow);
                if (index != -1)
                {
                    EnsureDockingWindowAssociatedModelIsClose(dockingWindow);

                    windowsPendingOpen.RemoveAt(index);
                }
            }
        }
Exemplo n.º 4
0
        /// <summary>
        /// Occurs when a docking window is registered.
        /// </summary>
        /// <param name="sender">The sender of the event.</param>
        /// <param name="e">The <c>DockingWindowEventArgs</c> that contains data related to this event.</param>
        private void OnDockSiteWindowRegistered(object sender, DockingWindowEventArgs e)
        {
            var browser = (WebBrowser)e.Window.Content;

            browser.LoadCompleted += OnBrowserLoadCompleted;
            browser.Navigated     += OnBrowserNavigated;
        }
Exemplo n.º 5
0
        /// <summary>
        /// Occurs after a <see cref="DockingWindow"/> has been deactivated.
        /// </summary>
        /// <param name="sender">The sender of the event.</param>
        /// <param name="e">The <see cref="DockingWindowEventArgs"/> that contains the event data.</param>
        private void OnDockSiteWindowDeactivated(object sender, DockingWindowEventArgs e)
        {
            if (!this.IsDockingWindowAValidContainer(e))
            {
                return;
            }

            // Get the region
            var region = this.Region;

            if (region == null)
            {
                return;
            }

            // Ensure the view is flagged inactive
            if (region.Views.Contains(e.Window))
            {
                region.Deactivate(e.Window);
            }
            else if (region.Views.Contains(e.Window.DataContext))
            {
                region.Deactivate(e.Window.DataContext);
            }
        }
Exemplo n.º 6
0
        /// <summary>
        /// Occurs when a docking window is unregistered.
        /// </summary>
        /// <param name="sender">The sender of the event.</param>
        /// <param name="e">The <c>DockingWindowEventArgs</c> that contains data related to this event.</param>
        private void OnDockSiteWindowUnregistered(object sender, DockingWindowEventArgs e)
        {
            if (!this.IsDockingWindowAValidContainer(e))
            {
                return;
            }

            // Clear the view model bindings
            e.Window.ClearContainerBindings();

            // Ensure the view is removed from the region
            var region = this.Region;

            if (region != null)
            {
                if (region.Views.Contains(e.Window))
                {
                    region.Remove(e.Window);
                }
                else if (region.Views.Contains(e.Window.DataContext))
                {
                    region.Remove(e.Window.DataContext);
                }
            }
        }
Exemplo n.º 7
0
        private void DockSite_OnWindowClosing(object sender, DockingWindowEventArgs e)
        {
            var paneWnd = e.Window as PaneWindow;

            if (paneWnd == null)
            {
                return;
            }

            if (paneWnd.Pane == null)
            {
                return;
            }

            paneWnd.Pane.Dispose();

            //if (!paneWnd.Pane.InProcess)
            //	return;

            //new MessageBoxBuilder()
            //	.Text("Закладка '{0}' в процессе работы и ее невозможно закрыть.".Put(paneWnd.Pane.Title))
            //	.Warning()
            //	.Owner(this)
            //	.Show();

            //e.Cancel = true;
        }
Exemplo n.º 8
0
 /// <summary>
 /// Occurs when a docking window is unregistered.
 /// </summary>
 /// <param name="sender">The sender of the event.</param>
 /// <param name="e">The <c>DockingWindowEventArgs</c> that contains data related to this event.</param>
 private void OnDockSiteWindowUnregistered(object sender, DockingWindowEventArgs e)
 {
     if (this.IsWindowRegistrationEventOutputEnabled)
     {
         this.AppendMessage(String.Format("WindowUnregistered: Title={0}", e.Window.Title));
     }
 }
Exemplo n.º 9
0
        /// <summary>
        /// Occurs when a docking window is activated.
        /// </summary>
        /// <param name="sender">The sender of the event.</param>
        /// <param name="e">The <c>DockingWindowEventArgs</c> that contains data related to this event.</param>
        private void OnDockSiteWindowActivated(object sender, DockingWindowEventArgs e)
        {
            var browser = (e.Window != null ? e.Window.Content as WebBrowser : null);

            if (browser != null)
            {
                this.UpdateUrlAndTitle(browser);
            }
        }
        // ******************************************************************
        /// <summary>
        /// Handles the <c>WindowRegistered</c> event of the <c>DockSite</c> control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="DockingWindowEventArgs"/> instance containing the event data.</param>
        private void OnDockSiteWindowRegistered(object sender, DockingWindowEventArgs e)
        {
            var dockSite = sender as DockSite;

            if (dockSite == null)
            {
                throw new ArgumentException("DockSiteViewModelBehavior is dedicated to actipro DockSite");
            }

            // Ensure the DockingWindow exists and is generated for an item
            DockingWindow dockingWindow = e.Window;

            if (dockingWindow == null || !dockingWindow.IsContainerForItem)
            {
                return;
            }

            // Pass down the name, if any as this cannot be done via a Style
            if (string.IsNullOrEmpty(dockingWindow.Name))
            {
                ViewModelBase viewModel = dockingWindow.DataContext as ViewModelBase;
                if (viewModel != null && !string.IsNullOrEmpty(viewModel.Name))
                {
                    dockingWindow.Name = viewModel.Name;
                }
            }

            // Open the DockingWindow, if it's not already open
            if (!dockingWindow.IsOpen)
            {
                if (!dockSite.IsLoaded)
                {
                    // Need to delay the opening until after the DockSite is loaded because it's content will not be loaded
                    IList <DockingWindow> windowsPendingOpen = dockSite.GetValue(WindowsPendingOpenProperty) as IList <DockingWindow>;
                    if (windowsPendingOpen == null)
                    {
                        windowsPendingOpen = new List <DockingWindow>();
                        dockSite.SetValue(WindowsPendingOpenProperty, windowsPendingOpen);
                    }

                    windowsPendingOpen.Add(dockingWindow);
                }
                else
                {
                    OpenDockingWindow(dockSite, dockingWindow);

                    // EO: To fix a bug in event "LastActiveDocument" which does not trig on initial window.
                    dockSite.Dispatcher.BeginInvoke(new Action(() =>
                    {
                        if (dockSite.DocumentWindows.Count == 1)
                        {
                            dockingWindow.Activate();
                        }
                    }), DispatcherPriority.ContextIdle);
                }
            }
        }
Exemplo n.º 11
0
        private void DockSite_OnWindowClosed(object sender, DockingWindowEventArgs e)
        {
            if (e.Window.Name == "LogToolWindow")
            {
                return;
            }

            DockSite.DocumentWindows.Remove((DocumentWindow)e.Window);
        }
Exemplo n.º 12
0
        /// <summary>
        /// Occurs when a docking window is registered.
        /// </summary>
        /// <param name="sender">The sender of the event.</param>
        /// <param name="e">The <c>DockingWindowEventArgs</c> that contains data related to this event.</param>
        private void OnDockSiteWindowUnregistered(object sender, DockingWindowEventArgs e)
        {
            var browser = (WebBrowser)e.Window.Content;

            browser.LoadCompleted -= OnBrowserLoadCompleted;
            browser.Navigated     -= OnBrowserNavigated;

            // Ensure there is always at least one browser tab
            if (dockSite.DocumentWindows.Count == 0)
            {
                this.CreateBrowserWindow("about:blank");
            }
        }
Exemplo n.º 13
0
        /// <summary>
        /// Occurs when the primary document is changed.
        /// </summary>
        /// <param name="sender">The sender of the event.</param>
        /// <param name="e">The <c>DockingWindowEventArgs</c> that contains data related to this event.</param>
        private void OnDockSitePrimaryDocumentChanged(object sender, DockingWindowEventArgs e)
        {
            this.UpdatePrimaryDocumentBindings();

            if (e.Window != null)
            {
                this.AppendMessage(String.Format("PrimaryDocumentChanged: Title={0}", e.Window.Title));
            }
            else
            {
                this.AppendMessage("PrimaryDocumentChanged: (none)");
            }
        }
Exemplo n.º 14
0
        /// <summary>
        /// Occurs when a docking window is registered.
        /// </summary>
        /// <param name="sender">The sender of the event.</param>
        /// <param name="e">The <c>DockingWindowEventArgs</c> that contains data related to this event.</param>
        private void OnDockSiteWindowRegistered(object sender, DockingWindowEventArgs e)
        {
            if (!this.IsDockingWindowAValidContainer(e))
            {
                return;
            }

            // Bind to the view model and open the window
            var viewModel = e.Window.DataContext as DockingItemViewModelBase;

            if (viewModel != null)
            {
                e.Window.PrepareContainerBindings(viewModel);
            }
        }
Exemplo n.º 15
0
        /// <summary>
        /// Handles the <c>WindowRegistered</c> event of the <c>DockSite</c> control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="DockingWindowEventArgs"/> instance containing the event data.</param>
        private static void OnDockSiteWindowRegistered(object sender, DockingWindowEventArgs e)
        {
            DockSite dockSite = sender as DockSite;

            if (dockSite == null)
            {
                return;
            }

            // Ensure the DockingWindow exists and is generated for an item
            DockingWindow dockingWindow = e.Window;

            if (dockingWindow == null || !dockingWindow.IsContainerForItem)
            {
                return;
            }

            // Pass down the name, if any as this cannot be done via a Style
            if (string.IsNullOrEmpty(dockingWindow.Name))
            {
                var viewModel = dockingWindow.DataContext as ToolItemViewModel;
                if (viewModel != null && !string.IsNullOrEmpty(viewModel.Name))
                {
                    dockingWindow.Name = viewModel.Name;
                }
            }

            // Open the DockingWindow, if it's not already open
            if (!dockingWindow.IsOpen)
            {
                if (!dockSite.IsLoaded)
                {
                    // Need to delay the opening until after the DockSite is loaded because it's content will not be loaded
                    IList <DockingWindow> windowsPendingOpen = dockSite.GetValue(WindowsPendingOpenProperty) as IList <DockingWindow>;
                    if (windowsPendingOpen == null)
                    {
                        windowsPendingOpen = new List <DockingWindow>();
                        dockSite.SetValue(WindowsPendingOpenProperty, windowsPendingOpen);
                    }

                    windowsPendingOpen.Add(dockingWindow);
                }
                else
                {
                    OpenDockingWindow(dockSite, dockingWindow);
                }
            }
        }
Exemplo n.º 16
0
		private void method_1(object sender, DockingWindowEventArgs e)
		{
			Console.WriteLine("DockSite Closed " + e.Window.Title);
			try
			{
				this.observableCollection_0.Remove(e.Window);
				if (this.ChildCollection != null)
				{
					this.ChildCollection.Remove(e.Window.DataContext);
				}
			}
			catch (Exception)
			{
				throw;
			}
		}
Exemplo n.º 17
0
        private void DockSiteWindowClosing(object sender, DockingWindowEventArgs e)
        {
            var dockingWindow = this.FindAncestorByLogicalTree<DockingWindow>();
            if (dockingWindow != e.Window)
                return;

            //VerticalControls.ForEach<IDisposable>(o => o.Dispose());
            _children.ForEach<IDisposable>(o => o.Dispose());
            HorizontalControls.ForEach<IDisposable>(o => o.Dispose());

            //VerticalControls.Clear();
            _children.Clear();
            HorizontalControls.Clear();

            e.OriginalSource.SaftyInvoke<DockSite>(o => o.WindowClosed -= DockSiteWindowClosing);

            DataContext = null;
        }
Exemplo n.º 18
0
        private void DockSiteWindowClosing(object sender, DockingWindowEventArgs e)
        {
            var dockingWindow = this.FindAncestorByLogicalTree <DockingWindow>();

            if (dockingWindow != e.Window)
            {
                return;
            }

            //VerticalControls.ForEach<IDisposable>(o => o.Dispose());
            _children.ForEach <IDisposable>(o => o.Dispose());
            HorizontalControls.ForEach <IDisposable>(o => o.Dispose());

            //VerticalControls.Clear();
            _children.Clear();
            HorizontalControls.Clear();

            e.OriginalSource.SaftyInvoke <DockSite>(o => o.WindowClosed -= DockSiteWindowClosing);

            DataContext = null;
        }
        private void DockSite_OnWindowClosing(object sender, DockingWindowEventArgs e)
        {
            //окна могут открываться и закрываться в момент загрузки разметки
            if (_suspendChangedEvent)
            {
                return;
            }

            var window = e.Window as ContentDocumentWindow;

            if (window == null)
            {
                return;
            }

            e.Handled = true;

            var strategy = window.Tag as StrategyContainer;

            if (strategy != null && strategy.ProcessState != ProcessStates.Stopped)
            {
                if (strategy.StrategyInfo.Type != StrategyInfoTypes.Terminal)
                {
                    e.Cancel = true;

                    new MessageBoxBuilder()
                    .Owner(this)
                    .Text(LocalizedStrings.Str3617Params.Put(window.Title))
                    .Warning()
                    .Show();

                    return;
                }

                new StopStrategyCommand(strategy).SyncProcess(strategy);
            }

            DisposeControl(window);
        }
Exemplo n.º 20
0
        /// <summary>
        ///  Called when the view is about to be closed.
        /// </summary>
        /// <param name = "sender">The sender.</param>
        /// <param name = "e">The <see cref = "DockingWindowEventArgs" /> instance containing the event data.</param>
        private void OnClosing(object sender, DockingWindowEventArgs e)
        {
            var guard = (IGuardClose)_viewModel;

            if (_isClosing)
            {
                _isClosing = false;
                return;
            }

            //bool runningAsync = false;
            bool shouldEnd = false;
            bool async     = false;

            guard.CanClose(canClose => Execute.OnUIThread(() =>
            {
                if (async && canClose)
                {
                    _isClosing = true;

                    _view.SafeClose();
                }
                else
                {
                    e.Cancel = !canClose;
                }

                shouldEnd = true;
            }));

            if (shouldEnd)
            {
                return;
            }

            //runningAsync =
            e.Cancel = true;
        }
Exemplo n.º 21
0
        private void DockSite_OnWindowActivated(object sender, DockingWindowEventArgs e)
        {
            var wnd = e.Window as PaneWindow;

            if (wnd == null)
            {
                return;
            }

            var taskPane = wnd.Pane as TaskPane;

            if (taskPane == null)
            {
                return;
            }

            var task = taskPane.Task;

            var lv = task.IsCategoryOf(TaskCategories.Tool) ? CurrentTools : CurrentSources;

            lv.ScrollIntoView(task);
            lv.SelectedItem = task;
        }
Exemplo n.º 22
0
        /// <summary>
        ///   Called when the view has been closed.
        /// </summary>
        /// <param name = "sender">The sender.</param>
        /// <param name = "e">The <see cref = "DockingWindowEventArgs" /> instance containing the event data.</param>
        private void OnClosed(object sender, DockingWindowEventArgs e)
        {
            if (e.Window != _view)
            {
                return; //  ignore if not our window
            }
            _dockSite.WindowClosed -= OnClosed;
            if (_viewModel is IGuardClose)
            {
                _dockSite.WindowClosing -= OnClosing;
            }

            if (_isDeactivatingFromViewModel)
            {
                return;
            }

            var deactivatable = (IDeactivate)_viewModel;

            _isDeactivatingFromView = true;
            deactivatable.Deactivate(true);
            _isDeactivatingFromView = false;
        }
Exemplo n.º 23
0
        private void DockSite_OnWindowActivated(object sender, DockingWindowEventArgs e)
        {
            var wnd = e.Window as PaneWindow;

            if (wnd == null)
            {
                return;
            }

            var taskPane = wnd.Pane as TaskPane;

            if (taskPane == null)
            {
                return;
            }

            var task = taskPane.Task;

            var lv = task.Type == TaskTypes.Source ? CurrentSources : CurrentConverters;

            lv.ScrollIntoView(task);
            lv.SelectedItem = task;
        }
Exemplo n.º 24
0
 // This is where closing summary tables and line charts will get disposed
 private void DockSite_WindowUnreg(object sender, DockingWindowEventArgs e) => (e.Window.Content as IDisposable)?.Dispose();
Exemplo n.º 25
0
		private void DockSite_OnWindowActivated(object sender, DockingWindowEventArgs e)
		{
			var wnd = e.Window as PaneWindow;

			if (wnd == null) 
				return;

			var taskPane = wnd.Pane as TaskPane;

			if (taskPane == null)
				return;

			var task = taskPane.Task;

			var lv = task.Type == TaskTypes.Source ? CurrentSources : CurrentConverters;

			lv.ScrollIntoView(task);
			lv.SelectedItem = task;
		}
Exemplo n.º 26
0
		private void DockSite_OnWindowClosed(object sender, DockingWindowEventArgs e)
		{
			if (e.Window.Name == "LogToolWindow")
				return;

			DockSite.DocumentWindows.Remove((DocumentWindow)e.Window);
		}
Exemplo n.º 27
0
 /// <summary>
 /// Occurs when a docking window is deactivated.
 /// </summary>
 /// <param name="sender">The sender of the event.</param>
 /// <param name="e">The <c>DockingWindowEventArgs</c> that contains data related to this event.</param>
 private void OnDockSiteWindowDeactivated(object sender, DockingWindowEventArgs e)
 {
     this.UpdateStatusBar();
 }
        /// <summary>
        /// Handles the <c>WindowActivated</c> event of the <c>DockSite</c> control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="DockingWindowEventArgs"/> instance containing the event data.</param>
        private static void OnDockSiteWindowActivated(object sender, DockingWindowEventArgs e)
        {
            DockSite dockSite = sender as DockSite;
            if (dockSite == null)
                return;

            // Ensure the DockingWindow exists and is generated for an item
            DockingWindow dockingWindow = e.Window;
            if (dockingWindow == null || !dockingWindow.IsContainerForItem)
                return;

            ToolWindowCollection toolWindows = dockSite.ToolWindows;
            foreach (ToolWindow tw in toolWindows)
            {
                if (tw.Name == "toolWindow2")
                {
                    if (dockingWindow is DocumentWindow)
                        tw.Title = dockingWindow.Title;
                    else if (dockingWindow is ToolWindow)
                        tw.Title = dockingWindow.Name;
                    else
                        tw.Title = "problem";
                }
            }
        }
Exemplo n.º 29
0
			private void WindowOpened(object sender, DockingWindowEventArgs args)
			{
				if (Equals(Window, args.Window))
					MenuItem.IsChecked = true;
			}
Exemplo n.º 30
0
		private void DockSite_OnWindowClosed(object sender, DockingWindowEventArgs e)
		{
			ToolItems.Remove(e.Window);
		}
 // ******************************************************************
 void dockSite_WindowClosing(object sender, DockingWindowEventArgs e)
 {
     EnsureDockingWindowAssociatedModelIsClose(e.Window);
 }
Exemplo n.º 32
0
        /////////////////////////////////////////////////////////////////////////////////////////////////////
        // NON-PUBLIC PROCEDURES
        /////////////////////////////////////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Occurs when the primary document is changed.
        /// </summary>
        /// <param name="sender">The sender of the event.</param>
        /// <param name="e">The <c>DockingWindowEventArgs</c> that contains data related to this event.</param>
        private void OnDockSitePrimaryDocumentChanged(object sender, DockingWindowEventArgs e)
        {
            this.UpdateStatusBar();
        }
Exemplo n.º 33
0
 private void DockSite_OnWindowClosed(object sender, DockingWindowEventArgs e)
 {
     LayoutManager.ToolItems.Remove(e.Window);
 }
		private void DockSite_OnWindowClosing(object sender, DockingWindowEventArgs e)
		{
			//окна могут открываться и закрываться в момент загрузки разметки
			if (_suspendChangedEvent)
				return;

			var window = e.Window as ContentDocumentWindow;
			if (window == null)
				return;

			e.Handled = true;

			var strategy = window.Tag as StrategyContainer;
			if (strategy != null && strategy.ProcessState != ProcessStates.Stopped)
			{
				if (strategy.StrategyInfo.Type != StrategyInfoTypes.Terminal)
				{
					e.Cancel = true;

					new MessageBoxBuilder()
						.Owner(this)
						.Text(LocalizedStrings.Str3617Params.Put(window.Title))
						.Warning()
						.Show();

					return;
				}

				new StopStrategyCommand(strategy).SyncProcess(strategy);
			}

			DisposeControl(window);
		}
Exemplo n.º 35
0
        /////////////////////////////////////////////////////////////////////////////////////////////////////
        // NON-PUBLIC PROCEDURES
        /////////////////////////////////////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Ensures the <see cref="DockingWindow"/> in the event args exists and is a generated container for an item in this region.
        /// </summary>
        /// <param name="e">The <see cref="DockingWindowEventArgs"/> to examine.</param>
        /// <returns>
        /// <c>true</c> if the <see cref="DockingWindow"/> in the event args is a valid container; otherwise, <c>false</c>.
        /// </returns>
        private bool IsDockingWindowAValidContainer(DockingWindowEventArgs e)
        {
            return((e != null) && (e.Window != null) && (e.Window.IsContainerForItem) && (dockSite != null) && (e.OriginalSource == dockSite));
        }
Exemplo n.º 36
0
        /// <summary>
        /// Handles the <c>WindowActivated</c> event of the <c>DockSite</c> control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="DockingWindowEventArgs"/> instance containing the event data.</param>
        public static void OnDockSiteWindowActivated(object sender, DockingWindowEventArgs e)
        {
            DockSite dockSite = sender as DockSite;
            if (dockSite == null)
                return;

            // Ensure the DockingWindow exists and is generated for an item
            DockingWindow dockingWindow = e.Window;
            if (dockingWindow == null || !dockingWindow.IsContainerForItem)
                return;

            // TODO: Later should have specific single case of display options tool window
            // which is either visible or not rather than looping and checking...
            ToolWindowCollection toolWindows = dockSite.ToolWindows;
            foreach (ToolWindow tw in toolWindows)
            {
                Tool3ViewModel vm = tw.DataContext as Tool3ViewModel;
                if (tw != null && vm != null)
                {
                    if (dockingWindow is DocumentWindow)
                    {
                        DocumentItemViewModel doc_model = dockingWindow.DataContext as DocumentItemViewModel;
                        if (doc_model != null)
                        {
                            vm.RemoteDocDisplayOptions = doc_model;
                        }
                    }
                    else
                    {
                        if (tw != dockingWindow)
                        {
                            vm.RemoteDocDisplayOptions = vm.DefaultOptions;
                        }
                    }
                }
            }
        }
Exemplo n.º 37
0
 /// <summary>
 /// Occurs when an auto-hide popup has been opened that displays a tool window.
 /// </summary>
 /// <param name="sender">The sender of the event.</param>
 /// <param name="e">The <c>DockingWindowEventArgs</c> that contains data related to this event.</param>
 private void OnDockSiteWindowAutoHidePopupOpened(object sender, DockingWindowEventArgs e)
 {
     this.AppendMessage(String.Format("AutoHidePopupOpened: Title={0}", e.Window.Title));
 }
        /// <summary>
        /// Handles the <c>WindowRegistered</c> event of the <c>DockSite</c> control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="DockingWindowEventArgs"/> instance containing the event data.</param>
        private static void OnDockSiteWindowRegistered(object sender, DockingWindowEventArgs e)
        {
            DockSite dockSite = sender as DockSite;
            if (dockSite == null)
                return;

            // Ensure the DockingWindow exists and is generated for an item
            DockingWindow dockingWindow = e.Window;
            if (dockingWindow == null || !dockingWindow.IsContainerForItem)
                return;

            // Pass down the name, if any as this cannot be done via a Style
            if (string.IsNullOrEmpty(dockingWindow.Name)) {
                ViewModelBase viewModel = dockingWindow.DataContext as ViewModelBase;
                if (viewModel != null && !string.IsNullOrEmpty(viewModel.Name))
                    dockingWindow.Name = viewModel.Name;
            }

            // Open the DockingWindow, if it's not already open
            if (!dockingWindow.IsOpen) {
                if (dockingWindow is DocumentWindow)
                    dockingWindow.Open();
                else {
                    ToolWindow toolWindow = dockingWindow as ToolWindow;
                    ToolItemViewModel toolItemViewModel = dockingWindow.DataContext as ToolItemViewModel;
                    if (toolWindow != null && toolItemViewModel != null) {
                        // Look for a ToolWindow within the same group, if found then dock to that group, otherwise either dock or auto-hide the window
                        ToolWindow targetToolWindow = GetToolWindow(dockSite, toolItemViewModel.DockGroup);
                        if (targetToolWindow != null && targetToolWindow != toolWindow)
                            toolWindow.Dock(targetToolWindow, Direction.Content);
                        else if (toolItemViewModel.IsInitiallyAutoHidden)
                            toolWindow.AutoHide(toolItemViewModel.DefaultDock);
                        else
                            toolWindow.Dock(dockSite, toolItemViewModel.DefaultDock);
                    }
                    else {
                        dockingWindow.Open();
                    }
                }
            }
        }
Exemplo n.º 39
0
		private void DockSite_OnWindowActivated(object sender, DockingWindowEventArgs e)
		{
			var wnd = e.Window as PaneWindow;

			if (wnd == null) 
				return;

			var taskPane = wnd.Pane as TaskPane;

			if (taskPane == null)
				return;

			var task = taskPane.Task;

			var lv = task.IsCategoryOf(TaskCategories.Tool) ? CurrentTools : CurrentSources;

			lv.ScrollIntoView(task);
			lv.SelectedItem = task;
		}
Exemplo n.º 40
0
 /// <summary>
 /// Occurs when the primary document is changed.
 /// </summary>
 /// <param name="sender">The sender of the event.</param>
 /// <param name="e">The <c>DockingWindowEventArgs</c> that contains data related to this event.</param>
 private void OnDockSitePrimaryDocumentChanged(object sender, DockingWindowEventArgs e)
 {
     this.PrimaryDocumentWindow = dockSite.PrimaryDocument as TextDocumentWindow;
 }
Exemplo n.º 41
0
		private void DockSite_OnWindowClosing(object sender, DockingWindowEventArgs e)
		{
			var paneWnd = e.Window as PaneWindow;

			if (paneWnd == null)
				return;

			if (paneWnd.Pane == null)
				return;

			paneWnd.Pane.Dispose();

			//if (!paneWnd.Pane.InProcess)
			//	return;

			//new MessageBoxBuilder()
			//	.Text("Закладка '{0}' в процессе работы и ее невозможно закрыть.".Put(paneWnd.Pane.Title))
			//	.Warning()
			//	.Owner(this)
			//	.Show();

			//e.Cancel = true;
		}