Exemplo n.º 1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="T:System.Object"/> class.
        /// </summary>
        /// <remarks></remarks>
        static AvalonDockHelper()
        {
            DockingManager = ServiceLocator.Default.ResolveType <DockingManager>();
            DockingManager.DocumentClosed += OnDockingManagerDocumentClosed;

            LayoutDocumentPane = ServiceLocator.Default.ResolveType <LayoutDocumentPane>();
        }
Exemplo n.º 2
0
        public static void Initialize(Window mainWnd, LayoutDocumentPane layoutDocumentPane, DockingManager dockingManager)
        {
            if (!_initialized && TaskbarManager.IsPlatformSupported)
            {
                ParentWindow = mainWnd;
                //LayoutPane = layoutDocumentPane;
                dockManager = dockingManager;
                dockManager.ActiveContentChanged += dockManager_ActiveContentChanged;
                //LayoutPane.Children.CollectionChanged += LayoutPane_CollectionChanged;
                //dockManager.Layout.FloatingWindows.CollectionChanged += new NotifyCollectionChangedEventHandler(FloatingWindows_CollectionChanged);
                //Used to avoid too much of refreshing preview bitmap. It prevents window resizing lag
                resizeTimer.Tick         += ResizingDone;
                moveTimer.Tick           += MovingDone;
                previewCreatorDelay.Tick += WaitingForRefreshDone;

                dockManager.Layout.ElementAdded   += new EventHandler <LayoutElementEventArgs>(Layout_ElementAdded);
                dockManager.Layout.ElementRemoved += new EventHandler <LayoutElementEventArgs>(Layout_ElementRemoved);

                ParentWindow.SizeChanged  += ParentWindow_SizeStateChanged;
                ParentWindow.StateChanged += ParentWindow_SizeStateChanged;

                //Add ribbon event handlers to recalculate preview offset
                var ribbon = ((MainWindow)ParentWindow).Ribbon;
                ribbon.Collapsed   += ParentWindow_RibbonStateChange;
                ribbon.Expanded    += ParentWindow_RibbonStateChange;
                ribbon.SizeChanged += ParentWindow_RibbonStateChange;
                _initialized        = true;
            }
        }
Exemplo n.º 3
0
 private void __restore_documents_docking_layout(IReadOnlyList <ToolLayout> dockingLayouts, LayoutDocumentPaneGroup root)
 {
     foreach (var layout in dockingLayouts)
     {
         if (layout.Type == TOOL_LAYOUT_TYPE_T.PANEL)
         {
             var layoutpanel          = layout as LayoutPanel <LayoutDocument>;
             LayoutDocumentPane panel = __restore_documents_docking_layout(layoutpanel.Documents);
             panel.DockHeight = new GridLength(layoutpanel.Height, GridUnitType.Star);
             panel.DockWidth  = new GridLength(layoutpanel.Width, GridUnitType.Star);
             root.Children.Add(panel);
         }
         else
         {
             var layoutgroup = layout as LayoutGroup;
             var group       = new LayoutDocumentPaneGroup()
             {
                 Orientation = layoutgroup.Orientation == TOOL_LAYOUT_ORIENTATION_T.HORIZONTAL ? Orientation.Horizontal : Orientation.Vertical
             };
             group.DockHeight = new GridLength(layoutgroup.Height, GridUnitType.Star);
             group.DockWidth  = new GridLength(layoutgroup.Width, GridUnitType.Star);
             __restore_documents_docking_layout(layoutgroup.SubLayout, group);
             root.Children.Add(group);
         }
     }
 }
Exemplo n.º 4
0
        private void OnLayoutUpdated(object sender, EventArgs e)
        {
            LayoutDocumentPane actualWidth = this._model;

            ((ILayoutPositionableElementWithActualSize)actualWidth).ActualWidth  = base.ActualWidth;
            ((ILayoutPositionableElementWithActualSize)actualWidth).ActualHeight = base.ActualHeight;
        }
Exemplo n.º 5
0
        public async Task <IView> addView(EngineeringMap eMap, bool canClose)
        {
            LayoutDocumentPane docPane = FindViewHolder();

            if (docPane == null)
            {
                docPane = ViewPane;
            }

            LayoutDocument LayoutDoc = new LayoutDocument();

            LayoutDoc.ContentId = eMap.MapID;
            LayoutDoc.Title     = eMap.MapID;
            LayoutDoc.CanClose  = canClose;
            LayoutDoc.Closed   += LayoutDoc_Closed;
            docPane.Children.Add(LayoutDoc);

            string datafilePath, filePath;

            if (_prj != null)
            {
                datafilePath = _prj.projDef.LocalFilePath;
                filePath     = datafilePath + "\\" + eMap.MapID + ".xml";
            }

            IView view = null;

            if (eMap.MapType == EngineeringMapType.FootPrintMap)
            {
                PlanView planView = new PlanView(this, _prj, eMap);
                LayoutDoc.Content = planView;
                view = planView.view;
            }
            else if (eMap.MapType == EngineeringMapType.GeneralProfileMap)
            {
                ProfileView profileView = new ProfileView(this, _prj, eMap);
                LayoutDoc.Content = profileView;
                view = profileView.view;
            }
            else if (eMap.MapType == EngineeringMapType.Map3D)
            {
                IS3.Unity.Webplayer.U3DView u3dView = new IS3.Unity.Webplayer.U3DView(_prj, eMap);
                LayoutDoc.Content = u3dView;
                view = u3dView.view;
            }

            // view is both a trigger and listener of object selection changed event
            view.objSelectionChangedTrigger += this.objSelectionChangedListener;
            this.objSelectionChangedTrigger += view.objSelectionChangedListener;
            view.initializeView();

            // Load predefined layers
            await view.loadPredefinedLayers();

            // Sync view graphics with data
            view.syncObjects();

            _views.Add(view);
            return(view);
        }
