Ver código fonte

Reports bar is now invisible if ther eare no reports

Kenric Nugteren 7 meses atrás
pai
commit
9b81c7179f
1 arquivos alterados com 5 adições e 4 exclusões
  1. 5 4
      prs.desktop/MainWindow.xaml.cs

+ 5 - 4
prs.desktop/MainWindow.xaml.cs

@@ -1392,7 +1392,7 @@ public partial class MainWindow : IPanelHostControl
         return LoadWindow<T>(sender, new CancelEventArgs());
     }
 
-    public IBasePanel LoadWindow(Type t, Fluent.Button sender, CancelEventArgs cancel)
+    public IBasePanel? LoadWindow(Type t, Fluent.Button sender, CancelEventArgs cancel)
     {
         using (new WaitCursor())
         {
@@ -2966,7 +2966,7 @@ public partial class MainWindow : IPanelHostControl
             var ReportsBar = FindRibbonBar(CurrentTab, x => x.Header.Equals("Print"));
             if (ReportsBar is not null)
             {
-                ReportsBar.Visibility = Security.IsAllowed<CanPrintReports>() ? Visibility.Visible : Visibility.Collapsed;
+                ReportsBar.Visibility = Visibility.Collapsed;
                 ReportsBar.Items.Clear();
             }
         }
@@ -2984,7 +2984,7 @@ public partial class MainWindow : IPanelHostControl
             var button = new Fluent.Button
             {
                 Header = action.Caption,
-                LargeIcon = action.Image.AsBitmapImage(),
+                LargeIcon = action.Image?.AsBitmapImage(),
                 MinWidth = 60
             };
 
@@ -2997,6 +2997,7 @@ public partial class MainWindow : IPanelHostControl
                 action.Execute();
             };
 
+            ReportsBar.Visibility = Security.IsAllowed<CanPrintReports>() ? Visibility.Visible : Visibility.Collapsed;
             ReportsBar.Items.Add(button);
         }
     }
@@ -3029,7 +3030,7 @@ public partial class MainWindow : IPanelHostControl
 
             if (action.OnPopulate != null)
             {
-                Fluent.DropDownButton button = null;
+                Fluent.DropDownButton button;
                 if (action.OnExecute != null)
                 {
                     button = new Fluent.SplitButton();