Jelajahi Sumber

REPORTS - email template support

Nick-PRSDigital@bitbucket.org 2 tahun lalu
induk
melakukan
26f415bf9b
2 mengubah file dengan 23 tambahan dan 4 penghapusan
  1. 8 3
      InABox.Reports/PreviewWindow.xaml.cs
  2. 15 1
      InABox.Reports/ReportUtils.cs

+ 8 - 3
InABox.Reports/PreviewWindow.xaml.cs

@@ -48,7 +48,11 @@ namespace InABox.Reports
             foreach (var def in ReportUtils.ExportDefinitions)
             {
                 var button = new Button();
-                button.Content = GetImage(def.Image);
+                if (def.Control != null)
+                    button.Content = def.Control;
+                else
+                    button.Content = GetImage(def.Image);
+
                 button.Click += (o, e) =>
                 {
                     var data = ExportReport(def.Type);
@@ -95,7 +99,7 @@ namespace InABox.Reports
 
         public bool IsPreview { get; set; } = true;
         public bool ShouldPopulate { get; set; } = true;
-        
+
         public Report Report
         {
             get => _report;
@@ -232,7 +236,8 @@ namespace InABox.Reports
             MainGrid.RowDefinitions[1].Height = new GridLength(1, GridUnitType.Star);
             MainGrid.RowDefinitions[2].Height = new GridLength(0);
 
-            SetupReport(() => {
+            SetupReport(() =>
+            {
                 Title = string.Format("Report Designer - {0}", Report.FileName);
                 Designer.RefreshLayout();
             });

+ 15 - 1
InABox.Reports/ReportUtils.cs

@@ -35,6 +35,8 @@ namespace InABox.Reports
         Image
     }
 
+    public delegate void ReportExportDefinitionClicked();
+
     public class ReportExportDefinition
     {
         public ReportExportDefinition(string caption, Bitmap image, ReportExportType type, Action<DataModel, byte[]> action)
@@ -45,10 +47,22 @@ namespace InABox.Reports
             Action = action;
         }
 
+        public ReportExportDefinition(string caption, ContentControl control, ReportExportType type, Action<DataModel, byte[]> action)
+        {
+            Caption = caption;
+            Type = type;
+            Action = action;
+            Control = control;
+        }
+
+        public event ReportExportDefinitionClicked OnReportDefinitionClicked;
+
         public string Caption { get; }
 
         public Bitmap Image { get; }
 
+        public ContentControl Control { get; }
+
         public ReportExportType Type { get; }
 
         public Action<DataModel, byte[]> Action { get; }
@@ -344,7 +358,7 @@ namespace InABox.Reports
             where TType : Entity, IRemotable, IPersistent, new()
         {
             PrintMenu(element, sectionName, model, allowdesign, populate);
-        }
+        }      
 
         #region Old RDL Stuff (Deprecated)