Exemplo n.º 6
0
        private void RefreshTestMesthodsList()
        {
            TestMethodListViewModel testMethodRespository = this.testMethodRespositoryView.DataContext as TestMethodListViewModel;

            if (testMethodRespository != null)
            {
                testMethodRespository.QueryTestMethodsCommand.Execute(null);
            }

            LayoutDocumentPane firstDocumentPane = dockManager.Layout.Descendents().OfType <LayoutDocumentPane>().FirstOrDefault();
            LayoutContent      temp = firstDocumentPane.Children.FirstOrDefault(o => o.Title == "测试用例仓库");

            if (temp == null)
            {
                temp = new LayoutDocument
                {
                    Title   = "测试用例仓库",
                    Content = this.testMethodRespositoryView
                };

                firstDocumentPane.Children.Add(temp);
            }

            temp.IsActive = true;
        }
Exemplo n.º 7
0
        private void OpenTestProject(TestProjectInfo testProjectInfo)
        {
            if (testProjectInfo != null)
            {
                LayoutDocumentPane firstDocumentPane = dockManager.Layout.Descendents().OfType <LayoutDocumentPane>().FirstOrDefault();
                LayoutDocument     doc = new LayoutDocument();
                doc.Title   = testProjectInfo.Name;
                doc.ToolTip = testProjectInfo.Location;
                LayoutContent temp = firstDocumentPane.Children.FirstOrDefault(o => o.Title == doc.Title && o.ToolTip.ToString() == doc.ToolTip.ToString());
                if (temp != null && temp is LayoutDocument)
                {
                    doc = temp as LayoutDocument;
                }
                else
                {
                    TestMethodListView listView = new TestMethodListView();
                    //listView.ComboBoxRespository.Visibility = Visibility.Collapsed;
                    (listView.DataContext as TestMethodListViewModel).CurrentTestProject = testProjectInfo;
                    doc.Content = listView;
                    firstDocumentPane.Children.Add(doc);
                }

                doc.IsActive = true;
                doc.Closing += this.Doc_Closing;
            }
        }
        /// <summary>
        ///		Añade / selecciona un documento
        /// </summary>
        public void AddDocument(string id, string header, UserControl control, object tag = null)
        {
            DockLayoutDocument previous = GetDocument(id);

            if (previous != null)
            {
                previous.LayoutContent.IsActive = true;
                ActiveDocument = previous;
            }
            else
            {
                LayoutDocumentPane documentPane   = Layout.Descendents().OfType <LayoutDocumentPane>().FirstOrDefault();
                LayoutDocument     layoutDocument = new LayoutDocument {
                    Title = header, ToolTip = header
                };

                // Crea un documento y le asigna el control de contenido
                if (documentPane != null)
                {
                    // Asigna el control
                    layoutDocument.Content   = control;
                    layoutDocument.ContentId = id;
                    // Añade el nuevo LayoutDocument al array existente
                    documentPane.Children.Add(layoutDocument);
                    // Activa el documento
                    layoutDocument.IsActive   = true;
                    layoutDocument.IsSelected = true;
                    // Cambia el foco al control
                    control.Focus();
                    // Añade el documento al controlador
                    AddDocument(id, header, DockLayoutDocument.DocumentType.Document, layoutDocument, control, tag);
                }
            }
        }
Exemplo n.º 9
0
        private void AddAnchorableDocument(DockingManager regionTarget, NotifyCollectionChangedEventArgs e)
        {
            foreach (FrameworkElement element in e.NewItems)
            {
                var view = element as UIElement;

                LayoutDocumentPane documentPane = regionTarget.Layout.Descendents().OfType <LayoutDocumentPane>().FirstOrDefault();

                if ((view == null) || (documentPane == null))
                {
                    continue;
                }
                ViewModelBase vm             = element.DataContext as ViewModelBase;
                var           newContentPane = new LayoutAnchorable
                {
                    Content  = view,
                    Title    = vm?.Title,
                    CanHide  = false,
                    CanClose = (vm?.CanClose ?? true),
                    CanFloat = true,
                };
                newContentPane.Closing += NewContentPane_Closing;
                newContentPane.Closed  += NewContentPane_Closed;
                documentPane.Children.Add(newContentPane);
                regionTarget.Layout.ActiveContent = newContentPane;
            }
        }
