|
@@ -86,11 +86,15 @@ public partial class DynamicDashboardEditor : UserControl, INotifyPropertyChange
|
|
|
if(dashboard.DataPresenter is not null)
|
|
|
{
|
|
|
_selectedPresentationType = dashboard.DataPresenter.GetType();
|
|
|
- SetProperties(dashboard.DataPresenter.Properties, _selectedPresentationType);
|
|
|
}
|
|
|
|
|
|
InitializeComponent();
|
|
|
|
|
|
+ if(dashboard.DataPresenter is not null)
|
|
|
+ {
|
|
|
+ SetProperties(dashboard.DataPresenter.Properties, _selectedPresentationType!);
|
|
|
+ }
|
|
|
+
|
|
|
PresentationTypes = DynamicDashboardUtils.GetPresenterTypes()
|
|
|
.Select(x => new Tuple<string, Type>(x.GetCaption(), x))
|
|
|
.ToArray();
|
|
@@ -105,27 +109,33 @@ public partial class DynamicDashboardEditor : UserControl, INotifyPropertyChange
|
|
|
_presenter.DataComponent = DataComponent;
|
|
|
|
|
|
PresentationEditorControl.Content = _presenter.Setup();
|
|
|
+ PresentationEditorControl.Height = _presenter.PreviewHeight;
|
|
|
+ RefreshData();
|
|
|
}
|
|
|
|
|
|
private void SelectData_Click(object sender, RoutedEventArgs e)
|
|
|
{
|
|
|
if (DynamicDashboardDataEditor.Execute(DataComponent))
|
|
|
{
|
|
|
- if(_presenter is not null)
|
|
|
+ RefreshData();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ private void RefreshData()
|
|
|
+ {
|
|
|
+ if(_presenter is not null)
|
|
|
+ {
|
|
|
+ _presenter.DataComponent = DataComponent;
|
|
|
+ DataComponent.RunQueryAsync(100).ContinueWith(data =>
|
|
|
{
|
|
|
- _presenter.DataComponent = DataComponent;
|
|
|
- DataComponent.RunQueryAsync(100).ContinueWith(data =>
|
|
|
+ if(data.Exception is not null)
|
|
|
{
|
|
|
- if(data.Exception is not null)
|
|
|
- {
|
|
|
- MessageWindow.ShowError("Error loading data.", data.Exception);
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- _presenter.Refresh(data.Result);
|
|
|
- }
|
|
|
- }, TaskScheduler.FromCurrentSynchronizationContext());
|
|
|
- }
|
|
|
+ MessageWindow.ShowError("Error loading data.", data.Exception);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ _presenter.Refresh(data.Result);
|
|
|
+ }
|
|
|
+ }, TaskScheduler.FromCurrentSynchronizationContext());
|
|
|
}
|
|
|
}
|
|
|
|