Beispiel #1
0
		public AltaxoSDWorkbench()
		{
			_wb = new WpfWorkbench();
			_wb.mainMenuPath = "/Altaxo/Workbench/MainMenu";
			_wb.viewContentPath = "/Altaxo/Workbench/Pads";
			_wb.toolBarPath = "/Altaxo/Workbench/ToolBar";
			_wb.Icon = null; // PresentationResourceService.GetBitmapSource("Icons.MainApplicationIcon");

			// events
			_wb.Closing += EhOnClosing;
			_wb.Closed += EhOnClosed;

			_wb.Initialized += EhInitialized;
		}
        protected override void FocusContent()
        {
            WpfWorkbench.FocusDebug("{0}.FocusContent() IsActiveContent={1} IsKeyboardFocusWithin={2} Keyboard.FocusedElement={3}",
                                    Title, IsActiveContent, IsKeyboardFocusWithin, Keyboard.FocusedElement);
            if (!(IsActiveContent && !IsKeyboardFocusWithin))
            {
                return;
            }
            IInputElement activeChild = CustomFocusManager.GetFocusedChild(this);

            WpfWorkbench.FocusDebug("{0}.FocusContent() - Will move focus (activeChild={1})", this.Title, activeChild);
            // use lambda for fetching the active child - this is necessary because the ActiveViewContent might change until the background
            // action is called
            AvalonWorkbenchWindow.SetFocus(this, () => activeChild ?? (ActiveViewContent != null ? ActiveViewContent.InitiallyFocusedControl as IInputElement : null));
        }
 public void Attach(IWorkbench workbench)
 {
     if (this.workbench != null)
     {
         throw new InvalidOperationException("Can attach only once!");
     }
     this.workbench = (WpfWorkbench)workbench;
     this.workbench.mainContent.Content = dockingManager;
     CommandManager.AddCanExecuteHandler(this.workbench, OnCanExecuteRoutedCommand);
     CommandManager.AddExecutedHandler(this.workbench, OnExecuteRoutedCommand);
     Busy = true;
     try {
         foreach (PadDescriptor pd in workbench.PadContentCollection)
         {
             ShowPad(pd);
         }
     } finally {
         Busy = false;
     }
     LoadConfiguration();
 }
 internal static void SetFocus(ManagedContent m, Func <IInputElement> activeChildFunc, bool forceSetFocus = false)
 {
     m.Dispatcher.BeginInvoke(
         DispatcherPriority.Background,
         new Action(
             delegate {
         // ensure that condition for FocusContent() is still fulfilled
         // (necessary to avoid focus switching loops when changing layouts)
         if (!forceSetFocus && !(m.IsActiveContent && !m.IsKeyboardFocusWithin))
         {
             WpfWorkbench.FocusDebug("{0} - not moving focus (IsActiveContent={1}, IsKeyboardFocusWithin={2})",
                                     m.Title, m.IsActiveContent, m.IsKeyboardFocusWithin);
             return;
         }
         IInputElement activeChild = activeChildFunc();
         WpfWorkbench.FocusDebug("{0} - moving focus to: {1}", m.Title, activeChild != null ? activeChild.ToString() : "<null>");
         if (activeChild != null)
         {
             Keyboard.Focus(activeChild);
         }
     }));
 }
        void dockingManager_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
        {
            if (e.PropertyName == "ActiveContent")
            {
                WpfWorkbench.FocusDebug("AvalonDock: ActiveContent changed to {0}", WpfWorkbench.GetElementName(dockingManager.ActiveContent));
                if (ActiveContentChanged != null)
                {
                    ActiveContentChanged(this, e);
                }
                CommandManager.InvalidateRequerySuggested();
            }
            else if (e.PropertyName == "ActiveDocument")
            {
                WpfWorkbench.FocusDebug("AvalonDock: ActiveDocument changed to {0}", WpfWorkbench.GetElementName(dockingManager.ActiveDocument));

                if (ActiveWorkbenchWindowChanged != null)
                {
                    ActiveWorkbenchWindowChanged(this, e);
                }
                CommandManager.InvalidateRequerySuggested();
            }
        }
		public void Attach(IWorkbench workbench)
		{
			if (this.workbench != null)
				throw new InvalidOperationException("Can attach only once!");
			this.workbench = (WpfWorkbench)workbench;
			this.workbench.mainContent.Content = dockingManager;
			CommandManager.AddCanExecuteHandler(this.workbench, OnCanExecuteRoutedCommand);
			CommandManager.AddExecutedHandler(this.workbench, OnExecuteRoutedCommand);
			Busy = true;
			try {
				foreach (PadDescriptor pd in workbench.PadContentCollection) {
					ShowPad(pd);
				}
			} finally {
				Busy = false;
			}
			LoadConfiguration();
			EnsureFloatingWindowsLocations();
		}
 internal void WriteState(TextWriter output)
 {
     output.WriteLine("AvalonDock: ActiveContent = " + WpfWorkbench.GetElementName(dockingManager.ActiveContent));
     output.WriteLine("AvalonDock: ActiveDocument = " + WpfWorkbench.GetElementName(dockingManager.ActiveDocument));
 }