Exemplo n.º 10
0
         /// <summary>
         /// Handles the NotifyCollectionChangedEventArgs event.
         /// </summary>
         /// <param name="sender">The sender.</param>
         /// <param name="e">The event.</param>
         /// <param name="region">The region.</param>
         /// <param name="regionTarget">The region target.</param>
         void OnViewsCollectionChanged(object sender, NotifyCollectionChangedEventArgs e, IRegion region, DockingManager regionTarget)
         {
             if (e.Action == NotifyCollectionChangedAction.Add)
             {
                 foreach (FrameworkElement item in e.NewItems)
                 {
                     UIElement view = item as UIElement;
                     
                     if (view != null)
                     {
                         //Create a new layout document to be included in the LayoutDocuemntPane (defined in xaml)
                         LayoutDocument newLayoutDocument = new LayoutDocument();
                         //Set the content of the LayoutDocument
                         newLayoutDocument.Content = item;
 
                         ViewModelBase_2 viewModel = (ViewModelBase_2)item.DataContext;
 
                         if (viewModel != null)
                         {
                             //All my viewmodels have a property DisplayName
                             newLayoutDocument.Title = viewModel.DisplayName;
                         }
 
                         //Store all LayoutDocuments alraedy pertaining to the LayoutDocumentPane (defined in xaml)
                         List<LayoutDocument> oldLayoutDocuments = new List<LayoutDocument>();
                         foreach (LayoutDocumentPane oldLayoutDocumentPane in regionTarget.Layout.RootPanel.Children)
                         {
                             foreach (LayoutDocument child in oldLayoutDocumentPane.Children)
                             {
                                 oldLayoutDocuments.Insert(0, child);
                             }
                         }
 
                         //Create a new LayoutDocumentPane and inserts your new LayoutDocument
                         LayoutDocumentPane newLayoutDocumentPane = new LayoutDocumentPane();
                         newLayoutDocumentPane.InsertChildAt(0, newLayoutDocument);
                         
                         //Append to the new LayoutDocumentPane the old LayoutDocuments
                         foreach (LayoutDocument doc in oldLayoutDocuments)
                         {
                             newLayoutDocumentPane.InsertChildAt(0, doc);
                         }
 
                         //Register the new LayoutDocumentPane with the ChildrenCollectionChanged event to manage
                         //LayoutDocuments closure
                         newLayoutDocumentPane.ChildrenCollectionChanged += delegate(
                             Object documentPaneSender, EventArgs args)
                             {
                                 this.OnChildrenCollectionChanged(documentPaneSender, args, region);
                             };
 
                         //Traverse the visual tree of the xaml and replace the LayoutDocumentPane in xaml
                         //with your new LayoutDocumentPane
                         regionTarget.Layout.RootPanel.ReplaceChildAt(0, newLayoutDocumentPane);
                         
                         newLayoutDocument.IsActive = true;
                     }
                 }
             }
         }
Exemplo n.º 11
0
        // Find LayoutDocumentPane where IS3View can be add.
        public LayoutDocumentPane FindViewHolder()
        {
            if (_prj == null)
            {
                return(null);
            }

            EngineeringMap baseMap = _prj.projDef.EngineeringMaps.FirstOrDefault();

            if (baseMap == null)
            {
                return(null);
            }
            LayoutContent layoutContent = FindLayoutContentByID(baseMap.MapID);

            if (layoutContent == null)
            {
                return(null);
            }

            LayoutDocumentPane docPane = layoutContent.Parent as LayoutDocumentPane;

            if (docPane == null)
            {
                LayoutRoot              root         = layoutContent.Root as LayoutRoot;
                LayoutPanel             panel        = root.Children.First() as LayoutPanel;
                LayoutDocumentPaneGroup docPaneGroup =
                    panel.Children.ElementAt(1) as LayoutDocumentPaneGroup;
                docPane = docPaneGroup.Children.First()
                          as LayoutDocumentPane;
            }
            return(docPane);
        }
Exemplo n.º 12
0
        internal EdiViewModel LoadOutputWindow(string fileName = "")
        {
            // Don't need to load output window when output.js is opening
            if (IsOutputFile(fileName))
            {
                return(null);
            }
            var firstPanel = FindFirstLayoutDocumentPane(Win.dockManager.Layout.RootPanel);
            var paneGroup  = firstPanel.Parent as LayoutDocumentPaneGroup;

            if (paneGroup == null)
            {
                return(null);
            }
            var vm = this.mFiles.FirstOrDefault(x => IsOutputFile(x.FileName));

            if (vm == null)
            {
                string outFilePath = GetOutFilePath();
                vm = EdiViewModel.LoadFile(outFilePath);
                this.mFiles.Add(vm);
                var outputContent = firstPanel.Children.Last();
                var layOutPanel   = paneGroup.Parent as LayoutPanel;
                if (layOutPanel != null)
                {
                    var newPane = new LayoutDocumentPane(outputContent);
                    paneGroup.InsertChildAt(1, newPane);
                }
            }
            return(vm);
        }
