コード例 #1
0
ファイル: ShellView.xaml.cs プロジェクト: kapiya/Warewolf
 void TryDockManager_OnToolWindowLoaded(object sender, PaneToolWindowEventArgs e)
 {
     try
     {
         DockManager_OnToolWindowLoaded(sender, e);
     }
     catch (Exception ex)
     {
         Dev2Logger.Error(ex, GlobalConstants.WarewolfError);
     }
 }
コード例 #2
0
ファイル: ShellView.xaml.cs プロジェクト: kapiya/Warewolf
        void DockManager_OnToolWindowLoaded(object sender, PaneToolWindowEventArgs e)
        {
            var window             = e.Window;
            var resourceDictionary = System.Windows.Application.Current.Resources;

            if (resourceDictionary["WarewolfToolWindow"] is Style style)
            {
                window.UseOSNonClientArea = false;
                window.Style = style;
                window.PreviewMouseLeftButtonUp += WindowOnPreviewMouseDown;
            }

            if (e.Source.GetType() == typeof(XamDockManager))
            {
                var binding = Infragistics.Windows.Utilities.CreateBindingObject(DataContextProperty, BindingMode.OneWay, sender as XamDockManager);
                e.Window.SetBinding(DataContextProperty, binding);

                var shellViewModel = DataContext as ShellViewModel;
                PaneToolWindow = window;

                if (PaneToolWindow.Pane.Panes != null && PaneToolWindow.Pane.Panes.Count > 0)
                {
                    var workSurfaceContextViewModel = PaneToolWindow.Pane.Panes[0].DataContext as WorkSurfaceContextViewModel;
                    shellViewModel?.ActivateItem(workSurfaceContextViewModel);
                    PaneToolWindow.Name = "FloatingWindow";
                    if (string.IsNullOrWhiteSpace(e.Window.Title))
                    {
                        PaneToolWindow.Title = Title;
                    }
                    else
                    {
                        UpdatePaneToolWindow(sender);
                    }
                    if (workSurfaceContextViewModel?.ContextualResourceModel != null)
                    {
                        PaneToolWindow.ToolTip = "Floating window for - " + workSurfaceContextViewModel.ContextualResourceModel.DisplayName;
                    }
                }
            }
        }
コード例 #3
0
        private void DockManager_OnToolWindowLoaded(object sender, PaneToolWindowEventArgs e)
        {
            try
            {
                var window             = e.Window;
                var resourceDictionary = System.Windows.Application.Current.Resources;
                var style = resourceDictionary["WarewolfToolWindow"] as Style;
                if (style != null)
                {
                    window.UseOSNonClientArea = false;
                    window.Style = style;

                    window.PreviewMouseLeftButtonUp += WindowOnPreviewMouseDown;
                }

                if (e.Source.GetType() == typeof(XamDockManager))
                {
                    var binding = Infragistics.Windows.Utilities.CreateBindingObject(DataContextProperty, BindingMode.OneWay, sender as XamDockManager);
                    e.Window.SetBinding(DataContextProperty, binding);

                    ShellViewModel shellViewModel = DataContext as ShellViewModel;
                    PaneToolWindow = window;

                    if (PaneToolWindow.Pane.Panes != null && PaneToolWindow.Pane.Panes.Count > 0)
                    {
                        var workSurfaceContextViewModel = PaneToolWindow.Pane.Panes[0].DataContext as WorkSurfaceContextViewModel;
                        shellViewModel?.ActivateItem(workSurfaceContextViewModel);
                        PaneToolWindow.Name = "FloatingWindow";
                        if (string.IsNullOrWhiteSpace(e.Window.Title))
                        {
                            PaneToolWindow.Title = Title;
                        }
                        else
                        {
                            var dockManager = sender as XamDockManager;
                            if (dockManager?.DataContext.GetType() == typeof(WorkflowDesignerViewModel))
                            {
                                var workflowDesignerViewModel = dockManager?.DataContext as WorkflowDesignerViewModel;
                                var title    = PaneToolWindow.Title;
                                var newTitle = " - " + workflowDesignerViewModel?.DisplayName.Replace("*", "").TrimEnd();
                                if (!title.Contains(newTitle))
                                {
                                    if (!string.IsNullOrWhiteSpace(workflowDesignerViewModel?.DisplayName))
                                    {
                                        PaneToolWindow.Title = PaneToolWindow.Title + " - " + workflowDesignerViewModel?.DisplayName;
                                    }
                                }
                            }
                            else if (dockManager?.DataContext.GetType() == typeof(StudioTestViewModel))
                            {
                                var studioTestViewModel = dockManager?.DataContext as StudioTestViewModel;
                                var title    = PaneToolWindow.Title;
                                var newTitle = " - " + studioTestViewModel?.DisplayName.Replace("*", "").TrimEnd();
                                if (!title.Contains(newTitle))
                                {
                                    if (!string.IsNullOrWhiteSpace(studioTestViewModel?.DisplayName))
                                    {
                                        PaneToolWindow.Title = PaneToolWindow.Title + " - " + studioTestViewModel?.DisplayName;
                                    }
                                }
                            }
                            else if (dockManager?.DataContext.GetType() == typeof(SchedulerViewModel))
                            {
                                var schedulerViewModel = dockManager?.DataContext as SchedulerViewModel;
                                var title    = PaneToolWindow.Title;
                                var newTitle = " - " + schedulerViewModel?.DisplayName.Replace("*", "").TrimEnd();
                                if (!title.Contains(newTitle))
                                {
                                    if (!string.IsNullOrWhiteSpace(schedulerViewModel?.DisplayName))
                                    {
                                        PaneToolWindow.Title = PaneToolWindow.Title + " - " + schedulerViewModel?.DisplayName;
                                    }
                                }
                            }
                        }
                        if (workSurfaceContextViewModel?.ContextualResourceModel != null)
                        {
                            PaneToolWindow.ToolTip = "Floating window for - " + workSurfaceContextViewModel?.ContextualResourceModel.DisplayName;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Dev2Logger.Error(ex);
            }
        }