ソースを参照

REPORTS - email template support

Nick-PRSDigital@bitbucket.org 2 年 前
コミット
26f415bf9b
2 ファイル変更23 行追加4 行削除
  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)
             foreach (var def in ReportUtils.ExportDefinitions)
             {
             {
                 var button = new Button();
                 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) =>
                 button.Click += (o, e) =>
                 {
                 {
                     var data = ExportReport(def.Type);
                     var data = ExportReport(def.Type);
@@ -95,7 +99,7 @@ namespace InABox.Reports
 
 
         public bool IsPreview { get; set; } = true;
         public bool IsPreview { get; set; } = true;
         public bool ShouldPopulate { get; set; } = true;
         public bool ShouldPopulate { get; set; } = true;
-        
+
         public Report Report
         public Report Report
         {
         {
             get => _report;
             get => _report;
@@ -232,7 +236,8 @@ namespace InABox.Reports
             MainGrid.RowDefinitions[1].Height = new GridLength(1, GridUnitType.Star);
             MainGrid.RowDefinitions[1].Height = new GridLength(1, GridUnitType.Star);
             MainGrid.RowDefinitions[2].Height = new GridLength(0);
             MainGrid.RowDefinitions[2].Height = new GridLength(0);
 
 
-            SetupReport(() => {
+            SetupReport(() =>
+            {
                 Title = string.Format("Report Designer - {0}", Report.FileName);
                 Title = string.Format("Report Designer - {0}", Report.FileName);
                 Designer.RefreshLayout();
                 Designer.RefreshLayout();
             });
             });

+ 15 - 1
InABox.Reports/ReportUtils.cs

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