Exemplo n.º 13
0
 public static void DockHorizontal(LayoutContent layoutContent, ILayoutElement paneRelativeTo, GridLength dockHeight, bool dockBefore = false)
 {
     if (paneRelativeTo is ILayoutDocumentPane parentDocumentPane)
     {
         var parentDocumentGroup = paneRelativeTo.FindParent <LayoutDocumentPaneGroup>();
         if (parentDocumentGroup == null)
         {
             var grandParent = parentDocumentPane.Parent as ILayoutContainer;
             parentDocumentGroup = new LayoutDocumentPaneGroup()
             {
                 Orientation = System.Windows.Controls.Orientation.Vertical
             };
             grandParent.ReplaceChild(paneRelativeTo, parentDocumentGroup);
             parentDocumentGroup.Children.Add(parentDocumentPane);
         }
         parentDocumentGroup.Orientation = System.Windows.Controls.Orientation.Vertical;
         int indexOfParentPane  = parentDocumentGroup.IndexOfChild(parentDocumentPane);
         var layoutDocumentPane = new LayoutDocumentPane(layoutContent)
         {
             DockHeight = dockHeight
         };
         parentDocumentGroup.InsertChildAt(dockBefore ? indexOfParentPane : indexOfParentPane + 1, layoutDocumentPane);
         layoutContent.IsActive = true;
         layoutContent.Root.CollectGarbage();
         Application.Current.MainWindow.Dispatcher.Invoke(() => {
             layoutDocumentPane.DockHeight = dockHeight;
         }, System.Windows.Threading.DispatcherPriority.Loaded);
     }
 }
Exemplo n.º 14
0
        public void AddExteralControl(IBaseView view)
        {
            if ((view.ViewPos == ViewLocation.Center) || (view.ViewPos == ViewLocation.Bottom))
            {
                LayoutDocumentPane docPane = GetControlObject <LayoutDocumentPane>(Enum.GetName(typeof(ViewLocation), view.ViewPos));
                if (docPane == null)
                {
                    docPane = Center;
                }

                LayoutDocument LayoutDoc = new LayoutDocument();
                LayoutDoc.ContentId = view.ViewID;
                LayoutDoc.Title     = view.ViewName;
                LayoutDoc.CanClose  = true;
                LayoutDoc.Closed   += LayoutDoc_Closed;
                LayoutDoc.Content   = view as UserControl;
                docPane.Children.Add(LayoutDoc);
            }
            else
            {
                LayoutAnchorablePane docPane = GetControlObject <LayoutAnchorablePane>(Enum.GetName(typeof(ViewLocation), view.ViewPos));

                LayoutAnchorable LayoutDoc = new LayoutAnchorable();
                LayoutDoc.ContentId = view.ViewID;
                LayoutDoc.Title     = view.ViewName;
                LayoutDoc.CanClose  = true;
                LayoutDoc.Closed   += LayoutDoc_Closed;
                LayoutDoc.Content   = view as UserControl;
                docPane.Children.Add(LayoutDoc);
            }
        }
Exemplo n.º 15
0
 public DockService()
 {
     DockingManager = ServiceLocator.Default.ResolveType <DockingManager>();
     //DockingManager.DocumentClosed += OnDockingManagerDocumentClosed;
     LayoutDocumentPane = ServiceLocator.Default.ResolveType <LayoutDocumentPane>();
     RegionManager      = ServiceLocator.Default.ResolveType <IRegionManager>();
 }
Exemplo n.º 16
0
        /// <summary>
        ///		Muestra un documento
        /// </summary>
        public void ShowDocument(string windowID, string title, System.Windows.Controls.UserControl control)
        {
            LayoutContent previous = GetLayoutPrevious(windowID);

            if (previous != null && previous.Parent != null)
            {
                previous.IsActive = true;
            }
            else
            {
                LayoutDocumentPane documentPane   = DockManager.Layout.Descendents().OfType <LayoutDocumentPane>().FirstOrDefault();
                LayoutDocument     layoutDocument = new LayoutDocument {
                    Title = title, ToolTip = title
                };

                // Crea un documento y le asigna el control de contenido
                if (documentPane != null)
                {
                    // Asigna el control
                    layoutDocument.Content   = control;
                    layoutDocument.ContentId = windowID;
                    // Añade el nuevo LayoutDocument al array existente
                    documentPane.Children.Add(layoutDocument);
                    // Activa el documento
                    layoutDocument.IsActive   = true;
                    layoutDocument.IsSelected = true;
                    // Cambia el foco al control
                    control.Focus();
                    // Añade el documento al controlador
                    AddDocument(new DocumentViewModel(windowID, title, layoutDocument, control));
                }
            }
        }
        /// <summary>
        /// 添加内容面板
        /// </summary>
        /// <param name="documentPane"></param>
        /// <param name="title"></param>
        internal LayoutDocument AddDocument(LayoutDocumentPane documentPane, string title)
        {
            LayoutDocument layout = new LayoutDocument();

            layout.Title = title;
            documentPane.Children.Add(layout);
            return(layout);
        }
