Преглед изворни кода

Moved Task Types setup button to task panel from back stage

Kenric Nugteren пре 1 година
родитељ
комит
3b074d2f11

+ 0 - 8
prs.desktop/MainWindow.xaml

@@ -151,14 +151,6 @@
                             HorizontalAlignment="Stretch"
                             Foreground="{Binding Path=(themes:ThemeManager.BackstageForegroundBrush)}" />
 
-                        <fluent:Button
-                            x:Name="TaskTypesButton"
-                            Header="Task Types"
-                            Click="TaskTypesButton_OnClick"
-                            Size="Middle"
-                            HorizontalAlignment="Stretch"
-                            Foreground="{Binding Path=(themes:ThemeManager.BackstageForegroundBrush)}" />
-
                         <fluent:SeparatorTabItem x:Name="BackstageSeparator5" Height="20" />
 
                         <fluent:Button

+ 9 - 14
prs.desktop/MainWindow.xaml.cs

@@ -1445,15 +1445,17 @@ namespace PRSDesktop
                     );
 
                     var dailyReportPanel = LoadWindow<DailyReport>(ProjectDailyReportButton);
-
-                    dailyReportPanel.OnTimeSheetConfirmed += e =>
+                    if(dailyReportPanel is not null)
                     {
-                        if (!OutstandingDailyReports(true))
+                        dailyReportPanel.OnTimeSheetConfirmed += e =>
                         {
-                            ConfigureMainScreen();
-                            LoadApplicationState();
-                        }
-                    };
+                            if (!OutstandingDailyReports(true))
+                            {
+                                ConfigureMainScreen();
+                                LoadApplicationState();
+                            }
+                        };
+                    }
                     return;
                 }
 
@@ -2752,13 +2754,6 @@ namespace PRSDesktop
             LoadWindow<DeliveryPanel>((Fluent.Button)sender);
         }
 
-
-        private void TaskTypesButton_OnClick(object sender, RoutedEventArgs e)
-        {
-            var list = new MasterList(typeof(KanbanType));
-            list.ShowDialog();
-        }
-
         private void TrolleySetup_Click()
         {
             var list = new MasterList(typeof(ManufacturingTrolley));

+ 15 - 2
prs.desktop/Panels/Tasks/TaskPanel.xaml.cs

@@ -746,6 +746,20 @@ namespace PRSDesktop
                     Image = PRSDesktop.Resources.add
                 }
             );
+            if (Security.CanView<KanbanType>())
+            {
+                host.CreateSetupAction(
+                    new PanelAction
+                    {
+                        Caption = "Task Types",
+                        Image = PRSDesktop.Resources.kanbantype,
+                        OnExecute = a =>
+                        {
+                            var list = new MasterList(typeof(KanbanType));
+                            list.ShowDialog();
+                        }
+                    });
+            }
         }
 
         public Dictionary<string, object[]> Selected()
@@ -761,8 +775,7 @@ namespace PRSDesktop
 
         private readonly List<ITaskControl> _initialized = new();
 
-        private ITaskControl 
-            GetCurrentPanel()
+        private ITaskControl GetCurrentPanel()
         {
             var result = (TaskPanels.SelectedContent as ITaskControl)!;
             if (result == null)