Explorar o código

Updated scriptEditorWindow slightly

Kenric Nugteren hai 1 semana
pai
achega
b25da3473b

+ 1 - 1
prs.desktop/Configuration/CustomModuleGrid.cs

@@ -89,7 +89,7 @@ using PRSDesktop;
 public class Module
 {
     
-    public DataModel Model { get; set; }
+    public DataModel Model { get; set; } = null!; // Guaranteed to be initialised before any methods are called.
     
     public void BeforeLoad(){
         // Code to customise Model here

+ 11 - 17
prs.desktop/Forms/Issues/IssuesGrid.cs

@@ -62,10 +62,6 @@ public class IssuesGrid : DynamicGrid<Kanban>, ISpecificGrid
 
     public IssuesGrid() : base()
     {
-        
-    
-        
-        
         var cols = LookupFactory.DefineColumns<Kanban>();
 
         // Minimum Columns for Lookup values
@@ -352,7 +348,17 @@ public class IssuesGrid : DynamicGrid<Kanban>, ISpecificGrid
                         Tag = script
                     };
                     itemBtn.VerticalAlignment = VerticalAlignment.Top;
-                    itemBtn.Click += ModuleOpen_Click;
+                    itemBtn.Click += (o, e) =>
+                    {
+                        var editor = new ScriptEditorWindow(script.Script, scriptTitle: script.Name)
+                        {
+                            ShowWarnings = showWarnings
+                        };
+                        if (editor.ShowDialog() == true)
+                        {
+                            script.Update(editor.Script);
+                        }
+                    };
                     itemGrid.AddChild(itemBtn, 0, 0);
                     itemGrid.AddChild(new Label
                     {
@@ -424,18 +430,6 @@ public class IssuesGrid : DynamicGrid<Kanban>, ISpecificGrid
         return false;
     }
 
-    private void ModuleOpen_Click(object sender, RoutedEventArgs e)
-    {
-        if (sender is not FrameworkElement element
-            || element.Tag is not IScriptReference script) return;
-
-        var editor = new ScriptEditorWindow(script.Script, scriptTitle: script.Name);
-        if (editor.ShowDialog() == true)
-        {
-            script.Update(editor.Script);
-        }
-    }
-
     private bool LaunchPRSMobile(Button button, CoreRow[] rows)
     {
         var _mobileApp = System.IO.Path.Combine(_baseDirectory, "PRSAvalonia", "PRS.Avalonia.Desktop.exe");