Exemplo n.º 18
0
        private LayoutDocumentPane CreateAndAddLayoutDocumentPane(double widthValue)
        {
            var pane = new LayoutDocumentPane();

            pane.DockWidth    = new GridLength(widthValue, GridUnitType.Star);
            pane.DockMinWidth = widthValue < 0.5 ? SmallPaneMinWidth : LargePaneMinWidth;
            PluginGroup.Children.Add(pane);
            return(pane);
        }
Exemplo n.º 19
0
        private static LayoutDocumentPane CreateDocumentPane(LayoutRoot layout)
        {
            var parent   = layout.Descendents().OfType <LayoutPanel>().FirstOrDefault();
            var docsPane = new LayoutDocumentPane {
            };

            parent.Children.Add(docsPane);
            return(docsPane);
        }
Exemplo n.º 20
0
 public WindowAvalonDockScreenManager(
     Window mainWindow, LayoutDocumentPane dockingManager,
     Action <Type, Type> register, Func <Type, object> resolve,
     IMenuManager menuManager = null, IPersistenceService persistenceService = null)
     : base(register, resolve, menuManager, persistenceService)
 {
     _mainWindow     = mainWindow;
     _dockingManager = dockingManager;
 }
Exemplo n.º 21
0
        public void AddChildrenToLayoutRootPanel(string title, FrameworkElement element)
        {
            LayoutDocumentPane dp = this.DManager.Layout.RootPanel.Children[0] as LayoutDocumentPane;
            LayoutDocument     d  = new LayoutDocument();

            d.Title   = title;
            d.Content = element;
            dp.Children.Add(d);
            this.DManager.ActiveContent = d;
        }
Exemplo n.º 22
0
        public MainViewModel(ICommandManager commandManager, GlobalFrontendService globalFrontendService)
        {
            _layoutDocumentPane = ServiceLocator.Default.ResolveType <LayoutDocumentPane>();
            _layoutDocumentPane.PropertyChanged += LayoutDocumentPaneOnPropertyChanged;
            _commandManager        = commandManager;
            _globalFrontendService = globalFrontendService;

            AvalonDockHelper.CreateDocument <VstPluginsViewModel>(activateDocument: true);
            AvalonDockHelper.CreateDocument <PresetExportListViewModel>();
        }
        internal LayoutDocumentPaneControl(LayoutDocumentPane model)
        {
            if (model == null)
                throw new ArgumentNullException("model");

            _model = model;
            SetBinding(ItemsSourceProperty, new Binding("Model.Children") { Source = this });
            SetBinding(FlowDirectionProperty, new Binding("Model.Root.Manager.FlowDirection") { Source = this });

            this.LayoutUpdated += new EventHandler(OnLayoutUpdated);
        }
