Files
DP44/Common/DTS.Common/Interface/Groups/IGroupImportViewModel.cs

150 lines
6.1 KiB
C#
Raw Normal View History

2026-04-17 14:55:32 -04:00
using DTS.Common.Base;
using DTS.Common.Enums.Groups;
using DTS.Common.Interface.Channels;
using DTS.Common.Utils;
using System.Windows.Media;
namespace DTS.Common.Interface.Groups
{
/// <summary>
/// this class describes the view module for the group import module
/// this handles iteraction betweens the views and the application, as well as
/// the logic and intermediate data for the module
/// </summary>
public interface IGroupImportViewModel : IBaseViewModel
{
void SetStatus(string message, Color color);
/// <summary>
/// options view controls selecting files
/// </summary>
IGroupImportOptionsView ImportOptionsView { get; set; }
/// <summary>
/// preview view handles selecting groups and viewing channels in a .grp file
/// </summary>
IGroupImportPreviewView ImportPreviewView { get; set; }
/// <summary>
/// handles commiting and displaying progress as commiting groups
/// </summary>
IGroupImportImportView ImportView { get; set; }
/// <summary>
/// reads source files and parses out channels and groups
/// </summary>
void ParseSourceFiles(string userTags);
/// <summary>
/// commits groups and channels to application
/// </summary>
void Import();
/// <summary>
/// resets the view model to initial values
/// we are currently not creating a new viewmodel in the page, but re-using an existing one
/// so everytime we re-visit the page we must re-initialize the vm
/// </summary>
void Reset();
/// <summary>
/// logging facility to log any messages to
/// </summary>
FileUtils.LogDelegate Logger { get; set; }
/// <summary>
/// nav steps exist outside the group import module, and inside
/// the application itself
/// this is the function that allows the module to change nav steps
/// </summary>
SwitchNavStepsDelegate SwitchNavSteps { get; set; }
/// <summary>
/// this provides a function for checking whether a group already exists in the application or not
/// </summary>
CheckGroupExistsDelegate CheckGroupExists { get; set; }
/// <summary>
/// this provides a function for checking whether a sensor already exists in the application or not
/// </summary>
CheckSensorExistsDelegate CheckSensorExists { get; set; }
/// <summary>
/// as groups exist in the application space currently, we need the application to actually create a group
/// this is the function that lets the module invoke creating a group
/// </summary>
CreateGroupDelegate CreateGroup { get; set; }
/// <summary>
/// as groups exist in the application space currently, we need the application to actually create channels in a group
/// this is the function that lets the module invoke adding a channel to a group
/// </summary>
AddChannelToGroupDelegate AddChannel { get; set; }
/// <summary>
/// as groups exist in the application space currently, we need the application to actually commit groups to the database
/// this is the function that lets the module invoke commiting a group to the db
/// </summary>
CommitGroupsDelegate CommitGroups { get; set; }
/// <summary>
/// allows the module to disable the UI
/// </summary>
Disable_UIDelegate DisableUI { get; set; }
/// <summary>
/// allows the module to enable the UI
/// </summary>
Enable_UIDelegate EnableUI { get; set; }
bool BrowseOk { get; set; }
}
/// <summary>
/// delegate describing a method of switching navigation steps
/// </summary>
/// <param name="step">step to switch to</param>
public delegate void SwitchNavStepsDelegate(GroupImportEnums.Steps step);
/// <summary>
/// delegate describing a method of checking if a group exists
/// </summary>
/// <param name="name">group serial number/name to check for</param>
/// <returns></returns>
public delegate bool CheckGroupExistsDelegate(string name);
/// <summary>
/// delegate describing a method of checking if a sensor exists
/// </summary>
/// <param name="serialNumber">serial number of sensor to check for</param>
/// <returns></returns>
public delegate bool CheckSensorExistsDelegate(string serialNumber);
/// <summary>
/// delegate describing a method for creating a group
/// </summary>
/// <param name="serialNumber">serial number of new group</param>
/// <param name="tags">tags that will be added to new group</param>
public delegate void CreateGroupDelegate(string serialNumber, string tags);
/// <summary>
/// adds a channel to a group
/// channels are added to the end of the groups existing channels
/// </summary>
/// <param name="groupSerialNumber">group serial number/name to add channel to</param>
/// <param name="displayName">the display name of the channel</param>
/// <param name="sensorSerialNumber">the sensor serial number of the sensor on the channel</param>
/// <param name="capacity">null if the sensor capacity should be used, otherwise the desired range for the channel</param>
/// <param name="invert">null if the sensor invert setting should be used, otherwise the desired invert settings for the channel</param>
public delegate void AddChannelToGroupDelegate(string groupSerialNumber, string displayName,
string sensorSerialNumber, double? capacity, bool? invert, string isoCode, IChannelSetting[] channelDefaults);
/// <summary>
/// delegate describing a method for commiting a group to the database
/// </summary>
/// <param name="serialNumber"></param>
public delegate void CommitGroupsDelegate(string[] serialNumbers);
public delegate void Disable_UIDelegate();
public delegate void Enable_UIDelegate();
}