inital
This commit is contained in:
439
FasdDesktopUi/Basics/Models/ConnectionStatusHelper.cs
Normal file
439
FasdDesktopUi/Basics/Models/ConnectionStatusHelper.cs
Normal file
@@ -0,0 +1,439 @@
|
||||
using C4IT.FASD.Base;
|
||||
using C4IT.FASD.Cockpit;
|
||||
using C4IT.FASD.Cockpit.Communication;
|
||||
using C4IT.Graphics;
|
||||
using C4IT.Logging;
|
||||
using C4IT.MultiLanguage;
|
||||
using C4IT.Security;
|
||||
|
||||
using FasdCockpitBase.Models;
|
||||
|
||||
using FasdDesktopUi.Pages.SettingsPage;
|
||||
using FasdDesktopUi.Pages.SplashScreenView;
|
||||
|
||||
using Microsoft.Win32;
|
||||
|
||||
using Newtonsoft.Json.Linq;
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Threading;
|
||||
using static C4IT.Logging.cLogManager;
|
||||
|
||||
namespace FasdDesktopUi.Basics.Models
|
||||
{
|
||||
public class cConnectionStatusHelper
|
||||
{
|
||||
public enum enumOnlineStatus
|
||||
{
|
||||
notSpecified = 0,
|
||||
offline,
|
||||
connectionError,
|
||||
incompatibleServerVersion,
|
||||
serverNotConfigured,
|
||||
serverStarting,
|
||||
illegalConfig,
|
||||
unauthorized,
|
||||
online
|
||||
}
|
||||
|
||||
public enum enumCheckReason
|
||||
{
|
||||
firstStart = 0,
|
||||
lateInit,
|
||||
heartBeat
|
||||
}
|
||||
|
||||
public bool IsActive = true;
|
||||
|
||||
public readonly Version MinServerVersion = new Version("0.0.0.0");
|
||||
|
||||
private enum enumCheckRunning { no = 0, running, again };
|
||||
|
||||
private enumCheckReason checkReason = enumCheckReason.firstStart;
|
||||
|
||||
public delegate void ConnectionStatusDelegate(enumOnlineStatus? Status);
|
||||
public static event ConnectionStatusDelegate ApiConnectionStatusChanged;
|
||||
|
||||
public delegate cF4SdUserInfoChange M42FormBasedAuthenticationDelegate();
|
||||
public event M42FormBasedAuthenticationDelegate M42FormBasedAuthentication;
|
||||
|
||||
public static cConnectionStatusHelper Instance { get; set; }
|
||||
|
||||
public bool IsAuthorizationSupported { get; private set; } = false;
|
||||
private System.Timers.Timer timer;
|
||||
|
||||
#region Lock Elements Connecion Status
|
||||
private readonly object connectionStatusCheckLock = new object();
|
||||
private enumCheckRunning IsConnectionStatusCheckRunning = enumCheckRunning.no;
|
||||
#endregion
|
||||
|
||||
public enumOnlineStatus ApiConnectionStatus = enumOnlineStatus.notSpecified;
|
||||
|
||||
public cConnectionStatusHelper()
|
||||
{
|
||||
ApiConnectionStatus = enumOnlineStatus.offline;
|
||||
cFasdCockpitCommunicationBase.Instance.CheckConnectionStatus = RunConnectionStatusCheckAsync;
|
||||
timer = new System.Timers.Timer();
|
||||
timer.Elapsed += Timer_Elapsed;
|
||||
|
||||
Assembly assembly = Assembly.GetExecutingAssembly();
|
||||
var arrMinClientVersion = assembly.GetCustomAttributes(typeof(AssemblyMinServerVersion), false);
|
||||
if (arrMinClientVersion != null && arrMinClientVersion.Length >= 1)
|
||||
{
|
||||
var attrMinClientVersion = (AssemblyMinServerVersion)(arrMinClientVersion[0]);
|
||||
MinServerVersion = new Version(attrMinClientVersion.minServerVersion);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private async void Timer_Elapsed(object sender, System.Timers.ElapsedEventArgs e) => await RunConnectionStatusCheckAsync();
|
||||
|
||||
public async Task RunConnectionStatusCheckAsync()
|
||||
{
|
||||
await RunConnectionStatusCheckAsync(null);
|
||||
}
|
||||
|
||||
private (int timerInterval, int shortInterval) GetTimerIntervalFromRegistry(int defaultInterval, int defaultShortInterval)
|
||||
{
|
||||
int timerInterval = defaultInterval;
|
||||
int shortInterval = defaultShortInterval;
|
||||
|
||||
if (!cLogManager.DefaultLogger.IsDebug)
|
||||
return (timerInterval, shortInterval);
|
||||
|
||||
try
|
||||
{
|
||||
var regBase = RegistryKey.OpenBaseKey(RegistryHive.CurrentUser, RegistryView.Registry32);
|
||||
var regKey = regBase.OpenSubKey("SOFTWARE\\Consulting4IT GmbH\\First Aid Service Desk\\Cockpit", false);
|
||||
|
||||
if (regKey is null || !int.TryParse(regKey.GetValue("DebugConnectionCheck", 0).ToString(), out var regValue))
|
||||
return (timerInterval, shortInterval);
|
||||
|
||||
if (regValue <= 0)
|
||||
return (timerInterval, shortInterval);
|
||||
|
||||
timerInterval = regValue * 1000;
|
||||
shortInterval = timerInterval / 10;
|
||||
}
|
||||
catch { }
|
||||
|
||||
return (timerInterval, shortInterval);
|
||||
}
|
||||
|
||||
private void HandleConnectionStatus(enumConnectionStatus status, ref int timerInterval, int timerInteralShort)
|
||||
{
|
||||
switch (status)
|
||||
{
|
||||
case enumConnectionStatus.unknown:
|
||||
case enumConnectionStatus.serverNotFound:
|
||||
if (ApiConnectionStatus != enumOnlineStatus.offline)
|
||||
ApiConnectionStatus = enumOnlineStatus.offline;
|
||||
timerInterval = timerInteralShort;
|
||||
LogEntry("RunConnectionStatusCheckAsync: Exit due to status 'serverNotFound'");
|
||||
break;
|
||||
case enumConnectionStatus.serverResponseError:
|
||||
ApiConnectionStatus = enumOnlineStatus.connectionError;
|
||||
timerInterval = timerInteralShort;
|
||||
LogEntry("RunConnectionStatusCheckAsync: Exit due to status 'serverResponseError'");
|
||||
break;
|
||||
case enumConnectionStatus.incompatibleServerVersion:
|
||||
LogEntry("RunConnectionStatusCheckAsync: Exit due to status 'incompatibleServerVersion'");
|
||||
ApiConnectionStatus = enumOnlineStatus.incompatibleServerVersion;
|
||||
break;
|
||||
case enumConnectionStatus.serverStarting:
|
||||
ApiConnectionStatus = enumOnlineStatus.serverStarting;
|
||||
break;
|
||||
case enumConnectionStatus.serverNotConfigured:
|
||||
ApiConnectionStatus = enumOnlineStatus.serverNotConfigured;
|
||||
break;
|
||||
case enumConnectionStatus.connected:
|
||||
if (cCockpitConfiguration.Instance == null || cF4SDCockpitXmlConfig.Instance == null)
|
||||
ApiConnectionStatus = enumOnlineStatus.illegalConfig;
|
||||
else if (ApiConnectionStatus != enumOnlineStatus.online)
|
||||
ApiConnectionStatus = enumOnlineStatus.online;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public async Task RunConnectionStatusCheckAsync(SplashScreenView splashScreen)
|
||||
{
|
||||
if (!IsActive)
|
||||
return;
|
||||
|
||||
var CM = MethodBase.GetCurrentMethod();
|
||||
LogMethodBegin(CM);
|
||||
try
|
||||
{
|
||||
(int timerInterval, int shortTimerInterval) = GetTimerIntervalFromRegistry(300000, 30000);
|
||||
enumOnlineStatus oldConnectionStatus = ApiConnectionStatus;
|
||||
|
||||
try
|
||||
{
|
||||
timer.Stop();
|
||||
lock (connectionStatusCheckLock)
|
||||
{
|
||||
switch (IsConnectionStatusCheckRunning)
|
||||
{
|
||||
case enumCheckRunning.again:
|
||||
LogEntry("RunConnectionStatusCheckAsync is already running. Status is 'again'.");
|
||||
return;
|
||||
case enumCheckRunning.running:
|
||||
LogEntry("RunConnectionStatusCheckAsync is already running. Status is 'running'.");
|
||||
IsConnectionStatusCheckRunning = enumCheckRunning.again;
|
||||
return;
|
||||
default:
|
||||
IsConnectionStatusCheckRunning = enumCheckRunning.running;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
cCheckConnectionResult connectionResult = await cFasdCockpitCommunicationBase.Instance.CheckConnection(MinServerVersion);
|
||||
IsAuthorizationSupported = connectionResult?.ApiConnectionInfo?.SupportAuthorisation ?? false;
|
||||
|
||||
HandleConnectionStatus(connectionResult.ConnectionStatus, ref timerInterval, shortTimerInterval);
|
||||
if (connectionResult.ConnectionStatus != enumConnectionStatus.connected)
|
||||
return;
|
||||
|
||||
if (checkReason < enumCheckReason.heartBeat && ApiConnectionStatus == enumOnlineStatus.illegalConfig)
|
||||
{
|
||||
// download the xml config files
|
||||
Task<bool> loadConfigFilesTask = Task.Run(async () => await cFasdCockpitConfig.Instance.LoadConfigFilesAsync(cFasdCockpitCommunicationBase.Instance));
|
||||
// get the cockpit base configuration from server
|
||||
Task<bool> getCockpitConfig = Task.Run(async () => await cFasdCockpitConfig.Instance.GetCockpitConfigurationAsync());
|
||||
|
||||
Dispatcher.CurrentDispatcher.Invoke(() => splashScreen?.SetStatusText(cMultiLanguageSupport.GetItem("StartUp.SplashScreen.LoadConfigs")));
|
||||
var configTasks = await Task.WhenAll(loadConfigFilesTask, getCockpitConfig);
|
||||
|
||||
if (configTasks.Any(t => t == false))
|
||||
return;
|
||||
if (cFasdCockpitConfig.Instance?.Global != null && cCockpitConfiguration.Instance?.GlobalConfig != null)
|
||||
{
|
||||
cFasdCockpitConfig.Instance.Global.Load(cCockpitConfiguration.Instance.GlobalConfig);
|
||||
cFasdCockpitConfig.Instance.Global.Save();
|
||||
}
|
||||
}
|
||||
|
||||
cF4sdUserInfo userInfo;
|
||||
lock (cFasdCockpitCommunicationBase.CockpitUserInfoLock)
|
||||
{
|
||||
userInfo = cFasdCockpitCommunicationBase.CockpitUserInfo;
|
||||
}
|
||||
if (IsAuthorizationSupported)
|
||||
{
|
||||
if (userInfo is null || DateTime.UtcNow > userInfo.RenewUntil)
|
||||
{
|
||||
Dispatcher.CurrentDispatcher.Invoke(() => splashScreen?.SetStatusText(cMultiLanguageSupport.GetItem("StartUp.SplashScreen.AuthenticateUser")));
|
||||
ApiConnectionStatus = enumOnlineStatus.unauthorized;
|
||||
const string cockpitUserRole = "Cockpit.User";
|
||||
#if isNewFeature
|
||||
const string cockpitTicketAgentRole = "Cockpit.TicketAgent";
|
||||
#endif
|
||||
userInfo = await cFasdCockpitCommunicationBase.Instance.WinLogon();
|
||||
lock (cFasdCockpitCommunicationBase.CockpitUserInfoLock)
|
||||
{
|
||||
cFasdCockpitCommunicationBase.CockpitUserInfo = userInfo;
|
||||
}
|
||||
if (userInfo?.Roles is null || !userInfo.Roles.Contains(cockpitUserRole))
|
||||
{
|
||||
Dispatcher.CurrentDispatcher.Invoke(() => splashScreen?.SetStatusText(cMultiLanguageSupport.GetItem("StartUp.SplashScreen.NoAuthorization")));
|
||||
LogEntry($"Cockpit User ({userInfo?.Name} with Id {userInfo?.Id}, has not the required permissions.", LogLevels.Error);
|
||||
}
|
||||
else
|
||||
{
|
||||
await Task.Run(async () => await cFasdCockpitConfig.Instance.InstantiateAnalyticsAsync(cFasdCockpitConfig.SessionId));
|
||||
ApiConnectionStatus = enumOnlineStatus.online;
|
||||
#if isNewFeature
|
||||
if (userInfo.Roles.Contains(cockpitTicketAgentRole))
|
||||
cCockpitConfiguration.Instance.ticketSupport.EditTicket = true;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (userInfo == null)
|
||||
{
|
||||
string cockpitUserName = Environment.UserName;
|
||||
string cockpitUserDomain = Environment.UserDomainName;
|
||||
Guid cockpitUserId = await cFasdCockpitCommunicationBase.Instance.GetUserIdByAccount(cockpitUserName, cockpitUserDomain);
|
||||
if (cockpitUserId == Guid.Empty)
|
||||
LogEntry($"Could not get UserId for cockpit user '{cockpitUserName}@{cockpitUserDomain}'.", LogLevels.Warning);
|
||||
else
|
||||
{
|
||||
userInfo = new cF4sdUserInfo()
|
||||
{
|
||||
Id = cockpitUserId,
|
||||
AccountType = cF4sdUserInfo.enumAccountType.unknown,
|
||||
};
|
||||
lock (cFasdCockpitCommunicationBase.CockpitUserInfoLock)
|
||||
{
|
||||
cFasdCockpitCommunicationBase.CockpitUserInfo = userInfo;
|
||||
}
|
||||
}
|
||||
}
|
||||
ApiConnectionStatus = enumOnlineStatus.online;
|
||||
}
|
||||
|
||||
if (App.M42OptionMenuItem != null)
|
||||
App.M42OptionMenuItem.Enabled = userInfo != null;
|
||||
|
||||
// check, if the are logons needed
|
||||
bool m42Valid = await CheckAndRefreshM42LogonAsync();
|
||||
await cFasdCockpitConfig.Instance.CheckAgentScriptAvailabilityAsync();
|
||||
await cFasdCockpitConfig.Instance.CheckServerQuickActionAvailabilityAsync();
|
||||
await cFasdCockpitCommunicationBase.Instance.InitializeAfterOnlineAsync();
|
||||
cFasdCockpitConfig.Instance.OnUiSettingsChanged();
|
||||
}
|
||||
catch (Exception E)
|
||||
{
|
||||
LogException(E);
|
||||
}
|
||||
finally
|
||||
{
|
||||
try
|
||||
{
|
||||
lock (connectionStatusCheckLock)
|
||||
{
|
||||
if (IsConnectionStatusCheckRunning == enumCheckRunning.again)
|
||||
timerInterval = 1;
|
||||
IsConnectionStatusCheckRunning = enumCheckRunning.no;
|
||||
}
|
||||
}
|
||||
catch (Exception E)
|
||||
{
|
||||
LogException(E);
|
||||
}
|
||||
|
||||
if (IsActive)
|
||||
{
|
||||
if (ApiConnectionStatus == enumOnlineStatus.online)
|
||||
NotifyerSupport.SetNotifyIcon("Default", null, NotifyerSupport.enumIconAlignment.BottomRight);
|
||||
else
|
||||
NotifyerSupport.SetNotifyIcon("Default", "OverlayOffline", NotifyerSupport.enumIconAlignment.BottomRight);
|
||||
if (ApiConnectionStatus != oldConnectionStatus)
|
||||
OnApiConnectionStatusChanged();
|
||||
}
|
||||
if (timer != null)
|
||||
{
|
||||
timer.Interval = timerInterval;
|
||||
timer.Start();
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception E)
|
||||
{
|
||||
LogException(E);
|
||||
}
|
||||
finally
|
||||
{
|
||||
LogMethodEnd(CM);
|
||||
}
|
||||
}
|
||||
|
||||
private async Task<bool> CheckAndRefreshM42LogonAsync()
|
||||
{
|
||||
var CM = MethodBase.GetCurrentMethod();
|
||||
LogMethodBegin(CM);
|
||||
try
|
||||
{
|
||||
var userInfo = cFasdCockpitCommunicationBase.CockpitUserInfo;
|
||||
|
||||
if (userInfo == null)
|
||||
return false;
|
||||
|
||||
// do we have a valid M42 token?
|
||||
if (userInfo?.ValidLogonsUntil != null && userInfo.ValidLogonsUntil.TryGetValue(enumAdditionalAuthentication.M42WinLogon, out var logonPeriod))
|
||||
{
|
||||
if (logonPeriod.renewUntil > DateTime.UtcNow)
|
||||
return true;
|
||||
}
|
||||
|
||||
// do we need a logon?
|
||||
var isNeeded = false;
|
||||
if (cFasdCockpitConfig.Instance?.M42Config == null)
|
||||
return false;
|
||||
|
||||
cF4sdCockpitConfigM42 config = cFasdCockpitConfig.Instance.M42Config;
|
||||
if (config.Control == enumM42AuthenticationControl.always)
|
||||
isNeeded = true;
|
||||
else if (config.Control == enumM42AuthenticationControl.auto)
|
||||
{
|
||||
if (userInfo?.additionalLogons == null)
|
||||
return false;
|
||||
|
||||
if (userInfo.additionalLogons.Contains(enumAdditionalAuthentication.M42WinLogon))
|
||||
isNeeded = true;
|
||||
}
|
||||
|
||||
if (!isNeeded)
|
||||
return false;
|
||||
|
||||
// yes, we need a new logon
|
||||
cF4sdCockpitM42BearerTokenInfo tokenInfo = null;
|
||||
cF4SdUserInfoChange userChange = null;
|
||||
switch (config.Method)
|
||||
{
|
||||
case enumM42AuthenticationMethod.passthrough:
|
||||
tokenInfo = await cFasdCockpitCommunicationBase.Instance.M42.ValidateLogonPassthrough();
|
||||
break;
|
||||
case enumM42AuthenticationMethod.basic:
|
||||
var user = config.BasicUser;
|
||||
var pw = PrivateSecurePassword.Instance.Decode(config.BasicPassword);
|
||||
tokenInfo = await cFasdCockpitCommunicationBase.Instance.M42.ValidateLogonBasic(user, pw);
|
||||
break;
|
||||
case enumM42AuthenticationMethod.token:
|
||||
var token = PrivateSecurePassword.Instance.Decode(config.ApiToken);
|
||||
tokenInfo = await cFasdCockpitCommunicationBase.Instance.M42.ValidateLogonToken(token);
|
||||
break;
|
||||
case enumM42AuthenticationMethod.forms:
|
||||
var FormBasedAuth = M42FormBasedAuthentication;
|
||||
userChange = FormBasedAuth?.Invoke();
|
||||
break;
|
||||
}
|
||||
|
||||
if (tokenInfo?.Token != null && tokenInfo.ValidUntil > DateTime.UtcNow)
|
||||
{
|
||||
var tokenRegistration = new cF4SDTokenRegistration()
|
||||
{
|
||||
UserId = userInfo.Id,
|
||||
TokenType = cF4SDTokenRegistration.enumTokenType.M42Bearer,
|
||||
Secret = tokenInfo.Token
|
||||
};
|
||||
|
||||
userChange = await cFasdCockpitCommunicationBase.Instance.RegisterExternalTokenAsync(tokenRegistration);
|
||||
}
|
||||
|
||||
if (userChange != null)
|
||||
{
|
||||
lock (cFasdCockpitCommunicationBase.CockpitUserInfoLock)
|
||||
{
|
||||
userChange.ChangeUserInfo(cFasdCockpitCommunicationBase.CockpitUserInfo);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
catch (Exception E)
|
||||
{
|
||||
LogException(E);
|
||||
}
|
||||
finally
|
||||
{
|
||||
LogMethodEnd(CM);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public void OnApiConnectionStatusChanged()
|
||||
{
|
||||
ConnectionStatusDelegate handler = ApiConnectionStatusChanged;
|
||||
handler?.Invoke(ApiConnectionStatus);
|
||||
}
|
||||
}
|
||||
}
|
||||
148
FasdDesktopUi/Basics/Models/ContainerDataModels.cs
Normal file
148
FasdDesktopUi/Basics/Models/ContainerDataModels.cs
Normal file
@@ -0,0 +1,148 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
|
||||
using FasdDesktopUi.Basics.Enums;
|
||||
using C4IT.FASD.Base;
|
||||
using static C4IT.Logging.cLogManager;
|
||||
|
||||
using MaterialIcons;
|
||||
using F4SD_AdaptableIcon.Enums;
|
||||
using C4IT.F4SD.DisplayFormatting;
|
||||
|
||||
namespace FasdDesktopUi.Basics.Models
|
||||
{
|
||||
public interface IContainerData
|
||||
{
|
||||
bool HasValue { get; }
|
||||
}
|
||||
public interface IContainerHelperClass
|
||||
{
|
||||
int MaxValueCount { get; }
|
||||
bool IsValueRequired { get; }
|
||||
}
|
||||
public interface IContainerCollectionElementData
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public class cContainerCollectionData : List<cContainerData>
|
||||
{
|
||||
public int ColumnSpan { get; set; }
|
||||
}
|
||||
|
||||
public class cContainerData : List<IContainerData>
|
||||
{
|
||||
public string ContainerName { get; set; }
|
||||
public bool IsMaximizable { get; set; }
|
||||
public bool IsAddable { get; set; }
|
||||
public bool IsDeletable { get; set; }
|
||||
}
|
||||
|
||||
public class cContainerStackPanel : IContainerData
|
||||
{
|
||||
public Orientation Orientation { get; set; }
|
||||
public List<IContainerData> StackPanelData { get; set; }
|
||||
|
||||
public bool HasValue { get => StackPanelData?.Any(data => data.HasValue) ?? false; }
|
||||
}
|
||||
|
||||
public class cContainerPrimaryContent : IContainerData
|
||||
{
|
||||
public IContainerData Value { get; set; }
|
||||
|
||||
public bool HasValue { get => Value.HasValue; }
|
||||
}
|
||||
|
||||
public class cContainerValue : IContainerData
|
||||
{
|
||||
public string DisplayValue { get; set; }
|
||||
public string Description { get; set; }
|
||||
public string MaximizeValue { get; set; }
|
||||
public double FontSize { get; set; } = 16;
|
||||
public FontWeight FontWeight { get; set; } = FontWeights.Normal;
|
||||
public bool IsEditOnly { get; set; } = false;
|
||||
public cEditableValueInformationBase EditableValueInformation { get; set; }
|
||||
|
||||
public bool HasValue { get => !string.IsNullOrWhiteSpace(DisplayValue); }
|
||||
}
|
||||
|
||||
public class cContainerIcon : IContainerData
|
||||
{
|
||||
public string IconName { get; set; }
|
||||
public enumIconType IconType { get; set; }
|
||||
public enumHighlightColor HighlightColor { get; set; } = enumHighlightColor.none;
|
||||
public string ToolTipText { get; set; }
|
||||
|
||||
public cContainerIcon()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public cContainerIcon(enumInternIcons internIcon, enumHighlightColor highlightColor = enumHighlightColor.none)
|
||||
{
|
||||
try
|
||||
{
|
||||
IconType = enumIconType.intern;
|
||||
IconName = internIcon.ToString();
|
||||
HighlightColor = highlightColor;
|
||||
}
|
||||
catch (Exception E)
|
||||
{
|
||||
LogException(E);
|
||||
}
|
||||
}
|
||||
|
||||
public cContainerIcon(MaterialIconType materialIcon, enumHighlightColor highlightColor = enumHighlightColor.none)
|
||||
{
|
||||
try
|
||||
{
|
||||
IconType = enumIconType.material;
|
||||
IconName = materialIcon.ToString();
|
||||
HighlightColor = highlightColor;
|
||||
}
|
||||
catch (Exception E)
|
||||
{
|
||||
LogException(E);
|
||||
}
|
||||
}
|
||||
|
||||
public bool HasValue { get => !string.IsNullOrWhiteSpace(IconName); }
|
||||
}
|
||||
|
||||
#region Helpers
|
||||
|
||||
public class cContainerValueHelper : cContainerValue, IContainerHelperClass
|
||||
{
|
||||
public int MaxValueCount { get => RawValues.Count; }
|
||||
public RawValueType DisplayType { get; set; }
|
||||
public List<object> RawValues { get; set; } = new List<object>();
|
||||
public List<object> RawMaximizeValues { get; set; } = new List<object>();
|
||||
public bool IsValueRequired { get; set; }
|
||||
}
|
||||
|
||||
public class cContainerIconHelper : IContainerHelperClass
|
||||
{
|
||||
public int MaxValueCount { get => Icons.Count; }
|
||||
public List<cContainerIcon> Icons { get; set; } = new List<cContainerIcon>();
|
||||
public bool IsValueRequired { get; set; }
|
||||
}
|
||||
|
||||
public class cContainerStackPanelHelper : cContainerStackPanel, IContainerHelperClass
|
||||
{
|
||||
public int MaxValueCount { get => StackPanelHelperData.Max(value => value.MaxValueCount); }
|
||||
public List<IContainerHelperClass> StackPanelHelperData { get; set; } = new List<IContainerHelperClass>();
|
||||
public bool IsValueRequired { get; set; }
|
||||
}
|
||||
|
||||
public class cContainerContentHelper : cContainerPrimaryContent, IContainerHelperClass
|
||||
{
|
||||
public int MaxValueCount { get => Content?.MaxValueCount ?? 1; }
|
||||
public IContainerHelperClass Content { get; set; }
|
||||
public bool IsValueRequired { get; set; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
191
FasdDesktopUi/Basics/Models/DataCanvasDataModel.cs
Normal file
191
FasdDesktopUi/Basics/Models/DataCanvasDataModel.cs
Normal file
@@ -0,0 +1,191 @@
|
||||
using C4IT.FASD.Base;
|
||||
using C4IT.MultiLanguage;
|
||||
using FasdCockpitBase.Models;
|
||||
using FasdDesktopUi.Basics.UserControls;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using static C4IT.Logging.cLogManager;
|
||||
|
||||
namespace FasdDesktopUi.Basics.Models
|
||||
{
|
||||
public class cDataCanvasDataModel
|
||||
{
|
||||
public cRecommendationDataModel RecommendationData { get; set; }
|
||||
|
||||
public Func<Task<cDetailedDataModel>> GetDetailedDataAsync { get; set; }
|
||||
|
||||
public Func<Task<cDetailedChartModel>> GetDatailedChartDataAsync { get; set; }
|
||||
|
||||
public Func<Task<cChartModel>> GetChartDataAsync { get; set; }
|
||||
|
||||
public cDetailedDataModel DetailedData { get; set; }
|
||||
|
||||
public cDetailedChartModel DetailedChartData { get; set; }
|
||||
|
||||
public cChartModel ChartData { get; set; }
|
||||
|
||||
public cQuickActionStatusMonitorModel QuickActionStatusMonitorData { get; set; }
|
||||
}
|
||||
|
||||
public class cRecommendationDataModel
|
||||
{
|
||||
public string Category { get; set; }
|
||||
public string Recommendation { get; set; }
|
||||
}
|
||||
|
||||
public class cDetailedDataModel
|
||||
{
|
||||
public string Heading { get; set; }
|
||||
|
||||
public bool HasColumnHeaders = true;
|
||||
|
||||
public List<object> FullDetailedData { get; set; }
|
||||
}
|
||||
|
||||
public class cDetailedChartModel
|
||||
{
|
||||
public List<object[]> Data { get; set; }
|
||||
public int TimeIndex { get; set; }
|
||||
public int ValueIndex { get; set; }
|
||||
public int DurationIndex { get; set; }
|
||||
public double WarningThreshold { get; set; }
|
||||
public double ErrorThreshold { get; set; }
|
||||
public bool IsThresholdActive { get; set; }
|
||||
public string ChartTitle { get; set; }
|
||||
}
|
||||
|
||||
public class cChartModel
|
||||
{
|
||||
public List<object[]> Data { get; set; }
|
||||
public int TimeIndex { get; set; }
|
||||
public int ValueIndex { get; set; }
|
||||
public int DurationIndex { get; set; }
|
||||
public double WarningThreshold { get; set; }
|
||||
public double ErrorThreshold { get; set; }
|
||||
public bool IsThresholdActive { get; set; }
|
||||
public bool IsDirectionUp { get; set; }
|
||||
public string ChartTitle { get; set; }
|
||||
public int StepLengthScale { get; set; }
|
||||
public int StepLengthLine { get; set; }
|
||||
public int MaxValue { get; set; }
|
||||
public int MinValue { get; set; }
|
||||
public string UnitFormat { get; set; }
|
||||
}
|
||||
|
||||
public class cQuickActionStatusMonitorModel
|
||||
{
|
||||
public class cQuickActionStep : INotifyPropertyChanged
|
||||
{
|
||||
public enum enumActionStepType
|
||||
{
|
||||
main,
|
||||
connectingToClient,
|
||||
waitingForUserAcceptance,
|
||||
running,
|
||||
finished
|
||||
}
|
||||
|
||||
private enumQuickActionRevisionStatus status;
|
||||
public enumQuickActionRevisionStatus Status
|
||||
{
|
||||
get => status; set
|
||||
{
|
||||
status = value;
|
||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(Status)));
|
||||
}
|
||||
}
|
||||
|
||||
public string DisplayName { get; private set; }
|
||||
public string QuickActionName { get; private set; }
|
||||
public enumActionStepType StepType { get; private set; }
|
||||
public List<cQuickActionStep> SubSteps { get; set; }
|
||||
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
|
||||
public cQuickActionStep(string displayName, string quickActionName, enumActionStepType stepType)
|
||||
{
|
||||
DisplayName = displayName;
|
||||
QuickActionName = quickActionName;
|
||||
StepType = stepType;
|
||||
}
|
||||
|
||||
public static void SetQuickActionStepStatuses(List<cQuickActionStep> actionSteps, string quickActionName, enumActionStepType type, enumQuickActionRevisionStatus status = enumQuickActionRevisionStatus.finishedSuccessfull)
|
||||
{
|
||||
try
|
||||
{
|
||||
foreach (var step in actionSteps)
|
||||
{
|
||||
if (step.StepType.Equals(type) && step.QuickActionName.Equals(quickActionName))
|
||||
step.Status = status;
|
||||
|
||||
if (step.SubSteps?.Count > 0)
|
||||
SetQuickActionStepStatuses(step.SubSteps, quickActionName, type, status);
|
||||
}
|
||||
}
|
||||
catch (Exception E)
|
||||
{
|
||||
LogException(E);
|
||||
}
|
||||
}
|
||||
|
||||
public static void CancelRemainingQuickActionSteps(List<cQuickActionStep> actionSteps)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (actionSteps is null || actionSteps.Count <= 0)
|
||||
return;
|
||||
|
||||
foreach (var step in actionSteps)
|
||||
{
|
||||
if (step.Status == enumQuickActionRevisionStatus.inProgress)
|
||||
step.Status = enumQuickActionRevisionStatus.canceled;
|
||||
|
||||
CancelRemainingQuickActionSteps(step.SubSteps);
|
||||
}
|
||||
}
|
||||
catch (Exception E)
|
||||
{
|
||||
LogException(E);
|
||||
}
|
||||
}
|
||||
|
||||
internal static void SetAllQuickActionStepStatuses(List<cQuickActionStep> actionSteps, enumQuickActionRevisionStatus status = enumQuickActionRevisionStatus.inProgress)
|
||||
{
|
||||
try
|
||||
{
|
||||
foreach (var step in actionSteps)
|
||||
{
|
||||
step.Status = status;
|
||||
|
||||
if (step.SubSteps?.Count > 0)
|
||||
SetAllQuickActionStepStatuses(step.SubSteps, status);
|
||||
}
|
||||
}
|
||||
catch (Exception E)
|
||||
{
|
||||
LogException(E);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public bool RequiresUserPermission { get; set; }
|
||||
|
||||
public cFasdQuickAction QuickActionDefinition { get; set; }
|
||||
|
||||
public string ActionName { get; set; }
|
||||
|
||||
public List<cQuickActionStep> ActionSteps { get; set; }
|
||||
|
||||
public Dictionary<string, cAdjustableParameter> QuickActionParameters { get; set; }
|
||||
|
||||
public delegate Task<List<object>> RunQuickActionDelegate(CancellationToken token, Dictionary<cAdjustableParameter, object> ParameterDictionary = null);
|
||||
|
||||
public RunQuickActionDelegate RunQuickAction { get; set; }
|
||||
}
|
||||
}
|
||||
31
FasdDesktopUi/Basics/Models/DataHistoryValueModel.cs
Normal file
31
FasdDesktopUi/Basics/Models/DataHistoryValueModel.cs
Normal file
@@ -0,0 +1,31 @@
|
||||
using FasdDesktopUi.Basics.Enums;
|
||||
using FasdDesktopUi.Basics.UiActions;
|
||||
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Converters;
|
||||
|
||||
namespace FasdDesktopUi.Basics.Models
|
||||
{
|
||||
public class cDataHistoryValueModel
|
||||
{
|
||||
public string Content { get; set; }
|
||||
|
||||
private string contentDecription;
|
||||
public string ContentDescription
|
||||
{
|
||||
get { return contentDecription ?? Content; }
|
||||
set { contentDecription = value; }
|
||||
}
|
||||
|
||||
public bool IsLoading { get; set; } = false;
|
||||
|
||||
[JsonConverter(typeof(StringEnumConverter))]
|
||||
public enumHighlightColor? HighlightColor { get; set; }
|
||||
|
||||
[JsonIgnore]
|
||||
public cUiActionBase UiAction { get; set; }
|
||||
|
||||
[JsonIgnore]
|
||||
public cStateThresholdValues ThresholdValues { get; set; }
|
||||
}
|
||||
}
|
||||
27
FasdDesktopUi/Basics/Models/EditableValueInformation.cs
Normal file
27
FasdDesktopUi/Basics/Models/EditableValueInformation.cs
Normal file
@@ -0,0 +1,27 @@
|
||||
using C4IT.FASD.Base;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace FasdDesktopUi.Basics.Models
|
||||
{
|
||||
public abstract class cEditableValueInformationBase
|
||||
{
|
||||
public string Description { get; set; }
|
||||
public object CurrentValue { get; set; }
|
||||
public Guid Id { get; set; } = Guid.Empty;
|
||||
public cValueAddress DatabaseInfo { get; set; }
|
||||
}
|
||||
|
||||
public class cEditValueInformationSelection : cEditableValueInformationBase
|
||||
{
|
||||
public List<KeyValuePair<object, string>> SelectionValues { get; set; }
|
||||
}
|
||||
|
||||
public class cEditValueInformationText : cEditableValueInformationBase
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
19
FasdDesktopUi/Basics/Models/HeadingDataModel.cs
Normal file
19
FasdDesktopUi/Basics/Models/HeadingDataModel.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
using C4IT.FASD.Base;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace FasdDesktopUi.Basics.Models
|
||||
{
|
||||
public class cHeadingDataModel
|
||||
{
|
||||
public string HeadingText { get; set; }
|
||||
public enumFasdInformationClass InformationClass { get; set; }
|
||||
public bool IsOnline { get; set; }
|
||||
public cF4sdIdentityList Identities { get; set; }
|
||||
}
|
||||
|
||||
public class cSwapCaseInfo
|
||||
{
|
||||
public enumFasdInformationClass SelectedCaseInformationClass { get; set; }
|
||||
public List<cHeadingDataModel> HeadingDatas { get; set; }
|
||||
}
|
||||
}
|
||||
88
FasdDesktopUi/Basics/Models/HotKeyInformation.cs
Normal file
88
FasdDesktopUi/Basics/Models/HotKeyInformation.cs
Normal file
@@ -0,0 +1,88 @@
|
||||
using C4IT.MultiLanguage;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Input;
|
||||
using static C4IT.Logging.cLogManager;
|
||||
|
||||
namespace FasdDesktopUi.Basics.Models
|
||||
{
|
||||
public class cHotKeyCategoryInformation
|
||||
{
|
||||
public cMultiLanguageDictionary Names { get; set; } = new cMultiLanguageDictionary();
|
||||
public List<cHotKeyInformation> HotKeyInformation { get; set; }
|
||||
}
|
||||
|
||||
public class cHotKeyInformation
|
||||
{
|
||||
public cMultiLanguageDictionary Names { get; set; } = new cMultiLanguageDictionary();
|
||||
public List<ModifierKeys> Modifiers { get; set; } = new List<ModifierKeys>();
|
||||
public Key HotKey { get; set; }
|
||||
public Key? AlternativeKey { get; set; }
|
||||
|
||||
public string GetKeyDisplayString(Key key)
|
||||
{
|
||||
string output = key.ToString();
|
||||
try
|
||||
{
|
||||
switch (key)
|
||||
{
|
||||
case Key.Tab:
|
||||
output = "Tab ↹";
|
||||
break;
|
||||
case Key.Enter:
|
||||
output = "Enter ↲";
|
||||
break;
|
||||
case Key.Escape:
|
||||
output = "ESC";
|
||||
break;
|
||||
case Key.Space:
|
||||
output = " ";
|
||||
break;
|
||||
case Key.Left:
|
||||
output = "←";
|
||||
break;
|
||||
case Key.Up:
|
||||
output = "↑";
|
||||
break;
|
||||
case Key.Right:
|
||||
output = "→";
|
||||
break;
|
||||
case Key.Down:
|
||||
output = "↓";
|
||||
break;
|
||||
case Key.Multiply:
|
||||
output = "*";
|
||||
break;
|
||||
case Key.OemPlus:
|
||||
case Key.Add:
|
||||
output = "+";
|
||||
break;
|
||||
case Key.OemMinus:
|
||||
case Key.Separator:
|
||||
case Key.Subtract:
|
||||
output = "-";
|
||||
break;
|
||||
case Key.Decimal:
|
||||
output = ",";
|
||||
break;
|
||||
case Key.Divide:
|
||||
output = "/";
|
||||
break;
|
||||
case Key.NumPad0:
|
||||
case Key.D0:
|
||||
output = "0";
|
||||
break;
|
||||
}
|
||||
}
|
||||
catch (Exception E)
|
||||
{
|
||||
LogException(E);
|
||||
}
|
||||
return output;
|
||||
}
|
||||
}
|
||||
}
|
||||
36
FasdDesktopUi/Basics/Models/IBlurrable.cs
Normal file
36
FasdDesktopUi/Basics/Models/IBlurrable.cs
Normal file
@@ -0,0 +1,36 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Web.UI;
|
||||
using System.Windows;
|
||||
|
||||
namespace FasdDesktopUi.Basics.Models
|
||||
{
|
||||
public interface IBlurrable
|
||||
{
|
||||
bool IsBlurred { get; set; }
|
||||
|
||||
List<IBlurInvoker> BlurInvokers { get; set; }
|
||||
|
||||
void UpdateBlurStatus(object sender);
|
||||
}
|
||||
|
||||
public interface IBlurInvoker
|
||||
{
|
||||
bool BlurInvoker_IsActive { get; }
|
||||
|
||||
void BlurInvoker_IsActiveChanged(object sender, DependencyPropertyChangedEventArgs e);
|
||||
}
|
||||
|
||||
public static class BlurInvoker
|
||||
{
|
||||
public static event EventHandler BlurInvokerVisibilityChanged = delegate { };
|
||||
|
||||
public static void InvokeVisibilityChanged(object sender, EventArgs e)
|
||||
{
|
||||
BlurInvokerVisibilityChanged?.Invoke(sender, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
174
FasdDesktopUi/Basics/Models/IFocusInvoker.cs
Normal file
174
FasdDesktopUi/Basics/Models/IFocusInvoker.cs
Normal file
@@ -0,0 +1,174 @@
|
||||
using FasdDesktopUi.Basics.Helper;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using static C4IT.Logging.cLogManager;
|
||||
|
||||
namespace FasdDesktopUi.Basics.Models
|
||||
{
|
||||
public interface IFocusInvoker
|
||||
{
|
||||
int? ParentIndex { get; }
|
||||
UIElement ParentElement { get; }
|
||||
}
|
||||
|
||||
public static class cFocusInvoker
|
||||
{
|
||||
public static EventHandler GotFocus = delegate { };
|
||||
public static EventHandler LostFocus = delegate { };
|
||||
|
||||
private static void ReAllocate(this IFocusInvoker focusInvoker)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (!(focusInvoker is FrameworkElement focusInvokerElement))
|
||||
return;
|
||||
|
||||
if (focusInvoker.ParentElement is null)
|
||||
return;
|
||||
|
||||
if (focusInvokerElement.Parent is Panel actualParentPanel)
|
||||
actualParentPanel.Children.Remove(focusInvokerElement);
|
||||
else if (focusInvokerElement.Parent is Decorator actualParentDecorator)
|
||||
actualParentDecorator.Child = null;
|
||||
else
|
||||
return;
|
||||
|
||||
if (focusInvoker.ParentElement is Panel parentPanel)
|
||||
{
|
||||
if (focusInvoker.ParentIndex != null)
|
||||
{
|
||||
parentPanel.Children.RemoveAt(focusInvoker.ParentIndex.Value);
|
||||
parentPanel.Children.Insert(focusInvoker.ParentIndex.Value, focusInvokerElement);
|
||||
}
|
||||
else
|
||||
{
|
||||
parentPanel.Children.Add(focusInvokerElement);
|
||||
}
|
||||
}
|
||||
else if (focusInvoker.ParentElement is Decorator parentDecorator)
|
||||
{
|
||||
parentDecorator.Child = focusInvokerElement;
|
||||
}
|
||||
}
|
||||
catch (Exception E)
|
||||
{
|
||||
LogException(E);
|
||||
}
|
||||
}
|
||||
|
||||
private static void ReAllocate(this FrameworkElement focusInvokerElement)
|
||||
{
|
||||
try
|
||||
{
|
||||
var preFocusParent = GetPreFocusParent(focusInvokerElement);
|
||||
|
||||
if (preFocusParent is null)
|
||||
return;
|
||||
|
||||
if (focusInvokerElement.Parent is Panel actualParentPanel)
|
||||
actualParentPanel.Children.Remove(focusInvokerElement);
|
||||
else if (focusInvokerElement.Parent is Decorator actualParentDecorator)
|
||||
actualParentDecorator.Child = null;
|
||||
else
|
||||
return;
|
||||
|
||||
if (preFocusParent is Panel parentPanel)
|
||||
{
|
||||
var preFocusChildIndex = GetPreFocusChildIndex(focusInvokerElement);
|
||||
|
||||
if (preFocusChildIndex != null)
|
||||
{
|
||||
parentPanel.Children.RemoveAt(preFocusChildIndex.Value);
|
||||
parentPanel.Children.Insert(preFocusChildIndex.Value, focusInvokerElement);
|
||||
}
|
||||
else
|
||||
{
|
||||
parentPanel.Children.Add(focusInvokerElement);
|
||||
}
|
||||
}
|
||||
else if (preFocusParent is Decorator parentDecorator)
|
||||
{
|
||||
parentDecorator.Child = focusInvokerElement;
|
||||
}
|
||||
}
|
||||
catch (Exception E)
|
||||
{
|
||||
LogException(E);
|
||||
}
|
||||
}
|
||||
|
||||
public static void InvokeGotFocus(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (sender is FrameworkElement senderElement)
|
||||
{
|
||||
SetPreFocusParent(senderElement, senderElement.Parent);
|
||||
|
||||
if (senderElement.Parent is Panel actualParentPanel)
|
||||
SetPreFocusChildIndex(senderElement, actualParentPanel.Children.IndexOf(senderElement));
|
||||
}
|
||||
|
||||
GotFocus?.Invoke(sender, e);
|
||||
}
|
||||
catch (Exception E)
|
||||
{
|
||||
LogException(E);
|
||||
}
|
||||
}
|
||||
|
||||
public static void InvokeLostFocus(object sender, EventArgs e)
|
||||
{
|
||||
LostFocus?.Invoke(sender, e);
|
||||
|
||||
if (sender is IFocusInvoker focusSender)
|
||||
focusSender.ReAllocate();
|
||||
else if (sender is FrameworkElement senderElement)
|
||||
senderElement.ReAllocate();
|
||||
}
|
||||
|
||||
#region Attached Properties
|
||||
|
||||
#region PreFocusChildIndex
|
||||
|
||||
private static int? GetPreFocusChildIndex(DependencyObject obj)
|
||||
{
|
||||
return (int?)obj.GetValue(PreFocusChildIndexProperty);
|
||||
}
|
||||
|
||||
private static void SetPreFocusChildIndex(DependencyObject obj, int? value)
|
||||
{
|
||||
obj.SetValue(PreFocusChildIndexProperty, value);
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty PreFocusChildIndexProperty =
|
||||
DependencyProperty.RegisterAttached("PreFocusChildIndex", typeof(int?), typeof(UIElement), new PropertyMetadata(null));
|
||||
|
||||
#endregion
|
||||
|
||||
#region PreFocusParent
|
||||
|
||||
private static DependencyObject GetPreFocusParent(DependencyObject obj)
|
||||
{
|
||||
return (DependencyObject)obj.GetValue(PreFocusParentProperty);
|
||||
}
|
||||
|
||||
private static void SetPreFocusParent(DependencyObject obj, DependencyObject value)
|
||||
{
|
||||
obj.SetValue(PreFocusParentProperty, value);
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty PreFocusParentProperty =
|
||||
DependencyProperty.RegisterAttached("PreFocusParent", typeof(DependencyObject), typeof(UIElement), new PropertyMetadata(null));
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
199
FasdDesktopUi/Basics/Models/MenuDataModel.cs
Normal file
199
FasdDesktopUi/Basics/Models/MenuDataModel.cs
Normal file
@@ -0,0 +1,199 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using C4IT.FASD.Base;
|
||||
using F4SD_AdaptableIcon;
|
||||
using F4SD_AdaptableIcon.Enums;
|
||||
using FasdDesktopUi.Basics.Converter;
|
||||
using FasdDesktopUi.Basics.UiActions;
|
||||
using static C4IT.Logging.cLogManager;
|
||||
|
||||
namespace FasdDesktopUi.Basics.Models
|
||||
{
|
||||
//todo: check what properties can/should be set via constructor
|
||||
|
||||
public class cMenuDataBase
|
||||
{
|
||||
public string MenuText { get; set; }
|
||||
|
||||
public string SubMenuText { get; set; }
|
||||
|
||||
public string TrailingText { get; set; }
|
||||
|
||||
public IconData MenuIcon { get; set; }
|
||||
|
||||
public double MenuIconSize { get; set; } = 1.0;
|
||||
|
||||
public int IconPositionIndex { get; set; }
|
||||
|
||||
public object Data { get; set; }
|
||||
|
||||
public List<string> MenuSections { get; set; }
|
||||
|
||||
public cUiActionBase UiAction { get; set; }
|
||||
|
||||
public cMenuDataBase()
|
||||
{
|
||||
}
|
||||
public cMenuDataBase(cFasdBaseConfigMenuItem menuItem)
|
||||
{
|
||||
MenuText = menuItem.Names.GetValue(Default: null);
|
||||
MenuIcon = IconDataConverter.Convert(menuItem.Icon);
|
||||
MenuSections = menuItem.Sections;
|
||||
}
|
||||
|
||||
public cMenuDataBase(cFasdQuickAction quickAction, Enums.enumActionDisplayType display) : this(quickAction)
|
||||
{
|
||||
SetUiActionDisplayType(display);
|
||||
}
|
||||
|
||||
|
||||
public cMenuDataBase(cFasdQuickAction quickAction) : this((cFasdBaseConfigMenuItem)quickAction)
|
||||
{
|
||||
var tempUiAction = cUiActionBase.GetUiAction(quickAction);
|
||||
tempUiAction.Name = quickAction.Name;
|
||||
tempUiAction.Description = quickAction.Descriptions?.GetValue(Default: null);
|
||||
tempUiAction.AlternativeDescription = quickAction.AlternativeDescriptions?.GetValue(Default: null);
|
||||
UiAction = tempUiAction;
|
||||
}
|
||||
|
||||
public cMenuDataBase(cCopyTemplate copyTemplate) : this((cFasdBaseConfigMenuItem)copyTemplate)
|
||||
{
|
||||
UiAction = new cUiCopyAction(copyTemplate) { Name = copyTemplate.Name, Description = copyTemplate.Descriptions.GetValue(Default: null), DisplayType = Enums.enumActionDisplayType.enabled };
|
||||
}
|
||||
|
||||
public cMenuDataBase(cFasdMenuSection menuSection) : this((cFasdBaseConfigMenuItem)menuSection)
|
||||
{
|
||||
IconPositionIndex = -1;
|
||||
}
|
||||
|
||||
public cMenuDataBase(cFasdQuickTip quickTip) : this((cFasdBaseConfigMenuItem)quickTip)
|
||||
{
|
||||
UiAction = new cUiQuickTipAction(quickTip) { DisplayType = Enums.enumActionDisplayType.enabled };
|
||||
}
|
||||
|
||||
public void SetUiActionDisplayType(Enums.enumActionDisplayType display)
|
||||
{
|
||||
if (this.UiAction != null)
|
||||
this.UiAction.DisplayType = display;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public class cMenuDataContainer : cMenuDataBase
|
||||
{
|
||||
public string ContainerName { get; private set; }
|
||||
public List<cMenuDataBase> SubMenuData { get; set; }
|
||||
|
||||
public cMenuDataContainer()
|
||||
{
|
||||
UiAction = new cSubMenuAction(true) { Name = MenuText, DisplayType = Enums.enumActionDisplayType.enabled };
|
||||
}
|
||||
|
||||
public cMenuDataContainer(cFasdMenuSection menuSection) : base(menuSection)
|
||||
{
|
||||
ContainerName = menuSection.TechName;
|
||||
UiAction = new cSubMenuAction(true) { Name = MenuText, DisplayType = Enums.enumActionDisplayType.enabled };
|
||||
}
|
||||
}
|
||||
|
||||
public class cMenuDataSearchResult : cMenuDataBase
|
||||
{
|
||||
public cMenuDataSearchResult(string menuText, ISearchUiProvider SearchUiProvider, List<cFasdApiSearchResultEntry> searchResults) : base()
|
||||
{
|
||||
if (searchResults?.Count <= 0)
|
||||
return;
|
||||
|
||||
MenuText = menuText;
|
||||
UiAction = new cUiProcessSearchResultAction(menuText, SearchUiProvider, searchResults);
|
||||
var firstSearchResult = searchResults.First();
|
||||
MenuIcon = GetMenuIcon(firstSearchResult.Type, firstSearchResult.Infos);
|
||||
}
|
||||
|
||||
static public IconData GetMenuIcon(enumF4sdSearchResultClass searchResultClass, Dictionary<string, string> infos)
|
||||
{
|
||||
switch (searchResultClass)
|
||||
{
|
||||
case enumF4sdSearchResultClass.Computer:
|
||||
return new IconData(enumInternIcons.misc_computer);
|
||||
case enumF4sdSearchResultClass.User:
|
||||
return new IconData(enumInternIcons.misc_user);
|
||||
case enumF4sdSearchResultClass.Phone:
|
||||
return new IconData(MaterialIcons.MaterialIconType.ic_phone);
|
||||
case enumF4sdSearchResultClass.Ticket:
|
||||
return new IconData(enumInternIcons.misc_ticket);
|
||||
case enumF4sdSearchResultClass.MobileDevice:
|
||||
return new IconData(MaterialIcons.MaterialIconType.ic_smartphone);
|
||||
case enumF4sdSearchResultClass.VirtualSession:
|
||||
if (!infos.TryGetValue("Status", out string status))
|
||||
return new IconData(MaterialIcons.MaterialIconType.ic_cloud_off);
|
||||
else if (status == nameof(enumCitrixSessionStatus.Active))
|
||||
return new IconData(MaterialIcons.MaterialIconType.ic_cloud_queue);
|
||||
else
|
||||
return new IconData(MaterialIcons.MaterialIconType.ic_cloud_off);
|
||||
default:
|
||||
return new IconData(MaterialIcons.MaterialIconType.ic_more_vert);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public sealed class cMenuDataSearchRelation : cMenuDataBase
|
||||
{
|
||||
public readonly DateTime LastUsed;
|
||||
public readonly double UsingLevel = 0;
|
||||
public readonly Dictionary<string, string> Infos = null;
|
||||
public bool IsMatchingRelation = false;
|
||||
public bool IsUsedForCaseEnrichment = false;
|
||||
|
||||
public readonly cF4sdApiSearchResultRelation searchResultRelation = null;
|
||||
|
||||
public cMenuDataSearchRelation(cF4sdApiSearchResultRelation searchResultRelation)
|
||||
{
|
||||
try
|
||||
{
|
||||
UiAction = null;
|
||||
|
||||
if (searchResultRelation is null)
|
||||
return;
|
||||
|
||||
this.searchResultRelation = searchResultRelation;
|
||||
MenuText = searchResultRelation.DisplayName;
|
||||
Data = searchResultRelation;
|
||||
LastUsed = searchResultRelation.LastUsed;
|
||||
UsingLevel = searchResultRelation.UsingLevel;
|
||||
Infos = searchResultRelation.Infos;
|
||||
MenuIcon = cMenuDataSearchResult.GetMenuIcon(searchResultRelation.Type, searchResultRelation.Infos);
|
||||
}
|
||||
catch (Exception E)
|
||||
{
|
||||
LogException(E);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public sealed class cMenuDataLoading : cMenuDataBase
|
||||
{
|
||||
public cMenuDataLoading(string LoadingText)
|
||||
{
|
||||
MenuText = LoadingText;
|
||||
}
|
||||
}
|
||||
|
||||
public class cFilteredResults
|
||||
{
|
||||
public bool AutoContinue { get; set; } = false;
|
||||
public cFasdApiSearchResultCollection Results { get; set; }
|
||||
|
||||
public cF4sdApiSearchResultRelation PreSelectedRelation { get; set; }
|
||||
|
||||
public cFilteredResults()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public cFilteredResults(cFasdApiSearchResultCollection _results)
|
||||
{
|
||||
Results = _results ?? new cFasdApiSearchResultCollection();
|
||||
}
|
||||
}
|
||||
}
|
||||
223
FasdDesktopUi/Basics/Models/NamedParameterEntry.cs
Normal file
223
FasdDesktopUi/Basics/Models/NamedParameterEntry.cs
Normal file
@@ -0,0 +1,223 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Windows;
|
||||
|
||||
using C4IT.F4SD.DisplayFormatting;
|
||||
using C4IT.FASD.Base;
|
||||
|
||||
using FasdCockpitBase;
|
||||
using FasdDesktopUi.Basics.Services.ProtocollService;
|
||||
using static C4IT.Logging.cLogManager;
|
||||
|
||||
namespace FasdDesktopUi.Basics.Models
|
||||
{
|
||||
public abstract class cNamedParameterEntryBase : FasdCockpitBase.cExternalToolExecutor.iNamedParameter
|
||||
{
|
||||
internal readonly cSupportCaseDataProvider dataProvider;
|
||||
|
||||
public string Title { get; set; }
|
||||
|
||||
public cNamedParameterEntryBase(cSupportCaseDataProvider dataProvider)
|
||||
{
|
||||
this.dataProvider = dataProvider;
|
||||
}
|
||||
|
||||
public abstract string GetValue();
|
||||
public abstract string GetHtmlValue();
|
||||
public virtual (string Title, string Value) GetTitleValuePair()
|
||||
{
|
||||
return (Title, GetValue());
|
||||
}
|
||||
}
|
||||
|
||||
public class cNamedParameterEntryPointer : cNamedParameterEntryBase
|
||||
{
|
||||
private readonly cValueAddress valueAdress;
|
||||
private readonly RawValueType display;
|
||||
|
||||
public cNamedParameterEntryPointer(cSupportCaseDataProvider dataProvider, cValueAddress valueAdress, RawValueType display = RawValueType.STRING) : base(dataProvider)
|
||||
{
|
||||
this.valueAdress = valueAdress;
|
||||
this.valueAdress = valueAdress;
|
||||
this.display = display;
|
||||
}
|
||||
|
||||
public override string GetValue()
|
||||
{
|
||||
var output = string.Empty;
|
||||
|
||||
try
|
||||
{
|
||||
IRawValueFormatter formatter = new RawValueFormatter();
|
||||
formatter.SetDefaultCulture(new System.Globalization.CultureInfo(cFasdCockpitConfig.Instance.SelectedLanguage));
|
||||
|
||||
var outputTable = dataProvider.HealthCardDataHelper.HealthCardRawData.GetTableByName(valueAdress.ValueTable, true);
|
||||
if (outputTable != null)
|
||||
if (outputTable.Columns.TryGetValue(valueAdress.ValueColumn, out var outpuColumn))
|
||||
output = formatter.GetDisplayValue(outpuColumn.Values[valueAdress.DayIndex], display);
|
||||
}
|
||||
catch (Exception E)
|
||||
{
|
||||
LogException(E);
|
||||
}
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
public override string GetHtmlValue()
|
||||
{
|
||||
return GetValue();
|
||||
}
|
||||
}
|
||||
|
||||
public class cNamedParameterEntryCopyTemplate : cNamedParameterEntryBase
|
||||
{
|
||||
private readonly string copyTemplateName;
|
||||
|
||||
public cNamedParameterEntryCopyTemplate(cSupportCaseDataProvider dataProvider, string copyTemplateName) : base(dataProvider)
|
||||
{
|
||||
this.copyTemplateName = copyTemplateName;
|
||||
}
|
||||
|
||||
public override string GetValue()
|
||||
{
|
||||
var output = string.Empty;
|
||||
try
|
||||
{
|
||||
if (cF4SDCockpitXmlConfig.Instance?.CopyTemplateConfig?.CopyTemplates.CopyTemplates.TryGetValue(copyTemplateName, out var selectedCopyTemplate) ?? false)
|
||||
if (selectedCopyTemplate.CopyContentList.TryGetValue(enumCopyContentFormat.UNICODE, out var selectedCopyContent))
|
||||
output = dataProvider.HealthCardDataHelper.ReplaceNamedParameters(selectedCopyContent.Content, false);
|
||||
}
|
||||
catch (Exception E)
|
||||
{
|
||||
LogException(E);
|
||||
}
|
||||
return output;
|
||||
}
|
||||
|
||||
public override string GetHtmlValue()
|
||||
{
|
||||
var output = string.Empty;
|
||||
try
|
||||
{
|
||||
if (cF4SDCockpitXmlConfig.Instance?.CopyTemplateConfig?.CopyTemplates.CopyTemplates.TryGetValue(copyTemplateName, out var selectedCopyTemplate) ?? false)
|
||||
{
|
||||
if (selectedCopyTemplate.CopyContentList.TryGetValue(enumCopyContentFormat.HTML, out var selectedCopyContent))
|
||||
output = dataProvider.HealthCardDataHelper.ReplaceNamedParameters(selectedCopyContent.Content, true);
|
||||
else if (selectedCopyTemplate.CopyContentList.TryGetValue(enumCopyContentFormat.UNICODE, out var selectedCopyContentUnicode))
|
||||
output = dataProvider.HealthCardDataHelper.ReplaceNamedParameters(selectedCopyContentUnicode.Content, false);
|
||||
}
|
||||
}
|
||||
catch (Exception E)
|
||||
{
|
||||
LogException(E);
|
||||
}
|
||||
return output;
|
||||
}
|
||||
}
|
||||
|
||||
public class cNamedParameterEntryQuickActionResult : cNamedParameterEntryBase
|
||||
{
|
||||
public cNamedParameterEntryQuickActionResult(cSupportCaseDataProvider dataProvider) : base(dataProvider)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override string GetValue()
|
||||
{
|
||||
var output = string.Empty;
|
||||
try
|
||||
{
|
||||
var quickActionResult = F4SDProtocoll.Instance.GetLatestOfTypeAsDataObject<QuickActionProtocollEntry>(false);
|
||||
output = quickActionResult.GetText();
|
||||
}
|
||||
catch (Exception E)
|
||||
{
|
||||
LogException(E);
|
||||
}
|
||||
return output;
|
||||
}
|
||||
|
||||
public override string GetHtmlValue()
|
||||
{
|
||||
var output = string.Empty;
|
||||
try
|
||||
{
|
||||
var quickActionResult = F4SDProtocoll.Instance.GetLatestOfTypeAsDataObject<QuickActionProtocollEntry>(true);
|
||||
output = quickActionResult.GetText(TextDataFormat.Html);
|
||||
}
|
||||
catch (Exception E)
|
||||
{
|
||||
LogException(E);
|
||||
}
|
||||
return output;
|
||||
}
|
||||
}
|
||||
|
||||
public class cNamedParameterEntryQuickActionResultProtocol : cNamedParameterEntryBase
|
||||
{
|
||||
public cNamedParameterEntryQuickActionResultProtocol(cSupportCaseDataProvider dataProvider) : base(dataProvider)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override string GetValue()
|
||||
{
|
||||
var output = string.Empty;
|
||||
try
|
||||
{
|
||||
var quickActionResult = F4SDProtocoll.Instance.GetAllAsDataObject(false); // dataProvider.QuickActionProtocollHelper.GetFullProtocollQuickActionResult();
|
||||
output = quickActionResult.GetText();
|
||||
}
|
||||
catch (Exception E)
|
||||
{
|
||||
LogException(E);
|
||||
}
|
||||
return output;
|
||||
}
|
||||
|
||||
public override string GetHtmlValue()
|
||||
{
|
||||
var output = string.Empty;
|
||||
try
|
||||
{
|
||||
var quickActionResult = F4SDProtocoll.Instance.GetAllAsDataObject(false); // dataProvider.QuickActionProtocollHelper.GetFullProtocollQuickActionResult();
|
||||
output = quickActionResult.GetText(TextDataFormat.Html);
|
||||
}
|
||||
catch (Exception E)
|
||||
{
|
||||
LogException(E);
|
||||
}
|
||||
return output;
|
||||
}
|
||||
}
|
||||
|
||||
public class cNamedParameterList : Dictionary<string, cNamedParameterEntryBase>
|
||||
{
|
||||
public cNamedParameterList()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public cNamedParameterList(cSupportCaseDataProvider dataProvider)
|
||||
{
|
||||
try
|
||||
{
|
||||
Add("F4SD_QuickActionProtocolLast", new cNamedParameterEntryQuickActionResult(dataProvider));
|
||||
Add("F4SD_QuickActionProtocol", new cNamedParameterEntryQuickActionResultProtocol(dataProvider));
|
||||
}
|
||||
catch (Exception E)
|
||||
{
|
||||
LogException(E);
|
||||
}
|
||||
}
|
||||
|
||||
public Dictionary<string, FasdCockpitBase.cExternalToolExecutor.iNamedParameter> ToInterfaceDictionary()
|
||||
{
|
||||
var output = new Dictionary<string, FasdCockpitBase.cExternalToolExecutor.iNamedParameter>();
|
||||
foreach (var entry in this)
|
||||
output.Add(entry.Key, entry.Value);
|
||||
return output;
|
||||
}
|
||||
}
|
||||
}
|
||||
19
FasdDesktopUi/Basics/Models/QuickActionCopyData.cs
Normal file
19
FasdDesktopUi/Basics/Models/QuickActionCopyData.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
using FasdDesktopUi.Basics.UserControls;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace FasdDesktopUi.Basics.Models
|
||||
{
|
||||
public class cQuickActionCopyData
|
||||
{
|
||||
public DateTime ExecutionTime { get; set; }
|
||||
public string Name { get; set; }
|
||||
public string AffectedDeviceName { get; set; }
|
||||
public bool WasRunningOnAffectedDevice { get; set; }
|
||||
public QuickActionStatusMonitor.cQuickActionOutput QuickActionOutput { get; set; }
|
||||
public List<QuickActionStatusMonitor.cQuickActionMeasureValue> MeasureValues { get; set; }
|
||||
}
|
||||
}
|
||||
11
FasdDesktopUi/Basics/Models/StateThresholdValues.cs
Normal file
11
FasdDesktopUi/Basics/Models/StateThresholdValues.cs
Normal file
@@ -0,0 +1,11 @@
|
||||
using C4IT.FASD.Base;
|
||||
|
||||
namespace FasdDesktopUi.Basics.Models
|
||||
{
|
||||
public class cStateThresholdValues
|
||||
{
|
||||
public object Value;
|
||||
public cHealthCardStateBase StateDefinition;
|
||||
public int ReferenceDays;
|
||||
}
|
||||
}
|
||||
233
FasdDesktopUi/Basics/Models/TicketOverviewModel.cs
Normal file
233
FasdDesktopUi/Basics/Models/TicketOverviewModel.cs
Normal file
@@ -0,0 +1,233 @@
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace FasdDesktopUi.Basics.Models
|
||||
{
|
||||
public class TicketOverviewModel : INotifyPropertyChanged
|
||||
{
|
||||
#region Selections-Properties
|
||||
|
||||
private bool _ticketsNewSelected;
|
||||
public bool TicketsNewSelected
|
||||
{
|
||||
get => _ticketsNewSelected;
|
||||
set { if (_ticketsNewSelected != value) { _ticketsNewSelected = value; OnPropertyChanged(nameof(TicketsNewSelected)); } }
|
||||
}
|
||||
|
||||
private bool _ticketsActiveSelected;
|
||||
public bool TicketsActiveSelected
|
||||
{
|
||||
get => _ticketsActiveSelected;
|
||||
set { if (_ticketsActiveSelected != value) { _ticketsActiveSelected = value; OnPropertyChanged(nameof(TicketsActiveSelected)); } }
|
||||
}
|
||||
|
||||
private bool _ticketsCriticalSelected;
|
||||
public bool TicketsCriticalSelected
|
||||
{
|
||||
get => _ticketsCriticalSelected;
|
||||
set { if (_ticketsCriticalSelected != value) { _ticketsCriticalSelected = value; OnPropertyChanged(nameof(TicketsCriticalSelected)); } }
|
||||
}
|
||||
|
||||
private bool _ticketsNewInfoSelected;
|
||||
public bool TicketsNewInfoSelected
|
||||
{
|
||||
get => _ticketsNewInfoSelected;
|
||||
set { if (_ticketsNewInfoSelected != value) { _ticketsNewInfoSelected = value; OnPropertyChanged(nameof(TicketsNewInfoSelected)); } }
|
||||
}
|
||||
|
||||
private bool _incidentNewSelected;
|
||||
public bool IncidentNewSelected
|
||||
{
|
||||
get => _incidentNewSelected;
|
||||
set { if (_incidentNewSelected != value) { _incidentNewSelected = value; OnPropertyChanged(nameof(IncidentNewSelected)); } }
|
||||
}
|
||||
|
||||
private bool _incidentActiveSelected;
|
||||
public bool IncidentActiveSelected
|
||||
{
|
||||
get => _incidentActiveSelected;
|
||||
set { if (_incidentActiveSelected != value) { _incidentActiveSelected = value; OnPropertyChanged(nameof(IncidentActiveSelected)); } }
|
||||
}
|
||||
|
||||
private bool _incidentCriticalSelected;
|
||||
public bool IncidentCriticalSelected
|
||||
{
|
||||
get => _incidentCriticalSelected;
|
||||
set { if (_incidentCriticalSelected != value) { _incidentCriticalSelected = value; OnPropertyChanged(nameof(IncidentCriticalSelected)); } }
|
||||
}
|
||||
|
||||
private bool _incidentNewInfoSelected;
|
||||
public bool IncidentNewInfoSelected
|
||||
{
|
||||
get => _incidentNewInfoSelected;
|
||||
set { if (_incidentNewInfoSelected != value) { _incidentNewInfoSelected = value; OnPropertyChanged(nameof(IncidentNewInfoSelected)); } }
|
||||
}
|
||||
|
||||
private bool _unassignedTicketsSelected;
|
||||
public bool UnassignedTicketsSelected
|
||||
{
|
||||
get => _unassignedTicketsSelected;
|
||||
set { if (_unassignedTicketsSelected != value) { _unassignedTicketsSelected = value; OnPropertyChanged(nameof(UnassignedTicketsSelected)); } }
|
||||
}
|
||||
|
||||
private bool _unassignedTicketsCriticalSelected;
|
||||
public bool UnassignedTicketsCriticalSelected
|
||||
{
|
||||
get => _unassignedTicketsCriticalSelected;
|
||||
set { if (_unassignedTicketsCriticalSelected != value) { _unassignedTicketsCriticalSelected = value; OnPropertyChanged(nameof(UnassignedTicketsCriticalSelected)); } }
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Highlight-Properties
|
||||
private bool _ticketsNewHighlighted;
|
||||
public bool TicketsNewHighlighted { get => _ticketsNewHighlighted; set { if (_ticketsNewHighlighted != value) { _ticketsNewHighlighted = value; OnPropertyChanged(nameof(TicketsNewHighlighted)); } } }
|
||||
|
||||
private bool _ticketsActiveHighlighted;
|
||||
public bool TicketsActiveHighlighted { get => _ticketsActiveHighlighted; set { if (_ticketsActiveHighlighted != value) { _ticketsActiveHighlighted = value; OnPropertyChanged(nameof(TicketsActiveHighlighted)); } } }
|
||||
|
||||
private bool _ticketsCriticalHighlighted;
|
||||
public bool TicketsCriticalHighlighted { get => _ticketsCriticalHighlighted; set { if (_ticketsCriticalHighlighted != value) { _ticketsCriticalHighlighted = value; OnPropertyChanged(nameof(TicketsCriticalHighlighted)); } } }
|
||||
|
||||
private bool _ticketsNewInfoHighlighted;
|
||||
public bool TicketsNewInfoHighlighted { get => _ticketsNewInfoHighlighted; set { if (_ticketsNewInfoHighlighted != value) { _ticketsNewInfoHighlighted = value; OnPropertyChanged(nameof(TicketsNewInfoHighlighted)); } } }
|
||||
|
||||
private bool _incidentNewHighlighted;
|
||||
public bool IncidentNewHighlighted { get => _incidentNewHighlighted; set { if (_incidentNewHighlighted != value) { _incidentNewHighlighted = value; OnPropertyChanged(nameof(IncidentNewHighlighted)); } } }
|
||||
|
||||
private bool _incidentActiveHighlighted;
|
||||
public bool IncidentActiveHighlighted { get => _incidentActiveHighlighted; set { if (_incidentActiveHighlighted != value) { _incidentActiveHighlighted = value; OnPropertyChanged(nameof(IncidentActiveHighlighted)); } } }
|
||||
|
||||
private bool _incidentCriticalHighlighted;
|
||||
public bool IncidentCriticalHighlighted { get => _incidentCriticalHighlighted; set { if (_incidentCriticalHighlighted != value) { _incidentCriticalHighlighted = value; OnPropertyChanged(nameof(IncidentCriticalHighlighted)); } } }
|
||||
|
||||
private bool _incidentNewInfoHighlighted;
|
||||
public bool IncidentNewInfoHighlighted { get => _incidentNewInfoHighlighted; set { if (_incidentNewInfoHighlighted != value) { _incidentNewInfoHighlighted = value; OnPropertyChanged(nameof(IncidentNewInfoHighlighted)); } } }
|
||||
|
||||
private bool _unassignedTicketsHighlighted;
|
||||
public bool UnassignedTicketsHighlighted { get => _unassignedTicketsHighlighted; set { if (_unassignedTicketsHighlighted != value) { _unassignedTicketsHighlighted = value; OnPropertyChanged(nameof(UnassignedTicketsHighlighted)); } } }
|
||||
|
||||
private bool _unassignedTicketsCriticalHighlighted;
|
||||
public bool UnassignedTicketsCriticalHighlighted { get => _unassignedTicketsCriticalHighlighted; set { if (_unassignedTicketsCriticalHighlighted != value) { _unassignedTicketsCriticalHighlighted = value; OnPropertyChanged(nameof(UnassignedTicketsCriticalHighlighted)); } } }
|
||||
#endregion
|
||||
|
||||
#region Change Hint Properties
|
||||
private string _ticketsNewChangeHint;
|
||||
public string TicketsNewChangeHint { get => _ticketsNewChangeHint; set { if (_ticketsNewChangeHint != value) { _ticketsNewChangeHint = value; OnPropertyChanged(nameof(TicketsNewChangeHint)); } } }
|
||||
|
||||
private string _ticketsActiveChangeHint;
|
||||
public string TicketsActiveChangeHint { get => _ticketsActiveChangeHint; set { if (_ticketsActiveChangeHint != value) { _ticketsActiveChangeHint = value; OnPropertyChanged(nameof(TicketsActiveChangeHint)); } } }
|
||||
|
||||
private string _ticketsCriticalChangeHint;
|
||||
public string TicketsCriticalChangeHint { get => _ticketsCriticalChangeHint; set { if (_ticketsCriticalChangeHint != value) { _ticketsCriticalChangeHint = value; OnPropertyChanged(nameof(TicketsCriticalChangeHint)); } } }
|
||||
|
||||
private string _ticketsNewInfoChangeHint;
|
||||
public string TicketsNewInfoChangeHint { get => _ticketsNewInfoChangeHint; set { if (_ticketsNewInfoChangeHint != value) { _ticketsNewInfoChangeHint = value; OnPropertyChanged(nameof(TicketsNewInfoChangeHint)); } } }
|
||||
|
||||
private string _incidentNewChangeHint;
|
||||
public string IncidentNewChangeHint { get => _incidentNewChangeHint; set { if (_incidentNewChangeHint != value) { _incidentNewChangeHint = value; OnPropertyChanged(nameof(IncidentNewChangeHint)); } } }
|
||||
|
||||
private string _incidentActiveChangeHint;
|
||||
public string IncidentActiveChangeHint { get => _incidentActiveChangeHint; set { if (_incidentActiveChangeHint != value) { _incidentActiveChangeHint = value; OnPropertyChanged(nameof(IncidentActiveChangeHint)); } } }
|
||||
|
||||
private string _incidentCriticalChangeHint;
|
||||
public string IncidentCriticalChangeHint { get => _incidentCriticalChangeHint; set { if (_incidentCriticalChangeHint != value) { _incidentCriticalChangeHint = value; OnPropertyChanged(nameof(IncidentCriticalChangeHint)); } } }
|
||||
|
||||
private string _incidentNewInfoChangeHint;
|
||||
public string IncidentNewInfoChangeHint { get => _incidentNewInfoChangeHint; set { if (_incidentNewInfoChangeHint != value) { _incidentNewInfoChangeHint = value; OnPropertyChanged(nameof(IncidentNewInfoChangeHint)); } } }
|
||||
|
||||
private string _unassignedTicketsChangeHint;
|
||||
public string UnassignedTicketsChangeHint { get => _unassignedTicketsChangeHint; set { if (_unassignedTicketsChangeHint != value) { _unassignedTicketsChangeHint = value; OnPropertyChanged(nameof(UnassignedTicketsChangeHint)); } } }
|
||||
|
||||
private string _unassignedTicketsCriticalChangeHint;
|
||||
public string UnassignedTicketsCriticalChangeHint { get => _unassignedTicketsCriticalChangeHint; set { if (_unassignedTicketsCriticalChangeHint != value) { _unassignedTicketsCriticalChangeHint = value; OnPropertyChanged(nameof(UnassignedTicketsCriticalChangeHint)); } } }
|
||||
#endregion
|
||||
|
||||
#region Ticket & Incident-Properties
|
||||
|
||||
// Ticket Properties
|
||||
private int _ticketsNew;
|
||||
public int TicketsNew { get => _ticketsNew; set { _ticketsNew = value; OnPropertyChanged(nameof(TicketsNew)); } }
|
||||
|
||||
private int _ticketsActive;
|
||||
public int TicketsActive { get => _ticketsActive; set { _ticketsActive = value; OnPropertyChanged(nameof(TicketsActive)); } }
|
||||
|
||||
private int _ticketsCritical;
|
||||
public int TicketsCritical { get => _ticketsCritical; set { _ticketsCritical = value; OnPropertyChanged(nameof(TicketsCritical)); } }
|
||||
|
||||
private int _ticketsNewInfo;
|
||||
public int TicketsNewInfo { get => _ticketsNewInfo; set { _ticketsNewInfo = value; OnPropertyChanged(nameof(TicketsNewInfo)); } }
|
||||
|
||||
// Incident Properties
|
||||
private int _incidentNew;
|
||||
public int IncidentNew { get => _incidentNew; set { _incidentNew = value; OnPropertyChanged(nameof(IncidentNew)); } }
|
||||
|
||||
private int _incidentActive;
|
||||
public int IncidentActive { get => _incidentActive; set { _incidentActive = value; OnPropertyChanged(nameof(IncidentActive)); } }
|
||||
|
||||
private int _incidentCritical;
|
||||
public int IncidentCritical { get => _incidentCritical; set { _incidentCritical = value; OnPropertyChanged(nameof(IncidentCritical)); } }
|
||||
|
||||
private int _incidentNewInfo;
|
||||
public int IncidentNewInfo { get => _incidentNewInfo; set { _incidentNewInfo = value; OnPropertyChanged(nameof(IncidentNewInfo)); } }
|
||||
|
||||
// Unassigned Ticket Properties
|
||||
private int _unassignedTickets;
|
||||
public int UnassignedTickets { get => _unassignedTickets; set { _unassignedTickets = value; OnPropertyChanged(nameof(UnassignedTickets)); } }
|
||||
|
||||
private int _unassignedTicketsCritical;
|
||||
public int UnassignedTicketsCritical { get => _unassignedTicketsCritical; set { _unassignedTicketsCritical = value; OnPropertyChanged(nameof(UnassignedTicketsCritical)); } }
|
||||
|
||||
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
protected void OnPropertyChanged(string propertyName) =>
|
||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
||||
#endregion
|
||||
|
||||
#region Helper-Methods
|
||||
|
||||
public void ResetSelection()
|
||||
{
|
||||
TicketsNewSelected = false;
|
||||
TicketsActiveSelected = false;
|
||||
TicketsCriticalSelected = false;
|
||||
TicketsNewInfoSelected = false;
|
||||
|
||||
IncidentNewSelected = false;
|
||||
IncidentActiveSelected = false;
|
||||
IncidentCriticalSelected = false;
|
||||
IncidentNewInfoSelected = false;
|
||||
|
||||
UnassignedTicketsSelected = false;
|
||||
UnassignedTicketsCriticalSelected = false;
|
||||
}
|
||||
|
||||
public void ResetHighlights()
|
||||
{
|
||||
TicketsNewHighlighted = false;
|
||||
TicketsActiveHighlighted = false;
|
||||
TicketsCriticalHighlighted = false;
|
||||
TicketsNewInfoHighlighted = false;
|
||||
|
||||
IncidentNewHighlighted = false;
|
||||
IncidentActiveHighlighted = false;
|
||||
IncidentCriticalHighlighted = false;
|
||||
IncidentNewInfoHighlighted = false;
|
||||
|
||||
UnassignedTicketsHighlighted = false;
|
||||
UnassignedTicketsCriticalHighlighted = false;
|
||||
|
||||
TicketsNewChangeHint = null;
|
||||
TicketsActiveChangeHint = null;
|
||||
TicketsCriticalChangeHint = null;
|
||||
TicketsNewInfoChangeHint = null;
|
||||
|
||||
IncidentNewChangeHint = null;
|
||||
IncidentActiveChangeHint = null;
|
||||
IncidentCriticalChangeHint = null;
|
||||
IncidentNewInfoChangeHint = null;
|
||||
|
||||
UnassignedTicketsChangeHint = null;
|
||||
UnassignedTicketsCriticalChangeHint = null;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
|
||||
namespace FasdDesktopUi.Basics.Models
|
||||
{
|
||||
public class TicketOverviewSelectionRequestedEventArgs : RoutedEventArgs
|
||||
{
|
||||
public string Key { get; }
|
||||
public bool UseRoleScope { get; }
|
||||
public int Count { get; }
|
||||
|
||||
public TicketOverviewSelectionRequestedEventArgs(RoutedEvent routedEvent, object source,
|
||||
string key, bool useRoleScope, int count)
|
||||
: base(routedEvent, source)
|
||||
{
|
||||
Key = key;
|
||||
UseRoleScope = useRoleScope;
|
||||
Count = count;
|
||||
}
|
||||
}
|
||||
}
|
||||
21
FasdDesktopUi/Basics/Models/WidgetValueModel.cs
Normal file
21
FasdDesktopUi/Basics/Models/WidgetValueModel.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
using FasdDesktopUi.Basics.Enums;
|
||||
using FasdDesktopUi.Basics.UiActions;
|
||||
|
||||
using static C4IT.FASD.Base.cF4SDHealthCardRawData;
|
||||
|
||||
namespace FasdDesktopUi.Basics.Models
|
||||
{
|
||||
public class cWidgetValueModel
|
||||
{
|
||||
public int ValueIndex { get; set; }
|
||||
public string TechnicalName { get; set; }
|
||||
public string Title { get; set; }
|
||||
public string Value { get; set; }
|
||||
public bool IsLoading { get; set; } = false;
|
||||
public cEditableValueInformationBase EditValueInformation { get; set; }
|
||||
public enumHighlightColor? HighlightIn { get; set; }
|
||||
public cUiActionBase UiActionTitle { get; set; } = null;
|
||||
public cUiActionBase UiActionValue { get; set; } = null;
|
||||
public cHealthCardDetailsTable ValuedDetails { get; set; } = null;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user