Exemplo n.º 24
0
        private void Window_Initialized(object sender, EventArgs e)
        {
            CultureInfo.DefaultThreadCurrentCulture   = new CultureInfo("en-US");
            CultureInfo.DefaultThreadCurrentUICulture = new CultureInfo("en-US");

            if (!Directory.Exists("data"))
            {
                MessageBox.Show(Debugger.IsAttached ? @"""data"" folder and/or sqlite3.dll not found. Make sure to copy the data folder and sqlite3.dll to the output directory." : "Some files are missing, please reinstall.", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                Environment.Exit(-1);
            }

            if (!Debugger.IsAttached)
            {
                AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
            }
            _uiManager = new UiManager();

            LoadExtensionDependencies();

            List <Assembly> assemblies = LoadExtensions();

            _extensionManager = new ExtensionManager(_uiManager, Dispatcher, ConfigDir, new FinalesFunkelnExtension());
            _extensionManager.AddAssemblies(assemblies);
            _extensionManager.InitExtensions();

            foreach (var x in _extensionManager.Extensions)
            {
                var item = new ExtensionMenuItem(x.Value);
                item.Views.AddRange(_uiManager.GetViewsByExtension(x.Value));
                ViewsMenuItem.Items.Add(item);
            }

            DockingManager.Layout.RootPanel = new LayoutPanel(_mainPane = new LayoutDocumentPane());


            foreach (var view in _uiManager.GetViews())
            {
                LayoutContent c = new DocumentViewControl(view);
                _mainPane.Children.Add(c);
            }

#if AIRDEBUG && DEBUG
            _processInjector = new ProcessInjector("adl");          //AirDebugLauncher
#elif LCU
            _processInjector = new ProcessInjector("LeagueClient"); //New LoL client
#else
            _processInjector = new ProcessInjector("lolclient");
#endif

            _processInjector.Injected      += pi_Injected;
            _processInjector.ProcessFound  += ProcessInjector_ProcessFound;
            _processInjector.ProcessExited += _processInjector_ProcessExited;
            _processInjector.Start();
        }
Exemplo n.º 25
0
        public MapApplication(gView.Win.Carto.MainWindow appWindow, LayoutDocumentPane dataViewContainer)
            : base()
        {
            _appWindow = appWindow;
            Title      = "gView.Carto";

            _dataViews         = new List <DataView>();
            _dataViewContainer = dataViewContainer;
            _tools             = new List <ITool>();

            _dataViewContainer.PropertyChanged += new System.ComponentModel.PropertyChangedEventHandler(_dataViewContainer_PropertyChanged);
        }
Exemplo n.º 26
0
        protected override void Drop(LayoutDocumentFloatingWindow floatingWindow)
        {
            ILayoutPane model = this._targetPane.Model as ILayoutPane;

            if (base.Type == DropTargetType.DocumentPaneGroupDockInside)
            {
                LayoutDocumentPane item         = (model as LayoutDocumentPaneGroup).Children[0] as LayoutDocumentPane;
                LayoutDocument     rootDocument = floatingWindow.RootDocument;
                item.Children.Insert(0, rootDocument);
            }
            base.Drop(floatingWindow);
        }
        public TaskDirectoryPage(LayoutDocumentPane parentArea)
        {
            InitializeComponent();

            this.parentArea = parentArea;
            DataContext = taskVM;

            taskVM.requestTaskCreation += TaskVM_requestTaskCreation;
            taskVM.requestSelectionCreation += TaskVM_requestSelectionCreation;
            taskVM.requestTaskInfoShow += TaskVM_requestTaskInfoShow;
            taskVM.requestSelectionInfoShow += TaskVM_requestSelectionInfoShow;
        }
Exemplo n.º 28
0
        private void ViewMenuItem_Click(object sender, RoutedEventArgs e)
        {
            var mi   = e.OriginalSource as MenuItem;
            var data = mi?.DataContext as View;

            //TODO probably inefficient needs to be rewritten eventually
            if (data != null)
            {
                List <LayoutDocumentPane> panes = GetPanes();
                bool alreadyActive         = false;
                LayoutDocumentPane biggest = null;
                if (panes.Count > 0)
                {
                    biggest = panes[0];
                    double biggestSize = biggest.DockWidth.Value * biggest.DockHeight.Value;
                    foreach (var x in panes)
                    {
                        foreach (var y in x.Children)
                        {
                            if (y is DocumentViewControl)
                            {
                                if ((y as DocumentViewControl).View.InternalName == data.InternalName)
                                {
                                    DockingManager.ActiveContent = y;
                                    alreadyActive = true;
                                }
                            }
                            else
                            {
                                throw new NotSupportedException();
                            }
                        }
                        var size = x.DockWidth.Value * x.DockHeight.Value;
                        if (size > biggestSize)
                        {
                            biggestSize = size;
                            biggest     = x;
                        }
                    }
                }
                else
                {
                    biggest = new LayoutDocumentPane();
                    DockingManager.Layout.RootPanel.Children.Add(biggest);
                }
                if (!alreadyActive)
                {
                    var ctrl = new DocumentViewControl(data);
                    biggest.Children.Add(ctrl);
                    DockingManager.ActiveContent = ctrl;
                }
            }
        }
Exemplo n.º 29
0
        private ToolLayout __save_documents_docking_layout(LayoutDocumentPane root)
        {
            LayoutPanel <LayoutDocument> r = new LayoutPanel <LayoutDocument>();

            r.Documents = new List <LayoutDocument>();
            r.Height    = root.DockHeight.Value;
            r.Width     = root.DockWidth.Value;
            foreach (var doc in root.Children)
            {
                r.Documents.Add(doc as LayoutDocument);
            }
            return(r);
        }
Exemplo n.º 30
0
        /// <summary>
        /// Initializes a new instance of the <see cref="RibbonService" /> class.
        /// </summary>
        /// <param name="layoutDocumentPane">The layout document pane.</param>
        /// <param name="dispatcherService">The dispatcher service.</param>
        /// <param name="ribbon">The ribbon.</param>
        /// <exception cref="ArgumentNullException">The <paramref name="layoutDocumentPane"/> is <c>null</c>.</exception>
        /// <exception cref="ArgumentNullException">The <paramref name="dispatcherService"/> is <c>null</c>.</exception>
        /// <exception cref="ArgumentNullException">The <paramref name="ribbon"/> is <c>null</c>.</exception>
        public RibbonService(LayoutDocumentPane layoutDocumentPane, IDispatcherService dispatcherService, Ribbon ribbon)
        {
            Argument.IsNotNull("layoutDocumentPane", layoutDocumentPane);
            Argument.IsNotNull("dispatcherService", dispatcherService);
            Argument.IsNotNull("ribbon", ribbon);

            _layoutDocumentPane = layoutDocumentPane;
            _dispatcherService  = dispatcherService;
            _ribbon             = ribbon;

            _layoutDocumentPane.PropertyChanged += OnLayoutDocumentPanePropertyChange;
            _ribbon.Loaded += OnRibbonLoaded;
        }
Exemplo n.º 31
0
        internal LayoutDocumentPaneControl(LayoutDocumentPane model)
        {
            _model = model ?? throw new ArgumentNullException(nameof(model));
            SetBinding(ItemsSourceProperty, new Binding("Model.Children")
            {
                Source = this
            });
            SetBinding(FlowDirectionProperty, new Binding("Model.Root.Manager.FlowDirection")
            {
                Source = this
            });

            LayoutUpdated += OnLayoutUpdated;
        }
Exemplo n.º 32
0
 private void MenuItem_Click(object sender, RoutedEventArgs e)
 {
     var group = _dock.Layout.RootPanel.Children.OfType<LayoutDocumentPaneGroup>().First();
     if (group.Children.Count == 0)
     {
         var pane = new LayoutDocumentPane();
         pane.Children.Add(new LayoutDocument { Content = new PriceData(), Title = "Price Data" });
         group.Children.Add(pane);
     }
     else
     {
         group.Children.OfType<LayoutDocumentPane>().First().Children.Add(new LayoutDocument { Content = new PriceData(), Title = "Price Data" });
     }
 }
Exemplo n.º 33
0
        private LayoutDocumentPaneGroup GetFillLayoutDocumentPaneGroup()
        {
            LayoutDocumentPaneGroup layoutDocumentPaneGroup = new LayoutDocumentPaneGroup();
            LayoutDocument          layoutDocument          = new LayoutDocument()
            {
                Title    = "地图",
                Content  = AppManager.Map,
                CanClose = false
            };
            LayoutDocumentPane layoutDocumentPane = new LayoutDocumentPane();

            layoutDocumentPane.Children.Add(layoutDocument);
            layoutDocumentPaneGroup.Children.Add(layoutDocumentPane);
            return(layoutDocumentPaneGroup);
        }
Exemplo n.º 34
0
        private void AddLayoutDocument(LayoutDocument layoutDocument)
        {
            var existingLayoutDocumentPane = dockingManager.Layout.RootPanel.Children.FirstOrDefault(x => x.GetType() == typeof (LayoutDocumentPane));

            if (existingLayoutDocumentPane != null)
            {
                 dockingManager.Layout.RootPanel.Children.Remove(existingLayoutDocumentPane);
            }

            var layoutPanel = dockingManager.Layout.RootPanel.Descendents().OfType<LayoutPanel>().FirstOrDefault();

            if (layoutPanel == null)
            {
                layoutPanel = new LayoutPanel(new LayoutDocumentPane());
                dockingManager.Layout.RootPanel.Children.Add(layoutPanel);
            }

            var layoutDocumentPane = layoutPanel.Descendents().OfType<LayoutDocumentPane>().FirstOrDefault();

            if (layoutDocumentPane == null)
            {
                layoutDocumentPane = new LayoutDocumentPane();
                layoutPanel.Children.Add(layoutDocumentPane);
            }

            var correspondingTab = GetDocumentById(layoutDocument.ContentId);
            if (correspondingTab != null)
            {
                correspondingTab.IsActive = true;
                correspondingTab.IsSelected = true;
            }
            else
            {
                layoutDocumentPane.Children.Add(layoutDocument);
                layoutDocument.IsSelected = true;
                layoutDocument.IsActive = true;
                layoutDocument.IsActiveChanged += DocumentIsActiveChanged;
            }
        }
Exemplo n.º 35
0
 private void ViewMenuItem_Click(object sender, RoutedEventArgs e)
 {
     var mi = e.OriginalSource as MenuItem;
     var data = mi?.DataContext as View;
     //TODO probably inefficient needs to be rewritten eventually
     if (data != null)
     {
         List<LayoutDocumentPane> panes = GetPanes();
         bool alreadyActive=false;
         LayoutDocumentPane biggest = null;
         if (panes.Count > 0)
         {
             biggest = panes[0];
             double biggestSize = biggest.DockWidth.Value*biggest.DockHeight.Value;
             foreach (var x in panes)
             {
                 foreach (var y in x.Children)
                 {
                     if (y is DocumentViewControl)
                     {
                         if ((y as DocumentViewControl).View.InternalName == data.InternalName)
                         {
                             DockingManager.ActiveContent = y;
                             alreadyActive = true;
                         }
                     }
                     else
                         throw new NotSupportedException();
                 }
                 var size = x.DockWidth.Value*x.DockHeight.Value;
                 if (size > biggestSize)
                 {
                     biggestSize = size;
                     biggest = x;
                 }
             }
         }
         else
         {
             biggest=new LayoutDocumentPane();
             DockingManager.Layout.RootPanel.Children.Add(biggest);
         }
         if (!alreadyActive)
         {
             var ctrl = new DocumentViewControl(data);
             biggest.Children.Add(ctrl);
             DockingManager.ActiveContent = ctrl;
         }
     }
 }
Exemplo n.º 36
0
        private void Window_Initialized(object sender, EventArgs e)
        {
            CultureInfo.DefaultThreadCurrentCulture = new CultureInfo("en-US");
            CultureInfo.DefaultThreadCurrentUICulture = new CultureInfo("en-US");
            if (!Directory.Exists("data") || !File.Exists("sqlite3.dll"))
            {
                MessageBox.Show(Debugger.IsAttached ? @"""data"" folder and/or sqlite3.dll not found. Make sure to copy the data folder and sqlite3.dll to the output directory." : "Some files are missing, please reinstall.", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                Environment.Exit(-1);
            }

            if (!Debugger.IsAttached)
                AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
            _uiManager = new UiManager();

            List<Assembly> assemblies = LoadExtensions();
            _extensionManager = new ExtensionManager(_uiManager, Dispatcher, ConfigDir, new FinalesFunkelnExtension());
            _extensionManager.AddAssemblies(assemblies);
            _extensionManager.InitExtensions();

            foreach (var x in _extensionManager.Extensions)
            {
                var item = new ExtensionMenuItem(x.Value);
                item.Views.AddRange(_uiManager.GetViewsByExtension(x.Value));
                ViewsMenuItem.Items.Add(item);
            }

            DockingManager.Layout.RootPanel = new LayoutPanel(_mainPane = new LayoutDocumentPane());

            foreach (var view in _uiManager.GetViews())
            {
                LayoutContent c = new DocumentViewControl(view);
                _mainPane.Children.Add(c);
            }

            #if AIRDEBUG && DEBUG
            _processInjector = new ProcessInjector("adl");//AirDebugLauncher
            #else
            _processInjector = new ProcessInjector("lolclient");
            #endif

            _processInjector.Injected += pi_Injected;
            _processInjector.ProcessFound += ProcessInjector_ProcessFound;
            _processInjector.ProcessExited += _processInjector_ProcessExited;
            _processInjector.Start();
        }
Exemplo n.º 37
0
 public void AtacheToPane(LayoutDocumentPane pane)
 {
     pane.Children.Add(this);
 }
Exemplo n.º 38
0
 internal override LayoutElement Convert(UiManager uiManager)
 {
     var doc = new LayoutDocumentPane
     {
         DockWidth = new GridLength(Width.Value, Width.Unit),
         DockHeight = new GridLength(Height.Value, Height.Unit)
     };
     foreach (var x in Content)
     {
         var v = x.Convert(uiManager);
         if(v!=null)
             doc.Children.Add(new DocumentViewControl(v));
     }
     return doc;
 }
Exemplo n.º 39
0
		private LayoutDocumentPane CreateAndAddLayoutDocumentPane(double widthValue)
		{
			var pane = new LayoutDocumentPane();
			pane.DockWidth = new GridLength(widthValue, GridUnitType.Star);
			pane.DockMinWidth = widthValue < 0.5 ? SmallPaneMinWidth : LargePaneMinWidth;
			PluginGroup.Children.Add(pane);
			return pane;
		}
Exemplo n.º 40
0
 public void AddPageInDocumentPane(string title)
 {
     if(m_openedDocuments.ContainsKey(title))
     {
         LayoutDocument tmpdoc = m_openedDocuments[title];
         tmpdoc.IsSelected = true;
         return;
     }
     LayoutDocumentPaneGroup m_LayoutDocumentPaneGroup=null;
     foreach (ILayoutElement pane in m_layoutpane.Children)
     {
         if (pane is LayoutDocumentPaneGroup)
         {
             m_LayoutDocumentPaneGroup =(LayoutDocumentPaneGroup) pane;
             break;
         }
     }
     if (m_LayoutDocumentPaneGroup == null)
     {
         m_LayoutDocumentPaneGroup = new LayoutDocumentPaneGroup();
         m_layoutpane.Children.Add(m_anchorablepanegroup);
     }
     LayoutDocumentPane layoutpane = null;
     if (m_LayoutDocumentPaneGroup.Children.Count == 0)
     {
         layoutpane = new LayoutDocumentPane();
         m_LayoutDocumentPaneGroup.Children.Add(layoutpane);
     }
     else
     {
         layoutpane = (LayoutDocumentPane)m_LayoutDocumentPaneGroup.Children[0];
     }
     LayoutDocument document = new LayoutDocument() { Content = new TextBox() { AcceptsReturn = true, HorizontalScrollBarVisibility = ScrollBarVisibility.Auto, VerticalScrollBarVisibility = ScrollBarVisibility.Auto}, Title = title };
     document.Closed += document_Closed;
     layoutpane.Children.Add(document);
     m_openedDocuments.Add(title,document);
     document.IsSelected = true;
 }