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
{
///
/// The desired height for this presenter while previewing in design mode.
///
int PreviewHeight { get; }
///
/// Sets whether this dashboard is in preview mode.
///
bool IsPreview { get; set; }
object Properties { get; set; }
///
/// Component for the data of this presenter; can be safely assumed to be non- when 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.
///
DynamicDashboardDataComponent DataComponent { get; set; }
///
/// Sets up the data presenter; returns the UI element to be rendered to the user.
///
///
/// if some error occurred and the data cannot be presented; otherwise, returns the control.
///
FrameworkElement? Setup();
///
/// Update the dashboard with .
///
/// The data to be rendered.
void Refresh(DynamicDashboardData data);
void Shutdown(CancelEventArgs? cancel);
}
public interface IDynamicDashboardDataPresenter : IDynamicDashboardDataPresenter
where TProperties: class, new()
{
///
/// The properties for the presenter; can be safely assumed to be non- when
/// is called. This may be modified by the presenter, and any changes made will be persisted.
///
new TProperties Properties { get; set; }
object IDynamicDashboardDataPresenter.Properties
{
get => Properties;
set => Properties = (value as TProperties)!;
}
}