Selaa lähdekoodia

Added distinction between Preview mode and display mode for dashboards; added refresh fucntion for formdesigngrid.

Kenric Nugteren 4 kuukautta sitten
vanhempi
commit
de0d907de4

+ 1 - 0
inabox.wpf/Dashboard/Editor/DynamicDashboardEditor.xaml.cs

@@ -106,6 +106,7 @@ public partial class DynamicDashboardEditor : UserControl, INotifyPropertyChange
 
 
         _presenter = (Activator.CreateInstance(presentationType) as IDynamicDashboardDataPresenter)!;
         _presenter = (Activator.CreateInstance(presentationType) as IDynamicDashboardDataPresenter)!;
         _presenter.Properties = _presenterProperties;
         _presenter.Properties = _presenterProperties;
+        _presenter.IsPreview = true;
         _presenter.DataComponent = DataComponent;
         _presenter.DataComponent = DataComponent;
 
 
         PresentationEditorControl.Content = _presenter.Setup();
         PresentationEditorControl.Content = _presenter.Setup();

+ 4 - 0
inabox.wpf/Dashboard/Presenters/DynamicDashboardGridPresenter.cs

@@ -42,6 +42,8 @@ public class DynamicDashboardGridPresenter : IDynamicDashboardDataPresenter<Dyna
 
 
     public int PreviewHeight => 300;
     public int PreviewHeight => 300;
 
 
+    public bool IsPreview { get; set; }
+
     private IDynamicDashboardGridPresenterGrid? Grid;
     private IDynamicDashboardGridPresenterGrid? Grid;
     private readonly ContentControl Content = new();
     private readonly ContentControl Content = new();
 
 
@@ -84,6 +86,8 @@ public class DynamicDashboardGridPresenter : IDynamicDashboardDataPresenter<Dyna
 
 
     private void CustomiseMenu(ContextMenu menu)
     private void CustomiseMenu(ContextMenu menu)
     {
     {
+        if (!IsPreview) return;
+
         if(DataComponent.Queries.Count > 1)
         if(DataComponent.Queries.Count > 1)
         {
         {
             var queryItem = menu.AddItem("Select Query", null, null);
             var queryItem = menu.AddItem("Select Query", null, null);

+ 5 - 0
inabox.wpf/Dashboard/Presenters/IDynamicDashboardDataPresenter.cs

@@ -16,6 +16,11 @@ public interface IDynamicDashboardDataPresenter
     /// </summary>
     /// </summary>
     int PreviewHeight { get; }
     int PreviewHeight { get; }
 
 
+    /// <summary>
+    /// Sets whether this dashboard is in preview mode.
+    /// </summary>
+    bool IsPreview { get; set; }
+
     object Properties { get; set; }
     object Properties { get; set; }
 
 
     /// <summary>
     /// <summary>

+ 5 - 0
inabox.wpf/DigitalForms/Designer/DynamicFormDesignGrid.cs

@@ -2181,6 +2181,11 @@ namespace InABox.DynamicGrid
             CheckRefresh(false);
             CheckRefresh(false);
         }
         }
 
 
+        public void Refresh()
+        {
+            CheckRefresh(false);
+        }
+
         private void CheckRefresh(bool keepValues = true)
         private void CheckRefresh(bool keepValues = true)
         {
         {
             if (!GridInitialized) return;
             if (!GridInitialized) return;