1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
- using Newtonsoft.Json;
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows;
- namespace InABox.Wpf.Dashboard;
- public interface IDynamicDashboardDataPresenter
- {
- /// <summary>
- /// The desired height for this presenter while previewing in design mode.
- /// </summary>
- int PreviewHeight { get; }
- /// <summary>
- /// Sets whether this dashboard is in preview mode.
- /// </summary>
- bool IsPreview { get; set; }
- object Properties { get; set; }
- /// <summary>
- /// Component for the data of this presenter; can be safely assumed to be non-<see langword="null"/> when <see cref="Setup"/> is called.
- /// This may be set later, if the user changes the data they've selected, so the setter should be used to manage data refreshes.
- /// </summary>
- DynamicDashboardDataComponent DataComponent { get; set; }
- /// <summary>
- /// Sets up the data presenter; returns the UI element to be rendered to the user.
- /// </summary>
- /// <returns>
- /// <see langword="null"/> if some error occurred and the data cannot be presented; otherwise, returns the control.
- /// </returns>
- FrameworkElement? Setup();
- /// <summary>
- /// Update the dashboard with <paramref name="data"/>.
- /// </summary>
- /// <param name="data">The data to be rendered.</param>
- void Refresh(DynamicDashboardData data);
- void Shutdown(CancelEventArgs? cancel);
- }
- public interface IDynamicDashboardDataPresenter<TProperties> : IDynamicDashboardDataPresenter
- where TProperties: class, new()
- {
- /// <summary>
- /// The properties for the presenter; can be safely assumed to be non-<see langword="null"/> when <see cref="IDynamicDashboardDataPresenter.Setup"/>
- /// is called. This may be modified by the presenter, and any changes made will be persisted.
- /// </summary>
- new TProperties Properties { get; set; }
- object IDynamicDashboardDataPresenter.Properties
- {
- get => Properties;
- set => Properties = (value as TProperties)!;
- }
- }
|