aktueller Stand

This commit is contained in:
Meik
2026-01-28 12:08:39 +01:00
parent 1283750829
commit ee1f54675e
104 changed files with 6797 additions and 1867 deletions

BIN
2026-01-28 10_49_55-.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.4 KiB

View File

@@ -67,7 +67,7 @@
<HintPath>.\Interop.CLMgr.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.13.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
<HintPath>..\packages\Newtonsoft.Json.13.0.4\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />

View File

@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Newtonsoft.Json" version="13.0.3" targetFramework="net472" />
<package id="Newtonsoft.Json" version="13.0.4" targetFramework="net472" />
</packages>

View File

@@ -1,4 +1,5 @@
using C4IT.FASD.Base;
using FasdDesktopUi.Basics.CustomEvents;
using FasdDesktopUi.Basics.Services.RelationService;
using FasdDesktopUi.Basics.Services.SupportCase;
using NSubstitute;
@@ -62,4 +63,90 @@ public class SupportCaseTest
Assert.Equal(_supportCase, raisedEvent.Sender);
Assert.Equal(relations, raisedEvent.Arguments.Relations);
}
[Fact]
public void UpdateSupportCaseDataCache_Raise_SupportCaseDataCacheHasChanged()
{
cF4sdApiSearchResultRelation relation = new()
{
Type = enumF4sdSearchResultClass.Computer,
Name = "My computer",
Identities =
[
new() { Id = Guid.NewGuid(), Class = enumFasdInformationClass.Computer }
]
};
List<cF4SDHealthCardRawData.cHealthCardTable> tables =
[
new() { Name = "TestTable1", Columns = [], TableType = eDataHistoryTableType.History },
];
var raisedEvent = Assert.Raises<SupportCaseDataEventArgs>(
h => _supportCase.SupportCaseDataCacheHasChanged += h,
h => _supportCase.SupportCaseDataCacheHasChanged -= h,
() => _supportCase.UpdateSupportCaseDataCache(relation, tables));
Assert.NotNull(raisedEvent);
Assert.Equal(_supportCase, raisedEvent.Sender);
Assert.Equal(relation, raisedEvent.Arguments.Relation);
Assert.Equal(tables, raisedEvent.Arguments.DataTables);
}
[Fact]
public void GetSupportCaseData_Contains_UpdateSupportCaseDataCacheData()
{
// Arrange
const string columnValue = "Hello world";
const string tableName = "TestTable1";
const string columnName = "TestColumn1";
List<object> expected = [columnValue];
cF4sdApiSearchResultRelation relation = new()
{
Type = enumF4sdSearchResultClass.Computer,
Name = "My computer",
Identities =
[
new() { Id = Guid.NewGuid(), Class = enumFasdInformationClass.Computer }
]
};
cF4SDHealthCardRawData.cHealthCardTable dataTable = new()
{
Name = tableName,
TableType = eDataHistoryTableType.History
};
dataTable.Columns = new()
{
[columnName] = new(dataTable) { Values = expected }
};
// Act
_supportCase.UpdateSupportCaseDataCache(relation, [dataTable]);
// Assert
var actual = _supportCase.GetSupportCaseHealthcardData(relation, new cValueAddress() { ValueTable = tableName, ValueColumn = columnName });
Assert.Equal(expected, actual);
}
[Fact]
public void GetSupportCaseData_ReturnsNull_When_NoDataExists()
{
// Arrange
cF4sdApiSearchResultRelation relation = new()
{
Type = enumF4sdSearchResultClass.Computer,
Name = "My computer",
Identities =
[
new() { Id = Guid.NewGuid(), Class = enumFasdInformationClass.Computer }
]
};
// Act
var actual = _supportCase.GetSupportCaseHealthcardData(relation, new cValueAddress() { ValueTable = "NonExistentTable", ValueColumn = "NonExistentColumn" });
// Assert
Assert.Null(actual);
}
}

View File

@@ -29,7 +29,7 @@
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="18.0.1" />
<PackageReference Include="NSubstitute" Version="5.3.0" />
<PackageReference Include="xunit.v3" Version="3.2.0" />
<PackageReference Include="xunit.v3" Version="3.2.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="3.1.5">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>

View File

@@ -53,15 +53,49 @@
<ErrorReport>prompt</ErrorReport>
</PropertyGroup>
<ItemGroup>
<Reference Include="C4IT.F4SD.DisplayFormatting, Version=1.0.9509.21303, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\C4IT.F4SD.DisplayFormatting.1.0.0\lib\netstandard2.0\C4IT.F4SD.DisplayFormatting.dll</HintPath>
</Reference>
<Reference Include="C4IT.F4SD.SupportCaseProtocoll, Version=1.0.9516.21165, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\C4IT.F4SD.SupportCaseProtocoll.1.0.0\lib\netstandard2.0\C4IT.F4SD.SupportCaseProtocoll.dll</HintPath>
</Reference>
<Reference Include="MaterialIcons, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\MaterialIcons.1.0.3\lib\MaterialIcons.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Bcl.AsyncInterfaces, Version=10.0.0.2, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Bcl.AsyncInterfaces.10.0.2\lib\net462\Microsoft.Bcl.AsyncInterfaces.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Extensions.DependencyInjection.Abstractions, Version=10.0.0.2, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Extensions.DependencyInjection.Abstractions.10.0.2\lib\net462\Microsoft.Extensions.DependencyInjection.Abstractions.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Extensions.Logging.Abstractions, Version=10.0.0.2, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Extensions.Logging.Abstractions.10.0.2\lib\net462\Microsoft.Extensions.Logging.Abstractions.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.13.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
<HintPath>..\packages\Newtonsoft.Json.13.0.4\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Buffers, Version=4.0.5.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Buffers.4.6.1\lib\net462\System.Buffers.dll</HintPath>
</Reference>
<Reference Include="System.Core" />
<Reference Include="System.Diagnostics.DiagnosticSource, Version=10.0.0.2, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Diagnostics.DiagnosticSource.10.0.2\lib\net462\System.Diagnostics.DiagnosticSource.dll</HintPath>
</Reference>
<Reference Include="System.Drawing" />
<Reference Include="System.Memory, Version=4.0.5.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Memory.4.6.3\lib\net462\System.Memory.dll</HintPath>
</Reference>
<Reference Include="System.Numerics" />
<Reference Include="System.Numerics.Vectors, Version=4.1.6.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Numerics.Vectors.4.6.1\lib\net462\System.Numerics.Vectors.dll</HintPath>
</Reference>
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=6.0.3.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.6.1.2\lib\net462\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
</Reference>
<Reference Include="System.Threading.Tasks.Extensions, Version=4.2.4.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Threading.Tasks.Extensions.4.6.3\lib\net462\System.Threading.Tasks.Extensions.dll</HintPath>
</Reference>
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
@@ -131,6 +165,7 @@
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="app.config" />
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>

View File

@@ -66,6 +66,7 @@ namespace C4IT.FASD.Cockpit.Communication
public abstract Task<List<cF4sdApiSearchResultRelation>> GetSearchResultRelations(enumF4sdSearchResultClass resultType, List<cFasdApiSearchResultEntry> searchResults);
public abstract Task<List<cF4sdApiSearchResultRelation>> GetTicketOverviewRelations(string key, bool useRoleScope, int count);
public abstract Task<Dictionary<string, int>> GetTicketOverviewCounts(IEnumerable<string> keys, bool useRoleScope);
public abstract Task<cF4SDHealthCardRawData> GetHealthCardData(cF4sdHealthCardRawDataRequest requestData);

View File

@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Microsoft.Extensions.Logging.Abstractions" publicKeyToken="adb9793829ddae60" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-10.0.0.2" newVersion="10.0.0.2" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>

View File

@@ -1,5 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="C4IT.F4SD.DisplayFormatting" version="1.0.0" targetFramework="net472" />
<package id="C4IT.F4SD.SupportCaseProtocoll" version="1.0.0" targetFramework="net472" />
<package id="MaterialIcons" version="1.0.3" targetFramework="net472" />
<package id="Newtonsoft.Json" version="13.0.3" targetFramework="net472" />
<package id="Microsoft.Bcl.AsyncInterfaces" version="10.0.2" targetFramework="net472" />
<package id="Microsoft.Extensions.DependencyInjection.Abstractions" version="10.0.2" targetFramework="net472" />
<package id="Microsoft.Extensions.Logging.Abstractions" version="10.0.2" targetFramework="net472" />
<package id="Newtonsoft.Json" version="13.0.4" targetFramework="net472" />
<package id="System.Buffers" version="4.6.1" targetFramework="net472" />
<package id="System.Diagnostics.DiagnosticSource" version="10.0.2" targetFramework="net472" />
<package id="System.Memory" version="4.6.3" targetFramework="net472" />
<package id="System.Numerics.Vectors" version="4.6.1" targetFramework="net472" />
<package id="System.Runtime.CompilerServices.Unsafe" version="6.1.2" targetFramework="net472" />
<package id="System.Threading.Tasks.Extensions" version="4.6.3" targetFramework="net472" />
</packages>

View File

@@ -56,7 +56,7 @@
</PropertyGroup>
<ItemGroup>
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.13.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
<HintPath>..\packages\Newtonsoft.Json.13.0.4\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
@@ -98,6 +98,7 @@
<Compile Include="F4sdCockpitCommunicationM42Web.cs" />
<Compile Include="FasdCockpitCommunicationWeb.cs" />
<Compile Include="FasdCockpitMachineConfiguration.cs" />
<Compile Include="TicketOverview\TicketOverviewCountsResponse.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
@@ -115,6 +116,7 @@
</ProjectReference>
</ItemGroup>
<ItemGroup>
<None Include="app.config" />
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />

View File

@@ -18,6 +18,7 @@ using C4IT.FASD.Communication.Agent;
using FasdCockpitBase.Models;
using FasdCockpitCommunication;
using FasdCockpitCommunication.TicketOverview;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
@@ -1095,9 +1096,118 @@ namespace C4IT.FASD.Cockpit.Communication
return output;
}
public override Task<List<cF4sdApiSearchResultRelation>> GetTicketOverviewRelations(string key, bool useRoleScope, int count)
public override async Task<Dictionary<string, int>> GetTicketOverviewCounts(IEnumerable<string> keys, bool useRoleScope)
{
return Task.FromResult(new List<cF4sdApiSearchResultRelation>());
var CM = MethodBase.GetCurrentMethod();
LogMethodBegin(CM);
var apiError = 0;
var timeStart = DateTime.UtcNow;
try
{
var normalizedKeys = (keys ?? Enumerable.Empty<string>())
.Where(k => !string.IsNullOrWhiteSpace(k))
.Distinct(StringComparer.OrdinalIgnoreCase)
.ToList();
var http = GetHttpHelper(true);
var scope = useRoleScope ? "role" : "personal";
var urlBuilder = new StringBuilder($"api/TicketOverview/GetCounts?scope={scope}");
if (normalizedKeys.Count > 0)
{
var joinedKeys = HttpUtility.UrlEncode(string.Join(",", normalizedKeys));
urlBuilder.Append($"&keys={joinedKeys}");
}
var url = urlBuilder.ToString();
var result = await http.GetHttpJson(url, 15000, CancellationToken.None);
if (!result.IsOk)
{
apiError = (int)result.Status;
if (CheckConnectionStatus != null)
await CheckConnectionStatus.Invoke();
LogEntry($"Error on requesting ticket overview counts ({scope}). Status: {result.Status}", LogLevels.Warning);
return new Dictionary<string, int>(StringComparer.OrdinalIgnoreCase);
}
if (Debug_apiValues) SaveApiResultValueJson("TicketOverview.GetCounts", result.Result, url);
var response = JsonConvert.DeserializeObject<TicketOverviewCountsResponse>(result.Result);
return response?.ToDictionary(normalizedKeys) ?? new Dictionary<string, int>(StringComparer.OrdinalIgnoreCase);
}
catch (Exception E)
{
apiError = E.HResult;
if (CheckConnectionStatus != null)
await CheckConnectionStatus.Invoke();
LogException(E);
}
finally
{
if (Debug_apiTiming) SaveApiTimingEntry("TicketOverview.GetCounts", timeStart, apiError);
LogMethodEnd(CM);
}
return new Dictionary<string, int>(StringComparer.OrdinalIgnoreCase);
}
public override async Task<List<cF4sdApiSearchResultRelation>> GetTicketOverviewRelations(string key, bool useRoleScope, int count)
{
var CM = MethodBase.GetCurrentMethod();
LogMethodBegin(CM);
var apiError = 0;
var timeStart = DateTime.UtcNow;
var output = new List<cF4sdApiSearchResultRelation>();
try
{
if (string.IsNullOrWhiteSpace(key))
return output;
var http = GetHttpHelper(true);
var scope = useRoleScope ? "role" : "personal";
var safeKey = HttpUtility.UrlEncode(key);
var url = $"api/TicketOverview/GetRelations?key={safeKey}&scope={scope}&count={Math.Max(0, count)}";
var result = await http.GetHttpJson(url, 20000, CancellationToken.None);
if (!result.IsOk)
{
apiError = (int)result.Status;
if (CheckConnectionStatus != null)
await CheckConnectionStatus.Invoke();
LogEntry($"Error on requesting ticket overview relations for '{key}' ({scope}). Status: {result.Status}", LogLevels.Warning);
return output;
}
if (Debug_apiValues) SaveApiResultValueJson("TicketOverview.GetRelations", result.Result, url);
var relations = JsonConvert.DeserializeObject<List<cF4sdApiSearchResultRelation>>(result.Result);
if (relations != null)
output = relations;
}
catch (Exception E)
{
apiError = E.HResult;
if (CheckConnectionStatus != null)
await CheckConnectionStatus.Invoke();
LogException(E);
}
finally
{
if (Debug_apiTiming) SaveApiTimingEntry("TicketOverview.GetRelations", timeStart, apiError);
LogMethodEnd(CM);
}
return output;
}
public override async Task<cF4SDHealthCardRawData> GetHealthCardData(cF4sdHealthCardRawDataRequest requestData)
{

View File

@@ -0,0 +1,48 @@
using System;
using System.Collections.Generic;
using Newtonsoft.Json;
namespace FasdCockpitCommunication.TicketOverview
{
internal sealed class TicketOverviewCountsResponse
{
[JsonProperty("counts")]
public Dictionary<string, int> Counts { get; set; } = new Dictionary<string, int>(StringComparer.OrdinalIgnoreCase);
public Dictionary<string, int> ToDictionary(IEnumerable<string> expectedKeys)
{
var comparer = StringComparer.OrdinalIgnoreCase;
var output = new Dictionary<string, int>(comparer);
if (expectedKeys != null)
{
foreach (var key in expectedKeys)
{
if (string.IsNullOrWhiteSpace(key))
continue;
if (Counts != null && Counts.TryGetValue(key, out var count))
output[key] = count;
else
output[key] = 0;
}
return output;
}
if (Counts != null)
{
foreach (var kvp in Counts)
{
if (string.IsNullOrWhiteSpace(kvp.Key))
continue;
output[kvp.Key] = kvp.Value;
}
}
return output;
}
}
}

View File

@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Microsoft.Extensions.Logging.Abstractions" publicKeyToken="adb9793829ddae60" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-10.0.0.2" newVersion="10.0.0.2" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>

View File

@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Newtonsoft.Json" version="13.0.3" targetFramework="net472" />
<package id="Newtonsoft.Json" version="13.0.4" targetFramework="net472" />
</packages>

View File

@@ -205,9 +205,6 @@
<NamedParameter ParameterName="ad-dn-User" Name="Distinguished name user" Display="STRING" ValueTable="ad-user" ValueColumn="distinguishedName">
<Name Lang="DE">Distinguished Name User</Name>
</NamedParameter>
<NamedParameter ParameterName="ad-dn-computer" Name="Distinguished name computer" Display="STRING" ValueTable="ad-computer" ValueColumn="distinguishedName">
<Name Lang="DE">Distinguished Name computer</Name>
</NamedParameter>
<NamedParameter ParameterName="IpAddress" Name="IP address" Display="STRING" ValueTable="agnt-computer-event-string-latest" ValueColumn="NetworkIPLast">
<Name Lang="DE">IP Adresse</Name>
</NamedParameter>
@@ -282,8 +279,8 @@
<Computation-Switch-Case ValueId="1">IBM</Computation-Switch-Case>
</Computation-Switch>
<Computation-Format Name="FullDeviceModelName" Format="{0} {1}" ValueTable0="agnt-computer" ValueColumn0="SystemManufacturer" ValueTable1="Computation_DeviceModel" ValueColumn1="default" RemoveDuplicateWords="true" />
<Computation-LinearAddition Name="IntuneMobileDeviceCount" a="1" b="1" c="0" ValueTable0="intune-userDeviceCount" ValueColumn0="iOS" ValueTable1="intune-userDeviceCount" ValueColumn1="android" />
<Computation-LinearAddition Name="IntuneOtherDeviceCount" a="1" b="1" c="0" ValueTable0="intune-userDeviceCount" ValueColumn0="macOs" ValueTable1="intune-userDeviceCount" ValueColumn1="linux" />
<!--<Computation-LinearAddition Name="IntuneMobileDeviceCount" a="1" b="1" c="0" ValueTable0="intune-userDeviceCount" ValueColumn0="iOS" ValueTable1="intune-userDeviceCount" ValueColumn1="android" />
<Computation-LinearAddition Name="IntuneOtherDeviceCount" a="1" b="1" c="0" ValueTable0="intune-userDeviceCount" ValueColumn0="macOs" ValueTable1="intune-userDeviceCount" ValueColumn1="linux" />-->
</Computations>
<Translations>
<Translator Name="true_good">
@@ -470,7 +467,7 @@
<State-Aggregation RefName="Ram_Details_Aggregation" Name="RAM Details">
<State-Link Reference="RAM_Relative" />
<State-Level Name="Free Memory" ValueTable="agnt-computer-event" ValueColumn="MemoryFree" Warning="4294967296" Error="2147483648" Direction="down">
<State-Level Name="Free Memory" ValueTable="agnt-computer-event-numerical" ValueColumn="MemoryFree" Warning="4294967296" Error="2147483648" Direction="down">
<Name Lang="DE">Freier Speicher</Name>
</State-Level>
</State-Aggregation>
@@ -1065,9 +1062,6 @@
<NamedParameter ParameterName="ad-dn-User" Name="Distinguished name user" Display="STRING" ValueTable="ad-user" ValueColumn="distinguishedName">
<Name Lang="DE">Distinguished Name User</Name>
</NamedParameter>
<NamedParameter ParameterName="ad-dn-computer" Name="Distinguished name computer" Display="STRING" ValueTable="ad-computer" ValueColumn="distinguishedName">
<Name Lang="DE">Distinguished Name computer</Name>
</NamedParameter>
<NamedParameter ParameterName="UserFullName" Name="User name" Display="STRING" ValueTable="ad-user" ValueColumn="name">
<Name Lang="DE">Anwender</Name>

View File

@@ -102,6 +102,13 @@
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="ValuedFormat">
<xs:restriction base="xs:NCName">
<xs:enumeration value="csv" />
<xs:enumeration value="json" />
</xs:restriction>
</xs:simpleType>
<xs:attributeGroup name="ValuePointer">
<xs:attribute name="Name" type="xs:string" use="optional" />
<xs:attribute name="ParameterName" type="xs:NCName" use="optional" />
@@ -543,7 +550,8 @@
<xs:complexType>
<xs:complexContent>
<xs:extension base="State-Details-Base">
<xs:attribute name="RowSeparator" type="xs:string" use="required"/>
<xs:attribute name="Format" type="ValuedFormat" use="optional"/>
<xs:attribute name="RowSeparator" type="xs:string" use="optional"/>
<xs:attribute name="ColSeparator" type="xs:string" use="optional"/>
<xs:attribute name="StringDecorator" type="Separator" use="optional"/>
</xs:extension>

View File

@@ -54,7 +54,7 @@
</PropertyGroup>
<ItemGroup>
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.13.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
<HintPath>..\packages\Newtonsoft.Json.13.0.4\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
@@ -122,6 +122,7 @@
<Content Include="Config\F4SD-QuickAction-Configuration.xml">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<None Include="app.config" />
<None Include="Config\F4SD-CopyTemplate-Configuration.xsd">
<SubType>Designer</SubType>
</None>

View File

@@ -268,6 +268,40 @@ namespace C4IT.FASD.Cockpit.Communication
return ticket;
}
public override Task<Dictionary<string, int>> GetTicketOverviewCounts(IEnumerable<string> keys, bool useRoleScope)
{
var scopeKey = useRoleScope ? "Role" : "Personal";
var comparer = StringComparer.OrdinalIgnoreCase;
var result = new Dictionary<string, int>(comparer);
var requestedKeys = keys == null
? TicketOverviewRelations.Keys.ToList()
: keys.Where(k => !string.IsNullOrWhiteSpace(k)).Distinct(comparer).ToList();
if (requestedKeys.Count == 0)
requestedKeys.AddRange(TicketOverviewRelations.Keys);
foreach (var key in requestedKeys)
{
if (string.IsNullOrWhiteSpace(key))
continue;
if (TicketOverviewRelations.TryGetValue(key, out var scopeDictionary) &&
scopeDictionary != null &&
scopeDictionary.TryGetValue(scopeKey, out var definitions) &&
definitions != null)
{
result[key] = definitions.Count;
}
else
{
result[key] = 0;
}
}
return Task.FromResult(result);
}
public override async Task<List<cF4sdApiSearchResultRelation>> GetTicketOverviewRelations(string key, bool useRoleScope, int count)
{
var CM = MethodBase.GetCurrentMethod();
@@ -821,14 +855,14 @@ namespace C4IT.FASD.Cockpit.Communication
output.Add(new cF4sdApiSearchResultRelation() { id = Guid.NewGuid(), Name = "C4-CK007", DisplayName = "C4-CK007", LastUsed = DateTime.UtcNow, Type = enumF4sdSearchResultClass.Computer, UsingLevel = 1, Identities = new cF4sdIdentityList() { new cF4sdIdentityEntry() { Class = enumFasdInformationClass.User, Id = resultIds.First() }, new cF4sdIdentityEntry() { Class = enumFasdInformationClass.Computer, Id = Guid.NewGuid() } } });
break;
case constGuidTimoTicket:
output.Add(new cF4sdApiSearchResultRelation() { id = Guid.Parse(constGuidTimoTicketComputer), Name = "C4-TT007", DisplayName = "C4-TT007", LastUsed = DateTime.UtcNow.AddSeconds(-31), Type = enumF4sdSearchResultClass.Computer, UsingLevel = 1, Identities = new cF4sdIdentityList() { new cF4sdIdentityEntry() { Class = enumFasdInformationClass.User, Id = Guid.Parse(constGuidTimoTicket) }, new cF4sdIdentityEntry() { Class = enumFasdInformationClass.Computer, Id = Guid.Parse(constGuidTimoTicketComputer) } } });
output.Add(new cF4sdApiSearchResultRelation() { id = Guid.NewGuid(), Name = "C4-NB00015", DisplayName = "C4-NB00015", LastUsed = DateTime.UtcNow.AddHours(-10), Type = enumF4sdSearchResultClass.Computer, UsingLevel = 0.6, Identities = new cF4sdIdentityList() { new cF4sdIdentityEntry() { Class = enumFasdInformationClass.User, Id = Guid.Parse(constGuidTimoTicket) }, new cF4sdIdentityEntry() { Class = enumFasdInformationClass.Computer, Id = Guid.NewGuid() } } });
output.Add(new cF4sdApiSearchResultRelation() { id = Guid.Parse(constGuidTimoTicketComputer), Name = "C4-TT007", DisplayName = "C4-TT007", LastUsed = DateTime.UtcNow.AddSeconds(-31), Type = enumF4sdSearchResultClass.Computer, UsingLevel = 1, Identities = new cF4sdIdentityList() { new cF4sdIdentityEntry() { Class = enumFasdInformationClass.User, Id = Guid.Parse(constGuidTimoTicket) }, new cF4sdIdentityEntry() { Class = enumFasdInformationClass.Computer, Id = Guid.Parse(constGuidTimoTicketComputer) } }, Infos = new Dictionary<string, string>() });
output.Add(new cF4sdApiSearchResultRelation() { id = Guid.NewGuid(), Name = "C4-NB00015", DisplayName = "C4-NB00015", LastUsed = DateTime.UtcNow.AddHours(-10), Type = enumF4sdSearchResultClass.Computer, UsingLevel = 0.6, Identities = new cF4sdIdentityList() { new cF4sdIdentityEntry() { Class = enumFasdInformationClass.User, Id = Guid.Parse(constGuidTimoTicket) }, new cF4sdIdentityEntry() { Class = enumFasdInformationClass.Computer, Id = Guid.NewGuid() } }, Infos = new Dictionary<string, string>() });
var demoTickets = await GetDemoTicketData(new cF4sdHealthCardRawDataRequest() { Identities = new cF4sdIdentityList() { new cF4sdIdentityEntry() { Class = enumFasdInformationClass.User, Id = Guid.Parse(constGuidTimoTicket) }, new cF4sdIdentityEntry() { Class = enumFasdInformationClass.Computer, Id = Guid.NewGuid() } } });
foreach (var demoTicket in demoTickets)
{
output.Add(new cF4sdApiSearchResultRelation() { id = demoTicket.Id, Name = demoTicket.Name, DisplayName = demoTicket.Name, Infos = new Dictionary<string, string>() { ["Summary"] = demoTicket.Summary, ["StatusId"] = ((int)demoTicket.Status).ToString(), ["Asset"] = demoTicket.Asset }, Type = enumF4sdSearchResultClass.Ticket, Identities = new cF4sdIdentityList() { new cF4sdIdentityEntry() { Class = enumFasdInformationClass.User, Id = Guid.Parse(constGuidTimoTicket) }, new cF4sdIdentityEntry() { Class = enumFasdInformationClass.Ticket, Id = demoTicket.Id } } });
output.Add(new cF4sdApiSearchResultRelation() { id = demoTicket.Id, Name = demoTicket.Name, DisplayName = demoTicket.Name, Infos = new Dictionary<string, string>() { ["Summary"] = demoTicket.Summary, ["Status"] = demoTicket.Status.ToString(), ["StatusId"] = ((int)demoTicket.Status).ToString(), ["Asset"] = demoTicket.Asset }, Type = enumF4sdSearchResultClass.Ticket, Identities = new cF4sdIdentityList() { new cF4sdIdentityEntry() { Class = enumFasdInformationClass.User, Id = Guid.Parse(constGuidTimoTicket) }, new cF4sdIdentityEntry() { Class = enumFasdInformationClass.Ticket, Id = demoTicket.Id } } });
}
break;
@@ -855,6 +889,7 @@ namespace C4IT.FASD.Cockpit.Communication
LogMethodBegin(CM);
var output = new cF4SDHealthCardRawData();
cF4SDHealthCardRawData.cHealthCardTable outputTable;
try
{
@@ -890,47 +925,52 @@ namespace C4IT.FASD.Cockpit.Communication
}
output.Tables["M42Wpm-Tickets"] = new cF4SDHealthCardRawData.cHealthCardTable()
outputTable = new cF4SDHealthCardRawData.cHealthCardTable()
{
Name = "M42Wpm-Tickets",
InformationClass = enumFasdInformationClass.Ticket,
IsStatic = true,
Columns = new Dictionary<string, cF4SDHealthCardRawData.cHealthCardTableColumn>()
{
["name"] = new cF4SDHealthCardRawData.cHealthCardTableColumn() { Values = new List<object>() { selectedTicket.Name } },
["Status"] = new cF4SDHealthCardRawData.cHealthCardTableColumn() { Values = new List<object>() { ticketStatusString } },
["Priority"] = new cF4SDHealthCardRawData.cHealthCardTableColumn() { Values = new List<object>() { selectedTicket.Priority } },
["AffectedUser"] = new cF4SDHealthCardRawData.cHealthCardTableColumn() { Values = new List<object>() { selectedTicket.AffectedUser } },
["AssetName"] = new cF4SDHealthCardRawData.cHealthCardTableColumn() { Values = new List<object>() { selectedTicket.Asset } },
["CreationDaysSinceNow"] = new cF4SDHealthCardRawData.cHealthCardTableColumn() { Values = new List<object>() { selectedTicket.CreationDaysSinceNow } },
["CreationDate"] = new cF4SDHealthCardRawData.cHealthCardTableColumn() { Values = new List<object>() { selectedTicket.CreationDate.ToUniversalTime() } },
["ClosingDaysSinceNow"] = new cF4SDHealthCardRawData.cHealthCardTableColumn() { Values = new List<object>() { selectedTicket.ClosingDaysSinceNow } },
["ClosingDate"] = new cF4SDHealthCardRawData.cHealthCardTableColumn() { Values = new List<object>() { selectedTicket.ClosingDate } },
["Category"] = new cF4SDHealthCardRawData.cHealthCardTableColumn() { Values = new List<object>() { selectedTicket.Category } },
["CreationSource"] = new cF4SDHealthCardRawData.cHealthCardTableColumn() { Values = new List<object>() { selectedTicket.CreationSource.ToString() } },
["Description"] = new cF4SDHealthCardRawData.cHealthCardTableColumn() { Values = new List<object>() { selectedTicket.Description?.ToString() } },
["DescriptionHtml"] = new cF4SDHealthCardRawData.cHealthCardTableColumn() { Values = new List<object>() { selectedTicket.DescriptionHtml?.ToString() } },
["Summary"] = new cF4SDHealthCardRawData.cHealthCardTableColumn() { Values = new List<object>() { selectedTicket.Summary.ToString() } },
["Solution"] = new cF4SDHealthCardRawData.cHealthCardTableColumn() { Values = new List<object>() { selectedTicket.Solution?.ToString() } },
["SolutionHtml"] = new cF4SDHealthCardRawData.cHealthCardTableColumn() { Values = new List<object>() { selectedTicket.SolutionHtml?.ToString() } },
}
};
output.Tables["M42Wpm-Ticket-History"] = new cF4SDHealthCardRawData.cHealthCardTable()
outputTable.Columns = new Dictionary<string, cF4SDHealthCardRawData.cHealthCardTableColumn>()
{
["name"] = new cF4SDHealthCardRawData.cHealthCardTableColumn(outputTable) { Values = new List<object>() { selectedTicket.Name } },
["Status"] = new cF4SDHealthCardRawData.cHealthCardTableColumn(outputTable) { Values = new List<object>() { ticketStatusString } },
["Priority"] = new cF4SDHealthCardRawData.cHealthCardTableColumn(outputTable) { Values = new List<object>() { selectedTicket.Priority } },
["AffectedUser"] = new cF4SDHealthCardRawData.cHealthCardTableColumn(outputTable) { Values = new List<object>() { selectedTicket.AffectedUser } },
["AssetName"] = new cF4SDHealthCardRawData.cHealthCardTableColumn(outputTable) { Values = new List<object>() { selectedTicket.Asset } },
["CreationDaysSinceNow"] = new cF4SDHealthCardRawData.cHealthCardTableColumn(outputTable) { Values = new List<object>() { selectedTicket.CreationDaysSinceNow } },
["CreationDate"] = new cF4SDHealthCardRawData.cHealthCardTableColumn(outputTable) { Values = new List<object>() { selectedTicket.CreationDate.ToUniversalTime() } },
["ClosingDaysSinceNow"] = new cF4SDHealthCardRawData.cHealthCardTableColumn(outputTable) { Values = new List<object>() { selectedTicket.ClosingDaysSinceNow } },
["ClosingDate"] = new cF4SDHealthCardRawData.cHealthCardTableColumn(outputTable) { Values = new List<object>() { selectedTicket.ClosingDate } },
["Category"] = new cF4SDHealthCardRawData.cHealthCardTableColumn(outputTable) { Values = new List<object>() { selectedTicket.Category } },
["CreationSource"] = new cF4SDHealthCardRawData.cHealthCardTableColumn(outputTable) { Values = new List<object>() { selectedTicket.CreationSource.ToString() } },
["Description"] = new cF4SDHealthCardRawData.cHealthCardTableColumn(outputTable) { Values = new List<object>() { selectedTicket.Description?.ToString() } },
["DescriptionHtml"] = new cF4SDHealthCardRawData.cHealthCardTableColumn(outputTable) { Values = new List<object>() { selectedTicket.DescriptionHtml?.ToString() } },
["Summary"] = new cF4SDHealthCardRawData.cHealthCardTableColumn(outputTable) { Values = new List<object>() { selectedTicket.Summary.ToString() } },
["Solution"] = new cF4SDHealthCardRawData.cHealthCardTableColumn(outputTable) { Values = new List<object>() { selectedTicket.Solution?.ToString() } },
["SolutionHtml"] = new cF4SDHealthCardRawData.cHealthCardTableColumn(outputTable) { Values = new List<object>() { selectedTicket.SolutionHtml?.ToString() } },
};
output.Tables["M42Wpm-Tickets"] = outputTable;
outputTable = new cF4SDHealthCardRawData.cHealthCardTable()
{
Name = "M42Wpm-Ticket-History",
InformationClass = enumFasdInformationClass.Ticket,
IsStatic = false,
Columns = new Dictionary<string, cF4SDHealthCardRawData.cHealthCardTableColumn>()
{
["Header"] = new cF4SDHealthCardRawData.cHealthCardTableColumn(),
["IsVisibleForUser"] = new cF4SDHealthCardRawData.cHealthCardTableColumn(),
["CreationDaysSinceNow"] = new cF4SDHealthCardRawData.cHealthCardTableColumn(),
["time"] = new cF4SDHealthCardRawData.cHealthCardTableColumn(),
["Description"] = new cF4SDHealthCardRawData.cHealthCardTableColumn(),
["DescriptionHtml"] = new cF4SDHealthCardRawData.cHealthCardTableColumn()
}
IsStatic = false
};
outputTable.Columns = new Dictionary<string, cF4SDHealthCardRawData.cHealthCardTableColumn>()
{
["Header"] = new cF4SDHealthCardRawData.cHealthCardTableColumn(outputTable),
["IsVisibleForUser"] = new cF4SDHealthCardRawData.cHealthCardTableColumn(outputTable),
["CreationDaysSinceNow"] = new cF4SDHealthCardRawData.cHealthCardTableColumn(outputTable),
["time"] = new cF4SDHealthCardRawData.cHealthCardTableColumn(outputTable),
["Description"] = new cF4SDHealthCardRawData.cHealthCardTableColumn(outputTable),
["DescriptionHtml"] = new cF4SDHealthCardRawData.cHealthCardTableColumn(outputTable)
};
output.Tables["M42Wpm-Ticket-History"] = outputTable;
foreach (var journalItem in selectedTicket.JournalItems)
{
@@ -944,55 +984,63 @@ namespace C4IT.FASD.Cockpit.Communication
foreach (var directLink in selectedTicket.DirectLinks)
{
output.Tables["M42Wpm-Tickets"].Columns[directLink.Key] = new cF4SDHealthCardRawData.cHealthCardTableColumn() { ColumnName = directLink.Key, IsIncomplete = false, Values = new List<object>() { directLink.Value } };
outputTable = output.Tables["M42Wpm-Tickets"];
if (outputTable?.Columns != null)
outputTable.Columns[directLink.Key] = new cF4SDHealthCardRawData.cHealthCardTableColumn(outputTable) { ColumnName = directLink.Key, IsIncomplete = false, Values = new List<object>() { directLink.Value } };
}
}
}
output.Tables.Add("sequenceTable", new cF4SDHealthCardRawData.cHealthCardTable()
outputTable = new cF4SDHealthCardRawData.cHealthCardTable()
{
IsIncomplete = true,
IsStatic = false,
StartingIndex = 7,
Columns = new Dictionary<string, cF4SDHealthCardRawData.cHealthCardTableColumn>()
StartingIndex = 7
};
outputTable.Columns = new Dictionary<string, cF4SDHealthCardRawData.cHealthCardTableColumn>()
{
["sequenceColumn"] = new cF4SDHealthCardRawData.cHealthCardTableColumn()
["sequenceColumn"] = new cF4SDHealthCardRawData.cHealthCardTableColumn(outputTable)
{
ColumnName = "sequenceColumn",
Values = new List<object>() { 1, 0 }
}
}
});
};
output.Tables.Add("sequenceTable2", new cF4SDHealthCardRawData.cHealthCardTable()
output.Tables.Add("sequenceTable", outputTable);
outputTable = new cF4SDHealthCardRawData.cHealthCardTable()
{
IsIncomplete = true,
IsStatic = false,
StartingIndex = 7,
Columns = new Dictionary<string, cF4SDHealthCardRawData.cHealthCardTableColumn>()
StartingIndex = 7
};
outputTable.Columns = new Dictionary<string, cF4SDHealthCardRawData.cHealthCardTableColumn>()
{
["sequenceColumn"] = new cF4SDHealthCardRawData.cHealthCardTableColumn()
["sequenceColumn"] = new cF4SDHealthCardRawData.cHealthCardTableColumn(outputTable)
{
ColumnName = "sequenceColumn",
Values = new List<object>() { 8, 1, 0 }
}
}
});
};
output.Tables.Add("sequenceTable3", new cF4SDHealthCardRawData.cHealthCardTable()
output.Tables.Add("sequenceTable2", outputTable);
outputTable = new cF4SDHealthCardRawData.cHealthCardTable()
{
IsIncomplete = false,
StartingIndex = 0,
IsStatic = true,
Columns = new Dictionary<string, cF4SDHealthCardRawData.cHealthCardTableColumn>()
IsStatic = true
};
outputTable.Columns = new Dictionary<string, cF4SDHealthCardRawData.cHealthCardTableColumn>()
{
["sequenceColumn"] = new cF4SDHealthCardRawData.cHealthCardTableColumn()
["sequenceColumn"] = new cF4SDHealthCardRawData.cHealthCardTableColumn(outputTable)
{
ColumnName = "sequenceColumn",
Values = new List<object>() { "Static" }
}
}
});
};
output.Tables.Add("sequenceTable3", outputTable);
output.Id = Guid.NewGuid();
@@ -1041,49 +1089,61 @@ namespace C4IT.FASD.Cockpit.Communication
await Task.Delay(250);
lock (CachedHealthCardRawData)
{
if (!CachedHealthCardRawData.ContainsKey(Id))
CachedHealthCardRawData[Id] = new cF4SDHealthCardRawData() { Id = Id, Tables = new Dictionary<string, cF4SDHealthCardRawData.cHealthCardTable>() };
if (!CachedHealthCardRawData.TryGetValue(Id, out var _rawData))
{
_rawData = new cF4SDHealthCardRawData() { Id = Id, Tables = new Dictionary<string, cF4SDHealthCardRawData.cHealthCardTable>() };
CachedHealthCardRawData[Id] = _rawData;
}
if (CachedHealthCardRawData[Id].Tables is null)
CachedHealthCardRawData[Id].Tables = new Dictionary<string, cF4SDHealthCardRawData.cHealthCardTable>();
if (_rawData.Tables is null)
_rawData.Tables = new Dictionary<string, cF4SDHealthCardRawData.cHealthCardTable>();
if (!CachedHealthCardRawData[Id].Tables.ContainsKey(tableOne))
CachedHealthCardRawData[Id].Tables[tableOne] = new cF4SDHealthCardRawData.cHealthCardTable() { Columns = new Dictionary<string, cF4SDHealthCardRawData.cHealthCardTableColumn>() };
if (!_rawData.Tables.TryGetValue(tableOne, out var _table))
{
_table = new cF4SDHealthCardRawData.cHealthCardTable() { Name = tableOne, Columns = new Dictionary<string, cF4SDHealthCardRawData.cHealthCardTableColumn>() };
_rawData.Tables[tableOne] = _table;
}
if (!CachedHealthCardRawData[Id].Tables[tableOne].Columns.ContainsKey(columnName))
CachedHealthCardRawData[Id].Tables[tableOne].Columns[columnName] = new cF4SDHealthCardRawData.cHealthCardTableColumn();
if (!_table.Columns.ContainsKey(columnName))
_table.Columns[columnName] = new cF4SDHealthCardRawData.cHealthCardTableColumn(_table);
CachedHealthCardRawData[Id].Tables[tableOne].StartingIndex = 3;
CachedHealthCardRawData[Id].Tables[tableOne].IsIncomplete = true;
_table.StartingIndex = 3;
_table.IsIncomplete = true;
if (CachedHealthCardRawData[Id].Tables[tableOne].Columns[columnName].Values.Count < 3)
CachedHealthCardRawData[Id].Tables[tableOne].Columns[columnName].Values.AddRange(new List<object>() { 5, 4, 3, 2, 1, 0 });
if (_table.Columns[columnName].Values.Count < 3)
_table.Columns[columnName].Values.AddRange(new List<object>() { 5, 4, 3, 2, 1, 0 });
else
CachedHealthCardRawData[Id].Tables[tableOne].Columns[columnName].Values.InsertRange(3, new List<object>() { 5, 4, 3, 2, 1, 0 });
_table.Columns[columnName].Values.InsertRange(3, new List<object>() { 5, 4, 3, 2, 1, 0 });
}
await Task.Delay(250);
lock (CachedHealthCardRawData)
{
if (!CachedHealthCardRawData.ContainsKey(Id))
CachedHealthCardRawData[Id] = new cF4SDHealthCardRawData() { Id = Id, Tables = new Dictionary<string, cF4SDHealthCardRawData.cHealthCardTable>() };
if (!CachedHealthCardRawData.TryGetValue(Id, out var _rawData))
{
_rawData = new cF4SDHealthCardRawData() { Id = Id, Tables = new Dictionary<string, cF4SDHealthCardRawData.cHealthCardTable>() };
CachedHealthCardRawData[Id] = _rawData;
}
if (CachedHealthCardRawData[Id].Tables is null)
CachedHealthCardRawData[Id].Tables = new Dictionary<string, cF4SDHealthCardRawData.cHealthCardTable>();
if (_rawData.Tables is null)
_rawData.Tables = new Dictionary<string, cF4SDHealthCardRawData.cHealthCardTable>();
if (!CachedHealthCardRawData[Id].Tables.ContainsKey(tableTwo))
CachedHealthCardRawData[Id].Tables[tableTwo] = new cF4SDHealthCardRawData.cHealthCardTable() { Columns = new Dictionary<string, cF4SDHealthCardRawData.cHealthCardTableColumn>() };
if (!_rawData.Tables.TryGetValue(tableTwo, out var _table))
{
_table = new cF4SDHealthCardRawData.cHealthCardTable() { Name = tableTwo, Columns = new Dictionary<string, cF4SDHealthCardRawData.cHealthCardTableColumn>() };
_rawData.Tables[tableTwo] = _table;
}
if (!CachedHealthCardRawData[Id].Tables[tableTwo].Columns.ContainsKey(columnName))
CachedHealthCardRawData[Id].Tables[tableTwo].Columns[columnName] = new cF4SDHealthCardRawData.cHealthCardTableColumn();
if (!_table.Columns.ContainsKey(columnName))
_table.Columns[columnName] = new cF4SDHealthCardRawData.cHealthCardTableColumn(_table);
CachedHealthCardRawData[Id].Tables[tableTwo].StartingIndex = 2;
CachedHealthCardRawData[Id].Tables[tableTwo].IsIncomplete = true;
_table.StartingIndex = 2;
_table.IsIncomplete = true;
if (CachedHealthCardRawData[Id].Tables[tableTwo].Columns[columnName].Values.Count < 2)
CachedHealthCardRawData[Id].Tables[tableTwo].Columns[columnName].Values.AddRange(new List<object>() { 0, 3, 1, 2, 3, 8, 1, 0 });
if (_table.Columns[columnName].Values.Count < 2)
_table.Columns[columnName].Values.AddRange(new List<object>() { 0, 3, 1, 2, 3, 8, 1, 0 });
else
CachedHealthCardRawData[Id].Tables[tableTwo].Columns[columnName].Values.InsertRange(2, new List<object>() { 0, 3, 1, 2, 3, 8, 1, 0 });
_table.Columns[columnName].Values.InsertRange(2, new List<object>() { 0, 3, 1, 2, 3, 8, 1, 0 });
}
await Task.Delay(500);
@@ -1092,61 +1152,79 @@ namespace C4IT.FASD.Cockpit.Communication
const string numericalTable = "agnt-computer-event-numerical";
const string processorColumn = "ProcessorUsage";
if (!CachedHealthCardRawData.ContainsKey(Id))
CachedHealthCardRawData[Id] = new cF4SDHealthCardRawData() { Id = Id, Tables = new Dictionary<string, cF4SDHealthCardRawData.cHealthCardTable>() };
if (!CachedHealthCardRawData.TryGetValue(Id, out var _rawData))
{
_rawData = new cF4SDHealthCardRawData() { Id = Id, Tables = new Dictionary<string, cF4SDHealthCardRawData.cHealthCardTable>() };
CachedHealthCardRawData[Id] = _rawData;
}
if (CachedHealthCardRawData[Id].Tables is null)
CachedHealthCardRawData[Id].Tables = new Dictionary<string, cF4SDHealthCardRawData.cHealthCardTable>();
if (_rawData.Tables is null)
_rawData.Tables = new Dictionary<string, cF4SDHealthCardRawData.cHealthCardTable>();
if (!CachedHealthCardRawData[Id].Tables.ContainsKey(numericalTable))
CachedHealthCardRawData[Id].Tables[numericalTable] = new cF4SDHealthCardRawData.cHealthCardTable() { Columns = new Dictionary<string, cF4SDHealthCardRawData.cHealthCardTableColumn>() };
if (!_rawData.Tables.TryGetValue(numericalTable, out var _table))
{
_table = new cF4SDHealthCardRawData.cHealthCardTable() { Name = numericalTable, Columns = new Dictionary<string, cF4SDHealthCardRawData.cHealthCardTableColumn>() };
_rawData.Tables[numericalTable] = _table;
}
if (!CachedHealthCardRawData[Id].Tables[numericalTable].Columns.ContainsKey(processorColumn))
CachedHealthCardRawData[Id].Tables[numericalTable].Columns[processorColumn] = new cF4SDHealthCardRawData.cHealthCardTableColumn();
if (!_table.Columns.ContainsKey(processorColumn))
_table.Columns[processorColumn] = new cF4SDHealthCardRawData.cHealthCardTableColumn(_table);
CachedHealthCardRawData[Id].Tables[numericalTable].IsIncomplete = false;
CachedHealthCardRawData[Id].Tables[numericalTable].Columns[processorColumn].IsIncomplete = false;
CachedHealthCardRawData[Id].Tables[numericalTable].Columns[processorColumn].Values = new List<object>() { 12.0, 20.0, 18.0, 15.0, 18.0, 19.0, 20.0, 26.0, 17.0, 11.0, 18.0, 16.0, 16.0, 14.0, 15.0 };
_table.IsIncomplete = false;
_table.Columns[processorColumn].IsIncomplete = false;
_table.Columns[processorColumn].Values = new List<object>() { 12.0, 20.0, 18.0, 15.0, 18.0, 19.0, 20.0, 26.0, 17.0, 11.0, 18.0, 16.0, 16.0, 14.0, 15.0 };
}
await Task.Delay(250);
lock (CachedHealthCardRawData)
{
if (!CachedHealthCardRawData.ContainsKey(Id))
CachedHealthCardRawData[Id] = new cF4SDHealthCardRawData() { Id = Id, Tables = new Dictionary<string, cF4SDHealthCardRawData.cHealthCardTable>() };
if (!CachedHealthCardRawData.TryGetValue(Id, out var _rawData))
{
_rawData = new cF4SDHealthCardRawData() { Id = Id, Tables = new Dictionary<string, cF4SDHealthCardRawData.cHealthCardTable>() };
CachedHealthCardRawData[Id] = _rawData;
}
if (CachedHealthCardRawData[Id].Tables is null)
CachedHealthCardRawData[Id].Tables = new Dictionary<string, cF4SDHealthCardRawData.cHealthCardTable>();
if (_rawData.Tables is null)
_rawData.Tables = new Dictionary<string, cF4SDHealthCardRawData.cHealthCardTable>();
if (!CachedHealthCardRawData[Id].Tables.ContainsKey(tableOne))
CachedHealthCardRawData[Id].Tables[tableOne] = new cF4SDHealthCardRawData.cHealthCardTable() { Columns = new Dictionary<string, cF4SDHealthCardRawData.cHealthCardTableColumn>() };
if (!_rawData.Tables.TryGetValue(tableOne, out var _table))
{
_table = new cF4SDHealthCardRawData.cHealthCardTable() { Name = tableOne, Columns = new Dictionary<string, cF4SDHealthCardRawData.cHealthCardTableColumn>() };
_rawData.Tables[tableOne] = _table;
}
if (!CachedHealthCardRawData[Id].Tables[tableOne].Columns.ContainsKey(columnName))
CachedHealthCardRawData[Id].Tables[tableOne].Columns[columnName] = new cF4SDHealthCardRawData.cHealthCardTableColumn();
if (!_table.Columns.TryGetValue(columnName, out var _column))
{
_column = new cF4SDHealthCardRawData.cHealthCardTableColumn(_table);
_table.Columns[columnName] = _column;
}
CachedHealthCardRawData[Id].Tables[tableOne].StartingIndex = 0;
CachedHealthCardRawData[Id].Tables[tableOne].IsIncomplete = false;
_table.StartingIndex = 0;
_table.IsIncomplete = false;
if (CachedHealthCardRawData[Id].Tables[tableOne].Columns[columnName].Values.Count < 0)
CachedHealthCardRawData[Id].Tables[tableOne].Columns[columnName].Values.AddRange(new List<object>() { 8, 7, 6 });
if (_column.Values.Count < 0)
_column.Values.AddRange(new List<object>() { 8, 7, 6 });
else
CachedHealthCardRawData[Id].Tables[tableOne].Columns[columnName].Values.InsertRange(0, new List<object>() { 8, 7, 6 });
_column.Values.InsertRange(0, new List<object>() { 8, 7, 6 });
if (!CachedHealthCardRawData[Id].Tables.ContainsKey(tableTwo))
CachedHealthCardRawData[Id].Tables[tableTwo] = new cF4SDHealthCardRawData.cHealthCardTable() { Columns = new Dictionary<string, cF4SDHealthCardRawData.cHealthCardTableColumn>() };
if (!_rawData.Tables.TryGetValue(tableTwo, out var _table2))
{
_table2 = new cF4SDHealthCardRawData.cHealthCardTable() { Name = tableTwo, Columns = new Dictionary<string, cF4SDHealthCardRawData.cHealthCardTableColumn>() };
_rawData.Tables[tableTwo] = _table2;
}
if (!CachedHealthCardRawData[Id].Tables[tableTwo].Columns.ContainsKey(columnName))
CachedHealthCardRawData[Id].Tables[tableTwo].Columns[columnName] = new cF4SDHealthCardRawData.cHealthCardTableColumn();
if (!_rawData.Tables[tableTwo].Columns.ContainsKey(columnName))
CachedHealthCardRawData[Id].Tables[tableTwo].Columns[columnName] = new cF4SDHealthCardRawData.cHealthCardTableColumn(_table2);
CachedHealthCardRawData[Id].Tables[tableTwo].StartingIndex = 1;
CachedHealthCardRawData[Id].Tables[tableTwo].IsIncomplete = false;
_table2.StartingIndex = 1;
_table2.IsIncomplete = false;
if (CachedHealthCardRawData[Id].Tables[tableTwo].Columns[columnName].Values.Count < 1)
CachedHealthCardRawData[Id].Tables[tableTwo].Columns[columnName].Values.AddRange(new List<object>() { 1 });
if (_table2.Columns[columnName].Values.Count < 1)
_table2.Columns[columnName].Values.AddRange(new List<object>() { 1 });
else
CachedHealthCardRawData[Id].Tables[tableTwo].Columns[columnName].Values.InsertRange(1, new List<object>() { 1 });
_table2.Columns[columnName].Values.InsertRange(1, new List<object>() { 1 });
}

View File

@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Microsoft.Extensions.Logging.Abstractions" publicKeyToken="adb9793829ddae60" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-10.0.0.2" newVersion="10.0.0.2" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>

View File

@@ -43,25 +43,26 @@ namespace C4IT.FASD.Base
if (output.Tables.ContainsKey(table.Name))
continue;
var tableColumns = new Dictionary<string, cF4SDHealthCardRawData.cHealthCardTableColumn>();
foreach (var column in table.Columns)
{
if (tableColumns.ContainsKey(column.ColumnName))
continue;
var values = new List<object>();
values.AddRange(column.Values);
tableColumns.Add(column.ColumnName, new cF4SDHealthCardRawData.cHealthCardTableColumn() { ColumnName = column.ColumnName, Values = values });
}
output.Tables.Add(table.Name, new cF4SDHealthCardRawData.cHealthCardTable()
var outputTable = new cF4SDHealthCardRawData.cHealthCardTable()
{
Name = table.Name,
IsStatic = table.IsStatic,
TimeFrames = table.TimeFrames,
Columns = tableColumns
});
};
outputTable.Columns = new Dictionary<string, cF4SDHealthCardRawData.cHealthCardTableColumn>();
foreach (var column in table.Columns)
{
if (outputTable.Columns.ContainsKey(column.ColumnName))
continue;
var values = new List<object>();
values.AddRange(column.Values);
outputTable.Columns.Add(column.ColumnName, new cF4SDHealthCardRawData.cHealthCardTableColumn(outputTable) { ColumnName = column.ColumnName, Values = values });
}
output.Tables.Add(table.Name, outputTable);
}
}
catch (Exception E)

View File

@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Newtonsoft.Json" version="13.0.3" targetFramework="net472" />
<package id="Newtonsoft.Json" version="13.0.4" targetFramework="net472" />
</packages>

View File

@@ -25,7 +25,11 @@
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Bcl.AsyncInterfaces" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-9.0.0.0" newVersion="9.0.0.0" />
<bindingRedirect oldVersion="0.0.0.0-10.0.1.0" newVersion="10.0.1.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Extensions.Logging.Abstractions" publicKeyToken="adb9793829ddae60" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-10.0.0.2" newVersion="10.0.0.2" />
</dependentAssembly>
</assemblyBinding>
</runtime>

View File

@@ -7,6 +7,7 @@ using C4IT.MultiLanguage;
using FasdDesktopUi.Basics;
using FasdDesktopUi.Basics.Helper;
using FasdDesktopUi.Basics.Models;
using FasdDesktopUi.Basics.Services.Models;
using FasdDesktopUi.Pages.CustomMessageBox;
using FasdDesktopUi.Pages.PhoneSettingsPage;
using FasdDesktopUi.Pages.SearchPage;
@@ -39,6 +40,7 @@ namespace FasdDesktopUi
public bool UseOsLanguage = string.IsNullOrEmpty(cFasdCockpitConfig.Instance.SelectedLanguage);
private TrayTicketNotificationManager _ticketTrayNotification;
private TileScope? _pendingTicketOverviewScope;
private async void Application_Startup(object sender, StartupEventArgs e)
{
@@ -179,10 +181,21 @@ namespace FasdDesktopUi
if (searchView == null)
return;
#if isDemo
var hasNotification = HasPendingTicketOverviewNotification();
if (hasNotification)
{
if (!searchView.IsVisible)
searchView.ActivateSearchView();
else
searchView.BringToFrontPreserveState();
if (searchView.IsVisible && !hasNotification)
searchView.ShowTicketOverviewPaneForScope(PendingTicketOverviewScope);
ClearTicketOverviewTrayNotification();
return;
}
#if isDemo
if (searchView.IsVisible)
{
searchView.Hide();
return;
@@ -194,9 +207,6 @@ namespace FasdDesktopUi
searchView.BringToFrontPreserveState();
searchView.ShowTicketOverviewPane();
if (hasNotification)
ClearTicketOverviewTrayNotification();
#else
if (SearchPageView.Instance.IsVisible)
SearchPageView.Instance.Hide();
@@ -276,7 +286,7 @@ namespace FasdDesktopUi
try
{
SearchPageView.Instance?.BringToFrontPreserveState();
SearchPageView.Instance?.ShowTicketOverviewPane();
SearchPageView.Instance?.ShowTicketOverviewPaneForScope(PendingTicketOverviewScope);
ClearTicketOverviewTrayNotification();
}
catch (Exception E)
@@ -306,6 +316,7 @@ namespace FasdDesktopUi
{
try
{
_pendingTicketOverviewScope = null;
_ticketTrayNotification?.Clear();
}
catch (Exception ex)
@@ -314,6 +325,13 @@ namespace FasdDesktopUi
}
}
public void SetTicketOverviewNotificationScope(TileScope? scope)
{
_pendingTicketOverviewScope = scope;
}
public TileScope? PendingTicketOverviewScope => _pendingTicketOverviewScope;
private System.Windows.Forms.ToolStripItem SetUpNotifyIconLanguageOption()
{
try

View File

@@ -0,0 +1,16 @@
using FasdDesktopUi.Basics.Models;
using System;
using System.Collections.Generic;
namespace FasdDesktopUi.Basics.CustomEvents
{
public class HeadingDataEventArgs : EventArgs
{
public IEnumerable<cHeadingDataModel> NewValue { get; }
public HeadingDataEventArgs(IEnumerable<cHeadingDataModel> headingData) : base()
{
NewValue = headingData;
}
}
}

View File

@@ -1,11 +1,8 @@
using C4IT.FASD.Base;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace FasdDesktopUi.Basics.Services.RelationService
namespace FasdDesktopUi.Basics.CustomEvents
{
public class RelationEventArgs : EventArgs
{

View File

@@ -0,0 +1,12 @@
using C4IT.FASD.Base;
using System;
using System.Collections.Generic;
namespace FasdDesktopUi.Basics.CustomEvents
{
public class SupportCaseDataEventArgs : EventArgs
{
public cF4sdApiSearchResultRelation Relation { get; set; }
public IEnumerable<cF4SDHealthCardRawData.cHealthCardTable> DataTables { get; set; }
}
}

View File

@@ -15,7 +15,6 @@ using C4IT.FASD.Base;
using C4IT.FASD.Cockpit.Communication;
using C4IT.Logging;
using C4IT.MultiLanguage;
using C4IT.XML;
using F4SD_AdaptableIcon.Enums;
@@ -26,6 +25,10 @@ using FasdDesktopUi.Basics.UiActions;
using FasdDesktopUi.Pages.DetailsPage.Models;
using FasdDesktopUi.Pages.SlimPage.Models;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using Newtonsoft.Json.Serialization;
using static C4IT.FASD.Base.cF4SDHealthCardRawData;
using static C4IT.Logging.cLogManager;
@@ -78,6 +81,7 @@ namespace FasdDesktopUi.Basics.Helper
this.dataProvider = dataProvider;
_menuDataProvider = new MenuItemDataProvider(dataProvider);
cUtility.RawValueFormatter.SetDefaultCulture(new CultureInfo(cFasdCockpitConfig.Instance.SelectedLanguage));
cUtility.RawValueFormatter.SetDefaultTimeZone(TimeZoneInfo.Local);
HistoryData = new cHealthCardHistoryDataHelper(this);
SlimCard = new cHealthCardSlimPageHelper(this);
@@ -246,6 +250,9 @@ namespace FasdDesktopUi.Basics.Helper
{
List<object> output = new List<object>();
if (healthCardColumn?.Values == null)
return output;
try
{
for (int i = 0; i < startingIndex; i++)
@@ -263,6 +270,13 @@ namespace FasdDesktopUi.Basics.Helper
return output;
}
private List<object> GetStateValues(cHealthCardTableColumn tableColumn)
{
if (tableColumn == null)
return new List<object>();
else return GetValuesOfHealthCardTableColumn(tableColumn.Table.StartingIndex, tableColumn);
}
private List<object> GetStateValues(cValueAddress DatabaseInfo, bool isStatic)
{
List<object> output = new List<object>();
@@ -313,9 +327,7 @@ namespace FasdDesktopUi.Basics.Helper
rawValueLeveling = GetStateValueAt(referencedStateDefinition.DatabaseInfo, 0, true);
}
var _color = stateDefinitionForLeveling is cHealthCardStateAggregation aggregation ?
GetSummaryStatusColor(aggregation.States, true) : GetHighlightColor(rawValueLeveling, stateDefinitionForLeveling);
var _color = GetHighlightColor(rawValueLeveling, stateDefinitionForLeveling, 0, true);
return _color;
}
catch (Exception ex)
@@ -325,63 +337,64 @@ namespace FasdDesktopUi.Basics.Helper
return enumHighlightColor.none;
}
private enumHighlightColor GetHighlightColor(object value, cHealthCardStateBase stateDefinition, int referenceDays = 0)
private enumHighlightColor GetHighlightColor(object value, cHealthCardStateBase stateDefinition, int referenceDays, bool isStatic)
{
return GetHighlightColor(new cStateThresholdValues() { Value = value, StateDefinition = stateDefinition, ReferenceDays = referenceDays });
}
if (stateDefinition == null)
return enumHighlightColor.none;
private enumHighlightColor GetHighlightColor(cStateThresholdValues thresholdValues)
{
enumHighlightColor output = enumHighlightColor.none;
if (stateDefinition is cHealthCardStateAggregation _stateAggregation)
return GetSummaryStatusColor(_stateAggregation.States, isStatic, referenceDays) ?? enumHighlightColor.none;
try
{
if (thresholdValues.Value == null)
if (value == null)
return output;
if (thresholdValues.StateDefinition is cHealthCardStateLevel stateLevel)
if (stateDefinition is cHealthCardStateLevel stateLevel)
{
var valueDouble = cF4SDHealthCardRawData.GetDouble(thresholdValues.Value);
var valueDouble = cF4SDHealthCardRawData.GetDouble(value);
if (valueDouble != null)
{
if (stateLevel.IsDirectionUp)
output = valueDouble >= stateLevel.Error ? enumHighlightColor.red : valueDouble >= stateLevel.Warning ? enumHighlightColor.orange : thresholdValues.StateDefinition.IsNotTransparent ? enumHighlightColor.green : enumHighlightColor.none;
output = valueDouble >= stateLevel.Error ? enumHighlightColor.red : valueDouble >= stateLevel.Warning ? enumHighlightColor.orange : stateDefinition.IsNotTransparent ? enumHighlightColor.green : enumHighlightColor.none;
else
output = valueDouble <= stateLevel.Error ? enumHighlightColor.red : valueDouble <= stateLevel.Warning ? enumHighlightColor.orange : thresholdValues.StateDefinition.IsNotTransparent ? enumHighlightColor.green : enumHighlightColor.none;
output = valueDouble <= stateLevel.Error ? enumHighlightColor.red : valueDouble <= stateLevel.Warning ? enumHighlightColor.orange : stateDefinition.IsNotTransparent ? enumHighlightColor.green : enumHighlightColor.none;
}
}
else if (thresholdValues.StateDefinition is cHealthCardStateVersion stateVersion)
else if (stateDefinition is cHealthCardStateVersion stateVersion)
{
var valueVersion = cF4SDHealthCardRawData.GetVersion(thresholdValues.Value);
var valueVersion = cF4SDHealthCardRawData.GetVersion(value);
if (valueVersion != null)
{
if (stateVersion.IsDirectionUp)
output = valueVersion >= stateVersion.Error ? enumHighlightColor.red : valueVersion >= stateVersion.Warning ? enumHighlightColor.orange : thresholdValues.StateDefinition.IsNotTransparent ? enumHighlightColor.green : enumHighlightColor.none;
output = valueVersion >= stateVersion.Error ? enumHighlightColor.red : valueVersion >= stateVersion.Warning ? enumHighlightColor.orange : stateDefinition.IsNotTransparent ? enumHighlightColor.green : enumHighlightColor.none;
else
output = valueVersion <= stateVersion.Error ? enumHighlightColor.red : valueVersion <= stateVersion.Warning ? enumHighlightColor.orange : thresholdValues.StateDefinition.IsNotTransparent ? enumHighlightColor.green : enumHighlightColor.none;
output = valueVersion <= stateVersion.Error ? enumHighlightColor.red : valueVersion <= stateVersion.Warning ? enumHighlightColor.orange : stateDefinition.IsNotTransparent ? enumHighlightColor.green : enumHighlightColor.none;
}
}
else if (thresholdValues.StateDefinition is cHealthCardStateDateTime stateDateTime)
else if (stateDefinition is cHealthCardStateDateTime stateDateTime)
{
var valueDateTime = cF4SDHealthCardRawData.GetDateTime(thresholdValues.Value);
var valueDateTime = cF4SDHealthCardRawData.GetDateTime(value);
if (valueDateTime != null)
{
var tempDateTime = valueDateTime ?? DateTime.Now;
var differenceHours = Math.Floor((DateTime.UtcNow.AddDays(-thresholdValues.ReferenceDays) - tempDateTime).TotalHours);
var differenceHours = Math.Floor((DateTime.UtcNow.AddDays(-referenceDays) - tempDateTime).TotalHours);
if (stateDateTime.IsDirectionUp)
output = differenceHours >= stateDateTime.ErrorHours ? enumHighlightColor.red : differenceHours >= stateDateTime.WarningHours ? enumHighlightColor.orange : thresholdValues.StateDefinition.IsNotTransparent ? enumHighlightColor.green : enumHighlightColor.none;
output = differenceHours >= stateDateTime.ErrorHours ? enumHighlightColor.red : differenceHours >= stateDateTime.WarningHours ? enumHighlightColor.orange : stateDefinition.IsNotTransparent ? enumHighlightColor.green : enumHighlightColor.none;
else
output = differenceHours <= stateDateTime.ErrorHours ? enumHighlightColor.red : differenceHours <= stateDateTime.WarningHours ? enumHighlightColor.orange : thresholdValues.StateDefinition.IsNotTransparent ? enumHighlightColor.green : enumHighlightColor.none;
output = differenceHours <= stateDateTime.ErrorHours ? enumHighlightColor.red : differenceHours <= stateDateTime.WarningHours ? enumHighlightColor.orange : stateDefinition.IsNotTransparent ? enumHighlightColor.green : enumHighlightColor.none;
}
}
else if (thresholdValues.StateDefinition is cHealthCardStateInfo)
else if (stateDefinition is cHealthCardStateInfo)
{
output = thresholdValues.StateDefinition.IsNotTransparent ? enumHighlightColor.blue : enumHighlightColor.none;
output = stateDefinition.IsNotTransparent ? enumHighlightColor.blue : enumHighlightColor.none;
}
else if (thresholdValues.StateDefinition is cHealthCardStateTranslation stateTranslation)
else if (stateDefinition is cHealthCardStateTranslation stateTranslation)
{
var abstractTranslation = cF4SDHealthCardConfig.GetTranslationsWithName(stateTranslation, stateTranslation.Translation);
if (abstractTranslation == null || !(abstractTranslation is cHealthCardTranslator translation))
@@ -390,7 +403,7 @@ namespace FasdDesktopUi.Basics.Helper
enumHealthCardStateLevel translationStateLevel = translation.DefaultTranslation?.StateLevel ?? enumHealthCardStateLevel.Info;
foreach (var translationEntry in translation.Translations)
{
if (translationEntry.Values.Any(translationValue => thresholdValues.Value.ToString().Equals(translationValue, StringComparison.InvariantCultureIgnoreCase)))
if (translationEntry.Values.Any(translationValue => value.ToString().Equals(translationValue, StringComparison.InvariantCultureIgnoreCase)))
translationStateLevel = translationEntry.StateLevel;
}
@@ -400,7 +413,7 @@ namespace FasdDesktopUi.Basics.Helper
output = enumHighlightColor.none;
break;
case enumHealthCardStateLevel.Ok:
if (thresholdValues.StateDefinition.IsNotTransparent)
if (stateDefinition.IsNotTransparent)
output = enumHighlightColor.green;
break;
case enumHealthCardStateLevel.Warning:
@@ -410,12 +423,12 @@ namespace FasdDesktopUi.Basics.Helper
output = enumHighlightColor.red;
break;
case enumHealthCardStateLevel.Info:
if (thresholdValues.StateDefinition.IsNotTransparent)
if (stateDefinition.IsNotTransparent)
output = enumHighlightColor.blue;
break;
}
}
else if (thresholdValues.StateDefinition is cHealthCardStateRefLink stateRefLink)
else if (stateDefinition is cHealthCardStateRefLink stateRefLink)
{
//if (cHealthCardPrerequisites.GetReferencableStates(SelectedHealthCard).TryGetValue(stateRefLink.Reference, out var referencedState))
// output = GetHighlightColor(thresholdValues);
@@ -428,9 +441,9 @@ namespace FasdDesktopUi.Basics.Helper
return output;
}
private enumHighlightColor GetSummaryStatusColor(List<cHealthCardStateBase> stateDefinitions, bool isStatic, int dayIndex = 0)
private enumHighlightColor? GetSummaryStatusColor(List<cHealthCardStateBase> stateDefinitions, bool isStatic, int dayIndex = 0)
{
enumHighlightColor output = enumHighlightColor.none;
enumHighlightColor? output = null;
try
{
foreach (var stateDefinition in stateDefinitions)
@@ -438,19 +451,19 @@ namespace FasdDesktopUi.Basics.Helper
if (!IsUiVisible(stateDefinition, dataProvider.NamedParameterEntries))
continue;
var tempColor = enumHighlightColor.none;
var stateValue = GetStateValueAt(stateDefinition.DatabaseInfo, dayIndex, isStatic);
if (stateDefinition is cHealthCardStateAggregation aggregationState)
tempColor = GetSummaryStatusColor(aggregationState.States, isStatic, dayIndex);
else
tempColor = GetHighlightColor(stateValue, stateDefinition, referenceDays: dayIndex);
enumHighlightColor? tempColor = null;
if (stateValue != null)
{
tempColor = GetHighlightColor(stateValue, stateDefinition, dayIndex, isStatic);
if (tempColor == enumHighlightColor.none && stateValue != null)
tempColor = enumHighlightColor.green;
}
if (output == null)
output = tempColor;
else if (tempColor != null)
output = (enumHighlightColor)Math.Max((int)tempColor, (int)output);
}
}
@@ -461,6 +474,134 @@ namespace FasdDesktopUi.Basics.Helper
return output;
}
private cDataHistoryValueModel ProcessSingleStateValue(cProcessStateRequirements Requirements, object value, object thresholdValue, int columnIndex)
{
try
{
var cellContent = new cDataHistoryValueModel() { Content = null, HighlightColor = enumHighlightColor.none, IsLoading = Requirements.valueTableColumn?.IsIncomplete ?? false };
if (Requirements.valueState is cHealthCardStateAggregation stateAggregation)
{
cellContent.Content = "Ø";
cellContent.HighlightColor = GetSummaryStatusColor(stateAggregation.States, Requirements.isStatic, columnIndex);
if (cellContent.HighlightColor == null)
{
cellContent.Content = "-";
cellContent.HighlightColor = enumHighlightColor.none;
}
}
else
{
FormattingOptions options = new FormattingOptions() { ReferenceDate = DateTime.UtcNow.Date.AddDays(columnIndex), TimeZone = TimeZoneInfo.Local };
var _c = cUtility.RawValueFormatter.GetDisplayValue(value, Requirements.valueState.DisplayType, options);
if (!string.IsNullOrWhiteSpace(_c))
cellContent.Content = _c;
cellContent.ThresholdValues = new cStateThresholdValues() { Value = thresholdValue, StateDefinition = Requirements.valueState.StateProcessingRequirements.tresholdState, ReferenceDays = columnIndex };
cellContent.HighlightColor = GetHighlightColor(cellContent.ThresholdValues.Value, Requirements.valueState.StateProcessingRequirements.tresholdState, columnIndex, Requirements.isStatic);
if (Requirements.valueState.StateProcessingRequirements.translation != null && cellContent.Content != null)
{
var translationValue = Requirements.valueState.StateProcessingRequirements.translation.DefaultTranslation?.Translation.GetValue() ?? cellContent.Content;
foreach (var translationEntry in Requirements.valueState.StateProcessingRequirements.translation.Translations)
{
if (translationEntry.Values.Any(_val => cellContent.Content.Equals(_val, StringComparison.CurrentCultureIgnoreCase)))
translationValue = translationEntry.Translation.GetValue();
}
cellContent.Content = translationValue;
}
if (cellContent.Content == null)
cellContent.Content = "-";
if (!cellContent.IsLoading && Requirements.valueTableColumn?.Table != null)
{
int maxColumnCount = 0;
if (Requirements.valueTableColumn.Table.Columns?.Count > 0)
maxColumnCount = Requirements.valueTableColumn.Table.Columns.Max(column => column.Value?.Values?.Count ?? 1);
if (columnIndex < Requirements.valueTableColumn.Table.StartingIndex || columnIndex >= Requirements.valueTableColumn.Table.StartingIndex + maxColumnCount)
cellContent.IsLoading = Requirements.valueTableColumn.Table.IsIncomplete;
}
}
if (Requirements.valueState.Details != null && value != null)
cellContent.UiAction = new cShowDetailedDataAction(Requirements.valueState, columnIndex);
return cellContent;
}
catch (Exception E)
{
LogException(E);
}
return null;
}
private cProcessStateRequirements CreateProcessStateRequirements(cHealthCardStateBase stateDefinition, bool isStatic)
{
var ProcessRequirements = new cProcessStateRequirements()
{
valueState = stateDefinition,
valueTableColumn = null,
isStatic = isStatic,
Values = new List<object>(),
ThresholdValues = new List<object>()
};
try
{
// get the global requirements one which are not support case dependent
if (stateDefinition.StateProcessingRequirements == null)
{
stateDefinition.StateProcessingRequirements = new cHealthCardStateBase.cStateProcessingRequirements() { tresholdState = stateDefinition, translation = null };
// if we have a ref link, get the referenced stateDefinition and state values
ProcessRequirements.ThresholdValues = ProcessRequirements.Values;
if (stateDefinition is cHealthCardStateRefLink ReferencedLinkState)
{
var refState = cF4SDHealthCardConfig.GetReferencableStateWithName(ReferencedLinkState.ParentNode, ReferencedLinkState.Reference);
if (refState != null)
{
stateDefinition.StateProcessingRequirements.tresholdState = refState;
}
}
//in state is translation state, get the translation
if (stateDefinition is cHealthCardStateTranslation _StateTranslation)
{
var abstractTranslation = cF4SDHealthCardConfig.GetTranslationsWithName(_StateTranslation, _StateTranslation.Translation);
if (abstractTranslation is cHealthCardTranslator castedTranslation)
stateDefinition.StateProcessingRequirements.translation = castedTranslation;
}
}
// get the state values
if (stateDefinition.DatabaseInfo != null)
{
var _table = HealthCardRawData.GetTableByName(stateDefinition.DatabaseInfo.ValueTable, isStatic);
if (_table != null)
{
_table.Columns.TryGetValue(stateDefinition.DatabaseInfo.ValueColumn, out ProcessRequirements.valueTableColumn);
ProcessRequirements.Values = GetValuesOfHealthCardTableColumn(_table.StartingIndex, ProcessRequirements.valueTableColumn);
}
}
// get the treshold values
if (stateDefinition == stateDefinition.StateProcessingRequirements.tresholdState)
ProcessRequirements.ThresholdValues = ProcessRequirements.Values;
else
ProcessRequirements.ThresholdValues = GetStateValues(stateDefinition.StateProcessingRequirements.tresholdState.DatabaseInfo, isStatic);
}
catch (Exception E)
{
LogException(E);
}
return ProcessRequirements;
}
private cUiActionBase GetUiActionByQuickActionNames(List<string> names, string uiActionName, string uiActionDescription)
{
try
@@ -961,10 +1102,10 @@ namespace FasdDesktopUi.Basics.Helper
string namedParameterTitle = namedParameter.Value.Names.GetValue();
var parameterValue = GetStateValueAt(namedParameter.Value.DatabaseInfo, 0, true);
string namedParameterValue = cUtility.RawValueFormatter.GetDisplayValue(parameterValue, cUtility.GetRawValueType(namedParameter.Value.Display));
string namedParameterValue = cUtility.RawValueFormatter.GetDisplayValue(parameterValue, namedParameter.Value.Display);
if (!dataProvider.NamedParameterEntries.ContainsKey(namedParameter.Value.ParameterName))
dataProvider.NamedParameterEntries.Add(namedParameter.Value.ParameterName, new cNamedParameterEntryPointer(dataProvider, namedParameter.Value.DatabaseInfo, cUtility.GetRawValueType(namedParameter.Value.Display)) { Title = namedParameterTitle });
dataProvider.NamedParameterEntries.Add(namedParameter.Value.ParameterName, new cNamedParameterEntryPointer(dataProvider, namedParameter.Value.DatabaseInfo, namedParameter.Value.Display) { Title = namedParameterTitle });
}
catch (Exception ex)
{
@@ -997,6 +1138,15 @@ namespace FasdDesktopUi.Basics.Helper
#endregion
private class cProcessStateRequirements
{
internal cHealthCardStateBase valueState;
internal bool isStatic;
internal cHealthCardTableColumn valueTableColumn;
internal List<object> Values;
internal List<object> ThresholdValues;
}
public abstract class cHealthCardStateSubHelper
{
protected readonly cHealthCardDataHelper parent;
@@ -1055,7 +1205,7 @@ namespace FasdDesktopUi.Basics.Helper
CultureInfo culture = new CultureInfo(cMultiLanguageSupport.CurrentLanguage);
var valueColumnHeader = i != 0 ? DateTime.Today.AddDays(-i).ToString(cMultiLanguageSupport.GetItem("Global.Date.Format.ShortDateWithDay", "ddd. dd.MM."), culture) : cMultiLanguageSupport.GetItem("Global.Date.Today");
var summaryStatusColor = parent.GetSummaryStatusColor(stateCategoryDefinition.States, false, i);
var valueColumn = new DetailsPageDataHistoryColumnModel() { ColumnValues = new List<cDataHistoryValueModel>(), Content = valueColumnHeader, HighlightColor = summaryStatusColor };
var valueColumn = new DetailsPageDataHistoryColumnModel() { ColumnValues = new List<cDataHistoryValueModel>(), Content = valueColumnHeader, HighlightColor = summaryStatusColor ?? enumHighlightColor.none };
historySectionValueColumns.Add(valueColumn);
}
@@ -1115,88 +1265,15 @@ namespace FasdDesktopUi.Basics.Helper
private void ProcessState(cHealthCardStateBase stateDefinition, int valueColumnCount, bool isStatic, List<DetailsPageDataHistoryColumnModel> historySectionValueColumns)
{
var stateValues = parent.GetStateValues(stateDefinition.DatabaseInfo, isStatic);
//in case state is translationstate, get translation to avoid calling GetTranslationWithName method for every column
cHealthCardStateTranslation stateTranslation = null;
cHealthCardTranslator translation = null;
if (stateDefinition is cHealthCardStateTranslation tempStateTranslation)
{
stateTranslation = tempStateTranslation;
var abstractTranslation = cF4SDHealthCardConfig.GetTranslationsWithName(tempStateTranslation, stateTranslation.Translation);
if (abstractTranslation is cHealthCardTranslator castedTranslation)
translation = castedTranslation;
}
else
tempStateTranslation = null;
var ProcessRequirements = parent.CreateProcessStateRequirements(stateDefinition, isStatic);
for (int i = 0; i < valueColumnCount; i++)
{
string cellContentString = stateDefinition is cHealthCardStateAggregation ? "Ø" : "-";
enumHighlightColor cellContentColor = enumHighlightColor.none;
cStateThresholdValues thresholdValues = null;
var Value = ProcessRequirements.Values?.Count > i ? ProcessRequirements.Values[i] : null;
var thresholdValue = ProcessRequirements.ThresholdValues?.Count > i ? ProcessRequirements.ThresholdValues[i] : null;
if (stateValues.Count > i)
{
FormattingOptions options = new FormattingOptions() { ReferenceDate = DateTime.UtcNow.Date.AddDays(i) };
thresholdValues = new cStateThresholdValues() { Value = stateValues[i], StateDefinition = stateDefinition, ReferenceDays = i };
cellContentString = cUtility.RawValueFormatter.GetDisplayValue(stateValues[i], cUtility.GetRawValueType(stateDefinition.DisplayType), options);
if (string.IsNullOrWhiteSpace(cellContentString))
cellContentString = "-";
cellContentColor = parent.GetHighlightColor(thresholdValues);
}
if (stateDefinition is cHealthCardStateAggregation stateAggregation)
{
cellContentColor = parent.GetSummaryStatusColor(stateAggregation.States, isStatic, i);
}
if (stateTranslation != null)
{
if (translation != null && cellContentString != "-")
{
var translationValue = translation.DefaultTranslation?.Translation.GetValue() ?? cellContentString;
foreach (var translationEntry in translation.Translations)
{
if (cellContentString != null)
if (translationEntry.Values.Any(value => cellContentString.Equals(value, StringComparison.CurrentCultureIgnoreCase)))
translationValue = translationEntry.Translation.GetValue();
}
cellContentString = translationValue;
}
}
bool isStateRowLoading = false;
if (stateDefinition.DatabaseInfo != null)
{
var stateTable = HealthCardRawData.GetTableByName(stateDefinition.DatabaseInfo.ValueTable, isStatic);
if (stateTable != null)
{
int maxColumnCount = 0;
if (stateTable?.Columns?.Count > 0)
maxColumnCount = stateTable.Columns.Max(column => column.Value?.Values?.Count ?? 1);
if (i < stateTable.StartingIndex || i >= stateTable.StartingIndex + maxColumnCount)
isStateRowLoading = stateTable.IsIncomplete;
}
}
if (stateDefinition.DatabaseInfo != null)
{
var stateTable = HealthCardRawData.GetTableByName(stateDefinition.DatabaseInfo.ValueTable, isStatic);
if (stateTable != null)
if (stateTable.Columns.TryGetValue(stateDefinition.DatabaseInfo.ValueColumn, out var stateColumn))
isStateRowLoading = stateColumn.IsIncomplete;
}
var cellContent = new cDataHistoryValueModel() { Content = cellContentString, HighlightColor = cellContentColor, IsLoading = isStateRowLoading, ThresholdValues = thresholdValues };
if (stateDefinition.Details != null && stateValues?.Count > i && stateValues[i] != null)
cellContent.UiAction = new cShowDetailedDataAction(stateDefinition, i);
var cellContent = parent.ProcessSingleStateValue(ProcessRequirements, Value, thresholdValue, i);
historySectionValueColumns[i].ColumnValues.Add(cellContent);
}
@@ -1272,15 +1349,16 @@ namespace FasdDesktopUi.Basics.Helper
if (stateDefinition.DatabaseInfo != null)
{
object widgetValue = parent.GetStateValueAt(stateDefinition.DatabaseInfo, 0, true);
widgetValueToAdd.Value = cUtility.RawValueFormatter.GetDisplayValue(widgetValue, cUtility.GetRawValueType(stateDefinition.DisplayType));
widgetValueToAdd.Value = cUtility.RawValueFormatter.GetDisplayValue(widgetValue, stateDefinition.DisplayType);
object stateValue = widgetValue;
if (stateDefinition is cHealthCardStateRefLink refLinkState)
{
stateModel = cF4SDHealthCardConfig.GetReferencableStateWithName(stateDefinition.ParentNode, refLinkState.Reference);
widgetValue = parent.GetStateValueAt(stateModel.DatabaseInfo, 0, true);
stateValue = parent.GetStateValueAt(stateModel.DatabaseInfo, 0, true);
}
var widgetHighlightColor = parent.GetHighlightColor(widgetValue, stateModel);
var widgetHighlightColor = parent.GetHighlightColor(stateValue, stateModel, 0, true);
widgetValueToAdd.HighlightIn = widgetHighlightColor;
widgetValues.Add(widgetValueToAdd);
@@ -1360,7 +1438,7 @@ namespace FasdDesktopUi.Basics.Helper
var tempContent = i != 0 ? DateTime.Today.AddDays(-i).ToString("dd.MM") : cMultiLanguageSupport.GetItem("Global.Date.Today");
var tempHighlightColor = parent.GetSummaryStatusColor(categoryDefinition.States, false, i);
slimPageData.ValueColumns.Add(new cDataHistoryValueModel() { Content = tempContent, HighlightColor = tempHighlightColor, IsLoading = isLoading });
slimPageData.ValueColumns.Add(new cDataHistoryValueModel() { Content = tempContent, HighlightColor = tempHighlightColor ?? enumHighlightColor.none, IsLoading = isLoading });
}
//SummaryValueColumn
@@ -1398,7 +1476,7 @@ namespace FasdDesktopUi.Basics.Helper
}
summaryValueColumnColor = (enumHighlightColor)Math.Max((int)summaryValueColumnColor, (int)parent.GetSummaryStatusColor(categoryDefinition.States, false, i));
summaryValueColumnColor = (enumHighlightColor)Math.Max((int)summaryValueColumnColor, (int)(parent.GetSummaryStatusColor(categoryDefinition.States, false, i) ?? enumHighlightColor.none));
}
var summaryValueColumn = new cDataHistoryValueModel() { Content = summaryValueColumnContent, HighlightColor = summaryValueColumnColor, IsLoading = isSummaryLoading };
@@ -1476,24 +1554,15 @@ namespace FasdDesktopUi.Basics.Helper
internal cHealthCardDetailPageHelper(cHealthCardDataHelper parent) : base(parent) { }
private cHealthCardDetailsTable GetDetailTableValued(object _value, cHealthCardDetailsValued StateDetailsValued)
private List<object[]> getDetailsValuesCsv(string Data, cHealthCardDetailsValued StateDetailsValued)
{
MethodBase CM = null; if (cLogManager.DefaultLogger.IsDebug) { CM = MethodBase.GetCurrentMethod(); LogMethodBegin(CM); }
var _values = new List<object[]>();
try
{
if (_value == null)
return null;
var _strData = cUtility.RawValueFormatter.GetDisplayValue(_value, RawValueType.STRING);
if (_strData == null)
return null;
var _cols = new List<string>();
foreach (var _colConfig in StateDetailsValued)
_cols.Add(_colConfig.Names.GetValue());
var _arrRow = _strData.Split(StateDetailsValued.RowSeparator);
var _values = new List<object[]>();
var _arrRow = Data.Split(StateDetailsValued.RowSeparator);
foreach (var _row in _arrRow)
{
if (string.IsNullOrEmpty(_row))
@@ -1504,21 +1573,109 @@ namespace FasdDesktopUi.Basics.Helper
_entry.Add(_row.Trim());
else
{
var _arrCol = _strData.Split((char)StateDetailsValued.ColSeparator);
var _arrCol = Data.Split((char)StateDetailsValued.ColSeparator);
foreach (var _col in _arrCol)
_entry.Add(_col.Trim());
}
while (_entry.Count < _cols.Count)
while (_entry.Count < StateDetailsValued.Count)
_entry.Add(null);
_values.Add(_entry.ToArray());
}
}
catch (Exception E)
{
LogException(E);
}
finally
{
if (CM != null) LogMethodEnd(CM);
}
return _values;
}
private List<object[]> getDetailsValuesJson(string Data, cHealthCardDetailsValued StateDetailsValued)
{
MethodBase CM = null; if (cLogManager.DefaultLogger.IsDebug) { CM = MethodBase.GetCurrentMethod(); LogMethodBegin(CM); }
try
{
var _rawVals = JsonConvert.DeserializeObject<List<JObject>>(Data);
if (_rawVals?.Count > 0)
{
var _values = new List<object[]>();
foreach (JObject _row in _rawVals)
{
var _props = _row.Children();
var _valRow = new object[StateDetailsValued.Count];
for (int i = 0; i < StateDetailsValued.Count; i++) _valRow[i] = null;
foreach (var _token in _props)
{
if (!(_token is JProperty jProp))
continue;
var _name = jProp.Name;
var _i = StateDetailsValued.FindIndex(v => v.Column.Equals(_name, StringComparison.InvariantCultureIgnoreCase));
if (_i < 0)
continue;
var _col = StateDetailsValued[_i];
if (jProp.Value is JValue jValue)
{
var _value = jValue.Value;
var _displayString = cUtility.RawValueFormatter.GetDisplayValue(_value, _col.DisplayType);
_valRow[_i] = _displayString;
}
}
_values.Add(_valRow);
}
return _values;
}
}
catch (Exception E)
{
LogException(E);
}
finally
{
if (CM != null) LogMethodEnd(CM);
}
return null;
}
private cHealthCardDetailsTable GetDetailTableValued(object _value, cHealthCardDetailsValued StateDetailsValued)
{
MethodBase CM = null; if (cLogManager.DefaultLogger.IsDebug) { CM = MethodBase.GetCurrentMethod(); LogMethodBegin(CM); }
try
{
if (_value == null)
return null;
var _strData = cUtility.RawValueFormatter.GetDisplayValue(_value, RawValueType.STRING);
if (_strData == null)
return null;
List<object[]> _values = new List<object[]>();
if (StateDetailsValued.Format == cHealthCardDetailsValued.ValuedFormat.json)
_values = getDetailsValuesJson(_strData, StateDetailsValued);
else
_values = getDetailsValuesCsv(_strData, StateDetailsValued);
var Result = new cHealthCardDetailsTable()
{
Name = "Details-" + StateDetailsValued.ParentState.Name,
Columns = _cols,
Columns = StateDetailsValued.Select(v => v.Names.GetValue()).ToList(),
Values = new Dictionary<int, List<object[]>>() { { 0, _values } }
};
@@ -1563,13 +1720,16 @@ namespace FasdDesktopUi.Basics.Helper
widgetRowData.EditValueInformation = GetEditInfo(rawValueDisplay);
bool shouldShowValueDetails =
(TryGetValuedDetails(rawValueDisplay, out var valuedDetails) && valuedDetails?.Values?.Values?.FirstOrDefault()?.Count > 1)
(TryGetValuedDetails(rawValueDisplay, out var valuedDetails)
&& (valuedDetails?.Values?.Values?.FirstOrDefault()?.Count > 1)
|| (valuedDetails?.Values?.Values?.FirstOrDefault()?.FirstOrDefault()?.Length > 1)
)
|| (stateDefinition.Details is cHealthCardDetails && rawValueDisplay != null && rawValueDisplay.ToString() != "0");
if (shouldShowValueDetails)
{
widgetRowData.ValuedDetails = valuedDetails;
widgetRowData.UiActionValue = new cShowDetailedDataAction(stateDefinition, ValuedDetailsData: valuedDetails)
widgetRowData.UiActionValue = new cShowDetailedDataAction(stateDefinition, valuedDetailsData: valuedDetails)
{
DisplayType = enumActionDisplayType.enabled
};
@@ -1615,7 +1775,7 @@ namespace FasdDesktopUi.Basics.Helper
if (detailTable != null)
displayValue = GetDetailStringValue(rawValue, detailTable);
return displayValue ?? cUtility.RawValueFormatter.GetDisplayValue(rawValue, cUtility.GetRawValueType(stateDefinition.DisplayType));
return displayValue ?? cUtility.RawValueFormatter.GetDisplayValue(rawValue, stateDefinition.DisplayType);
}
string GetTranslationValue(cHealthCardStateTranslation translationDefinition, object rawValue)
@@ -1644,8 +1804,8 @@ namespace FasdDesktopUi.Basics.Helper
return null;
var tableValues = detailTableValueTable.Values.First().Value;
if (detailTableValueTable.Columns.Count == 1 && tableValues.Count == 1)
return cUtility.RawValueFormatter.GetDisplayValue(detailTableValueTable.Values.First().Value.First()?.First(), cUtility.GetRawValueType(stateDefinition.Details.First().DisplayType));
if (detailTableValueTable.Columns.Count >= 1 && tableValues.Count == 1)
return cUtility.RawValueFormatter.GetDisplayValue(detailTableValueTable.Values.First().Value.First()?.First(), stateDefinition.Details.First().DisplayType);
else
return cUtility.RawValueFormatter.GetDisplayValue(detailTableValueTable.Values.First().Value.Count, RawValueType.STRING);
}
@@ -1807,87 +1967,46 @@ namespace FasdDesktopUi.Basics.Helper
}
}
public async Task<bool> GetHealthCardRawDataAsync(cF4sdHealthCardRawDataRequest requestData)
public async Task SetHealthCardRawData(cF4SDHealthCardRawData newHealthCardRawData, cF4sdIdentityList identities)
{
var CM = MethodBase.GetCurrentMethod();
var IsDataIncomplete = true;
LogMethodBegin(CM);
try
{
if (SelectedHealthCard == null)
{
LogEntry("No valid healthcard was found.");
return false;
}
dataProvider.Identities = requestData.Identities;
var requestedTables = requestData.Tables;
HealthCardRawData.RemoveEmptyTables();
var requiredTables = requestedTables.Where(value => HealthCardRawData.Tables.ContainsKey(value) == false && value.StartsWith("Computation_") == false).ToList();
Mouse.OverrideCursor = Cursors.Wait;
cF4SDHealthCardRawData newHealthCardRawData = null;
await LoadingRawDataCriticalSection.EnterAsync();
IsDataIncomplete = false;
if (requiredTables?.Count > 0)
{
requestData.Tables = requiredTables;
newHealthCardRawData = await cFasdCockpitCommunicationBase.Instance.GetHealthCardData(requestData);
if (newHealthCardRawData == null)
return false;
}
parent.dataProvider.Identities = identities;
if (newHealthCardRawData != null)
parent.HealthCardRawData = HealthCardRawData.Combine(newHealthCardRawData);
parent.UpdateNamedParameterEntries();
IsDataIncomplete = HealthCardRawData.Tables.Where(table => table.Key.StartsWith("Computation_") == false)
.ToList()
bool isDataIncomplete = HealthCardRawData.Tables
.Where(table => table.Key.StartsWith("Computation_") == false)
.Any(table => table.Value.IsIncomplete);
if (IsDataIncomplete)
{
var _ = Task.Run(ContinueHealthCardDataLoadingAsync);
}
lock (HealthCardRawData)
{
SelectedHealthCard.DoComputations(HealthCardRawData);
}
LogEntry("DataChanged - Finished getting Healthcard rawdata.");
DataChanged?.Invoke(this, new BooleanEventArgs() { BooleanArg = true });
DataChanged?.Invoke(this, new BooleanEventArgs(true));
parent.UpdateNamedParameterEntries();
if (IsDataIncomplete is false)
DataFullyLoaded?.Invoke(this, new EventArgs());
return true;
if (!isDataIncomplete)
DataFullyLoaded?.Invoke(this, EventArgs.Empty);
}
catch (Exception E)
catch (Exception ex)
{
LogException(E);
LogException(ex);
}
finally
{
if (IsDataIncomplete is false)
LoadingRawDataCriticalSection.Leave();
Mouse.OverrideCursor = null;
LogMethodEnd(CM);
}
return false;
}
internal cHealthCardDataLoadingHelper(cHealthCardDataHelper parent) : base(parent) { }
@@ -1980,7 +2099,7 @@ namespace FasdDesktopUi.Basics.Helper
{
try
{
if (newRawData is null)
if (newRawData?.Tables is null)
return;
foreach (var tableName in newRawData.Tables.Keys)
@@ -2035,32 +2154,21 @@ namespace FasdDesktopUi.Basics.Helper
}
}
private bool CheckUpdatedTable(KeyValuePair<string, cF4SDHealthCardRawData.cHealthCardTable> table, cF4SDHealthCardRawData updatedHealthCardRawData)
public async Task UpdateHealthcardRawData(cF4SDHealthCardRawData updatedHealthCardRawData)
{
if (!(updatedHealthCardRawData?.Tables?.ContainsKey(table.Key) is true))
return false;
var _res = WasTableUpdated(table.Value, updatedHealthCardRawData.Tables[table.Key]);
return _res;
}
private async Task ContinueHealthCardDataLoadingAsync()
{
var CM = MethodBase.GetCurrentMethod();
LogMethodBegin(CM);
try
{
var IsDataIncomplete = true;
do
{
if (updatedHealthCardRawData is null)
return;
bool isDataIncomplete = true;
await LoadingRawDataCriticalSection.EnterAsync();
try
{
var updatedHealthCardRawData = await cFasdCockpitCommunicationBase.Instance.GetHealthCardData(HealthCardRawData.Id);
lock (HealthCardRawData)
{
var incompleteRawTables = HealthCardRawData.Tables.Where(table => table.Value.IsIncomplete
&& table.Key.StartsWith("Computation_") == false)
.ToDictionary(table => table.Key, table => table.Value);
@@ -2089,28 +2197,24 @@ namespace FasdDesktopUi.Basics.Helper
SelectedHealthCard.DoComputations(HealthCardRawData);
LogEntry("DataChanged - Couldn't complete healthcard raw data.");
DataChanged?.Invoke(this, EventArgs.Empty);
break;
return;
}
var rawTablesToUpdate = incompleteRawTables.Where(table => CheckUpdatedTable(table, updatedHealthCardRawData)).ToDictionary(table => table.Key, table => table.Value);
Dictionary<string, cHealthCardTable> rawTablesToUpdate = updatedHealthCardRawData.Tables
.Where(table => HealthCardRawData.Tables.TryGetValue(table.Key, out var oldTable) && WasTableUpdated(oldTable, table.Value))
.ToDictionary(table => table.Key, table => table.Value);
foreach (var oldTable in rawTablesToUpdate)
{
if (oldTable.Key.ToLowerInvariant() == "nxt-user")
{
cHealthCardTable newTable = updatedHealthCardRawData.Tables[oldTable.Key];
cHealthCardTable oldTableValues = HealthCardRawData.Tables[oldTable.Key];
}
var newTable = updatedHealthCardRawData.Tables[oldTable.Key];
var oldTableValues = HealthCardRawData.Tables[oldTable.Key];
cF4SDHealthCardRawData.cHealthCardTable mergedTable = oldTableValues;
cHealthCardTable mergedTable = oldTableValues;
foreach (var newTableColumnKeys in newTable.Columns.Keys)
{
if (mergedTable.Columns.ContainsKey(newTableColumnKeys) == false)
mergedTable.Columns[newTableColumnKeys] = new cF4SDHealthCardRawData.cHealthCardTableColumn();
mergedTable.Columns[newTableColumnKeys] = new cHealthCardTableColumn(mergedTable);
int mergedTableColumnValueCount = mergedTable.Columns[newTableColumnKeys].Values.Count;
int mergedTableColumnLength = Math.Max(mergedTable.StartingIndex + mergedTableColumnValueCount, newTable.StartingIndex + newTable.Columns[newTableColumnKeys].Values.Count); //mergedTable.Columns[newTableColumnKeys].Values.Count + newTable.Columns.Count;
@@ -2136,7 +2240,8 @@ namespace FasdDesktopUi.Basics.Helper
HealthCardRawData.Tables[oldTable.Key] = mergedTable;
}
IsDataIncomplete = HealthCardRawData.Tables.Where(table => table.Key.StartsWith("Computation_") == false)
isDataIncomplete = HealthCardRawData.Tables
.Where(table => table.Key.StartsWith("Computation_") == false)
.Any(table => table.Value.IsIncomplete);
if (rawTablesToUpdate?.Count > 0)
@@ -2151,13 +2256,13 @@ namespace FasdDesktopUi.Basics.Helper
{
LogException(E);
}
} while (IsDataIncomplete);
DataFullyLoaded?.Invoke(this, new EventArgs());
if (!isDataIncomplete)
DataFullyLoaded?.Invoke(this, EventArgs.Empty);
}
catch (Exception E)
catch (Exception ex)
{
LogException(E);
LogException(ex);
}
finally
{
@@ -2529,7 +2634,7 @@ namespace FasdDesktopUi.Basics.Helper
{
RawValues = values,
RawMaximizeValues = maximingValues,
DisplayType = cUtility.GetRawValueType(display),
DisplayType = display,
Description = parent.GetTitleColumnOfHealthCardState(stylableStateConfig).ContentDescription,
FontSize = stylableStateConfig.FontSize,
FontWeight = fontWeight,

View File

@@ -125,7 +125,7 @@ namespace FasdDesktopUi.Basics.Helper
private bool HasRequiredInformationClasses(List<enumFasdInformationClass> required)
{
return !(required.Any(informationClass => _dataProvider.Identities.Any(identity => identity.Class == informationClass) == false));
return !(required.Any(informationClass => _dataProvider?.Identities?.Any(identity => identity.Class == informationClass) == false));
}

View File

@@ -280,7 +280,10 @@ namespace FasdDesktopUi.Basics.Models
}
if (App.M42OptionMenuItem != null)
App.Current.MainWindow.Dispatcher.Invoke(() =>
{
App.M42OptionMenuItem.Enabled = userInfo != null;
});
// check, if the are logons needed
bool m42Valid = await CheckAndRefreshM42LogonAsync();

View File

@@ -9,6 +9,7 @@ namespace FasdDesktopUi.Basics.Models
public enumFasdInformationClass InformationClass { get; set; }
public bool IsOnline { get; set; }
public cF4sdIdentityList Identities { get; set; }
public cF4sdApiSearchResultRelation Realtion { get; set; }
}
public class cSwapCaseInfo

View File

@@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Windows;
using C4IT.F4SD.DisplayFormatting;
using C4IT.F4SD.SupportCaseProtocoll.Models;
using C4IT.FASD.Base;
using FasdCockpitBase;
@@ -49,6 +50,7 @@ namespace FasdDesktopUi.Basics.Models
try
{
cUtility.RawValueFormatter.SetDefaultCulture(new System.Globalization.CultureInfo(cFasdCockpitConfig.Instance.SelectedLanguage));
cUtility.RawValueFormatter.SetDefaultTimeZone(TimeZoneInfo.Local);
var outputTable = dataProvider.HealthCardDataHelper.HealthCardRawData.GetTableByName(valueAdress.ValueTable, true);
if (outputTable != null)

View File

@@ -229,5 +229,11 @@ namespace FasdDesktopUi.Basics.Models
UnassignedTicketsCriticalChangeHint = null;
}
#endregion
public TicketOverviewModel()
{
}
}
}

View File

@@ -242,7 +242,7 @@ namespace FasdDesktopUi.Basics
if (addRelation)
foreach (var _caseRelation in CaseRelations)
{
if (_caseRelation.isEqual(CaseRelation))
if (_caseRelation.Equals(CaseRelation))
{
addRelation = false;
break;

View File

@@ -5,15 +5,18 @@ namespace FasdDesktopUi.Basics.Services.Models
{
public sealed class TicketOverviewCountsChangedEventArgs : EventArgs
{
public TicketOverviewCountsChangedEventArgs(IReadOnlyList<TileCountChange> changes, IReadOnlyDictionary<string, TileCounts> currentCounts)
public TicketOverviewCountsChangedEventArgs(IReadOnlyList<TileCountChange> changes, IReadOnlyDictionary<string, TileCounts> currentCounts, TileScope? initializedScope = null)
{
Changes = changes;
Changes = changes ?? Array.Empty<TileCountChange>();
CurrentCounts = currentCounts;
InitializedScope = initializedScope;
}
public IReadOnlyList<TileCountChange> Changes { get; }
public IReadOnlyDictionary<string, TileCounts> CurrentCounts { get; }
public TileScope? InitializedScope { get; }
}
public readonly struct TileCountChange

View File

@@ -1,4 +1,5 @@
using System;
using C4IT.F4SD.SupportCaseProtocoll.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows;
@@ -8,14 +9,14 @@ namespace FasdDesktopUi.Basics.Services.ProtocollService
{
internal class F4SDProtocoll
{
private readonly ICollection<IProtocollEntry> _protocollEntries = new List<IProtocollEntry>();
private readonly ICollection<ProtocollEntryBase> _protocollEntries = new List<ProtocollEntryBase>();
public static F4SDProtocoll Instance { get; private set; } = new F4SDProtocoll();
private F4SDProtocoll() { }
internal void Add(IProtocollEntry entry) => _protocollEntries.Add(entry);
internal void Add(IEnumerable<IProtocollEntry> entries)
internal void Add(ProtocollEntryBase entry) => _protocollEntries.Add(entry);
internal void Add(IEnumerable<ProtocollEntryBase> entries)
{
foreach (var entry in entries)
{
@@ -25,34 +26,34 @@ namespace FasdDesktopUi.Basics.Services.ProtocollService
internal void Clear() => _protocollEntries.Clear();
internal T GetLatestOfType<T>() where T : IProtocollEntry => _protocollEntries.OfType<T>().LastOrDefault();
internal T GetLatestOfType<T>() where T : ProtocollEntryBase => _protocollEntries.OfType<T>().LastOrDefault();
internal IEnumerable<T> GetOfType<T>(int? count = null) where T : IProtocollEntry
internal IEnumerable<T> GetOfType<T>(int? count = null) where T : ProtocollEntryBase
{
if(count.HasValue)
return _protocollEntries.OfType<T>().Reverse().Take(count.Value).Reverse();
return _protocollEntries.OfType<T>();
}
internal IEnumerable<IProtocollEntry> GetAll() => _protocollEntries;
internal IEnumerable<ProtocollEntryBase> GetAll() => _protocollEntries;
internal DataObject GetLatestOfTypeAsDataObject<T>(bool skipHtmlFrame) where T : IProtocollEntry
internal DataObject GetLatestOfTypeAsDataObject<T>(bool skipHtmlFrame) where T : ProtocollEntryBase
{
IProtocollEntry entry = _protocollEntries.OfType<T>().LastOrDefault();
ProtocollEntryBase entry = _protocollEntries.OfType<T>().LastOrDefault();
if (entry is null)
return new DataObject();
return GetDataObjectOf(new IProtocollEntry[] { entry }, skipHtmlFrame);
return GetDataObjectOf(new ProtocollEntryBase[] { entry }, skipHtmlFrame);
}
internal DataObject GetOfTypeAsDataObject<T>(bool skipHtmlFrame, int? count = null) where T : IProtocollEntry
=> GetDataObjectOf(GetOfType<T>(count).Cast<IProtocollEntry>(), skipHtmlFrame);
internal DataObject GetOfTypeAsDataObject<T>(bool skipHtmlFrame, int? count = null) where T : ProtocollEntryBase
=> GetDataObjectOf(GetOfType<T>(count).Cast<ProtocollEntryBase>(), skipHtmlFrame);
internal DataObject GetAllAsDataObject(bool skipHtmlFrame)
=> GetDataObjectOf(_protocollEntries, skipHtmlFrame);
private DataObject GetDataObjectOf(IEnumerable<IProtocollEntry> entries, bool skipHtmlFrame, int? count = null)
private DataObject GetDataObjectOf(IEnumerable<ProtocollEntryBase> entries, bool skipHtmlFrame, int? count = null)
{
DataObject dataObject = new DataObject();
@@ -67,16 +68,16 @@ namespace FasdDesktopUi.Basics.Services.ProtocollService
if (count.HasValue)
entries = entries.Reverse().Take(count.Value).Reverse();
foreach (IProtocollEntry entry in entries)
foreach (ProtocollEntryBase entry in entries)
{
string entryAscii = entry.GetAscii();
string entryAscii = entry.AsciiContent;
if (!string.IsNullOrEmpty(entryAscii))
{
ascii += entryAscii;
ascii += asciiSeparator;
}
string entryHtml = entry.GetHtml();
string entryHtml = entry.HtmlContent;
if (!string.IsNullOrEmpty(entryHtml))
{
html += entryHtml;

View File

@@ -1,15 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
namespace FasdDesktopUi.Basics.Services.ProtocollService
{
internal interface IProtocollEntry
{
string GetAscii();
string GetHtml();
}
}

View File

@@ -1,4 +1,4 @@
using C4IT.F4SD.DisplayFormatting;
using C4IT.F4SD.SupportCaseProtocoll.Models;
using C4IT.FASD.Base;
using C4IT.MultiLanguage;
using FasdDesktopUi.Basics.Models;
@@ -11,17 +11,26 @@ using static FasdDesktopUi.Basics.UserControls.QuickActionStatusMonitor;
namespace FasdDesktopUi.Basics.Services.ProtocollService
{
internal class QuickActionProtocollEntry : IProtocollEntry
internal static class QuickActionProtocollEntryOutput
{
private readonly cFasdQuickAction _quickActionDefinition;
private readonly cQuickActionCopyData _quickActionCopyData;
const string AsciiSeperator = "\n\n";
public QuickActionProtocollEntry(cFasdQuickAction quickActionDefinition, cQuickActionCopyData quickActionCopyData)
public static QuickActionProtocollEntry GetQuickActionProtocollEntry(cFasdQuickAction quickActionDefinition, cQuickActionCopyData quickActionCopyData)
{
_quickActionDefinition = quickActionDefinition;
_quickActionCopyData = quickActionCopyData;
string ascii = GetAscii(quickActionDefinition, quickActionCopyData);
string html = GetHtml(quickActionDefinition, quickActionCopyData);
return new QuickActionProtocollEntry(ascii, html)
{
Id = quickActionDefinition.Id,
Name = quickActionDefinition.Name,
ExecutionTypeId = (int)quickActionDefinition.ExecutionType,
WasRunningOnAffectedDevice = quickActionCopyData.WasRunningOnAffectedDevice,
AffectedDeviceName = quickActionCopyData.AffectedDeviceName,
ResultCode = (int?)quickActionCopyData.QuickActionOutput?.ResultCode,
ErrorMessage = quickActionCopyData.QuickActionOutput?.ErrorDescription,
MeasureValues = GetQuickActionHtmlValueComparison(quickActionCopyData.MeasureValues)
};
}
internal static cQuickActionCopyData GetCopyData(cFasdQuickAction quickActionDefinition, cSupportCaseDataProvider dataProvider, bool wasRunningOnAffectedDevice, cQuickActionOutput quickActionOutput, List<cQuickActionMeasureValue> measureValues)
@@ -51,38 +60,21 @@ namespace FasdDesktopUi.Basics.Services.ProtocollService
return quickActionCopyData;
}
internal cQuickActionResult GetResult()
{
return new cQuickActionResult()
{
QuickActionId = _quickActionDefinition.Id,
QuickActionName = _quickActionDefinition.Name,
QuickActionExecutionType = (int)_quickActionDefinition.ExecutionType,
wasRunningOnAffectedDevice = _quickActionCopyData.WasRunningOnAffectedDevice,
AffectedDeviceName = _quickActionCopyData.AffectedDeviceName,
ExecutionTime = DateTime.UtcNow,
ResultCode = (int?)(_quickActionCopyData.QuickActionOutput?.ResultCode),
ErrorMessage = _quickActionCopyData.QuickActionOutput?.ErrorDescription,
Output = GetQuickActionHtmlOutput(_quickActionCopyData.QuickActionOutput),
MeasureValues = GetQuickActionHtmlValueComparison(_quickActionCopyData.MeasureValues)
};
}
private static string GetAscii(cFasdQuickAction quickActionDefinition, cQuickActionCopyData quickActionCopyData) => GetQuickActionAscii(quickActionDefinition, quickActionCopyData);
public string GetAscii() => GetQuickActionAscii(_quickActionCopyData);
private static string GetHtml(cFasdQuickAction quickActionDefinition, cQuickActionCopyData quickActionCopyData) => GetQuickActionHtml(quickActionDefinition, quickActionCopyData);
public string GetHtml() => GetQuickActionHtml(_quickActionCopyData);
private bool ShouldHideQuickActionOutput(string outputValueKey)
private static bool ShouldHideQuickActionOutput(cFasdQuickAction quickActionDefinition, string outputValueKey)
{
try
{
if (_quickActionDefinition.ColumnOutputFormattings is null)
if (quickActionDefinition.ColumnOutputFormattings is null)
return false;
if (!_quickActionDefinition.ShowAllOutputContent && !_quickActionDefinition.ColumnOutputFormattings.ContainsKey(outputValueKey))
if (!quickActionDefinition.ShowAllOutputContent && !quickActionDefinition.ColumnOutputFormattings.ContainsKey(outputValueKey))
return true;
if (_quickActionDefinition.ColumnOutputFormattings.TryGetValue(outputValueKey, out var columnFormatting))
if (quickActionDefinition.ColumnOutputFormattings.TryGetValue(outputValueKey, out var columnFormatting))
return columnFormatting.Hidden;
}
catch (Exception ex)
@@ -95,19 +87,19 @@ namespace FasdDesktopUi.Basics.Services.ProtocollService
#region Ascii
private string GetQuickActionAscii(cQuickActionCopyData copyData)
private static string GetQuickActionAscii(cFasdQuickAction quickActionDefinition, cQuickActionCopyData copyData)
{
string ascii = string.Empty;
ascii += GetQuickActionAsciiDescription(copyData.Name, copyData.AffectedDeviceName, copyData.WasRunningOnAffectedDevice, copyData.ExecutionTime, copyData.QuickActionOutput?.ResultCode);
ascii += GetQuickActionAsciiError(copyData.QuickActionOutput?.ErrorDescription);
ascii += GetQuickActionAsciiOutput(copyData.QuickActionOutput);
ascii += GetQuickActionAsciiOutput(quickActionDefinition, copyData.QuickActionOutput);
ascii += GetQuickActionAsciiValueComparisonString(copyData.MeasureValues);
return ascii;
}
private string GetQuickActionAsciiDescription(string quickActionName, string deviceName, bool wasRunningOnAffectedDevice, DateTime executionTime, enumQuickActionSuccess? quickActionStatus)
private static string GetQuickActionAsciiDescription(string quickActionName, string deviceName, bool wasRunningOnAffectedDevice, DateTime executionTime, enumQuickActionSuccess? quickActionStatus)
{
string asciiDescription = string.Empty;
try
@@ -136,7 +128,7 @@ namespace FasdDesktopUi.Basics.Services.ProtocollService
return asciiDescription;
}
private string GetQuickActionAsciiError(string errorMessage)
private static string GetQuickActionAsciiError(string errorMessage)
{
if (!string.IsNullOrEmpty(errorMessage))
errorMessage.Insert(0, AsciiSeperator);
@@ -144,7 +136,7 @@ namespace FasdDesktopUi.Basics.Services.ProtocollService
return errorMessage;
}
private string GetQuickActionAsciiOutput(QuickActionStatusMonitor.cQuickActionOutput quickActionOutput)
private static string GetQuickActionAsciiOutput(cFasdQuickAction quickActionDefinition, QuickActionStatusMonitor.cQuickActionOutput quickActionOutput)
{
string output = string.Empty;
@@ -162,7 +154,7 @@ namespace FasdDesktopUi.Basics.Services.ProtocollService
output += AsciiSeperator;
output += cMultiLanguageSupport.GetItem("QuickAction.Copy.Output") + " ";
output += singleOutput.GetDisplayValue(_quickActionDefinition.ColumnOutputFormattings);
output += singleOutput.GetDisplayValue(quickActionDefinition.ColumnOutputFormattings);
break;
}
@@ -174,10 +166,10 @@ namespace FasdDesktopUi.Basics.Services.ProtocollService
foreach (var value in listOutput.Values[0])
{
if (ShouldHideQuickActionOutput(value.Key))
if (ShouldHideQuickActionOutput(quickActionDefinition, value.Key))
continue;
if (_quickActionDefinition.ColumnOutputFormattings?.TryGetValue(value.Key, out var outputFormatting) ?? false)
if (quickActionDefinition.ColumnOutputFormattings?.TryGetValue(value.Key, out var outputFormatting) ?? false)
output += outputFormatting.Names.GetValue();
else
output += value.Key;
@@ -193,10 +185,10 @@ namespace FasdDesktopUi.Basics.Services.ProtocollService
{
string valueKey = listOutput.Values[0][j].Key;
if (ShouldHideQuickActionOutput(valueKey))
if (ShouldHideQuickActionOutput(quickActionDefinition, valueKey))
continue;
string displayValue = listOutput.GetDisplayValue(i, j, _quickActionDefinition.ColumnOutputFormattings);
string displayValue = listOutput.GetDisplayValue(i, j, quickActionDefinition.ColumnOutputFormattings);
if (string.IsNullOrWhiteSpace(displayValue))
continue;
@@ -217,12 +209,12 @@ namespace FasdDesktopUi.Basics.Services.ProtocollService
{
var value = objectOutput.Values[i];
if (ShouldHideQuickActionOutput(value.Key))
if (ShouldHideQuickActionOutput(quickActionDefinition, value.Key))
continue;
string columnTitle = string.Empty;
if (_quickActionDefinition.ColumnOutputFormattings?.TryGetValue(value.Key, out var outputFormatting) ?? false)
if (quickActionDefinition.ColumnOutputFormattings?.TryGetValue(value.Key, out var outputFormatting) ?? false)
columnTitle = outputFormatting.Names.GetValue();
else
columnTitle = value.Key;
@@ -230,7 +222,7 @@ namespace FasdDesktopUi.Basics.Services.ProtocollService
if (!string.IsNullOrEmpty(columnTitle))
output += $"{columnTitle}: ";
string displayValue = objectOutput.GetDisplayValue(i, _quickActionDefinition.ColumnOutputFormattings);
string displayValue = objectOutput.GetDisplayValue(i, quickActionDefinition.ColumnOutputFormattings);
output += !string.IsNullOrWhiteSpace(displayValue) ? displayValue : null;
output += "\n";
@@ -248,7 +240,7 @@ namespace FasdDesktopUi.Basics.Services.ProtocollService
return output;
}
private string GetQuickActionAsciiValueComparisonString(List<QuickActionStatusMonitor.cQuickActionMeasureValue> measureValues)
private static string GetQuickActionAsciiValueComparisonString(List<QuickActionStatusMonitor.cQuickActionMeasureValue> measureValues)
{
string output = string.Empty;
@@ -260,6 +252,7 @@ namespace FasdDesktopUi.Basics.Services.ProtocollService
output += AsciiSeperator + cMultiLanguageSupport.GetItem("QuickAction.Copy.Measure");
cUtility.RawValueFormatter.SetDefaultCulture(new System.Globalization.CultureInfo(cFasdCockpitConfig.Instance.SelectedLanguage));
cUtility.RawValueFormatter.SetDefaultTimeZone(TimeZoneInfo.Local);
foreach (var measureValue in measureValues)
{
@@ -292,7 +285,7 @@ namespace FasdDesktopUi.Basics.Services.ProtocollService
#region Html
private string GetQuickActionHtml(cQuickActionCopyData copyData)
private static string GetQuickActionHtml(cFasdQuickAction quickActionDefinition, cQuickActionCopyData copyData)
{
string output = string.Empty;
@@ -300,7 +293,7 @@ namespace FasdDesktopUi.Basics.Services.ProtocollService
{
output += GetQuickActionHtmlDescription(copyData.Name, copyData.AffectedDeviceName, copyData.WasRunningOnAffectedDevice, copyData.ExecutionTime, copyData.QuickActionOutput?.ResultCode);
output += GetQuickActionHtmlError(copyData.QuickActionOutput?.ErrorDescription);
output += GetQuickActionHtmlOutput(copyData.QuickActionOutput);
output += GetQuickActionHtmlOutput(quickActionDefinition, copyData.QuickActionOutput);
output += GetQuickActionHtmlValueComparison(copyData.MeasureValues);
}
catch (Exception E)
@@ -311,7 +304,7 @@ namespace FasdDesktopUi.Basics.Services.ProtocollService
return output;
}
private string GetQuickActionHtmlDescription(string quickActionName, string deviceName, bool wasRunningOnAffectedDevice, DateTime executionTime, enumQuickActionSuccess? quickActionStatus)
private static string GetQuickActionHtmlDescription(string quickActionName, string deviceName, bool wasRunningOnAffectedDevice, DateTime executionTime, enumQuickActionSuccess? quickActionStatus)
{
string output = string.Empty;
try
@@ -348,7 +341,7 @@ namespace FasdDesktopUi.Basics.Services.ProtocollService
return errorMessage;
}
private string GetQuickActionHtmlOutput(QuickActionStatusMonitor.cQuickActionOutput quickActionOutput)
private static string GetQuickActionHtmlOutput(cFasdQuickAction quickActionDefinition, QuickActionStatusMonitor.cQuickActionOutput quickActionOutput)
{
string output = string.Empty;
@@ -366,7 +359,7 @@ namespace FasdDesktopUi.Basics.Services.ProtocollService
if (singleOutput.Value is null)
return output;
var displayValue = singleOutput.GetDisplayValue(_quickActionDefinition?.ColumnOutputFormattings);
var displayValue = singleOutput.GetDisplayValue(quickActionDefinition?.ColumnOutputFormattings);
output += "<p>" + cMultiLanguageSupport.GetItem("QuickAction.Copy.Output.Html") + " " + displayValue + "</p>";
break;
}
@@ -379,11 +372,11 @@ namespace FasdDesktopUi.Basics.Services.ProtocollService
foreach (var value in listOutput.Values[0])
{
if (ShouldHideQuickActionOutput(value.Key))
if (ShouldHideQuickActionOutput(quickActionDefinition, value.Key))
continue;
string headingValue = value.Key;
if (_quickActionDefinition.ColumnOutputFormattings?.TryGetValue(value.Key, out var outputFormatting) ?? false)
if (quickActionDefinition.ColumnOutputFormattings?.TryGetValue(value.Key, out var outputFormatting) ?? false)
headingValue = outputFormatting.Names.GetValue();
output += "<th align=\"left\">";
@@ -400,10 +393,10 @@ namespace FasdDesktopUi.Basics.Services.ProtocollService
for (int j = 0; j < listOutput.Values[i].Count; j++)
{
string valueKey = listOutput.Values[0][j].Key;
if (ShouldHideQuickActionOutput(valueKey))
if (ShouldHideQuickActionOutput(quickActionDefinition, valueKey))
continue;
string displayValue = listOutput.GetDisplayValue(i, j, _quickActionDefinition.ColumnOutputFormattings);
string displayValue = listOutput.GetDisplayValue(i, j, quickActionDefinition.ColumnOutputFormattings);
if (string.IsNullOrWhiteSpace(displayValue))
continue;
@@ -429,11 +422,11 @@ namespace FasdDesktopUi.Basics.Services.ProtocollService
{
var value = objectOutput.Values[i];
if (ShouldHideQuickActionOutput(value.Key))
if (ShouldHideQuickActionOutput(quickActionDefinition, value.Key))
continue;
string headingValue = value.Key;
if (_quickActionDefinition.ColumnOutputFormattings?.TryGetValue(value.Key, out var outputFormatting) ?? false)
if (quickActionDefinition.ColumnOutputFormattings?.TryGetValue(value.Key, out var outputFormatting) ?? false)
headingValue = outputFormatting.Names.GetValue();
output += "<tr>";
@@ -442,7 +435,7 @@ namespace FasdDesktopUi.Basics.Services.ProtocollService
output += "</td>";
output += "<td>";
string displayValue = objectOutput.GetDisplayValue(i, _quickActionDefinition.ColumnOutputFormattings);
string displayValue = objectOutput.GetDisplayValue(i, quickActionDefinition.ColumnOutputFormattings);
output += !string.IsNullOrWhiteSpace(displayValue) ? displayValue : null;
output += "</td>";
@@ -462,7 +455,7 @@ namespace FasdDesktopUi.Basics.Services.ProtocollService
return output;
}
private string GetQuickActionHtmlValueComparison(List<QuickActionStatusMonitor.cQuickActionMeasureValue> measureValues)
private static string GetQuickActionHtmlValueComparison(List<QuickActionStatusMonitor.cQuickActionMeasureValue> measureValues)
{
string output = string.Empty;
@@ -474,6 +467,7 @@ namespace FasdDesktopUi.Basics.Services.ProtocollService
output += "<p>" + cMultiLanguageSupport.GetItem("QuickAction.Copy.Measure.Html") + "</p>";
cUtility.RawValueFormatter.SetDefaultCulture(new System.Globalization.CultureInfo(cFasdCockpitConfig.Instance.SelectedLanguage));
cUtility.RawValueFormatter.SetDefaultTimeZone(TimeZoneInfo.Local);
foreach (var measureValue in measureValues)
{

View File

@@ -1,27 +1,30 @@
using C4IT.FASD.Base;
using C4IT.F4SD.SupportCaseProtocoll.Models;
using C4IT.FASD.Base;
using C4IT.MultiLanguage;
namespace FasdDesktopUi.Basics.Services.ProtocollService
{
internal class QuickTipStepProtocollEntry : IProtocollEntry
internal static class QuickTipStepProtocollEntryOutput
{
private readonly cQuickTipElement _quickTipElementDefinition;
private readonly bool _wasSuccessfull;
public QuickTipStepProtocollEntry(cQuickTipElement quickTipElementDefinition, bool wasSuccessfull)
public static QuickTipStepProtocollEntry GetQuickTipStepProtocollEntry(cQuickTipElement quickTipElementDefinition, bool wasSuccessfull)
{
_quickTipElementDefinition = quickTipElementDefinition;
_wasSuccessfull = wasSuccessfull;
string ascii = GetAsciiOutput(quickTipElementDefinition, wasSuccessfull);
string html = GetHtmlOutput(quickTipElementDefinition, wasSuccessfull);
return new QuickTipStepProtocollEntry(ascii, html)
{
Name = quickTipElementDefinition.Name,
WasSuccessfull = wasSuccessfull
};
}
public string GetAscii()
private static string GetAsciiOutput(cQuickTipElement quickTipElementDefinition, bool wasSuccessfull)
{
string currentLanguage = cMultiLanguageSupport.CurrentLanguage;
try
{
cMultiLanguageSupport.CurrentLanguage = cF4SDCockpitXmlConfig.Instance.HealthCardConfig.ProtocollLanguage ?? currentLanguage;
string ascii = _wasSuccessfull ? cMultiLanguageSupport.GetItem("QuickTips.Copy.ManualStep.Successfull") : cMultiLanguageSupport.GetItem("QuickTips.Copy.ManualStep.Unsuccessfull");
return string.Format(ascii, _quickTipElementDefinition?.Names?.GetValue());
string ascii = wasSuccessfull ? cMultiLanguageSupport.GetItem("QuickTips.Copy.ManualStep.Successfull") : cMultiLanguageSupport.GetItem("QuickTips.Copy.ManualStep.Unsuccessfull");
return string.Format(ascii, quickTipElementDefinition?.Names?.GetValue());
}
finally
{
@@ -29,7 +32,7 @@ namespace FasdDesktopUi.Basics.Services.ProtocollService
}
}
public string GetHtml()
=> GetAscii();
private static string GetHtmlOutput(cQuickTipElement quickTipElementDefinition, bool wasSuccessfull)
=> GetAsciiOutput(quickTipElementDefinition, wasSuccessfull);
}
}

View File

@@ -1,18 +0,0 @@
namespace FasdDesktopUi.Basics.Services.ProtocollService
{
internal class TextualProtocollEntry : IProtocollEntry
{
private readonly string _asciiText;
private readonly string _htmlText;
public TextualProtocollEntry(string asciiText, string htmlText)
{
_asciiText = asciiText;
_htmlText = htmlText;
}
public string GetAscii() => _asciiText;
public string GetHtml() => _htmlText;
}
}

View File

@@ -4,10 +4,8 @@ using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
using static C4IT.Logging.cLogManager;
[assembly: InternalsVisibleTo("F4SD.Cockpit.Client.Test")]
@@ -29,7 +27,7 @@ namespace FasdDesktopUi.Basics.Services.RelationService
{
try
{
_relations = new List<cF4sdApiSearchResultRelation>();
_relations = relatedTo?.Select(searchResult => new cF4sdApiSearchResultRelation(searchResult)).ToList() ?? new List<cF4sdApiSearchResultRelation>();
cF4sdStagedSearchResultRelationTaskId gatherRelationTask = await cFasdCockpitCommunicationBase.Instance.StartGatheringRelations(relatedTo, token);
_ = Task.Run(async () =>

View File

@@ -0,0 +1,255 @@
using C4IT.FASD.Base;
using C4IT.FASD.Cockpit.Communication;
using FasdDesktopUi.Basics.CustomEvents;
using FasdDesktopUi.Basics.Models;
using FasdDesktopUi.Pages.DetailsPage.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using static C4IT.Logging.cLogManager;
namespace FasdDesktopUi.Basics.Services.SupportCase.Controllers
{
/// <summary>
/// Used to manage the <see cref="ISupportCase"/> for the UI via the <see cref="SupportCaseProcessor"/>"
/// </summary>
public class SupportCaseController
{
private SupportCaseProcessor _supportCaseProcessor;
private cF4sdApiSearchResultRelation _focusedRelation;
private readonly Dictionary<enumFasdInformationClass, cF4sdApiSearchResultRelation> _selectedRelations = new Dictionary<enumFasdInformationClass, cF4sdApiSearchResultRelation>();
private cHealthCard _selectedHealthcard = null;
private bool _hasDirectionConnection = false;
public cSupportCaseDataProvider SupportCaseDataProviderArtifact { get => _supportCaseProcessor?.SupportCaseDataProviderArtifact; }
internal void SetSupportCaseProcessor(SupportCaseProcessor supportCaseProcessor, IEnumerable<cF4sdIdentityEntry> preselectedIdentities)
{
IEnumerable<cF4sdApiSearchResultRelation> preselectedRelations = GetPreselectedRelations(supportCaseProcessor.GetCaseRelations(), preselectedIdentities);
ResetSelectedRelations(preselectedRelations);
_hasDirectionConnection = false;
if (_supportCaseProcessor != null)
{
_supportCaseProcessor.AvailableCaseRelationsAdded -= HandleAvailableCaseRelationsAdded;
_supportCaseProcessor.CaseDataChanged -= HandleCaseDataChanged;
_supportCaseProcessor.SupportCaseDataProviderArtifact.DirectConnectionHelper.DirectConnectionChanged -= HandleDirectConnectionChanged;
}
_supportCaseProcessor = supportCaseProcessor;
_supportCaseProcessor.AvailableCaseRelationsAdded += HandleAvailableCaseRelationsAdded;
_supportCaseProcessor.CaseDataChanged += HandleCaseDataChanged;
_supportCaseProcessor.SupportCaseDataProviderArtifact.DirectConnectionHelper.DirectConnectionChanged += HandleDirectConnectionChanged;
}
private IEnumerable<cF4sdApiSearchResultRelation> GetPreselectedRelations
(ILookup<enumFasdInformationClass, cF4sdApiSearchResultRelation> loadedRelations, IEnumerable<cF4sdIdentityEntry> preselectedIdentities)
{
List<cF4sdApiSearchResultRelation> preselectedRelations = new List<cF4sdApiSearchResultRelation>();
foreach (var relationType in loadedRelations)
{
foreach (var relation in relationType)
{
if (relation.Identities.All(ri => preselectedIdentities.Any(i => i.Id == ri.Id)))
preselectedRelations.Add(relation);
}
}
return preselectedRelations;
}
private void ResetSelectedRelations(IEnumerable<cF4sdApiSearchResultRelation> preselectedRelations)
{
try
{
_selectedRelations.Clear();
if (preselectedRelations is null)
return;
foreach (var relation in preselectedRelations)
{
_selectedRelations[cF4sdIdentityEntry.GetFromSearchResult(relation.Type)] = relation;
}
}
catch (Exception ex)
{
LogException(ex);
}
}
private void HandleAvailableCaseRelationsAdded(object sender, RelationEventArgs e)
=> AvailableCaseRelationsAdded?.Invoke(this, e);
private void HandleCaseDataChanged(object sender, SupportCaseDataEventArgs e)
{
CaseDataChanged?.Invoke(this, e);
_ = Task.Run(async () =>
{
await UpdateStatusOfSelectedRelations();
if (!_hasDirectionConnection)
await SupportCaseDataProviderArtifact.DirectConnectionHelper.DirectConnectionStartAsync();
});
}
private void HandleDirectConnectionChanged(object sender, EventArgs e)
{
_hasDirectionConnection = SupportCaseDataProviderArtifact.DirectConnectionHelper.IsDirectConnectionActive;
}
/// <summary>
/// Updates the currently for a support case relevant and shown relation.
/// </summary>
/// <remarks>Raises <see cref="FocusedRelationsChanged"/></remarks>
internal void UpdateFocusedCaseRelation(cF4sdApiSearchResultRelation relation)
{
try
{
_selectedHealthcard = _supportCaseProcessor.GetHealthcardFor(relation);
HashSet<string> requiredTables = cHealthCard.GetRequiredTables(_selectedHealthcard);
_ = Task.Run(async () => await _supportCaseProcessor.LoadSupportCaseDataAsync(relation, requiredTables));
List<enumFasdInformationClass> requiredInformationClasses = relation.Identities
.Where(i => i.Class != enumFasdInformationClass.User)
.Select(i => i.Class)
.ToList();
if (relation.Type == enumF4sdSearchResultClass.User)
requiredInformationClasses = new List<enumFasdInformationClass>() { enumFasdInformationClass.User };
if (requiredInformationClasses.Count == 0)
requiredInformationClasses.Add(enumFasdInformationClass.User);
SupportCaseDataProviderArtifact.HealthCardDataHelper.TrySetSelectedHealthcard(requiredInformationClasses);
_focusedRelation = relation;
if (!_selectedRelations.Values.Contains(relation))
_hasDirectionConnection = false;
_selectedRelations[cF4sdIdentityEntry.GetFromSearchResult(relation.Type)] = relation;
_ = Task.Run(async () => await UpdateStatusOfSelectedRelations());
var focusedRelations = new cF4sdApiSearchResultRelation[1] { _focusedRelation };
FocusedRelationsChanged?.Invoke(this, new RelationEventArgs()
{
Relations = focusedRelations.ToLookup(r => cF4sdIdentityEntry.GetFromSearchResult(r.Type), r => r)
});
}
catch (Exception ex)
{
LogException(ex);
}
}
private async Task UpdateStatusOfSelectedRelations()
{
const string StatusString = "Status";
try
{
int? agentUserId = null;
int? agentDeviceId = null;
// todo these values should not be recieved from the NamedParameters, instead from the relation it self
if (SupportCaseDataProviderArtifact.NamedParameterEntries.TryGetValue("AgentUserId", out var userNamedParameter))
{
var value = userNamedParameter.GetValue();
if (!string.IsNullOrWhiteSpace(value))
agentUserId = int.Parse(value);
}
// todo these values should not be recieved from the NamedParameters, instead from the relation it self
if (SupportCaseDataProviderArtifact.NamedParameterEntries.TryGetValue("AgentDeviceId", out var deviceNamedParameter))
{
var value = deviceNamedParameter.GetValue();
if (!string.IsNullOrWhiteSpace(value))
agentDeviceId = int.Parse(deviceNamedParameter.GetValue());
}
foreach (var relationEntry in _selectedRelations)
{
if (relationEntry.Value is null)
continue;
string statusValue = "Unknown";
switch (relationEntry.Key)
{
case enumFasdInformationClass.Computer:
if (!agentDeviceId.HasValue)
continue;
bool isDeviceOnline = await cFasdCockpitCommunicationBase.Instance.GetAgentOnlineStatus(agentDeviceId.Value);
statusValue = isDeviceOnline ? "Online" : "Offline";
break;
case enumFasdInformationClass.User:
if (!agentDeviceId.HasValue || !agentUserId.HasValue)
continue;
bool isUserOnline = await cFasdCockpitCommunicationBase.Instance.GetAgentOnlineStatus(agentDeviceId.Value, agentUserId.Value);
statusValue = isUserOnline ? "Online" : "Offline";
break;
case enumFasdInformationClass.Ticket:
case enumFasdInformationClass.VirtualSession:
case enumFasdInformationClass.MobileDevice:
default:
continue;
}
if (relationEntry.Value.Infos is null)
relationEntry.Value.Infos = new Dictionary<string, string>();
relationEntry.Value.Infos[StatusString] = statusValue;
}
IEnumerable<cHeadingDataModel> newHeadingData = SupportCaseHeadingController.GetHeadingData(_selectedRelations);
HeadingDataChanged?.Invoke(this, new HeadingDataEventArgs(newHeadingData));
}
catch (Exception ex)
{
LogException(ex);
}
}
public async Task RefreshDataForCurrentlyFocusedRelationAsync()
{
await _supportCaseProcessor.UpdateLatestCaseDataFor(_focusedRelation);
}
public List<List<cWidgetValueModel>> GetWidgetData()
=> _supportCaseProcessor.GetWidgetData(_focusedRelation);
public cDetailsPageDataHistoryDataModel GetHistoryData()
=> _supportCaseProcessor.GetHistoryData(_focusedRelation);
public List<cContainerCollectionData> GetContainerData()
=> _supportCaseProcessor.GetContainerData(_focusedRelation);
public List<cMenuDataBase> GetMenuBarData()
=> _supportCaseProcessor.GetMenuBarData(_focusedRelation);
/// <summary>
/// Raised when the currently for a support case relevant and shown relations have been updated.
/// </summary>
public event EventHandler<RelationEventArgs> FocusedRelationsChanged;
/// <summary>
/// Raised when newly available relations for a support case were added.
/// </summary>
public event EventHandler<RelationEventArgs> AvailableCaseRelationsAdded;
/// <summary>
/// Raised when the data set of a support case has changed.
/// </summary>
public event EventHandler<SupportCaseDataEventArgs> CaseDataChanged;
public event EventHandler<HeadingDataEventArgs> HeadingDataChanged;
}
}

View File

@@ -0,0 +1,93 @@
using C4IT.FASD.Base;
using C4IT.MultiLanguage;
using FasdDesktopUi.Basics.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using static C4IT.Logging.cLogManager;
namespace FasdDesktopUi.Basics.Services.SupportCase.Controllers
{
internal class SupportCaseHeadingController
{
internal static IEnumerable<cHeadingDataModel> GetHeadingData(Dictionary<enumFasdInformationClass, cF4sdApiSearchResultRelation> relations)
{
try
{
return Enum.GetValues(typeof(enumFasdInformationClass))
.Cast<enumFasdInformationClass>()
.Select(informationClass =>
{
if (relations.TryGetValue(informationClass, out var relation) && relation != null)
return GetHeadingDataFor(relation);
else
return GetEmptyHeadingDataFor(informationClass);
});
}
catch (Exception ex)
{
LogException(ex);
}
return Enumerable.Empty<cHeadingDataModel>();
}
private static cHeadingDataModel GetEmptyHeadingDataFor(enumFasdInformationClass informationClass)
{
string headingText = string.Empty;
switch (informationClass)
{
case enumFasdInformationClass.Computer:
headingText = cMultiLanguageSupport.GetItem("Header.Select.Computer");
break;
case enumFasdInformationClass.Ticket:
headingText = cMultiLanguageSupport.GetItem("Header.Select.Ticket");
break;
case enumFasdInformationClass.VirtualSession:
headingText = cMultiLanguageSupport.GetItem("Header.Select.VirtualSession");
break;
case enumFasdInformationClass.MobileDevice:
headingText = cMultiLanguageSupport.GetItem("Header.Select.MobileDevice");
break;
}
return new cHeadingDataModel() { InformationClass = informationClass, HeadingText = headingText };
}
private static cHeadingDataModel GetHeadingDataFor(cF4sdApiSearchResultRelation relation)
{
const string StatusString = "Status";
bool isOnline = false;
string statusValue = "Unknown";
if (relation?.Infos?.TryGetValue(StatusString, out var statusValueFromDictionary) ?? false)
statusValue = statusValueFromDictionary;
switch (relation.Type)
{
case enumF4sdSearchResultClass.Computer:
case enumF4sdSearchResultClass.User:
isOnline = string.Equals(statusValue, "Online", StringComparison.InvariantCultureIgnoreCase);
break;
case enumF4sdSearchResultClass.Ticket:
isOnline = !string.Equals(statusValue, nameof(enumTicketStatus.Closed));
break;
case enumF4sdSearchResultClass.VirtualSession:
isOnline = string.Equals(statusValue, nameof(enumCitrixSessionStatus.Active));
break;
case enumF4sdSearchResultClass.MobileDevice:
break;
}
return new cHeadingDataModel()
{
HeadingText = string.IsNullOrEmpty(relation.Name) ? relation.DisplayName : relation.Name,
InformationClass = cF4sdIdentityEntry.GetFromSearchResult(relation.Type),
IsOnline = isOnline,
Identities = relation.Identities,
Realtion = relation
};
}
}
}

View File

@@ -1,8 +1,9 @@
using C4IT.FASD.Base;
using FasdDesktopUi.Basics.Services.RelationService;
using FasdDesktopUi.Basics.CustomEvents;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace FasdDesktopUi.Basics.Services.SupportCase
{
@@ -12,10 +13,13 @@ namespace FasdDesktopUi.Basics.Services.SupportCase
void Initialize();
void AddCaseRelations(ILookup<enumFasdInformationClass, cF4sdApiSearchResultRelation> relations);
ILookup<enumFasdInformationClass, cF4sdApiSearchResultRelation> GetCaseRelations();
IEnumerable<cF4SDHealthCardRawData.cHealthCardTable> GetSupportCaseHealthcardData(object identities, object valueAddress);
void UpdateSupportCaseDataCache();
Task LoadSupportCaseDataAsync(cF4sdApiSearchResultRelation relation, IEnumerable<string> tablesToLoad);
IEnumerable<object> GetSupportCaseHealthcardData(cF4sdApiSearchResultRelation relation, cValueAddress valueAddress);
void UpdateSupportCaseDataCache(cF4sdApiSearchResultRelation relation, IEnumerable<cF4SDHealthCardRawData.cHealthCardTable> tables);
void InvalidateCaseDataCacheFor(cF4sdApiSearchResultRelation relation);
void InvalidateLatestCaseDataCacheFor(cF4sdApiSearchResultRelation relation, out ICollection<cF4SDHealthCardRawData.cHealthCardTable> invalidatedTables);
event EventHandler<RelationEventArgs> CaseRelationsAdded;
event EventHandler<object> SupportCaseDataCacheHasChanged;
event EventHandler<SupportCaseDataEventArgs> SupportCaseDataCacheHasChanged;
}
}

View File

@@ -1,10 +1,10 @@
using C4IT.FASD.Base;
using C4IT.FASD.Cockpit.Communication;
using FasdDesktopUi.Basics.CustomEvents;
using FasdDesktopUi.Basics.Services.RelationService;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using static C4IT.Logging.cLogManager;
@@ -13,7 +13,7 @@ namespace FasdDesktopUi.Basics.Services.SupportCase
public class SupportCase : ISupportCase
{
private readonly Dictionary<enumFasdInformationClass, IList<cF4sdApiSearchResultRelation>> _caseRelations = new Dictionary<enumFasdInformationClass, IList<cF4sdApiSearchResultRelation>>();
//private readonly Lookup<IdentitySet, cF4SDHealthCardRawData.cHealthCardTable> _supportCaseDataCache;
private readonly Dictionary<string, Dictionary<cF4sdApiSearchResultRelation, cF4SDHealthCardRawData.cHealthCardTable>> _supportCaseDataCache = new Dictionary<string, Dictionary<cF4sdApiSearchResultRelation, cF4SDHealthCardRawData.cHealthCardTable>>();
internal readonly Guid Id;
private readonly IRelationService _relationService;
@@ -67,12 +67,12 @@ namespace FasdDesktopUi.Basics.Services.SupportCase
foreach (var relationType in relations)
{
if (_caseRelations.TryGetValue(relationType.Key, out var caseRelation))
caseRelation = caseRelation.Union(relationType, new SearchResultRelationEqualityComparer()).ToList();
caseRelation = caseRelation.Union(relationType).ToList();
else
_caseRelations.Add(relationType.Key, relationType.ToList());
if (SupportCaseDataProviderArtifact?.CaseRelations?.TryGetValue(relationType.Key, out var caseRelations) ?? false)
caseRelations = caseRelations.Union(relationType, new SearchResultRelationEqualityComparer()).ToList();
caseRelations = caseRelations.Union(relationType).ToList();
else
SupportCaseDataProviderArtifact?.CaseRelations?.Add(relationType.Key, relationType.ToList());
}
@@ -85,14 +85,158 @@ namespace FasdDesktopUi.Basics.Services.SupportCase
}
}
public void UpdateSupportCaseDataCache()
public async Task LoadSupportCaseDataAsync(cF4sdApiSearchResultRelation relation, IEnumerable<string> tablesToLoad)
{
throw new NotImplementedException();
try
{
cF4SDHealthCardRawData rawData = null;
// todo this is only a temporary fix. Currently the tablesToLoad contain also detail tables
// and tables won't be loaded e.g. the QuickActionHistory
bool isDataComplete = tablesToLoad.Any(t =>
_supportCaseDataCache.TryGetValue(t, out var cachedTables)
&& cachedTables.TryGetValue(relation, out var table)
&& !table.IsIncomplete && !table.Columns.Values.Any(c => c.IsIncomplete)
);
var rawDataRequest = new cF4sdHealthCardRawDataRequest()
{
Identities = relation.Identities,
Tables = tablesToLoad.ToList(),
MaxAge = cF4SDCockpitXmlConfig.Instance?.HealthCardConfig?.SearchResultAge ?? 14
};
while (!isDataComplete)
{
if (rawData is null)
{
rawData = await cFasdCockpitCommunicationBase.Instance.GetHealthCardData(rawDataRequest);
await SupportCaseDataProviderArtifact.HealthCardDataHelper.LoadingHelper.SetHealthCardRawData(rawData, rawDataRequest.Identities);
}
else
{
rawData = await cFasdCockpitCommunicationBase.Instance.GetHealthCardData(rawData.Id);
await SupportCaseDataProviderArtifact.HealthCardDataHelper.LoadingHelper.UpdateHealthcardRawData(rawData);
}
public IEnumerable<cF4SDHealthCardRawData.cHealthCardTable> GetSupportCaseHealthcardData(object identities, object valueAddress)
UpdateSupportCaseDataCache(relation, rawData?.Tables?.Values);
isDataComplete = rawData?.Tables?
.Where(table => table.Key.StartsWith("Computation_") == false)
.All(table => !table.Value.IsIncomplete && !table.Value.Columns.Values.Any(c => c.IsIncomplete)) ?? false;
}
}
catch (Exception ex)
{
throw new NotImplementedException();
LogException(ex);
}
}
public void UpdateSupportCaseDataCache(cF4sdApiSearchResultRelation relation, IEnumerable<cF4SDHealthCardRawData.cHealthCardTable> tables)
{
try
{
if (tables is null)
return;
List<cF4SDHealthCardRawData.cHealthCardTable> dataTables = tables?.ToList();
foreach (var table in dataTables)
{
if (string.IsNullOrEmpty(table.Name))
continue;
if (!_supportCaseDataCache.ContainsKey(table.Name))
_supportCaseDataCache.Add(table.Name, new Dictionary<cF4sdApiSearchResultRelation, cF4SDHealthCardRawData.cHealthCardTable>());
if (!_supportCaseDataCache[table.Name].ContainsKey(relation))
_supportCaseDataCache[table.Name][relation] = table;
else
MergeTable(_supportCaseDataCache[table.Name][relation], table);
}
SupportCaseDataCacheHasChanged?.Invoke(this, new SupportCaseDataEventArgs() { Relation = relation, DataTables = dataTables });
}
catch (Exception ex)
{
LogException(ex);
}
void MergeTable(cF4SDHealthCardRawData.cHealthCardTable existingTable, cF4SDHealthCardRawData.cHealthCardTable newTable)
{
foreach (var newColumn in newTable.Columns)
{
existingTable.Columns[newColumn.Key] = newColumn.Value;
}
}
}
public void InvalidateCaseDataCacheFor(cF4sdApiSearchResultRelation relation)
{
try
{
foreach (var tableCache in _supportCaseDataCache.Values)
{
tableCache.Remove(relation);
}
// todo: invoke SupportCaseDataChache with empty tables
// SupportCaseDataCacheHasChanged?.Invoke(this, new SupportCaseDataEventArgs() { Relation = relation });
}
catch (Exception ex)
{
LogException(ex);
}
}
public void InvalidateLatestCaseDataCacheFor(cF4sdApiSearchResultRelation relation, out ICollection<cF4SDHealthCardRawData.cHealthCardTable> invalidatedTables)
{
invalidatedTables = new HashSet<cF4SDHealthCardRawData.cHealthCardTable>();
try
{
foreach (var tableCache in _supportCaseDataCache.Values)
{
if (!tableCache.TryGetValue(relation, out cF4SDHealthCardRawData.cHealthCardTable table))
continue;
table.IsIncomplete = true;
foreach (var column in table.Columns.Values)
{
column.Values[0] = null;
column.IsIncomplete = true;
}
invalidatedTables.Add(table);
}
}
catch (Exception ex)
{
LogException(ex);
}
}
public IEnumerable<object> GetSupportCaseHealthcardData(cF4sdApiSearchResultRelation relation, cValueAddress valueAddress)
{
try
{
if (!_supportCaseDataCache.TryGetValue(valueAddress.ValueTable, out var tables))
return null;
if (!tables.TryGetValue(relation, out var table))
return null;
if (!table.Columns.TryGetValue(valueAddress.ValueColumn, out var column))
return null;
return column.Values;
}
catch (Exception ex)
{
LogException(ex);
}
return null;
}
private void HandleRelationsFound(object sender, StagedSearchResultRelationsEventArgs e)
@@ -107,19 +251,6 @@ namespace FasdDesktopUi.Basics.Services.SupportCase
=> AddCaseRelations(relations?.ToLookup(r => cF4sdIdentityEntry.GetFromSearchResult(r.Type), r => r));
public event EventHandler<RelationEventArgs> CaseRelationsAdded;
public event EventHandler<object> SupportCaseDataCacheHasChanged; // Lookup for IdentitySet and tables which has been updated
private class SearchResultRelationEqualityComparer : IEqualityComparer<cF4sdApiSearchResultRelation>
{
public bool Equals(cF4sdApiSearchResultRelation x, cF4sdApiSearchResultRelation y)
{
return x.isEqual(y);
}
public int GetHashCode(cF4sdApiSearchResultRelation obj)
{
return obj.GetHashCode();
}
}
public event EventHandler<SupportCaseDataEventArgs> SupportCaseDataCacheHasChanged;
}
}

View File

@@ -23,9 +23,6 @@ namespace FasdDesktopUi.Basics.Services.SupportCase
if (primaryIdentity is null)
throw new InvalidEnumArgumentException($"{nameof(primaryIdentity)} must not be null.");
if (primaryIdentity.Class != enumFasdInformationClass.User)
throw new InvalidEnumArgumentException($"{nameof(primaryIdentity)} must be of class {nameof(enumFasdInformationClass.User)}.");
if (_supportCases.TryGetValue(primaryIdentity.Id, out var supportCase))
{
supportCase.Initialize();

View File

@@ -0,0 +1,274 @@
using C4IT.FASD.Base;
using C4IT.FASD.Cockpit.Communication;
using C4IT.Logging;
using FasdDesktopUi.Basics.CustomEvents;
using FasdDesktopUi.Basics.Models;
using FasdDesktopUi.Pages.DetailsPage.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using static C4IT.Logging.cLogManager;
namespace FasdDesktopUi.Basics.Services.SupportCase
{
/// <summary>
/// Used for processing raw data of a <see cref="ISupportCase"/> for the UI in a certain way.
/// </summary>
internal class SupportCaseProcessor
{
private ISupportCase _supportCase;
public cSupportCaseDataProvider SupportCaseDataProviderArtifact { get => _supportCase?.SupportCaseDataProviderArtifact; }
private readonly Dictionary<cF4sdApiSearchResultRelation, cDetailsPageData> _detailsPageDataCache = new Dictionary<cF4sdApiSearchResultRelation, cDetailsPageData>();
private readonly Dictionary<cF4sdApiSearchResultRelation, Dictionary<string, object>> _namedParameterCache = new Dictionary<cF4sdApiSearchResultRelation, Dictionary<string, object>>();
internal void SetSupportCase(ISupportCase supportCase)
{
if (_supportCase != null)
{
_supportCase.CaseRelationsAdded -= HandleSupportCaseRelationsAdded;
_supportCase.SupportCaseDataCacheHasChanged -= HandleSupportCaseDataCacheHasChanged;
}
_supportCase = supportCase;
_supportCase.CaseRelationsAdded += HandleSupportCaseRelationsAdded;
_supportCase.SupportCaseDataCacheHasChanged += HandleSupportCaseDataCacheHasChanged;
}
private void HandleSupportCaseRelationsAdded(object sender, RelationEventArgs e)
=> AvailableCaseRelationsAdded?.Invoke(this, e);
private async void HandleSupportCaseDataCacheHasChanged(object sender, SupportCaseDataEventArgs e)
{
bool isArtifactShowingCorrectHealthCard
= SupportCaseDataProviderArtifact.HealthCardDataHelper.SelectedHealthCard == GetHealthcardFor(e.Relation);
if (!isArtifactShowingCorrectHealthCard)
{
// todo this can probably be removed, as soon as the last dependency of the SupportCaseDataProviderArtifact is gone.
// till then the detailspageData gets overriden with the detailspageData of the new relation.
// However, the removal shouldn't be much of a problem, due to the fact the Artifact also stores the raw data
_detailsPageDataCache.Remove(e.Relation);
return;
}
if (_detailsPageDataCache.TryGetValue(e.Relation, out var cachedData))
{
cDetailsPageData detailData = _supportCase.SupportCaseDataProviderArtifact.HealthCardDataHelper.DetailPage.GetDataWithoutHeading();
cachedData.WidgetData = detailData.WidgetData;
cachedData.DataHistoryList = detailData.DataHistoryList;
cachedData.MenuBarData = detailData.MenuBarData;
cachedData.DataContainerCollectionList = detailData.DataContainerCollectionList;
}
else
{
_detailsPageDataCache[e.Relation] = await _supportCase.SupportCaseDataProviderArtifact.HealthCardDataHelper.DetailPage.GetDataAsync();
}
UpdateNamedParameters(e.Relation, e.DataTables);
CaseDataChanged?.Invoke(this, e);
}
private void UpdateNamedParameters(cF4sdApiSearchResultRelation relation, IEnumerable<cF4SDHealthCardRawData.cHealthCardTable> dataTables)
{
try
{
if (!_namedParameterCache.ContainsKey(relation))
_namedParameterCache.Add(relation, new Dictionary<string, object>());
var healthcard = GetHealthcardFor(relation);
foreach (var namedParameter in cHealthCardPrerequisites.GetNamedParameters(healthcard).Values)
{
var table = dataTables.FirstOrDefault(t => t.Name == namedParameter.DatabaseInfo.ValueTable);
if (table is null)
continue;
if (!table.Columns.TryGetValue(namedParameter.DatabaseInfo.ValueColumn, out var column))
continue;
string value = cUtility.RawValueFormatter.GetDisplayValue(column.Values.FirstOrDefault(), namedParameter.Display);
_namedParameterCache[relation][namedParameter.ParameterName] = value;
}
}
catch (Exception ex)
{
LogException(ex);
}
}
public async Task LoadSupportCaseDataAsync(cF4sdApiSearchResultRelation relation, IEnumerable<string> tablesToLoad)
{
_ = Task.Run(async () => await _supportCase.LoadSupportCaseDataAsync(relation, tablesToLoad.Where(t => !t.Contains("-details-"))));
if (!_detailsPageDataCache.TryGetValue(relation, out var detailsData))
{
detailsData = await _supportCase.SupportCaseDataProviderArtifact.HealthCardDataHelper.DetailPage.GetDataAsync();
_detailsPageDataCache.Add(relation, detailsData);
}
CaseDataChanged?.Invoke(this, new SupportCaseDataEventArgs());
}
public async Task UpdateLatestCaseDataFor(cF4sdApiSearchResultRelation relation)
{
try
{
int? agentUserId = relation.Identities.FirstOrDefault(i => i.Class == enumFasdInformationClass.User)?.agentId;
int? agentDeviceId = relation.Identities.FirstOrDefault(i => i.Class == enumFasdInformationClass.Computer)?.agentId;
await ActualizeDataAsync(agentUserId, agentDeviceId);
_supportCase.InvalidateLatestCaseDataCacheFor(relation, out var invalidatedTables);
_detailsPageDataCache.Remove(relation);
await _supportCase.LoadSupportCaseDataAsync(relation, invalidatedTables.Select(t => t.Name));
}
catch (Exception ex)
{
LogException(ex);
}
}
private async Task<enumActualizeStatus> ActualizeDataAsync(int? agentUserId, int? agentDeviceId)
{
var status = enumActualizeStatus.unknown;
try
{
TimeSpan refreshDelay = TimeSpan.FromMilliseconds(500);
const int maxPollCount = 20;
if (!agentDeviceId.HasValue)
{
LogEntry("Coudldn't acutalize data. There was no valid AgentDeviceId found.", LogLevels.Error);
return status;
}
var taskId = await cFasdCockpitCommunicationBase.Instance.ActualizeAgentData(agentDeviceId.Value, agentUserId);
if (taskId == Guid.Empty)
return enumActualizeStatus.failed;
enumFasdInformationClass informationClass = agentUserId != null ? enumFasdInformationClass.User : enumFasdInformationClass.Computer;
int pollCount = 0;
do
{
status = await cFasdCockpitCommunicationBase.Instance.GetActualizeAgentDataStatus(taskId, informationClass);
if (status == enumActualizeStatus.unknown)
{
pollCount++;
if (pollCount >= maxPollCount)
return status;
await Task.Delay(refreshDelay);
}
} while (status == enumActualizeStatus.unknown);
}
catch (Exception E)
{
LogException(E);
}
return status;
}
internal ILookup<enumFasdInformationClass, cF4sdApiSearchResultRelation> GetCaseRelations()
=> _supportCase.GetCaseRelations();
internal cHealthCard GetHealthcardFor(cF4sdApiSearchResultRelation relation)
{
var availableHealthCards = cF4SDCockpitXmlConfig.Instance?.HealthCardConfig?.HealthCards?.Values;
if (availableHealthCards is null || availableHealthCards.Count == 0)
return null;
return availableHealthCards
.FirstOrDefault(hc =>
hc.InformationClasses.All(i => i == cF4sdIdentityEntry.GetFromSearchResult(relation.Type))
&& HasCockpitUserRequiredRoles(hc.RequiredRoles));
}
private static bool HasCockpitUserRequiredRoles(List<string> requiredRoles)
{
try
{
if (requiredRoles is null || requiredRoles.Count == 0)
return true;
List<string> roles = null;
lock (cFasdCockpitCommunicationBase.CockpitUserInfoLock)
{
roles = cFasdCockpitCommunicationBase.CockpitUserInfo?.Roles;
}
if (roles is null || roles.Count == 0)
return false;
foreach (var requiredRole in requiredRoles)
{
if (roles.Contains(requiredRole, StringComparer.InvariantCultureIgnoreCase))
return true;
}
}
catch (Exception E)
{
LogException(E);
}
return false;
}
public List<List<cWidgetValueModel>> GetWidgetData(cF4sdApiSearchResultRelation relation)
{
List<List<cWidgetValueModel>> widgetData = null;
if (_detailsPageDataCache.TryGetValue(relation, out var detailsData))
widgetData = detailsData?.WidgetData;
return widgetData ?? new List<List<cWidgetValueModel>>();
}
public cDetailsPageDataHistoryDataModel GetHistoryData(cF4sdApiSearchResultRelation relation)
{
cDetailsPageDataHistoryDataModel historyData = null;
if (_detailsPageDataCache.TryGetValue(relation, out var detailsData))
historyData = detailsData?.DataHistoryList;
return historyData ?? new cDetailsPageDataHistoryDataModel();
}
public List<cContainerCollectionData> GetContainerData(cF4sdApiSearchResultRelation relation)
{
List<cContainerCollectionData> containerData = null;
if (_detailsPageDataCache.TryGetValue(relation, out var detailsData))
containerData = detailsData?.DataContainerCollectionList;
return containerData ?? new List<cContainerCollectionData>();
}
public List<cMenuDataBase> GetMenuBarData(cF4sdApiSearchResultRelation relation)
{
List<cMenuDataBase> menuData = null;
if (_detailsPageDataCache.TryGetValue(relation, out var detailsData))
menuData = detailsData?.MenuBarData;
return menuData ?? new List<cMenuDataBase>();
}
/// <summary>
/// Raised when newly available relations for a support case were added.
/// </summary>
public event EventHandler<RelationEventArgs> AvailableCaseRelationsAdded;
/// <summary>
/// Raised when the data set of a support case has changed.
/// </summary>
public event EventHandler<SupportCaseDataEventArgs> CaseDataChanged;
}
}

View File

@@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
namespace FasdDesktopUi.Basics.Services.SupportCase
{
internal class SupportCaseProcessorFactory
{
private readonly static Dictionary<Guid, SupportCaseProcessor> _supportCaseProccesors = new Dictionary<Guid, SupportCaseProcessor>();
internal static SupportCaseProcessor Get(Guid id)
{
if (!_supportCaseProccesors.ContainsKey(id))
_supportCaseProccesors.Add(id, new SupportCaseProcessor());
return _supportCaseProccesors[id];
}
}
}

View File

@@ -7,6 +7,7 @@ using System.Windows.Threading;
using C4IT.FASD.Base;
using C4IT.FASD.Cockpit.Communication;
using FasdDesktopUi;
using FasdDesktopUi.Basics.Models;
using FasdDesktopUi.Basics.Services.Models;
#if isDemo
@@ -19,7 +20,6 @@ namespace FasdDesktopUi.Basics.Services
{
public sealed class TicketOverviewUpdateService
{
private static readonly TimeSpan RefreshInterval = TimeSpan.FromMinutes(5);
private static readonly string[] OverviewKeys = new[]
{
"TicketsNew",
@@ -37,11 +37,17 @@ namespace FasdDesktopUi.Basics.Services
private readonly Dispatcher _dispatcher;
private readonly Dictionary<string, TileCounts> _currentCounts = new Dictionary<string, TileCounts>(StringComparer.OrdinalIgnoreCase);
private readonly Dictionary<(string Key, bool UseRoleScope), List<cF4sdApiSearchResultRelation>> _demoRelations = new Dictionary<(string, bool), List<cF4sdApiSearchResultRelation>>();
private DispatcherTimer _timer;
private bool _isFetching;
private bool _fetchRetryPending;
private readonly HashSet<TileScope> _pendingScopes = new HashSet<TileScope>();
private readonly HashSet<TileScope> _initializedScopes = new HashSet<TileScope>();
private readonly object _fetchLock = new object();
private readonly HashSet<TileScope> _retryScopes = new HashSet<TileScope>();
private DispatcherTimer _personalTimer;
private DispatcherTimer _roleTimer;
private Task _fetchWorker;
private bool _retryScheduled;
private bool _isDemo;
private bool _initialized;
private bool _isEnabled;
private readonly Random _random = new Random();
#if isDemo
private readonly List<DemoTicketRecord> _persistedDemoTickets = new List<DemoTicketRecord>();
@@ -69,18 +75,69 @@ namespace FasdDesktopUi.Basics.Services
static TicketOverviewUpdateService()
{
#if isDemo
Instance = new TicketOverviewUpdateService();
#endif
}
public static TicketOverviewUpdateService Instance { get; } = null;
public static TicketOverviewUpdateService Instance { get; }
public event EventHandler<TicketOverviewCountsChangedEventArgs> OverviewCountsChanged;
public IReadOnlyDictionary<string, TileCounts> CurrentCounts => _currentCounts;
public bool IsScopeInitialized(TileScope scope)
{
lock (_fetchLock)
{
return _initializedScopes.Contains(scope);
}
}
public bool AreAllScopesInitialized
{
get
{
lock (_fetchLock)
{
return _initializedScopes.Contains(TileScope.Personal)
&& _initializedScopes.Contains(TileScope.Role);
}
}
}
public void Start()
{
UpdateAvailability(true);
}
public void Stop()
{
UpdateAvailability(false);
}
public void UpdateAvailability(bool isEnabled)
{
if (isEnabled)
{
if (!_isEnabled)
{
_isEnabled = true;
StartInternal();
}
else
{
RefreshTimerIntervals();
}
}
else
{
if (_isEnabled)
StopInternal();
_isEnabled = false;
}
}
private void StartInternal()
{
if (_initialized)
return;
@@ -93,110 +150,259 @@ namespace FasdDesktopUi.Basics.Services
_isDemo = cFasdCockpitCommunicationBase.Instance?.IsDemo() == true;
#endif
if (!_isDemo)
{
_timer = new DispatcherTimer(RefreshInterval, DispatcherPriority.Background, async (s, e) => await FetchAsync().ConfigureAwait(false), _dispatcher);
_timer.Start();
InitializeTimers();
_ = FetchAsync();
}
else
{
_ = FetchAsync();
}
}
public async Task FetchAsync()
private void StopInternal()
{
if (_isFetching)
if (!_initialized)
return;
var communication = cFasdCockpitCommunicationBase.Instance;
if (communication == null)
_initialized = false;
lock (_fetchLock)
{
ScheduleFetchRetry();
return;
_pendingScopes.Clear();
_initializedScopes.Clear();
}
_isFetching = true;
try
lock (_retryScopes)
{
_isDemo = communication?.IsDemo() == true;
if (_isDemo && _timer != null)
{
_timer.Stop();
_timer = null;
}
var counts = await Task.Run(() => RetrieveCountsAsync()).ConfigureAwait(false);
if (counts != null)
{
await _dispatcher.InvokeAsync(() => ProcessCounts(counts));
}
}
finally
{
_isFetching = false;
}
_retryScheduled = false;
_retryScopes.Clear();
}
private Dictionary<string, TileCounts> RetrieveCountsAsync()
_dispatcher.InvokeAsync(() =>
{
var communication = cFasdCockpitCommunicationBase.Instance;
if (communication == null)
return null;
var result = new Dictionary<string, TileCounts>(StringComparer.OrdinalIgnoreCase);
_personalTimer?.Stop();
_roleTimer?.Stop();
_personalTimer = null;
_roleTimer = null;
foreach (var key in OverviewKeys)
{
var personalTask = communication.GetTicketOverviewRelations(key, useRoleScope: false, count: 0);
var roleTask = communication.GetTicketOverviewRelations(key, useRoleScope: true, count: 0);
Task.WaitAll(personalTask, roleTask);
_currentCounts[key] = TileCounts.Empty;
}
});
}
int personalCount = personalTask.Result?.Count ?? 0;
int roleCount = roleTask.Result?.Count ?? 0;
private void InitializeTimers()
{
_personalTimer = CreateScopeTimer(TileScope.Personal);
_roleTimer = CreateScopeTimer(TileScope.Role);
_personalTimer?.Start();
_roleTimer?.Start();
}
private DispatcherTimer CreateScopeTimer(TileScope scope)
{
var interval = GetPollingInterval(scope);
var timer = new DispatcherTimer(interval, DispatcherPriority.Background, async (s, e) => await FetchAsync(scope).ConfigureAwait(false), _dispatcher)
{
IsEnabled = false
};
return timer;
}
private TimeSpan GetPollingInterval(TileScope scope)
{
var ticketConfig = cFasdCockpitConfig.Instance?.Global?.TicketConfiguration;
int minutes = scope == TileScope.Role
? cF4sdTicketConfig.DefaultOverviewPollingRole
: cF4sdTicketConfig.DefaultOverviewPollingPersonal;
if (ticketConfig != null)
{
minutes = scope == TileScope.Role
? ticketConfig.OverviewPollingRole
: ticketConfig.OverviewPollingPersonal;
}
if (minutes < 1)
minutes = 1;
return TimeSpan.FromMinutes(minutes);
}
public Task FetchAsync()
{
if (!_isEnabled)
return Task.CompletedTask;
return QueueFetchAsync(new[] { TileScope.Personal, TileScope.Role });
}
public Task FetchAsync(TileScope scope)
{
if (!_isEnabled)
return Task.CompletedTask;
return QueueFetchAsync(new[] { scope });
}
private Task QueueFetchAsync(IEnumerable<TileScope> scopes)
{
if (!_isEnabled)
return Task.CompletedTask;
if (scopes == null)
return Task.CompletedTask;
lock (_fetchLock)
{
foreach (var scope in scopes)
{
_pendingScopes.Add(scope);
}
if (_fetchWorker == null || _fetchWorker.IsCompleted)
{
_fetchWorker = Task.Run(ProcessFetchQueueAsync);
}
return _fetchWorker;
}
}
private async Task ProcessFetchQueueAsync()
{
while (true)
{
TileScope scope;
lock (_fetchLock)
{
if (_pendingScopes.Count == 0)
{
_fetchWorker = null;
return;
}
scope = _pendingScopes.First();
_pendingScopes.Remove(scope);
}
await FetchScopeAsync(scope).ConfigureAwait(false);
}
}
private async Task FetchScopeAsync(TileScope scope)
{
if (!_isEnabled)
return;
var communication = cFasdCockpitCommunicationBase.Instance;
if (communication == null)
{
ScheduleFetchRetry(scope);
return;
}
try
{
_isDemo = communication.IsDemo();
var rawCounts = await communication.GetTicketOverviewCounts(OverviewKeys, scope == TileScope.Role).ConfigureAwait(false);
var counts = new Dictionary<string, int>(StringComparer.OrdinalIgnoreCase);
if (rawCounts != null)
{
foreach (var kvp in rawCounts)
{
if (string.IsNullOrWhiteSpace(kvp.Key))
continue;
counts[kvp.Key] = Math.Max(0, kvp.Value);
}
}
if (_isDemo)
{
personalCount += GetDemoRelationCount(key, useRoleScope: false);
roleCount += GetDemoRelationCount(key, useRoleScope: true);
}
result[key] = new TileCounts(personalCount, roleCount);
}
return result;
}
private void ProcessCounts(Dictionary<string, TileCounts> newCounts)
foreach (var key in OverviewKeys)
{
var extras = GetDemoRelationCount(key, scope == TileScope.Role);
if (counts.ContainsKey(key))
counts[key] += extras;
else
counts[key] = extras;
}
}
if (!_isEnabled)
return;
await _dispatcher.InvokeAsync(() => ProcessScopeCounts(scope, counts));
}
catch (Exception ex)
{
System.Diagnostics.Debug.WriteLine($"[TicketOverview] Fetch {scope} failed: {ex}");
ScheduleFetchRetry(scope);
}
}
private void RefreshTimerIntervals()
{
_dispatcher.InvokeAsync(() =>
{
if (_personalTimer != null)
_personalTimer.Interval = GetPollingInterval(TileScope.Personal);
if (_roleTimer != null)
_roleTimer.Interval = GetPollingInterval(TileScope.Role);
});
}
private void ProcessScopeCounts(TileScope scope, IDictionary<string, int> newCounts)
{
if (newCounts == null)
return;
var hasInitializedScope = _initializedScopes.Contains(scope);
var changes = new List<TileCountChange>();
bool hasPrevious = _currentCounts.Values.Any(tc => tc.Personal > 0 || tc.Role > 0);
foreach (var key in OverviewKeys)
{
var previous = _currentCounts[key];
var current = newCounts.TryGetValue(key, out var value) ? value : TileCounts.Empty;
var previous = _currentCounts.TryGetValue(key, out var counts) ? counts : TileCounts.Empty;
var incoming = newCounts.TryGetValue(key, out var value) ? value : 0;
if (previous.Personal != current.Personal)
TileCounts updated;
int oldValue;
if (scope == TileScope.Role)
{
changes.Add(new TileCountChange(key, TileScope.Personal, previous.Personal, current.Personal));
updated = new TileCounts(previous.Personal, incoming);
oldValue = previous.Role;
}
if (previous.Role != current.Role)
else
{
changes.Add(new TileCountChange(key, TileScope.Role, previous.Role, current.Role));
updated = new TileCounts(incoming, previous.Role);
oldValue = previous.Personal;
}
_currentCounts[key] = current;
_currentCounts[key] = updated;
if (hasInitializedScope && oldValue != incoming)
{
changes.Add(new TileCountChange(key, scope, oldValue, incoming));
}
}
if (!hasPrevious)
if (!hasInitializedScope)
{
_initializedScopes.Add(scope);
var initArgs = new TicketOverviewCountsChangedEventArgs(
Array.Empty<TileCountChange>(),
new Dictionary<string, TileCounts>(_currentCounts, StringComparer.OrdinalIgnoreCase),
scope);
OverviewCountsChanged?.Invoke(this, initArgs);
return;
}
if (changes.Count == 0)
return;
var args = new TicketOverviewCountsChangedEventArgs(changes, new Dictionary<string, TileCounts>(_currentCounts));
var args = new TicketOverviewCountsChangedEventArgs(changes, new Dictionary<string, TileCounts>(_currentCounts, StringComparer.OrdinalIgnoreCase));
OverviewCountsChanged?.Invoke(this, args);
}
@@ -577,22 +783,41 @@ namespace FasdDesktopUi.Basics.Services
return 0;
}
private void ScheduleFetchRetry()
private void ScheduleFetchRetry(TileScope scope)
{
if (_fetchRetryPending)
if (!_isEnabled)
return;
_fetchRetryPending = true;
lock (_retryScopes)
{
_retryScopes.Add(scope);
if (_retryScheduled)
return;
_retryScheduled = true;
}
_ = _dispatcher.InvokeAsync(async () =>
{
try
{
await Task.Delay(250).ConfigureAwait(false);
await FetchAsync().ConfigureAwait(false);
}
finally
await Task.Delay(TimeSpan.FromSeconds(5)).ConfigureAwait(false);
TileScope[] scopes;
lock (_retryScopes)
{
_fetchRetryPending = false;
scopes = _retryScopes.ToArray();
_retryScopes.Clear();
_retryScheduled = false;
}
foreach (var pendingScope in scopes)
{
await FetchAsync(pendingScope).ConfigureAwait(false);
}
}
catch (Exception ex)
{
System.Diagnostics.Debug.WriteLine($"[TicketOverview] Retry scheduling failed: {ex}");
}
}, DispatcherPriority.Background);
}

View File

@@ -7,6 +7,7 @@ using System.Windows.Documents;
using System.Linq;
using System.Windows.Input;
using System.Diagnostics;
using System.Windows.Threading;
using C4IT.FASD.Base;
using C4IT.Logging;
@@ -26,6 +27,8 @@ using Newtonsoft.Json;
using FasdDesktopUi.Basics.Services.ProtocollService;
using FasdDesktopUi.Basics.Services.SupportCase;
using FasdDesktopUi.Basics.Services.RelationService;
using FasdDesktopUi.Basics.Services.SupportCase.Controllers;
using C4IT.F4SD.SupportCaseProtocoll.Models;
namespace FasdDesktopUi.Basics
@@ -100,7 +103,7 @@ namespace FasdDesktopUi.Basics
QuickActionProtocollHelper = new cQuickActionProtocollHelper(this);
}
public static async Task<cSupportCaseDataProvider> GetDataProviderForAsync(List<cF4sdApiSearchResultRelation> storedRelations, cF4sdApiSearchResultRelation selectedRelation, IRelationService relationService)
public static async Task<cSupportCaseDataProvider> GetDataProviderForAsync(cF4sdApiSearchResultRelation selectedRelation, IRelationService relationService)
{
try
{
@@ -153,37 +156,62 @@ namespace FasdDesktopUi.Basics
DataProviders.Add(MainIdentity.Id, _result);
}
await EnsureSupportCasePagesAsync();
_result.NamedParameterEntries = new cNamedParameterList(_result);
_result.StartCase(MainIdentity.Id);
var supportCase = SupportCaseFactory.Get(MainIdentity, relationService, _result);
cSupportCaseDataProvider.detailsPage.SetSupportCase(supportCase);
cSupportCaseDataProvider.slimPage.SetSupportCase(supportCase);
var supportCaseProcessor = SupportCaseProcessorFactory.Get(MainIdentity.Id);
var supportCaseController = new SupportCaseController();
supportCaseProcessor.SetSupportCase(supportCase);
supportCaseController.SetSupportCaseProcessor(supportCaseProcessor, Identities);
if (cSupportCaseDataProvider.detailsPage == null || cSupportCaseDataProvider.slimPage == null)
{
LogEntry("Support case pages are not initialized; aborting case start.", LogLevels.Error);
return null;
}
cSupportCaseDataProvider.detailsPage.SetSupportCaseController(supportCaseController);
cSupportCaseDataProvider.slimPage.SetSupportCaseController(supportCaseController);
var Status = await _result.SetViewDataAsync(requiredInformationClasses, Identities, true);
cF4sdApiSearchResultRelation relationToFocus = GetRelationToFocus(selectedRelation, relationService.GetLoadedRelations());
// relation to focus may not have all identities
supportCaseController.UpdateFocusedCaseRelation(relationToFocus);
if (!Status)
return null;
var selectedHealthCard = _result.HealthCardDataHelper?.SelectedHealthCard;
if (selectedHealthCard != null)
_ = cHealthCard.GetRequiredTables(selectedHealthCard); // todo the healthcard is not selected at this point
if (detailsPage?.WidgetCollection != null)
detailsPage.WidgetCollection.WidgetDataList = supportCaseController.GetWidgetData();
if (detailsPage?.DataHistoryCollectionUserControl != null)
detailsPage.DataHistoryCollectionUserControl.HistoryDataList = supportCaseController.GetHistoryData();
if (detailsPage?.CustomizableSectionUc != null)
detailsPage.CustomizableSectionUc.ContainerCollections = supportCaseController.GetContainerData();
CurrentProvider = _result;
// start the direct connection
if (_result.DirectConnectionHelper.IsDirectConnectionActive is false)
_ = Task.Run(async () =>
{
try
{
await _result.DirectConnectionHelper.DirectConnectionStartAsync();
}
catch { }
});
// start the slim or detaild page
bool shouldSkipSlimView = Identities.Any(identity => identity.Class is enumFasdInformationClass.Ticket) || cFasdCockpitConfig.Instance.Global.ShouldSkipSlimView;
bool shouldSkipSlimView = (Identities?.Any(identity => identity.Class is enumFasdInformationClass.Ticket) ?? false)
|| (cFasdCockpitConfig.Instance?.Global?.ShouldSkipSlimView ?? false);
if (shouldSkipSlimView)
{
cSupportCaseDataProvider.detailsPage?.Show();
cSupportCaseDataProvider.slimPage?.Hide();
}
else
cSupportCaseDataProvider.slimPage.Show();
{
cSupportCaseDataProvider.slimPage?.Show();
cSupportCaseDataProvider.detailsPage?.Hide();
}
return _result;
}
@@ -194,6 +222,30 @@ namespace FasdDesktopUi.Basics
return null;
}
private static cF4sdApiSearchResultRelation GetRelationToFocus(cF4sdApiSearchResultRelation selectedRelation, IEnumerable<cF4sdApiSearchResultRelation> loadedRelations)
{
try
{
if (selectedRelation.Type != enumF4sdSearchResultClass.User)
return selectedRelation;
cF4sdIdentityEntry alternativeIdentity = selectedRelation.Identities.FirstOrDefault(i => i.Class != enumFasdInformationClass.User);
cF4sdApiSearchResultRelation relationToFocus = loadedRelations.FirstOrDefault(r => r.id == alternativeIdentity?.Id && cF4sdIdentityEntry.GetFromSearchResult(r.Type) == alternativeIdentity.Class);
if (relationToFocus is null)
return selectedRelation;
relationToFocus.Identities = selectedRelation.Identities;
return relationToFocus;
}
catch (Exception ex)
{
LogException(ex);
}
return selectedRelation;
}
public void StartCase(Guid userId)
{
var CM = MethodBase.GetCurrentMethod();
@@ -244,6 +296,23 @@ namespace FasdDesktopUi.Basics
}
}
private static async Task EnsureSupportCasePagesAsync()
{
if (detailsPage != null && slimPage != null)
return;
if (Application.Current == null)
return;
await Application.Current.Dispatcher.InvokeAsync(() =>
{
if (slimPage == null)
slimPage = new Pages.SlimPage.SlimPageView();
if (detailsPage == null)
detailsPage = new Pages.DetailsPage.DetailsPageView();
}, DispatcherPriority.Normal);
}
public async Task CloseCaseAsync()
{
var CM = MethodBase.GetCurrentMethod();
@@ -452,35 +521,12 @@ namespace FasdDesktopUi.Basics
}
}
var isOk = await HealthCardDataHelper.LoadingHelper.GetHealthCardRawDataAsync(new cF4sdHealthCardRawDataRequest()
{
Identities = Identities,
Tables = requiredTables.ToList(),
MaxAge = cF4SDCockpitXmlConfig.Instance?.HealthCardConfig?.SearchResultAge ?? 14
});
if (isNewCase)
HealthCardDataHelper.LoadingHelper.LastDataRequest = DateTime.Now;
if (isOk == false)
{
string identityString = "";
foreach (var identity in Identities)
{
identityString += "\n" + identity.Id + " (Type: " + identity.Class + ")";
}
LogEntry($"Error trying to receive healthcard data for following identities: {identityString}", LogLevels.Error);
CustomMessageBox.Show($"Error trying to receive healthcard data for following identities: {identityString}", "Data Error", enumHealthCardStateLevel.Error);
return false;
}
var slimPageData = await HealthCardDataHelper.SlimCard.GetDataAsync();
var detailsPageData = await HealthCardDataHelper.DetailPage.GetDataAsync();
slimPage?.SetPropertyValues(slimPageData);
detailsPage?.SetPropertyValues(detailsPageData);
return true;
}
@@ -545,11 +591,6 @@ namespace FasdDesktopUi.Basics
}
relationIdentity.CopyTo(existingIdentity);
}
else
{
Identities.Add(relationIdentity.CreateCopy());
ComputerAdded |= relationIdentity.Class == enumFasdInformationClass.Computer;
}
}
@@ -561,16 +602,6 @@ namespace FasdDesktopUi.Basics
var searchResultInfoClass = cF4sdIdentityEntry.GetFromSearchResult(searchResultRelation.Type);
await SetViewDataAsync(new List<enumFasdInformationClass>() { searchResultInfoClass }, Identities, false);
if (ComputerAdded)
_ = Task.Run(async () =>
{
try
{
await DirectConnectionHelper.DirectConnectionStartAsync();
}
catch { }
});
}
catch (Exception E)
{

View File

@@ -1,24 +1,11 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Security.Cryptography.X509Certificates;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Input;
using C4IT.FASD.Base;
using C4IT.FASD.Cockpit.Communication;
using C4IT.Logging;
using C4IT.MultiLanguage;
using FasdDesktopUi.Basics.Models;
using FasdDesktopUi.Basics.UserControls;
using FasdDesktopUi.Basics.Services.SupportCase.Controllers;
using FasdDesktopUi.Pages.DetailsPage;
using FasdDesktopUi.Pages.DetailsPage.UserControls;
using static C4IT.Logging.cLogManager;
@@ -26,11 +13,14 @@ namespace FasdDesktopUi.Basics.UiActions
{
public class cChangeHealthCardAction : cUiActionBase
{
private readonly SupportCaseController _supportCaseController;
public cF4sdApiSearchResultRelation ResultRelation { get; private set; } = null;
public cChangeHealthCardAction(cF4sdApiSearchResultRelation resultRelation)
public cChangeHealthCardAction(cF4sdApiSearchResultRelation resultRelation, SupportCaseController supportCaseController)
{
ResultRelation = resultRelation;
_supportCaseController = supportCaseController;
}
public override async Task<bool> RunUiActionAsync(object sender, UIElement UiLocation, bool isDetailedLayout, cSupportCaseDataProvider dataProvider)
@@ -52,6 +42,8 @@ namespace FasdDesktopUi.Basics.UiActions
detailsPage.NavigationHeadingUc.ResetSelectors();
await dataProvider.ExchangeCaseIdentitiesAsync(ResultRelation);
_supportCaseController.UpdateFocusedCaseRelation(ResultRelation);
detailsPage.UpdateHealthcardSectionVisibilities();
return true;
}

View File

@@ -34,17 +34,17 @@ namespace FasdDesktopUi.Basics.UiActions
private string Recommendation { get; set; }
private cHealthCardDetailsTable ValuedDetailsData = null;
private readonly cHealthCardDetailsTable _valuedDetailsData = null;
public cShowDetailedDataAction(cHealthCardStateBase StateDefinition, int DayIndex = 0, cHealthCardDetailsTable ValuedDetailsData = null)
public cShowDetailedDataAction(cHealthCardStateBase stateDefinition, int dayIndex = 0, cHealthCardDetailsTable valuedDetailsData = null)
{
this.StateDefinition = StateDefinition;
this.DayIndex = DayIndex;
this.DetailsTitle = StateDefinition.Names.GetValue();
this.Recommendation = StateDefinition.Descriptions.GetValue();
if (this.Recommendation == String.Empty)
this.Recommendation = null;
this.ValuedDetailsData = ValuedDetailsData;
StateDefinition = stateDefinition;
DayIndex = dayIndex;
DetailsTitle = stateDefinition.Names.GetValue();
Recommendation = stateDefinition.Descriptions.GetValue();
if (Recommendation == string.Empty)
Recommendation = null;
_valuedDetailsData = valuedDetailsData;
}
public override async Task<bool> RunUiActionAsync(object sender, UIElement UiLocation, bool isDetailedLayout, cSupportCaseDataProvider dataProvider)
@@ -61,7 +61,7 @@ namespace FasdDesktopUi.Basics.UiActions
if (StateDefinition.Details is cHealthCardDetailsValued)
{
if (ValuedDetailsData == null)
if (_valuedDetailsData == null)
return false;
}
else
@@ -240,26 +240,37 @@ namespace FasdDesktopUi.Basics.UiActions
private cDetailedDataModel GetValuedDataModel()
{
if (!(StateDefinition.Details is cHealthCardDetailsValued _details) || ValuedDetailsData == null)
if (!(StateDefinition.Details is cHealthCardDetailsValued details) || _valuedDetailsData == null)
return null;
if (ValuedDetailsData.Columns.Count > 1)
var _colCount = details.Count;
if (_colCount == 0)
return null;
var _rowHeadings = _details.Select(v => v.Names.GetValue() as object).ToList();
var rowHeadings = details.Select(v => (object)v.Names.GetValue()).ToList();
cDetailedDataModel output = new cDetailedDataModel()
{
Heading = StateDefinition.Names.GetValue(),
FullDetailedData = new List<object>(),
HasColumnHeaders = _rowHeadings.Count > 1
HasColumnHeaders = _colCount > 1
};
if (_rowHeadings.Count > 1)
output.FullDetailedData.Add(_rowHeadings);
if (rowHeadings.Count > 1)
output.FullDetailedData.Add(rowHeadings);
var _data = ValuedDetailsData.Values[0];
var _data = _valuedDetailsData.Values[0];
foreach (var _row in _data)
output.FullDetailedData.Add(new List<object>() { _row[0] });
{
var _rowValues = new List<object>();
for (int i = 0; i < _colCount; i++)
{
_rowValues.Add(_row[i]);
}
output.FullDetailedData.Add(_rowValues);
}
var _json = Newtonsoft.Json.JsonConvert.SerializeObject(output);
return output;
}
@@ -307,7 +318,7 @@ namespace FasdDesktopUi.Basics.UiActions
var valueProcessing = splitColumnName.Length > 1 ? splitColumnName[1] : null;
rawColumnIndexes.Add(rawColumnIndex);
displayTypes.Add(cUtility.GetRawValueType(displayType));
displayTypes.Add(displayType);
valueProcessings.Add(valueProcessing);
}
@@ -326,7 +337,8 @@ namespace FasdDesktopUi.Basics.UiActions
shouldHideRow = true;
}
cUtility.RawValueFormatter.SetDefaultCulture(new System.Globalization.CultureInfo(cFasdCockpitConfig.Instance.SelectedLanguage));
cUtility.RawValueFormatter.SetDefaultCulture(new CultureInfo(cFasdCockpitConfig.Instance.SelectedLanguage));
cUtility.RawValueFormatter.SetDefaultTimeZone(TimeZoneInfo.Local);
foreach (var index in rawColumnIndexes)
{
@@ -366,6 +378,8 @@ namespace FasdDesktopUi.Basics.UiActions
output.FullDetailedData.Add(displayValuesOfRow);
}
var _json = Newtonsoft.Json.JsonConvert.SerializeObject(output);
return output;
}
catch (Exception E)

View File

@@ -5,6 +5,7 @@ using System.Text;
using System.Threading;
using System.Threading.Tasks;
using C4IT.F4SD.DisplayFormatting;
using C4IT.F4SD.SupportCaseProtocoll.Models;
using C4IT.FASD.Base;
using C4IT.Logging;
using C4IT.MultiLanguage;
@@ -135,8 +136,10 @@ namespace FasdDesktopUi.Basics.UiActions
StatusMonitor.QuickActionOutputs.Add(_ref.Output);
quickActionOutput = QuickActionStatusMonitor.cQuickActionOutput.GetQuickActionOutput(_ref.Output, DataProvider);
cQuickActionCopyData copyData = QuickActionProtocollEntry.GetCopyData(quickActionDemo, DataProvider, true, quickActionOutput, StatusMonitor.MeasureValues);
F4SDProtocoll.Instance.Add(new QuickActionProtocollEntry(quickActionDemo, copyData));
cQuickActionCopyData copyData = QuickActionProtocollEntryOutput.GetCopyData(quickActionDemo, DataProvider, true, quickActionOutput, StatusMonitor.MeasureValues);
QuickActionProtocollEntry protocollEntry = QuickActionProtocollEntryOutput.GetQuickActionProtocollEntry(quickActionDemo, copyData);
F4SDProtocoll.Instance.Add(protocollEntry);
_msg = cMultiLanguageSupport.GetItem("QuickAction.Revision.Status.FinishedSuccessfull");
}

View File

@@ -6,6 +6,7 @@ using System.Text;
using System.Threading;
using System.Threading.Tasks;
using C4IT.F4SD.DisplayFormatting;
using C4IT.F4SD.SupportCaseProtocoll.Models;
using C4IT.FASD.Base;
using C4IT.FASD.Cockpit.Communication;
using C4IT.Logging;
@@ -154,9 +155,10 @@ namespace FasdDesktopUi.Basics.UiActions
cMultiLanguageSupport.CurrentLanguage = tempLang;
}
cQuickActionCopyData copyData = QuickActionProtocollEntry.GetCopyData(LocalQuickAction, DataProvider, false, protocollOutput, StatusMonitor.MeasureValues);
F4SDProtocoll.Instance.Add(new QuickActionProtocollEntry(LocalQuickAction, copyData));
cQuickActionCopyData copyData = QuickActionProtocollEntryOutput.GetCopyData(LocalQuickAction, DataProvider, false, protocollOutput, StatusMonitor.MeasureValues);
QuickActionProtocollEntry protocollEntry = QuickActionProtocollEntryOutput.GetQuickActionProtocollEntry(LocalQuickAction, copyData);
F4SDProtocoll.Instance.Add(protocollEntry);
string quickActionStatus;
switch (ResultRevision.Status)
@@ -193,8 +195,10 @@ namespace FasdDesktopUi.Basics.UiActions
cMultiLanguageSupport.CurrentLanguage = tempLang;
}
cQuickActionCopyData copyData = QuickActionProtocollEntry.GetCopyData(LocalQuickAction, DataProvider, false, protocollOutput, StatusMonitor.MeasureValues);
F4SDProtocoll.Instance.Add(new QuickActionProtocollEntry(LocalQuickAction, copyData));
cQuickActionCopyData copyData = QuickActionProtocollEntryOutput.GetCopyData(LocalQuickAction, DataProvider, false, protocollOutput, StatusMonitor.MeasureValues);
QuickActionProtocollEntry protocollEntry = QuickActionProtocollEntryOutput.GetQuickActionProtocollEntry(LocalQuickAction, copyData);
F4SDProtocoll.Instance.Add(protocollEntry);
output = new List<object>() { cMultiLanguageSupport.GetItem("QuickAction.Revision.Status.Canceled"), cUtility.RawValueFormatter.GetDisplayValue(DateTime.UtcNow, RawValueType.DATETIME) };
}

View File

@@ -1,4 +1,5 @@
using C4IT.F4SD.DisplayFormatting;
using C4IT.F4SD.SupportCaseProtocoll.Models;
using C4IT.FASD.Base;
using C4IT.Logging;
using C4IT.MultiLanguage;
@@ -124,8 +125,10 @@ namespace FasdDesktopUi.Basics.UiActions
cMultiLanguageSupport.CurrentLanguage = tempLang;
}
cQuickActionCopyData copyData = QuickActionProtocollEntry.GetCopyData(LocalQuickAction, DataProvider, false, protocollOutput, StatusMonitor.MeasureValues);
F4SDProtocoll.Instance.Add(new QuickActionProtocollEntry(LocalQuickAction, copyData));
cQuickActionCopyData copyData = QuickActionProtocollEntryOutput.GetCopyData(LocalQuickAction, DataProvider, false, protocollOutput, StatusMonitor.MeasureValues);
QuickActionProtocollEntry protocollEntry = QuickActionProtocollEntryOutput.GetQuickActionProtocollEntry(LocalQuickAction, copyData);
F4SDProtocoll.Instance.Add(protocollEntry);
return new List<object>() { cMultiLanguageSupport.GetItem("QuickAction.Revision.Status.FinishedSuccessfull"), cUtility.RawValueFormatter.GetDisplayValue(DateTime.UtcNow, RawValueType.DATETIME) };
}
@@ -141,8 +144,10 @@ namespace FasdDesktopUi.Basics.UiActions
cMultiLanguageSupport.CurrentLanguage = cF4SDCockpitXmlConfig.Instance.HealthCardConfig.ProtocollLanguage;
protocollOutput = new cQuickActionOutputSingle(new cF4sdQuickActionRevision.cOutput() { ResultCode = enumQuickActionSuccess.error, ErrorDescription = cMultiLanguageSupport.GetItem("QuickAction.Copy.Output.Cancel") });
cQuickActionCopyData copyData = QuickActionProtocollEntry.GetCopyData(LocalQuickAction, DataProvider, false, protocollOutput, StatusMonitor.MeasureValues);
F4SDProtocoll.Instance.Add(new QuickActionProtocollEntry(LocalQuickAction, copyData));
cQuickActionCopyData copyData = QuickActionProtocollEntryOutput.GetCopyData(LocalQuickAction, DataProvider, false, protocollOutput, StatusMonitor.MeasureValues);
QuickActionProtocollEntry protocollEntry = QuickActionProtocollEntryOutput.GetQuickActionProtocollEntry(LocalQuickAction, copyData);
F4SDProtocoll.Instance.Add(protocollEntry);
cMultiLanguageSupport.CurrentLanguage = tempLang;
return new List<object>() { cMultiLanguageSupport.GetItem("QuickAction.Revision.Status.Canceled"), cUtility.RawValueFormatter.GetDisplayValue(DateTime.UtcNow, RawValueType.DATETIME) };

View File

@@ -58,7 +58,7 @@ namespace FasdDesktopUi.Basics.UiActions
}
}
HistoryEntry.isSeen = true;
dataProvider = await cSupportCaseDataProvider.GetDataProviderForAsync(RelationEntry.Relations, RelationEntry.SelectedRelation, relationService);
dataProvider = await cSupportCaseDataProvider.GetDataProviderForAsync(RelationEntry.SelectedRelation, relationService);
if (dataProvider is null)
{
Debug.Assert(true, "Could not start a data provider for the selected criterias.");

View File

@@ -6,6 +6,7 @@ using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Threading;
using System.Threading.Tasks;
using System.Windows;
using static C4IT.Logging.cLogManager;
@@ -23,7 +24,7 @@ namespace FasdDesktopUi.Basics.UiActions
public cUiProcessSearchRelationAction(cSearchHistorySearchResultEntry searchHistoryEntry, cF4sdApiSearchResultRelation selectedRelation, IRelationService relationService, ISearchUiProvider searchUiProvider)
{
Name = $"{searchHistoryEntry.HeaderText} → {selectedRelation.DisplayName}";
Name = !string.IsNullOrWhiteSpace(selectedRelation.DisplayName) ? $"{searchHistoryEntry.HeaderText} → {selectedRelation.DisplayName}" : searchHistoryEntry.HeaderText;
_selectedSearchResult = searchHistoryEntry.SelectedSearchResult;
_relations = searchHistoryEntry.Relations;
_selectedRelation = selectedRelation;
@@ -32,7 +33,7 @@ namespace FasdDesktopUi.Basics.UiActions
_searchHistoryEntry = searchHistoryEntry;
}
public cUiProcessSearchRelationAction(string name, List<cFasdApiSearchResultEntry> selectedSearchResult, List<cF4sdApiSearchResultRelation> relations, cF4sdApiSearchResultRelation selectedRelation, ISearchUiProvider searchUiProvider, cSearchHistoryEntryBase searchHistoryEntry)
public cUiProcessSearchRelationAction(string name, List<cFasdApiSearchResultEntry> selectedSearchResult, List<cF4sdApiSearchResultRelation> relations, cF4sdApiSearchResultRelation selectedRelation, ISearchUiProvider searchUiProvider, cSearchHistoryEntryBase searchHistoryEntry, IRelationService relationService)
{
Name = name;
_selectedSearchResult = selectedSearchResult;
@@ -40,6 +41,7 @@ namespace FasdDesktopUi.Basics.UiActions
_selectedRelation = selectedRelation;
_searchUiProvider = searchUiProvider;
_searchHistoryEntry = searchHistoryEntry;
_relationService = relationService;
}
public override async Task<bool> RunUiActionAsync(object sender, UIElement UiLocation, bool isDetailedLayout, cSupportCaseDataProvider dataProvider)
@@ -84,10 +86,15 @@ namespace FasdDesktopUi.Basics.UiActions
return false;
}
// set the new result menu properies for loading ....
_seachHistoryEntry.isSeen = true;
// get the new data provider for the support call informations (get it from the cache or create a new one)
dataProvider = await cSupportCaseDataProvider.GetDataProviderForAsync(_relations, _selectedRelation, _relationService);
dataProvider = await cSupportCaseDataProvider.GetDataProviderForAsync(_selectedRelation, _relationService);
bool shouldLoadRelationsForSelectedRelation = _selectedRelation.Type == enumF4sdSearchResultClass.User;
if (shouldLoadRelationsForSelectedRelation)
StartLoadingRelationsFor(_selectedRelation);
if (dataProvider is null)
{
@@ -106,5 +113,26 @@ namespace FasdDesktopUi.Basics.UiActions
return false;
}
private void StartLoadingRelationsFor(cF4sdApiSearchResultRelation selectedRelation)
{
try
{
var relationsToReload = new List<cFasdApiSearchResultEntry>() { new cFasdApiSearchResultEntry()
{
DisplayName = selectedRelation.DisplayName,
id = selectedRelation.id,
Infos = selectedRelation.Infos,
Name = selectedRelation.Name,
Status = selectedRelation.Status,
Type = selectedRelation.Type
} };
_ = Task.Run(async () => _relationService.LoadRelationsAsync(relationsToReload), CancellationToken.None);
}
catch (Exception ex)
{
LogException(ex);
}
}
}
}

View File

@@ -24,6 +24,8 @@ namespace FasdDesktopUi.Basics.UiActions
private readonly List<cF4sdApiSearchResultRelation> _loadedRelations = new List<cF4sdApiSearchResultRelation>();
private readonly TaskCompletionSource<bool> _isSearchUnambigous = new TaskCompletionSource<bool>();
private IRelationService _relationService = null;
public cF4sdApiSearchResultRelation PreSelectedSearchRelation { get; set; } = null;
public cUiProcessSearchResultAction(string name, ISearchUiProvider searchUiProvider, List<cFasdApiSearchResultEntry> searchResults)
@@ -115,10 +117,10 @@ namespace FasdDesktopUi.Basics.UiActions
private async Task<bool> ProcessSearchResultRelationAsync(string name, List<cF4sdApiSearchResultRelation> caseRelations, cF4sdApiSearchResultRelation selectedRelation)
{
var relationSearchResult = new cSearchHistorySearchResultEntry(_searchResults.FirstOrDefault().DisplayName, _searchResults.FirstOrDefault().DisplayName, _searchResults, caseRelations, _searchUiProvider);
string displayName = selectedRelation != null ? $"{name} → {selectedRelation.Name}" : name;
string displayName = !string.IsNullOrWhiteSpace(selectedRelation?.Name) ? $"{name} → {selectedRelation.Name}" : name;
cUiProcessSearchRelationAction action
= new cUiProcessSearchRelationAction(displayName, _searchResults, caseRelations, caseRelations.FirstOrDefault(), _searchUiProvider, relationSearchResult)
= new cUiProcessSearchRelationAction(displayName, _searchResults, caseRelations, selectedRelation, _searchUiProvider, relationSearchResult, _relationService)
{
DisplayType = enumActionDisplayType.enabled,
};
@@ -155,6 +157,7 @@ namespace FasdDesktopUi.Basics.UiActions
try
{
_loadedRelations.AddRange(e.StagedResultRelations.Relations);
_relationService = e.RelationService;
if (!e.StagedResultRelations.IsComplete)
return;

View File

@@ -45,6 +45,7 @@ namespace FasdDesktopUi.Basics.UiActions
return;
cUtility.RawValueFormatter.SetDefaultCulture(new System.Globalization.CultureInfo(cFasdCockpitConfig.Instance.SelectedLanguage));
cUtility.RawValueFormatter.SetDefaultTimeZone(TimeZoneInfo.Local);
shouldRunImmidiate = QuickActionConfig.RunImmediate;
Description = QuickActionConfig.Descriptions?.GetValue(Default: null);

View File

@@ -27,12 +27,12 @@ namespace FasdDesktopUi.Basics.UiActions
_quickTip = quickTip;
}
public override Task<bool> RunUiActionAsync(object sender, UIElement UiLocation, bool isDetailedLayout, cSupportCaseDataProvider dataProvider)
public override async Task<bool> RunUiActionAsync(object sender, UIElement UiLocation, bool isDetailedLayout, cSupportCaseDataProvider dataProvider)
{
try
{
if (!(UiLocation is QuickTipStatusMonitor quickTipStatusMonitor))
return Task.FromResult(false);
return false;
DataProvider = dataProvider;
@@ -49,13 +49,13 @@ namespace FasdDesktopUi.Basics.UiActions
quickTipStatusMonitor.Visibility = Visibility.Visible;
return Task.FromResult(true);
return true;
}
catch (Exception E)
{
LogException(E);
}
return Task.FromResult(false);
return false;
}
private void CreateElementData()

View File

@@ -1,4 +1,5 @@
using C4IT.F4SD.DisplayFormatting;
using C4IT.F4SD.SupportCaseProtocoll.Models;
using C4IT.FASD.Base;
using C4IT.FASD.Cockpit.Communication;
using C4IT.Logging;
@@ -137,9 +138,10 @@ namespace FasdDesktopUi.Basics.UiActions
cQuickActionStatusMonitorModel.cQuickActionStep.SetQuickActionStepStatuses(StatusMonitor.QuickActionData.ActionSteps, RemoteQuickAction.Name, enumActionStepType.running, status);
cQuickActionStatusMonitorModel.cQuickActionStep.SetQuickActionStepStatuses(StatusMonitor.QuickActionData.ActionSteps, RemoteQuickAction.Name, enumActionStepType.main, status);
cQuickActionCopyData copyData = QuickActionProtocollEntry.GetCopyData(RemoteQuickAction, DataProvider, true, protocollOutput, StatusMonitor.MeasureValues);
F4SDProtocoll.Instance.Add(new QuickActionProtocollEntry(RemoteQuickAction, copyData));
cQuickActionCopyData copyData = QuickActionProtocollEntryOutput.GetCopyData(RemoteQuickAction, DataProvider, true, protocollOutput, StatusMonitor.MeasureValues);
QuickActionProtocollEntry protocollEntry = QuickActionProtocollEntryOutput.GetQuickActionProtocollEntry(RemoteQuickAction, copyData);
F4SDProtocoll.Instance.Add(protocollEntry);
}
else
{
@@ -155,8 +157,11 @@ namespace FasdDesktopUi.Basics.UiActions
cMultiLanguageSupport.CurrentLanguage = tempLang;
}
cQuickActionCopyData copyData = QuickActionProtocollEntry.GetCopyData(RemoteQuickAction, DataProvider, true, protocollOutput, StatusMonitor.MeasureValues);
F4SDProtocoll.Instance.Add(new QuickActionProtocollEntry(RemoteQuickAction, copyData));
cQuickActionCopyData copyData = QuickActionProtocollEntryOutput.GetCopyData(RemoteQuickAction, DataProvider, true, protocollOutput, StatusMonitor.MeasureValues);
QuickActionProtocollEntry protocollEntry = QuickActionProtocollEntryOutput.GetQuickActionProtocollEntry(RemoteQuickAction, copyData);
F4SDProtocoll.Instance.Add(protocollEntry);
return new List<object>() { cMultiLanguageSupport.GetItem("QuickAction.Revision.Status.Canceled"), cUtility.RawValueFormatter.GetDisplayValue(DateTime.UtcNow, RawValueType.DATETIME) };
}
@@ -241,7 +246,7 @@ namespace FasdDesktopUi.Basics.UiActions
{
Id = measure.Id,
Names = measureDefinition.Names,
Display = cUtility.GetRawValueType(measureDefinition.Display),
Display = measureDefinition.Display,
Value = measure.Value,
PostValue = measure.PostValue
});

View File

@@ -1,4 +1,5 @@
using C4IT.F4SD.DisplayFormatting;
using C4IT.F4SD.SupportCaseProtocoll.Models;
using C4IT.FASD.Base;
using C4IT.FASD.Cockpit.Communication;
using C4IT.Logging;
@@ -170,8 +171,10 @@ namespace FasdDesktopUi.Basics.UiActions
cMultiLanguageSupport.CurrentLanguage = tempLang;
}
cQuickActionCopyData copyData = QuickActionProtocollEntry.GetCopyData(ServerQuickAction, DataProvider, false, protocollOutput, StatusMonitor.MeasureValues);
F4SDProtocoll.Instance.Add(new QuickActionProtocollEntry(ServerQuickAction, copyData));
cQuickActionCopyData copyData = QuickActionProtocollEntryOutput.GetCopyData(ServerQuickAction, DataProvider, false, protocollOutput, StatusMonitor.MeasureValues);
QuickActionProtocollEntry protocollEntry = QuickActionProtocollEntryOutput.GetQuickActionProtocollEntry(ServerQuickAction, copyData);
F4SDProtocoll.Instance.Add(protocollEntry);
string quickActionStatus;
switch (ResultRevision.Status)
@@ -208,8 +211,10 @@ namespace FasdDesktopUi.Basics.UiActions
cMultiLanguageSupport.CurrentLanguage = tempLang;
}
cQuickActionCopyData copyData = QuickActionProtocollEntry.GetCopyData(ServerQuickAction, DataProvider, false, protocollOutput, StatusMonitor.MeasureValues);
F4SDProtocoll.Instance.Add(new QuickActionProtocollEntry(ServerQuickAction, copyData));
cQuickActionCopyData copyData = QuickActionProtocollEntryOutput.GetCopyData(ServerQuickAction, DataProvider, false, protocollOutput, StatusMonitor.MeasureValues);
QuickActionProtocollEntry protocollEntry = QuickActionProtocollEntryOutput.GetQuickActionProtocollEntry(ServerQuickAction, copyData);
F4SDProtocoll.Instance.Add(protocollEntry);
output = new List<object>() { cMultiLanguageSupport.GetItem("QuickAction.Revision.Status.Canceled"), cUtility.RawValueFormatter.GetDisplayValue(DateTime.UtcNow, RawValueType.DATETIME) };
}

View File

@@ -0,0 +1,41 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using C4IT.Logging;
using FasdDesktopUi.Pages.RawHealthCardValuesPage;
using static C4IT.Logging.cLogManager;
namespace FasdDesktopUi.Basics.UiActions
{
public class UiShowRawHealthcardValues : cUiActionBase
{
public override async Task<bool> RunUiActionAsync(object sender, UIElement UiLocation, bool isDetailedLayout, cSupportCaseDataProvider dataProvider)
{
MethodBase CM = null; if (cLogManager.DefaultLogger.IsDebug) { CM = MethodBase.GetCurrentMethod(); LogMethodBegin(CM); }
try
{
var _rawValueWindow = new RawHealthCardValuesPage();
_rawValueWindow.Show();
return true;
}
catch (Exception E)
{
LogException(E);
}
finally
{
if (CM != null) LogMethodEnd(CM);
}
return false;
}
}
}

View File

@@ -0,0 +1,27 @@
<UserControl x:Class="FasdDesktopUi.Basics.UserControls.Badge"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:FasdDesktopUi.Basics.UserControls"
xmlns:ico="clr-namespace:FasdDesktopUi.Basics.UserControls.AdaptableIcon;assembly=F4SD-AdaptableIcon"
mc:Ignorable="d"
d:DesignHeight="20"
d:DesignWidth="40"
x:Name="BadgeControl">
<Border Background="{DynamicResource Color.F4SD}"
CornerRadius="5">
<StackPanel HorizontalAlignment="Center"
VerticalAlignment="Center"
Orientation="Horizontal"
Margin="7.5 2.5">
<TextBlock FontSize="12"
FontWeight="Bold"
Foreground="White"
Text="{Binding ElementName=BadgeControl, Path=Text}" />
</StackPanel>
</Border>
</UserControl>

View File

@@ -0,0 +1,27 @@
using F4SD_AdaptableIcon;
using FasdDesktopUi.Basics.Helper;
using System;
using System.Windows;
using System.Windows.Controls;
using static C4IT.Logging.cLogManager;
namespace FasdDesktopUi.Basics.UserControls
{
public partial class Badge : UserControl
{
public string Text
{
get { return (string)GetValue(TextProperty); }
set { SetValue(TextProperty, value); }
}
public static readonly DependencyProperty TextProperty =
DependencyProperty.Register(nameof(Text), typeof(string), typeof(Badge), new PropertyMetadata("Beta"));
public Badge()
{
InitializeComponent();
}
}
}

View File

@@ -23,12 +23,6 @@
Visibility="{Binding ElementName=DataCanvasUc, Path=IsDetailedLayout, Converter={StaticResource BoolToVisibility}}"
IsCloseButtonVisible="{Binding ElementName=DataCanvasUc, Path=DataCanvasData, Converter={StaticResource IsCloseButtonVisible}, ConverterParameter={x:Static converter:enumDataCanvasTypes.detailedData} }" />
<local:DetailedChart x:Name="DetailedChartUc"
HorizontalAlignment="Stretch"
Width="385"
Visibility="{Binding ElementName=DataCanvasUc, Path=IsDetailedLayout, Converter={StaticResource BoolToVisibility}}"
IsCloseButtonVisible="{Binding ElementName=DataCanvasUc, Path=DataCanvasData, Converter={StaticResource IsCloseButtonVisible}, ConverterParameter={x:Static converter:enumDataCanvasTypes.detailedData} }" />
<local:DynamicChart x:Name="DynamicChartUc"
HorizontalAlignment="Stretch"
Width="385"

View File

@@ -72,20 +72,16 @@ namespace FasdDesktopUi.Basics.UserControls
{
_me.DetailedDataUc.DetailedInformationData = _me.DataCanvasData.DetailedData;
_me.DetailedDataUc.CloseButtonClickedAction = _me.CloseDataCanvas;
_me.DetailedChartUc.ChartData = null;
_me.DynamicChartUc.ChartData = null;
}
else if (_me.DataCanvasData.ChartData is null)
{
_me.DetailedChartUc.ChartData = _me.DataCanvasData.DetailedChartData;
_me.DynamicChartUc.ChartData = null;
_me.DetailedDataUc.DetailedInformationData = null;
_me.DetailedChartUc.CloseButtonClickedAction = _me.CloseDataCanvas;
}
else
{
_me.DynamicChartUc.ChartData = _me.DataCanvasData.ChartData;
_me.DetailedChartUc.ChartData = null;
_me.DetailedDataUc.DetailedInformationData = null;
_me.DynamicChartUc.CloseButtonClickedAction = _me.CloseDataCanvas;
}
@@ -169,7 +165,6 @@ namespace FasdDesktopUi.Basics.UserControls
public DataCanvas()
{
InitializeComponent();
DetailedChartUc.Visibility = Visibility.Visible;
}
public DataCanvas(bool drawInScrollViewer)
@@ -186,6 +181,11 @@ namespace FasdDesktopUi.Basics.UserControls
}
private async void HealthCardDataHelper_DataRefreshed(object sender, EventArgs e)
{
await UpdateDataAsync();
}
internal async Task UpdateDataAsync()
{
try
{

View File

@@ -555,21 +555,34 @@ namespace FasdDesktopUi.Basics.UserControls
}
}
public void SetValuesLineGraph()
{
try
{
double oneDayMs = TimeSpan.FromDays(1).TotalMilliseconds;
double chartStartMs = 0;
double chartEndMs = oneDayMs;
foreach (var data in GraphicDataProperty)
{
DateTime dataTime = data.Time;
double dataValue = data.Value;
int dataDuration = data.Duration;
double time = dataTime.TimeOfDay.TotalMilliseconds;
double startMs = dataTime.TimeOfDay.TotalMilliseconds;
double endMs = startMs + dataDuration;
double xLeft = xCoordinate.GetCoordinate(time);
double xRight = xCoordinate.GetCoordinate(time + dataDuration);
if (startMs >= chartEndMs || endMs <= chartStartMs)
continue;
if (startMs < chartStartMs)
startMs = chartStartMs;
if (endMs > chartEndMs)
endMs = chartEndMs;
double xLeft = xCoordinate.GetCoordinate(startMs);
double xRight = xCoordinate.GetCoordinate(endMs);
double y = 0;
@@ -652,16 +665,30 @@ namespace FasdDesktopUi.Basics.UserControls
{
try
{
double oneDayMs = TimeSpan.FromDays(1).TotalMilliseconds;
double chartStartMs = 0;
double chartEndMs = oneDayMs;
foreach (var data in GraphicDataProperty)
{
DateTime dataTime = data.Time;
double dataValue = data.Value;
int dataDuration = data.Duration;
double time = dataTime.TimeOfDay.TotalMilliseconds;
double startMs = dataTime.TimeOfDay.TotalMilliseconds;
double endMs = startMs + dataDuration;
double xLeft = xCoordinate.GetCoordinate(time);
double xRight = xCoordinate.GetCoordinate(time + dataDuration);
if (startMs >= chartEndMs || endMs <= chartStartMs)
continue;
if (startMs < chartStartMs)
startMs = chartStartMs;
if (endMs > chartEndMs)
endMs = chartEndMs;
double xLeft = xCoordinate.GetCoordinate(startMs);
double xRight = xCoordinate.GetCoordinate(endMs);
double y = 0;

View File

@@ -1,4 +1,5 @@
using C4IT.F4SD.DisplayFormatting;
using C4IT.F4SD.SupportCaseProtocoll.Models;
using C4IT.FASD.Base;
using C4IT.MultiLanguage;
using F4SD_AdaptableIcon.Enums;
@@ -38,6 +39,7 @@ namespace FasdDesktopUi.Basics.UserControls
public cQuickActionOutput(cF4sdQuickActionRevision.cOutput scriptOutput)
{
_rawValueFormatter.SetDefaultCulture(new System.Globalization.CultureInfo(cFasdCockpitConfig.Instance.SelectedLanguage));
_rawValueFormatter.SetDefaultTimeZone(TimeZoneInfo.Local);
ErrorCode = scriptOutput.ErrorCode;
ErrorDescription = scriptOutput.ErrorDescription;
ResultCode = scriptOutput.ResultCode.GetValueOrDefault();
@@ -246,7 +248,7 @@ namespace FasdDesktopUi.Basics.UserControls
return veiledText;
if (outputFormatting.DisplayType != null)
output = _rawValueFormatter.GetDisplayValue(Value, cUtility.GetRawValueType(outputFormatting.DisplayType.Value));
output = _rawValueFormatter.GetDisplayValue(Value, outputFormatting.DisplayType.Value);
if (outputFormatting.Translation != null)
{
@@ -372,7 +374,7 @@ namespace FasdDesktopUi.Basics.UserControls
return veiledText;
if (outputFormatting.DisplayType != null)
output = _rawValueFormatter.GetDisplayValue(selectedItem.Value, cUtility.GetRawValueType(outputFormatting.DisplayType.Value));
output = _rawValueFormatter.GetDisplayValue(selectedItem.Value, outputFormatting.DisplayType.Value);
if (outputFormatting.Translation != null)
{
@@ -464,7 +466,7 @@ namespace FasdDesktopUi.Basics.UserControls
return veiledText;
if (outputFormatting.DisplayType != null)
output = _rawValueFormatter.GetDisplayValue(Values[row][column].Value, cUtility.GetRawValueType(outputFormatting.DisplayType.Value));
output = _rawValueFormatter.GetDisplayValue(Values[row][column].Value, outputFormatting.DisplayType.Value);
if (outputFormatting.Translation != null)
{
@@ -803,6 +805,7 @@ namespace FasdDesktopUi.Basics.UserControls
return;
_rawValueFormatter.SetDefaultCulture(new System.Globalization.CultureInfo(cFasdCockpitConfig.Instance.SelectedLanguage));
_rawValueFormatter.SetDefaultTimeZone(TimeZoneInfo.Local);
for (int i = 0; i < measureValues.Count; i++)
{

View File

@@ -3,12 +3,15 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:uc="clr-namespace:FasdDesktopUi.Basics.UserControls"
xmlns:local="clr-namespace:FasdDesktopUi.Basics.UserControls.QuickTip"
xmlns:ico="clr-namespace:FasdDesktopUi.Basics.UserControls.AdaptableIcon;assembly=F4SD-AdaptableIcon"
xmlns:icod="clr-namespace:F4SD_AdaptableIcon;assembly=F4SD-AdaptableIcon"
xmlns:gif="http://wpfanimatedgif.codeplex.com"
xmlns:converter="clr-namespace:FasdDesktopUi.Basics.Converter"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="400"
d:DesignHeight="450"
d:DesignWidth="400"
MinWidth="400"
MinHeight="200"
IsVisibleChanged="QuickTipStatusMonitorUc_IsVisibleChanged"
@@ -16,21 +19,35 @@
<UserControl.Resources>
<converter:LanguageDefinitionsConverter x:Key="LanguageConverter" />
<Style x:Key="BorderButtonWithText" TargetType="Border">
<Setter Property="CornerRadius" Value="5"/>
<Setter Property="Background" Value="{DynamicResource Color.AppBackground}"/>
<Setter Property="Height" Value="35"/>
<EventSetter Event="MouseEnter" Handler="ButtonBorder_MouseEnter"/>
<EventSetter Event="MouseLeave" Handler="ButtonBorder_MouseLeave"/>
<Style x:Key="BorderButtonWithText"
TargetType="Border">
<Setter Property="CornerRadius"
Value="5" />
<Setter Property="Background"
Value="{DynamicResource Color.AppBackground}" />
<Setter Property="Height"
Value="35" />
<EventSetter Event="MouseEnter"
Handler="ButtonBorder_MouseEnter" />
<EventSetter Event="MouseLeave"
Handler="ButtonBorder_MouseLeave" />
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="{DynamicResource BackgroundColor.Menu.MainCategory}"/>
<Trigger Property="IsMouseOver"
Value="True">
<Setter Property="Background"
Value="{DynamicResource BackgroundColor.Menu.MainCategory}" />
</Trigger>
</Style.Triggers>
</Style>
</UserControl.Resources>
<Grid>
<uc:Badge Panel.ZIndex="999"
HorizontalAlignment="Right"
VerticalAlignment="Top"
Margin="10" />
<Border CornerRadius="10"
Padding="10"
Margin="0 0 0 10"
@@ -38,10 +55,10 @@
VerticalAlignment="Top">
<DockPanel>
<DockPanel LastChildFill="False" DockPanel.Dock="Top">
<DockPanel LastChildFill="False"
DockPanel.Dock="Top">
<ico:AdaptableIcon
x:Name="HeadingIcon"
<ico:AdaptableIcon x:Name="HeadingIcon"
DockPanel.Dock="Left"
Style="{DynamicResource Menu.MenuBar.PinnedIcon.Base}"
VerticalAlignment="Center"
@@ -50,10 +67,9 @@
IconHeight="15"
IconWidth="15"
SelectedInternIcon="{Binding QuickTipIcon.Intern, ElementName=QuickTipStatusMonitorUc}"
SelectedMaterialIcon="{Binding QuickTipIcon.Material, ElementName=QuickTipStatusMonitorUc}"/>
SelectedMaterialIcon="{Binding QuickTipIcon.Material, ElementName=QuickTipStatusMonitorUc}" />
<TextBlock
x:Name="HeadingText"
<TextBlock x:Name="HeadingText"
Text="{Binding QuickTipName, ElementName=QuickTipStatusMonitorUc}"
DockPanel.Dock="Left"
Style="{DynamicResource DetailsPage.DataHistory.TitleColumn.OverviewTitle}"
@@ -63,63 +79,55 @@
</DockPanel>
<Grid Margin="0,5,0,0" DockPanel.Dock="Bottom">
<Grid Margin="0,5,0,0"
DockPanel.Dock="Bottom">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="1.5*"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="1.5*"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="1.5*" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="1.5*" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Border
x:Name="CompleteButton"
<Border x:Name="CompleteButton"
Grid.Column="1"
Style="{DynamicResource BorderButtonWithText}"
MouseLeftButtonUp="CompleteButton_Click"
TouchDown="CompleteButton_Click">
<TextBlock
Text="{Binding Converter={StaticResource LanguageConverter}, ConverterParameter=QuickTips.Complete}"
<TextBlock Text="{Binding Converter={StaticResource LanguageConverter}, ConverterParameter=QuickTips.Complete}"
Style="{DynamicResource DetailsPage.DataHistory.TitleColumn.OverviewTitle}"
VerticalAlignment="Center"
HorizontalAlignment="Center"/>
HorizontalAlignment="Center" />
</Border>
<Border
x:Name="CancelButton"
<Border x:Name="CancelButton"
Grid.Column="3"
Style="{DynamicResource BorderButtonWithText}"
MouseLeftButtonUp="CancelButton_Click"
TouchDown="CancelButton_Click">
<TextBlock
Text="{Binding Converter={StaticResource LanguageConverter}, ConverterParameter=QuickTips.Cancel}"
<TextBlock Text="{Binding Converter={StaticResource LanguageConverter}, ConverterParameter=QuickTips.Cancel}"
Style="{DynamicResource DetailsPage.DataHistory.TitleColumn.OverviewTitle}"
VerticalAlignment="Center"
HorizontalAlignment="Center"/>
HorizontalAlignment="Center" />
</Border>
</Grid>
<TextBlock
x:Name="StepCountTextBlock"
<TextBlock x:Name="StepCountTextBlock"
TextAlignment="Center"
Text="0 von 0 Schritten abgeschlossen"
Foreground="{DynamicResource FontColor.DetailsPage.DataHistory.Value}"
DockPanel.Dock="Bottom"/>
DockPanel.Dock="Bottom" />
<ScrollViewer
x:Name="QuickTipElementViewer"
<ScrollViewer x:Name="QuickTipElementViewer"
VerticalScrollBarVisibility="Auto"
DockPanel.Dock="Top">
<StackPanel
x:Name="QuickTipElementPanel">
<StackPanel x:Name="QuickTipElementPanel">
</StackPanel>
@@ -128,4 +136,5 @@
</DockPanel>
</Border>
</Grid>
</UserControl>

View File

@@ -1,4 +1,5 @@
using C4IT.FASD.Base;
using C4IT.F4SD.SupportCaseProtocoll.Models;
using C4IT.FASD.Base;
using C4IT.MultiLanguage;
using F4SD_AdaptableIcon;
using F4SD_AdaptableIcon.Enums;
@@ -254,7 +255,9 @@ namespace FasdDesktopUi.Basics.UserControls.QuickTip
return;
bool wasSuccessfull = step.SuccessState == enumQuickActionSuccess.finished || step.SuccessState == enumQuickActionSuccess.successfull;
F4SDProtocoll.Instance.Add(new QuickTipStepProtocollEntry(step.StepData.QuickTipElementDefinition, wasSuccessfull));
ProtocollEntryBase protocollEntry = QuickTipStepProtocollEntryOutput.GetQuickTipStepProtocollEntry(step.StepData.QuickTipElementDefinition, wasSuccessfull);
F4SDProtocoll.Instance.Add(protocollEntry);
}
catch (Exception ex)
{

View File

@@ -173,7 +173,7 @@ namespace FasdDesktopUi.Basics.UserControls
}
SearchTextBox.Text = search;
await ChangedSearchValue.Invoke(_result);
await ChangedSearchValue?.Invoke(_result);
}

File diff suppressed because it is too large Load Diff

View File

@@ -1911,7 +1911,7 @@ namespace FasdDesktopUi.Basics.UserControls
ResponsibleRole = selectedRole,
ResponsiblePerson = selectedPerson,
Comment = comment,
QuickActionHistory = TransferQuickActionHistoryCheck.IsChecked ?? false ? F4SDProtocoll.Instance.GetOfType<QuickActionProtocollEntry>().Select(e => e.GetResult()).ToList() : null,
SupportCaseProtocollEntries = TransferQuickActionHistoryCheck.IsChecked ?? false ? F4SDProtocoll.Instance.GetAll().ToList() : null,
workTimes = workingTimes,
StatusIdValue = statusIdValue,
CaseId = DataProvider.CaseId

View File

@@ -10,6 +10,7 @@ using System.Windows.Threading;
using C4IT.FASD.Cockpit.Communication;
using FasdDesktopUi.Basics.Models;
using FasdDesktopUi.Basics.Services;
using FasdDesktopUi.Basics.Services.Models;
using FasdDesktopUi.Pages.SearchPage;
namespace FasdDesktopUi.Basics.UserControls
@@ -217,12 +218,48 @@ namespace FasdDesktopUi.Basics.UserControls
private async Task RefreshCountsAsync(bool useRoleTickets)
{
var communication = cFasdCockpitCommunicationBase.Instance;
Dictionary<string, int> counts = null;
var service = TicketOverviewUpdateService.Instance;
var counts = CategorySetters.ToDictionary(item => item.Key, _ => 0);
if (communication != null)
if (service != null)
{
try
{
var scope = useRoleTickets ? TileScope.Role : TileScope.Personal;
await service.FetchAsync(scope).ConfigureAwait(false);
counts = service.GetCountsForScope(useRoleTickets);
}
catch (Exception ex)
{
Debug.WriteLine($"[TicketOverview] Service refresh failed: {ex}");
counts = null;
}
}
if (counts == null || counts.Count == 0)
counts = await LoadCountsFallbackAsync(useRoleTickets).ConfigureAwait(false);
await Dispatcher.InvokeAsync(() =>
{
foreach (var (key, setter) in CategorySetters)
{
counts.TryGetValue(key, out var value);
setter(_viewModel, value);
}
_viewModel.ResetSelection();
SearchPageView.Instance?.CloseTicketOverviewResults();
UpdateHighlightState(useRoleTickets);
}, DispatcherPriority.Background);
}
private async Task<Dictionary<string, int>> LoadCountsFallbackAsync(bool useRoleTickets)
{
var counts = CategorySetters.ToDictionary(item => item.Key, _ => 0);
var communication = cFasdCockpitCommunicationBase.Instance;
if (communication == null)
return counts;
var tasks = CategorySetters.ToDictionary(
item => item.Key,
item => communication.GetTicketOverviewRelations(item.Key, useRoleTickets, 0));
@@ -236,23 +273,12 @@ namespace FasdDesktopUi.Basics.UserControls
}
catch (Exception ex)
{
Debug.WriteLine($"[TicketOverview] Failed to load count for '{kvp.Key}': {ex}");
Debug.WriteLine($"[TicketOverview] Fallback load failed for '{kvp.Key}': {ex}");
counts[kvp.Key] = 0;
}
}
}
await Dispatcher.InvokeAsync(() =>
{
foreach (var (key, setter) in CategorySetters)
{
setter(_viewModel, counts[key]);
}
_viewModel.ResetSelection();
SearchPageView.Instance?.CloseTicketOverviewResults();
UpdateHighlightState(useRoleTickets);
}, DispatcherPriority.Background);
return counts;
}
public void UpdateCounts(IDictionary<string, int> counts, bool useRoleTickets)
@@ -272,6 +298,16 @@ namespace FasdDesktopUi.Basics.UserControls
}, DispatcherPriority.Background);
}
public void ClearHighlightsForScope(TileScope scope)
{
var highlightStates = scope == TileScope.Role ? _roleHighlightStates : _personalHighlightStates;
if (highlightStates.Count == 0)
return;
highlightStates.Clear();
UpdateHighlightState(scope == TileScope.Role);
}
public void SetHighlights(IEnumerable<TileCountChange> changes, bool useRoleTickets)
{
if (changes != null)

View File

@@ -26,55 +26,6 @@ namespace FasdDesktopUi.Basics
{
public static readonly IRawValueFormatter RawValueFormatter = new RawValueFormatter();
internal static RawValueType GetRawValueType(enumHealthCardDisplayTypes displayType)
{
switch (displayType)
{
case enumHealthCardDisplayTypes.STRING:
return RawValueType.STRING;
case enumHealthCardDisplayTypes.INTEGER:
return RawValueType.INTEGER;
case enumHealthCardDisplayTypes.PERCENT:
return RawValueType.PERCENT;
case enumHealthCardDisplayTypes.PERCENT100:
return RawValueType.PERCENT100;
case enumHealthCardDisplayTypes.PERCENT1000:
return RawValueType.PERCENT1000;
case enumHealthCardDisplayTypes.TIME:
return RawValueType.TIME;
case enumHealthCardDisplayTypes.DATE:
return RawValueType.DATE;
case enumHealthCardDisplayTypes.DATE_CALC:
return RawValueType.DATE_CALC;
case enumHealthCardDisplayTypes.DATETIME:
return RawValueType.DATETIME;
case enumHealthCardDisplayTypes.DURATION_DAY:
return RawValueType.DURATION_DAY;
case enumHealthCardDisplayTypes.DURATION_HOUR:
return RawValueType.DURATION_HOUR;
case enumHealthCardDisplayTypes.DURATION_MINUTE:
return RawValueType.DURATION_MINUTE;
case enumHealthCardDisplayTypes.DURATION_SECOND:
return RawValueType.DURATION_SECOND;
case enumHealthCardDisplayTypes.DURATION_MILLI:
return RawValueType.DURATION_MILLI;
case enumHealthCardDisplayTypes.DURATION_MICRO:
return RawValueType.DURATION_MICRO;
case enumHealthCardDisplayTypes.DURATION_DAY_SINCE_NOW:
return RawValueType.DURATION_DAY_SINCE_NOW;
case enumHealthCardDisplayTypes.BITS_PERSECOND:
return RawValueType.BITS_PERSECOND;
case enumHealthCardDisplayTypes.BYTES:
return RawValueType.BYTES;
case enumHealthCardDisplayTypes.HERTZ:
return RawValueType.HERTZ;
case enumHealthCardDisplayTypes.MEGA_HERTZ:
return RawValueType.MEGA_HERTZ;
default:
return RawValueType.STRING;
}
}
public static int SmoothedInt(int oldValue, int newValue)
{
if (oldValue < newValue)
@@ -410,24 +361,25 @@ namespace FasdDesktopUi.Basics
{
try
{
FormattingOptions options = new FormattingOptions() { ReferenceDate = DateTime.UtcNow.AddDays(_v.ReferenceDays) };
FormattingOptions options = new FormattingOptions() { ReferenceDate = DateTime.UtcNow.AddDays(_v.ReferenceDays), TimeZone = TimeZoneInfo.Local };
RawValueFormatter.SetDefaultCulture(new System.Globalization.CultureInfo(cFasdCockpitConfig.Instance.SelectedLanguage));
var _strVal = RawValueFormatter.GetDisplayValue(_v.Value, GetRawValueType(_v.StateDefinition.DisplayType), options);
RawValueFormatter.SetDefaultTimeZone(TimeZoneInfo.Local);
var _strVal = RawValueFormatter.GetDisplayValue(_v.Value, _v.StateDefinition.DisplayType, options);
_t.rawValue.Text = _strVal;
if (_v.StateDefinition is cHealthCardStateLevel _sl)
{
_strVal = RawValueFormatter.GetDisplayValue(_sl.Warning, GetRawValueType(_v.StateDefinition.DisplayType), options);
_strVal = RawValueFormatter.GetDisplayValue(_sl.Warning, _v.StateDefinition.DisplayType, options);
_t.tresholdWarning.Text = _strVal;
_strVal = RawValueFormatter.GetDisplayValue(_sl.Error, GetRawValueType(_v.StateDefinition.DisplayType), options);
_strVal = RawValueFormatter.GetDisplayValue(_sl.Error, _v.StateDefinition.DisplayType, options);
_t.tresholdError.Text = _strVal;
}
else if (_v.StateDefinition is cHealthCardStateVersion _sv)
{
_strVal = RawValueFormatter.GetDisplayValue(_sv.Warning, GetRawValueType(_v.StateDefinition.DisplayType), options);
_strVal = RawValueFormatter.GetDisplayValue(_sv.Warning, _v.StateDefinition.DisplayType, options);
_t.tresholdWarning.Text = _strVal;
_strVal = RawValueFormatter.GetDisplayValue(_sv.Error, GetRawValueType(_v.StateDefinition.DisplayType), options);
_strVal = RawValueFormatter.GetDisplayValue(_sv.Error, _v.StateDefinition.DisplayType, options);
_t.tresholdError.Text = _strVal;
}
else if (_v.StateDefinition is cHealthCardStateDateTime _sd)

View File

@@ -71,6 +71,11 @@
<Language Lang="DE">Als angedocktes Fenster anzeigen</Language>
</UIItem>
<UIItem Name="Global.NavBar.ShowRawValues">
<Language Lang="EN">Show raw values of healthcard</Language>
<Language Lang="DE">Rohwerte der Healthcard anzeigen</Language>
</UIItem>
<UIItem Name="Global.Time.Suffix">
<Language Lang="EN"></Language>
<Language Lang="DE"> Uhr</Language>
@@ -96,6 +101,34 @@
<Language Lang="DE">Nicht erneut anzeigen</Language>
</UIItem>
<UIItem Name="Global.Enumeration.DataHistoryOrigin.Unknown">
<Language Lang="EN">All</Language>
<Language Lang="DE">Alle</Language>
</UIItem>
<UIItem Name="Global.Enumeration.DataHistoryOrigin.Main">
<Language Lang="EN">Main Information</Language>
</UIItem>
<UIItem Name="Global.Enumeration.DataHistoryOrigin.F4sdAgent">
<Language Lang="EN">F4SD Agent</Language>
</UIItem>
<UIItem Name="Global.Enumeration.DataHistoryOrigin.NexthinkNxql">
<Language Lang="EN">Nexthink NXQL</Language>
</UIItem>
<UIItem Name="Global.Enumeration.DataHistoryOrigin.ActiveDirectory">
<Language Lang="EN">Active Directory</Language>
</UIItem>
<UIItem Name="Global.Enumeration.DataHistoryOrigin.AzureAD">
<Language Lang="EN">Azure AD</Language>
</UIItem>
<UIItem Name="Global.Enumeration.DataHistoryOrigin.M42Wpm">
<Language Lang="EN">Matrix42 WPM</Language>
</UIItem>
<UIItem Name="Global.Enumeration.DataHistoryOrigin.Intune">
<Language Lang="EN">MS Intune</Language>
</UIItem>
<UIItem Name="Global.Enumeration.DataHistoryOrigin.Citrix">
<Language Lang="EN">Citrix</Language>
</UIItem>
<UIItem Name="App.Startup.SecurityInitFailed.Text">
<Language Lang="EN">The RSA encryption could not be initialised correctly. The cockpit will be closed.</Language>

View File

@@ -91,32 +91,58 @@
<ErrorReport>prompt</ErrorReport>
</PropertyGroup>
<ItemGroup>
<Reference Include="C4IT.F4SD.DisplayFormatting, Version=0.0.1.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\C4IT.F4SD.DisplayFormatting.0.0.1-preview-0.0.2\lib\netstandard2.0\C4IT.F4SD.DisplayFormatting.dll</HintPath>
<Reference Include="C4IT.F4SD.DisplayFormatting, Version=1.0.9509.21303, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\C4IT.F4SD.DisplayFormatting.1.0.0\lib\netstandard2.0\C4IT.F4SD.DisplayFormatting.dll</HintPath>
</Reference>
<Reference Include="C4IT.F4SD.SupportCaseProtocoll, Version=1.0.9516.21165, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\C4IT.F4SD.SupportCaseProtocoll.1.0.0\lib\netstandard2.0\C4IT.F4SD.SupportCaseProtocoll.dll</HintPath>
</Reference>
<Reference Include="MaterialIcons, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\MaterialIcons.1.0.3\lib\MaterialIcons.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Extensions.Logging.Abstractions, Version=3.1.32.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Extensions.Logging.Abstractions.3.1.32\lib\netstandard2.0\Microsoft.Extensions.Logging.Abstractions.dll</HintPath>
<Reference Include="Microsoft.Bcl.AsyncInterfaces, Version=10.0.0.2, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Bcl.AsyncInterfaces.10.0.2\lib\net462\Microsoft.Bcl.AsyncInterfaces.dll</HintPath>
</Reference>
<Reference Include="Microsoft.VisualStudio.Shell.Framework, Version=17.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />
<Reference Include="Microsoft.Web.WebView2.Core, Version=1.0.3240.44, Culture=neutral, PublicKeyToken=2a8ab48044d2601e, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Web.WebView2.1.0.3240.44\lib\net462\Microsoft.Web.WebView2.Core.dll</HintPath>
<Reference Include="Microsoft.Extensions.DependencyInjection.Abstractions, Version=10.0.0.2, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Extensions.DependencyInjection.Abstractions.10.0.2\lib\net462\Microsoft.Extensions.DependencyInjection.Abstractions.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Web.WebView2.WinForms, Version=1.0.3240.44, Culture=neutral, PublicKeyToken=2a8ab48044d2601e, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Web.WebView2.1.0.3240.44\lib\net462\Microsoft.Web.WebView2.WinForms.dll</HintPath>
<Reference Include="Microsoft.Extensions.Logging.Abstractions, Version=10.0.0.2, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Extensions.Logging.Abstractions.10.0.2\lib\net462\Microsoft.Extensions.Logging.Abstractions.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Web.WebView2.Wpf, Version=1.0.3240.44, Culture=neutral, PublicKeyToken=2a8ab48044d2601e, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Web.WebView2.1.0.3240.44\lib\net462\Microsoft.Web.WebView2.Wpf.dll</HintPath>
<Reference Include="Microsoft.Web.WebView2.Core, Version=1.0.3650.58, Culture=neutral, PublicKeyToken=2a8ab48044d2601e, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Web.WebView2.1.0.3650.58\lib\net462\Microsoft.Web.WebView2.Core.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Web.WebView2.WinForms, Version=1.0.3650.58, Culture=neutral, PublicKeyToken=2a8ab48044d2601e, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Web.WebView2.1.0.3650.58\lib\net462\Microsoft.Web.WebView2.WinForms.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Web.WebView2.Wpf, Version=1.0.3650.58, Culture=neutral, PublicKeyToken=2a8ab48044d2601e, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Web.WebView2.1.0.3650.58\lib\net462\Microsoft.Web.WebView2.Wpf.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.13.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
<HintPath>..\packages\Newtonsoft.Json.13.0.4\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Buffers, Version=4.0.5.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Buffers.4.6.1\lib\net462\System.Buffers.dll</HintPath>
</Reference>
<Reference Include="System.Data" />
<Reference Include="System.Diagnostics.DiagnosticSource, Version=10.0.0.2, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Diagnostics.DiagnosticSource.10.0.2\lib\net462\System.Diagnostics.DiagnosticSource.dll</HintPath>
</Reference>
<Reference Include="System.Drawing" />
<Reference Include="System.Memory, Version=4.0.5.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Memory.4.6.3\lib\net462\System.Memory.dll</HintPath>
</Reference>
<Reference Include="System.Numerics" />
<Reference Include="System.Numerics.Vectors, Version=4.1.6.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Numerics.Vectors.4.6.1\lib\net462\System.Numerics.Vectors.dll</HintPath>
</Reference>
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=6.0.3.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.6.1.2\lib\net462\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
</Reference>
<Reference Include="System.Threading.Tasks.Extensions, Version=4.2.4.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Threading.Tasks.Extensions.4.6.3\lib\net462\System.Threading.Tasks.Extensions.dll</HintPath>
</Reference>
<Reference Include="System.Web" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
@@ -151,6 +177,9 @@
</Compile>
<Compile Include="AppStartUp.cs" />
<Compile Include="Basics\Browser.cs" />
<Compile Include="Basics\CustomEvents\HeadingDataEventArgs.cs" />
<Compile Include="Basics\Services\SupportCase\Controllers\SupportCaseController.cs" />
<Compile Include="Basics\Services\SupportCase\Controllers\SupportCaseHeadingController.cs" />
<Compile Include="Basics\ExternalToolExecutorEnh.cs" />
<Compile Include="Basics\Converter\BoolOrToVisibilityConverter.cs" />
<Compile Include="Basics\Converter\DataCanvasIsCloseButtonVisibileConverter.cs" />
@@ -173,18 +202,19 @@
<Compile Include="Basics\Models\TicketOverviewSelectionRequestedEventArgs.cs" />
<Compile Include="Basics\SearchHistoryManager.cs" />
<Compile Include="Basics\Services\ProtocollService\F4SDProtocoll.cs" />
<Compile Include="Basics\Services\ProtocollService\IProtocollEntry.cs" />
<Compile Include="Basics\Services\ProtocollService\QuickActionProtocollEntry.cs" />
<Compile Include="Basics\Services\ProtocollService\QuickTipStepProtocollEntry.cs" />
<Compile Include="Basics\Services\ProtocollService\TextualProtocollEntry.cs" />
<Compile Include="Basics\Services\RelationService\IRelationService.cs" />
<Compile Include="Basics\Services\RelationService\RelationService.cs" />
<Compile Include="Basics\Services\RelationService\RelationEventArgs.cs" />
<Compile Include="Basics\CustomEvents\RelationEventArgs.cs" />
<Compile Include="Basics\Services\RelationService\StagedSearchResultRelationsEventArgs.cs" />
<Compile Include="Basics\Services\SupportCaseSearchService\SupportCaseSearchService.cs" />
<Compile Include="Basics\Services\SupportCase\ISupportCase.cs" />
<Compile Include="Basics\Services\SupportCase\SupportCase.cs" />
<Compile Include="Basics\CustomEvents\SupportCaseDataEventArgs.cs" />
<Compile Include="Basics\Services\SupportCase\SupportCaseFactory.cs" />
<Compile Include="Basics\Services\SupportCase\SupportCaseProcessor.cs" />
<Compile Include="Basics\Services\SupportCase\SupportCaseProcessorFactory.cs" />
<Compile Include="Basics\SupportCaseDataProvider.cs" />
<Compile Include="Basics\Enums\enumActionDisplayType.cs" />
<Compile Include="Basics\Helper\DirectConnectionHelper.cs" />
@@ -234,13 +264,18 @@
<Compile Include="Basics\UiActions\UiQuickTipAction.cs" />
<Compile Include="Basics\UiActions\UiRemoteQuickAction.cs" />
<Compile Include="Basics\UiActions\UiServerQuickAction.cs" />
<Compile Include="Basics\UiActions\UiShowRawHealthcardValues.cs" />
<Compile Include="Basics\UiActions\UiSystemDefaultQuickAction.cs" />
<Compile Include="Basics\UserControls\Badge.xaml.cs">
<DependentUpon>Badge.xaml</DependentUpon>
</Compile>
<Compile Include="Basics\UserControls\BlurInvokerContainer.xaml.cs">
<DependentUpon>BlurInvokerContainer.xaml</DependentUpon>
</Compile>
<Compile Include="Basics\UserControls\ComboBoxPageAble.xaml.cs">
<DependentUpon>ComboBoxPageAble.xaml</DependentUpon>
</Compile>
<Compile Include="Basics\UserControls\HierarchicalSelectionControl.xaml.cs">
<DependentUpon>HierarchicalSelectionControl.xaml</DependentUpon>
</Compile>
@@ -340,6 +375,12 @@
<DependentUpon>CustomMessageBox.xaml</DependentUpon>
</Compile>
<Compile Include="Pages\CustomPopupBase.cs" />
<Compile Include="Pages\RawHealthCardValuesPage\RawHealthCardValuesPage.xaml.cs">
<DependentUpon>RawHealthCardValuesPage.xaml</DependentUpon>
</Compile>
<Compile Include="Pages\SearchPage\SearchPageView.xaml.cs">
<DependentUpon>SearchPageView.xaml</DependentUpon>
</Compile>
<Compile Include="Pages\SplashScreenView\IntroView.xaml.cs">
<DependentUpon>IntroView.xaml</DependentUpon>
</Compile>
@@ -398,9 +439,6 @@
<Compile Include="Pages\SettingsPage\PhoneSettingsPage.xaml.cs">
<DependentUpon>PhoneSettingsPage.xaml</DependentUpon>
</Compile>
<Compile Include="Pages\SearchPage\SearchPageView.xaml.cs">
<DependentUpon>SearchPageView.xaml</DependentUpon>
</Compile>
<Compile Include="Pages\SettingsPage\M42SettingsPageView.xaml.cs">
<DependentUpon>M42SettingsPageView.xaml</DependentUpon>
</Compile>
@@ -443,6 +481,10 @@
<Compile Include="Pages\SlimPage\UserControls\SlimPageWidgetCollection.xaml.cs">
<DependentUpon>SlimPageWidgetCollection.xaml</DependentUpon>
</Compile>
<Page Include="Basics\UserControls\Badge.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Basics\UserControls\BlurInvokerContainer.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
@@ -701,13 +743,17 @@
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Pages\SettingsPage\PhoneSettingsPage.xaml">
<Page Include="Pages\RawHealthCardValuesPage\RawHealthCardValuesPage.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Pages\SearchPage\SearchPageView.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Pages\SearchPage\SearchPageView.xaml">
<SubType>Designer</SubType>
<Page Include="Pages\SettingsPage\PhoneSettingsPage.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Pages\SettingsPage\M42SettingsPageView.xaml">
<SubType>Designer</SubType>
@@ -854,15 +900,6 @@
<Compile Include="Properties\AssemblyInfo.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
<EmbeddedResource Include="..\..\C4IT FASD\_Common\XmlSchemas\LanguageDefinitions.xsd">
<Link>Config\LanguageDefinitions.xsd</Link>
<SubType>Designer</SubType>
@@ -993,6 +1030,7 @@
<ItemGroup>
<WCFMetadata Include="Connected Services\" />
</ItemGroup>
<ItemGroup />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PostBuildEvent>if $(ConfigurationName) == BuildToTeams powershell.exe -ExecutionPolicy remotesigned -file "$(SolutionDir)BuildToTeams.ps1" -DirectoryToZip "$(SolutionDir)\FasdDesktopUi\bin\Release"</PostBuildEvent>
@@ -1008,11 +1046,11 @@ taskkill -im "F4SD-Cockpit-Client.exe" -f -FI "STATUS eq RUNNING"
<PropertyGroup>
<PreBuildEvent>copy "$(ProjectDir)..\..\C4IT FASD\_Common\XmlSchemas\LanguageDefinitions.xsd" "$(ProjectDir)Config"</PreBuildEvent>
</PropertyGroup>
<Import Project="..\packages\Microsoft.Web.WebView2.1.0.3240.44\build\Microsoft.Web.WebView2.targets" Condition="Exists('..\packages\Microsoft.Web.WebView2.1.0.3240.44\build\Microsoft.Web.WebView2.targets')" />
<Import Project="..\packages\Microsoft.Web.WebView2.1.0.3650.58\build\Microsoft.Web.WebView2.targets" Condition="Exists('..\packages\Microsoft.Web.WebView2.1.0.3650.58\build\Microsoft.Web.WebView2.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\Microsoft.Web.WebView2.1.0.3240.44\build\Microsoft.Web.WebView2.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.Web.WebView2.1.0.3240.44\build\Microsoft.Web.WebView2.targets'))" />
<Error Condition="!Exists('..\packages\Microsoft.Web.WebView2.1.0.3650.58\build\Microsoft.Web.WebView2.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.Web.WebView2.1.0.3650.58\build\Microsoft.Web.WebView2.targets'))" />
</Target>
</Project>

View File

@@ -90,12 +90,11 @@
<Border x:Name="DialogCloseElement"
x:FieldModifier="private"
DockPanel.Dock="Bottom"
Width="{Binding ElementName=WindowStateBarUserControl, Path=ActualWidth}"
HorizontalAlignment="Right"
Cursor="Hand"
CornerRadius="5"
Margin="0 2.5 7.5 -30"
Padding="0 2.5"
Padding="10 2.5"
Background="{DynamicResource BackgroundColor.DetailsPage.Widget.Value}"
MouseLeftButtonUp="CloseCaseWithTicketIcon_MouseLeftButtonUp"
TouchDown="CloseCaseWithTicketIcon_TouchDown">
@@ -220,8 +219,7 @@
<uc:DetailsPageWidgetCollection x:Name="WidgetCollection"
Grid.Row="1"
Margin="0 35 0 10"
WidgetGeometryList="{Binding WidgetGeometryList}"
WidgetDataList="{Binding WidgetDataList}" />
WidgetGeometryList="{Binding WidgetGeometryList}" />
<uc:DetailsPageRefreshControl x:Name="RefreshControl"
Grid.Row="2"

View File

@@ -31,8 +31,7 @@ using static C4IT.Logging.cLogManager;
using F4SD_AdaptableIcon.Enums;
using FasdDesktopUi.Basics.CustomEvents;
using FasdDesktopUi.Basics.Converter;
using FasdDesktopUi.Basics.Services.SupportCase;
using FasdDesktopUi.Basics.Services.RelationService;
using FasdDesktopUi.Basics.Services.SupportCase.Controllers;
namespace FasdDesktopUi.Pages.DetailsPage
{
@@ -54,7 +53,9 @@ namespace FasdDesktopUi.Pages.DetailsPage
private bool isQuickActionDecoratorVisible = false;
private bool isNotepadDecoratorVisible = false;
private DispatcherTimer midnightTimer = new DispatcherTimer();
private readonly DispatcherTimer _midnightTimer = new DispatcherTimer();
private double _lastDesiredHeightOfWidgetCollection = 0; // to avoid resizing the main grid on every data changed event
#region Notepad
@@ -131,9 +132,9 @@ namespace FasdDesktopUi.Pages.DetailsPage
try
{
InitializeComponent();
midnightTimer.Interval = TimeSpan.FromSeconds(1);
midnightTimer.Tick += MidnightTimer_Tick;
midnightTimer.Start();
_midnightTimer.Interval = TimeSpan.FromSeconds(1);
_midnightTimer.Tick += MidnightTimer_Tick;
_midnightTimer.Start();
SupportNotepad = true;
var _screen = System.Windows.Forms.Screen.PrimaryScreen;
@@ -159,44 +160,150 @@ namespace FasdDesktopUi.Pages.DetailsPage
BlurInvoker.BlurInvokerVisibilityChanged -= (obj, e) => UpdateBlurStatus(obj);
}
public override void SetSupportCase(ISupportCase supportCase)
internal override void SetSupportCaseController(SupportCaseController supportCaseController)
{
if (_supportCase != null)
_supportCase.CaseRelationsAdded -= HandleCaseRelationsAdded;
if (_supportCaseController != null)
UnsubscribeEventsOf(_supportCaseController);
supportCase.CaseRelationsAdded += HandleCaseRelationsAdded;
base.SetSupportCase(supportCase);
ResetPageToDefaultState();
SubscribeEventsOf(supportCaseController);
base.SetSupportCaseController(supportCaseController);
NavigationHeadingUc.SupportCaseController = supportCaseController;
IsBlurred = true;
RefreshControl.DataProvider = supportCase.SupportCaseDataProviderArtifact;
NavigationHeadingUc.DataProvider = supportCase.SupportCaseDataProviderArtifact;
RefreshControl.DataProvider = supportCaseController.SupportCaseDataProviderArtifact;
NavigationHeadingUc.DataProvider = supportCaseController.SupportCaseDataProviderArtifact;
cSupportCaseDataProvider.CaseChanged += DataProvider_CaseChanged;
RefreshControl.IsDataIncomplete = true;
RefreshControl.LoadingDataIndicatorUc.LoadingText = cMultiLanguageSupport.GetItem("DetailsPage.Loading");
CustomizableSectionUc.IsDataIncomplete = true;
supportCase.SupportCaseDataProviderArtifact.NotepadDocumentUpdated += ResetNotepadNotification;
supportCaseController.SupportCaseDataProviderArtifact.NotepadDocumentUpdated += ResetNotepadNotification;
void SubscribeEventsOf(SupportCaseController controller)
{
controller.AvailableCaseRelationsAdded += HandleAvailableRelationsAdded;
controller.FocusedRelationsChanged += HandleFocusedRelationsChanged;
controller.CaseDataChanged += HandleCaseDataChanged;
controller.HeadingDataChanged += HandleHeadingDataChanged;
}
private async void HandleCaseRelationsAdded(object sender, RelationEventArgs e)
void UnsubscribeEventsOf(SupportCaseController controller)
{
await Dispatcher.Invoke(async () =>
controller.AvailableCaseRelationsAdded -= HandleAvailableRelationsAdded;
controller.FocusedRelationsChanged -= HandleFocusedRelationsChanged;
controller.CaseDataChanged -= HandleCaseDataChanged;
controller.HeadingDataChanged -= HandleHeadingDataChanged;
}
}
private void HandleAvailableRelationsAdded(object sender, RelationEventArgs e)
{
NavigationHeadingUc.HeadingData = _supportCase?.SupportCaseDataProviderArtifact.HealthCardDataHelper.GetHeadingDataWithoutOnlineStatus();
NavigationHeadingUc.HeadingData = await _supportCase?.SupportCaseDataProviderArtifact.HealthCardDataHelper.UpdateOnlineStatusAsync();
}
private void HandleFocusedRelationsChanged(object sender, RelationEventArgs e)
{
IsBlurred = false;
_supportCaseController.SupportCaseDataProviderArtifact.Identities = e.Relations.FirstOrDefault()?.FirstOrDefault()?.Identities; // todo remove when ShowDetailedDataAction is not dependent on Artifact anymore
Dispatcher.Invoke(() =>
{
ResetPageToDefaultState();
UpdateHealthcardSectionVisibilities();
HandleCaseDataChanged(null, null);
});
}
private void HandleHeadingDataChanged(object sender, HeadingDataEventArgs e)
{
Dispatcher.Invoke(() => NavigationHeadingUc.HeadingData = e.NewValue.ToList());
}
// todo update NavigationHeadingUc_HeadingIconClickedEvent as soon as EventArgs are taken into account
private void HandleCaseDataChanged(object sender, SupportCaseDataEventArgs e)
{
try
{
if (isDataChangedEventRunning)
{
shouldReRunDataChangedEvent = true;
return;
}
isDataChangedEventRunning = true;
Dispatcher.Invoke(() =>
{
if (QuickActionDecorator.Child is DataCanvas dataCanvas)
Dispatcher.Invoke(async () => await dataCanvas.UpdateDataAsync());
if (WidgetCollection.WidgetDataList is null || WidgetCollection.WidgetDataList.Count == 0)
WidgetCollection.WidgetDataList = _supportCaseController?.GetWidgetData();
WidgetCollection.UpdateWidgetData(_supportCaseController?.GetWidgetData());
if (DataHistoryCollectionUserControl.HistoryDataList is null || DataHistoryCollectionUserControl.HistoryDataList.Count == 0)
DataHistoryCollectionUserControl.HistoryDataList = _supportCaseController?.GetHistoryData();
DataHistoryCollectionUserControl.UpdateHistory(_supportCaseController?.GetHistoryData());
if (CustomizableSectionUc.ContainerCollections is null || CustomizableSectionUc.ContainerCollections.Count == 0)
CustomizableSectionUc.ContainerCollections = _supportCaseController?.GetContainerData();
CustomizableSectionUc.UpdateContainerCollection(_supportCaseController?.GetContainerData());
if (this.DataContext is DetailsPageViewModel viewModel)
viewModel.MenuBarData = _supportCaseController?.GetMenuBarData();
if (_lastDesiredHeightOfWidgetCollection != WidgetCollection.DesiredSize.Height)
{
_lastDesiredHeightOfWidgetCollection = WidgetCollection.DesiredSize.Height;
MainGrid.InvalidateMeasure();
MainGrid.UpdateLayout();
}
});
if (shouldReRunDataChangedEvent)
HandleCaseDataChanged(sender, e);
}
finally
{
isDataChangedEventRunning = false;
shouldReRunDataChangedEvent = false;
}
}
/// <summary>
/// Sets the visibility of History and Customizable Section based on the currently selected Healthcard.
/// </summary>
internal void UpdateHealthcardSectionVisibilities()
{
try
{
cHealthCard selectedHealthcard = _supportCaseController.SupportCaseDataProviderArtifact.HealthCardDataHelper.SelectedHealthCard;
bool showHistorySection = selectedHealthcard.CategoriesHistory?.StateCategories != null && selectedHealthcard.CategoriesHistory.StateCategories.Count > 0;
Dispatcher.Invoke(() =>
{
DataHistoryCollectionUserControl.Visibility = showHistorySection ? Visibility.Visible : Visibility.Collapsed;
CustomizableSectionUc.Visibility = showHistorySection ? Visibility.Collapsed : Visibility.Visible;
});
}
catch (Exception ex)
{
LogException(ex);
}
}
private void ReinitializeNotepad()
{
if (SupportNotepad == true)
{
notepad = new Notepad(_supportCase?.SupportCaseDataProviderArtifact);
notepad = new Notepad(_supportCaseController?.SupportCaseDataProviderArtifact);
ChangeNotepadNotification();
NotepadDecorator.Child = notepad;
NotepadDecorator.Visibility = Visibility.Collapsed;
@@ -318,6 +425,8 @@ namespace FasdDesktopUi.Pages.DetailsPage
private void BlurBorder_Click()
{
try
{
Dispatcher.Invoke(() =>
{
Panel.SetZIndex(NavigationHeadingUc, 1);
NavigationHeadingUc.ResetSelectors();
@@ -344,6 +453,7 @@ namespace FasdDesktopUi.Pages.DetailsPage
}
IsBlurred = BlurInvokers?.Count > 0;
});
}
catch (Exception E)
{
@@ -450,21 +560,8 @@ namespace FasdDesktopUi.Pages.DetailsPage
{
try
{
Dispatcher.Invoke(() =>
{
NavigationHeadingUc.IsHitTestVisible = false;
NavigationHeadingUc.Opacity = 0.7;
});
RefreshControl.IsDataIncomplete = true;
List<Task> tasks = new List<Task>
{
_supportCase?.SupportCaseDataProviderArtifact?.HealthCardDataHelper?.UpdateOnlineStatusAsync(),
_supportCase?.SupportCaseDataProviderArtifact?.HealthCardDataHelper?.LoadingHelper?.RefreshLatestDataAsync()
};
await Task.WhenAll(tasks);
await _supportCaseController.RefreshDataForCurrentlyFocusedRelationAsync();
RefreshControl.UpdateLastDataRequestTime();
RefreshControl.IsDataIncomplete = false;
}
@@ -495,6 +592,7 @@ namespace FasdDesktopUi.Pages.DetailsPage
{
case cChangeHealthCardAction _:
case cShowHeadingSelectionMenuAction _:
case UiShowRawHealthcardValues _:
break;
case cUiQuickAction _:
case cShowRecommendationAction _:
@@ -515,7 +613,7 @@ namespace FasdDesktopUi.Pages.DetailsPage
break;
}
await e.UiAction.RunUiActionAsync(e.OriginalSource, drawingArea, true, _supportCase?.SupportCaseDataProviderArtifact);
await e.UiAction.RunUiActionAsync(e.OriginalSource, drawingArea, true, _supportCaseController?.SupportCaseDataProviderArtifact);
UpdateHistoryWidth();
}
catch (Exception E)
@@ -545,21 +643,13 @@ namespace FasdDesktopUi.Pages.DetailsPage
{
try
{
if (isDataProviderLoading)
return;
if (!(sender is FrameworkElement senderElement))
return;
if (!(senderElement.Tag is enumFasdInformationClass informationClassTag))
if (!(senderElement.Tag is cF4sdApiSearchResultRelation selectedRelation))
return;
if (_supportCase?.SupportCaseDataProviderArtifact is null || !_supportCase.SupportCaseDataProviderArtifact.Identities.Any(identity => identity.Class == informationClassTag))
return;
Mouse.OverrideCursor = Cursors.Wait;
await _supportCase?.SupportCaseDataProviderArtifact.ChangeHealthCardAsync(informationClassTag);
_supportCaseController.UpdateFocusedCaseRelation(selectedRelation);
}
catch (Exception E)
{
@@ -654,7 +744,7 @@ namespace FasdDesktopUi.Pages.DetailsPage
private void F4SDIcon_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
{
CustomMessageBox.CustomMessageBox.Show("1. Have you tried turning it off and on again?\n2. Are you sure it is plugged in?", "How to solve (almost) any computer problem", enumHealthCardStateLevel.Info, this);
_supportCase.SupportCaseDataProviderArtifact.HealthCardDataHelper.IsInEditMode = true;
_supportCaseController.SupportCaseDataProviderArtifact.HealthCardDataHelper.IsInEditMode = true;
}
#region CloseCaseWithTicketIcon_Click
@@ -701,18 +791,15 @@ namespace FasdDesktopUi.Pages.DetailsPage
{
try
{
if (!(e.NewValue is bool isVisible))
if (!(e.NewValue is bool isVisible && isVisible))
return;
if (isVisible)
{
Show();
Activate();
Focus();
if (IsWindowLoaded)
WindowState = WindowState.Maximized;
}
}
catch (Exception E)
{
LogException(E);
@@ -936,7 +1023,7 @@ namespace FasdDesktopUi.Pages.DetailsPage
LogMethodBegin(CM);
try
{
LogEntry($"DataChanged - DataProvider for Class: {_supportCase?.SupportCaseDataProviderArtifact.Identities[0].Class} - Id: {_supportCase?.SupportCaseDataProviderArtifact.Identities[0].Id}");
LogEntry($"DataChanged - DataProvider for Class: {_supportCaseController?.SupportCaseDataProviderArtifact.Identities[0].Class} - Id: {_supportCaseController?.SupportCaseDataProviderArtifact.Identities[0].Id}");
if (isDataChangedEventRunning)
{
@@ -949,21 +1036,6 @@ namespace FasdDesktopUi.Pages.DetailsPage
if (!(e is BooleanEventArgs booleanArg) || booleanArg.BooleanArg == false)
isDataProviderLoading = true;
var data = _supportCase?.SupportCaseDataProviderArtifact.HealthCardDataHelper.DetailPage.GetDataWithoutHeading();
await Dispatcher.Invoke(async () =>
{
NavigationHeadingUc.HeadingData = _supportCase?.SupportCaseDataProviderArtifact.HealthCardDataHelper.GetHeadingDataWithoutOnlineStatus();
NavigationHeadingUc.HeadingData = await _supportCase?.SupportCaseDataProviderArtifact.HealthCardDataHelper.UpdateOnlineStatusAsync();
});
Dispatcher.Invoke(() => { WidgetCollection.UpdateWidgetData(data.WidgetData); });
Dispatcher.Invoke(() => DataHistoryCollectionUserControl.UpdateHistory(data.DataHistoryList));
Dispatcher.Invoke(() => CustomizableSectionUc.UpdateContainerCollection(data.DataContainerCollectionList));
Dispatcher.Invoke(() =>
{
if (DataContext is DetailsPageViewModel viewModel)
viewModel.SetPropertyValues(data);
});
Dispatcher.Invoke(UpdateHistoryWidth);
@@ -1023,7 +1095,7 @@ namespace FasdDesktopUi.Pages.DetailsPage
{
Dispatcher.Invoke(() =>
{
bool hasDirectConnection = _supportCase?.SupportCaseDataProviderArtifact?.DirectConnectionHelper?.IsDirectConnectionActive ?? false;
bool hasDirectConnection = _supportCaseController?.SupportCaseDataProviderArtifact?.DirectConnectionHelper?.IsDirectConnectionActive ?? false;
NavigationHeadingUc.HasDirectConnection = hasDirectConnection;
if (hasDirectConnection)
@@ -1295,7 +1367,7 @@ namespace FasdDesktopUi.Pages.DetailsPage
private void ChangeNotepadNotification()
{
FlowDocument document = _supportCase?.SupportCaseDataProviderArtifact.CaseNotes;
FlowDocument document = _supportCaseController?.SupportCaseDataProviderArtifact.CaseNotes;
bool isFlowDocumentEmpty = !document.Blocks.Any(block =>
{
if (block is Paragraph paragraph)
@@ -1358,22 +1430,16 @@ namespace FasdDesktopUi.Pages.DetailsPage
BlurBorder_Click();
MenuBarUserControl.Visibility = Visibility.Visible;
SearchBarUserControl.Visibility = Visibility.Collapsed;
QuickActionSelectorUc.QuickActionList = null;
QuickActionSelectorUc.Visibility = Visibility.Collapsed;
QuickActionDecorator.Child.Visibility = Visibility.Collapsed;
NotepadDecorator.Visibility = Visibility.Collapsed;
NotepadDecorator.Child = null;
notepad = null;
isQuickActionDecoratorVisible = false;
isQuickActionSelectorVisible = false;
if (IsLoaded)
ReinitializeNotepad();
DataHistoryCollectionUserControl.ToggleVerticalCollapseDetails(true);
UpdateHistoryWidth();
}
@@ -1383,64 +1449,6 @@ namespace FasdDesktopUi.Pages.DetailsPage
}
}
public void SetPropertyValues(cDetailsPageData detailPageData)
{
var CM = MethodBase.GetCurrentMethod();
LogMethodBegin(CM);
try
{
if (DataContext is DetailsPageViewModel viewModel)
{
viewModel.SetPropertyValues(detailPageData);
NavigationHeadingUc.HeadingData = detailPageData.HeadingData;
ResetPageToDefaultState();
if (detailPageData.DataHistoryList?.Count > 0)
{
CustomizableSectionUc.Visibility = Visibility.Collapsed;
DataHistoryCollectionUserControl.Visibility = Visibility.Visible;
DataHistoryCollectionUserControl.HistoryDataList = detailPageData.DataHistoryList;
DataHistoryCollectionUserControl.DataProvider = _supportCase?.SupportCaseDataProviderArtifact;
QuickActionSelectorUc.IsLocked = cFasdCockpitConfig.Instance.IsHistoryQuickActionSelectorVisible;
if (cFasdCockpitConfig.Instance.IsHistoryQuickActionSelectorVisible)
MoreButtonClickedAction();
}
else if (detailPageData.DataContainerCollectionList?.Count > 0)
{
DataHistoryCollectionUserControl.Visibility = Visibility.Collapsed;
CustomizableSectionUc.Visibility = Visibility.Visible;
CustomizableSectionUc.ContainerCollections = detailPageData.DataContainerCollectionList;
var ticketMenuData = detailPageData.MenuBarData.FirstOrDefault(menuData => menuData.MenuText == "Ticket");
if (ticketMenuData != null)
if (ticketMenuData is cMenuDataContainer containerMenuData)
{
QuickActionSelectorUc.QuickActionSelectorHeading = containerMenuData.MenuText;
QuickActionSelectorUc.QuickActionList = containerMenuData.SubMenuData;
}
QuickActionSelectorUc.IsLocked = cFasdCockpitConfig.Instance.IsCustomizableQuickActionSelectorVisible;
if (cFasdCockpitConfig.Instance.IsCustomizableQuickActionSelectorVisible)
QuickActionSelectorUc.Visibility = Visibility.Visible;
}
}
}
catch (Exception E)
{
LogException(E);
}
finally
{
LogMethodEnd(CM);
}
}
#endregion
#region DataHistoryCollection
@@ -1589,9 +1597,9 @@ namespace FasdDesktopUi.Pages.DetailsPage
try
{
midnightTimer.Stop();
_midnightTimer.Stop();
var from = _supportCase?.SupportCaseDataProviderArtifact?.HealthCardDataHelper?.LoadingHelper?.LastDataRequest;
var from = _supportCaseController?.SupportCaseDataProviderArtifact?.HealthCardDataHelper?.LoadingHelper?.LastDataRequest;
if (from == null)
{
@@ -1618,7 +1626,7 @@ namespace FasdDesktopUi.Pages.DetailsPage
}
finally
{
midnightTimer.Start();
_midnightTimer.Start();
}

View File

@@ -1,19 +1,10 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Input;
using System.Windows.Threading;
using FasdDesktopUi.Basics.Models;
using FasdDesktopUi.Pages.DetailsPage.Models;
using FasdDesktopUi.Basics;
using static C4IT.Logging.cLogManager;
namespace FasdDesktopUi.Pages.DetailsPage.ViewModels
@@ -48,56 +39,6 @@ namespace FasdDesktopUi.Pages.DetailsPage.ViewModels
#endregion
#region Header Properties
#region PageTitle Property
private string pageTitle;
public string PageTitle
{
get { return pageTitle; }
set
{
pageTitle = value;
OnPropertyChanged();
}
}
#endregion
#region HeadingData Property
private List<cHeadingDataModel> headingData;
public List<cHeadingDataModel> HeadingData
{
get { return headingData; }
set
{
headingData = value;
OnPropertyChanged();
}
}
#endregion
#endregion
#region Widget Properties
#region WidgetData Property
private List<List<cWidgetValueModel>> widgetDataList;
public List<List<cWidgetValueModel>> WidgetDataList
{
get { return widgetDataList; }
set
{
widgetDataList = value;
OnPropertyChanged();
}
}
#endregion
#region WidgetGeometry Property
private List<DetailsPageWidgetGeometryModel> widgetGeometryList;
public List<DetailsPageWidgetGeometryModel> WidgetGeometryList
@@ -112,8 +53,6 @@ namespace FasdDesktopUi.Pages.DetailsPage.ViewModels
#endregion
#endregion
#region Details Properties
#region TimeSinceLastRefresh property
@@ -145,21 +84,6 @@ namespace FasdDesktopUi.Pages.DetailsPage.ViewModels
#endregion
#region DetailsData property
private cDetailsPageDataHistoryDataModel detailsDataList;
public cDetailsPageDataHistoryDataModel DetailsDataList
{
get { return detailsDataList; }
set
{
detailsDataList = value;
OnPropertyChanged();
}
}
#endregion
#region ShownValueColumnsCount
public int ShownValueColumnsCount
{
@@ -245,39 +169,6 @@ namespace FasdDesktopUi.Pages.DetailsPage.ViewModels
}
}
public void SetPropertyValues(cDetailsPageData propertyValues)
{
var CM = MethodBase.GetCurrentMethod();
LogMethodBegin(CM);
try
{
DataProvider = propertyValues.DataProvider;
//Heading Properties
HeadingData = propertyValues.HeadingData;
//Widget Properties
WidgetDataList = propertyValues.WidgetData;
//Details Properties
TimeSinceLastRefresh = propertyValues.TimeSinceLastRefresh;
ShownValueColumnsCount = propertyValues.ShownValueColumnsCount;
DetailsDataList = propertyValues.DataHistoryList;
//Menu Properties
MenuBarData = propertyValues.MenuBarData;
}
catch (Exception E)
{
LogEntry($"Passed history values: {propertyValues}");
LogException(E);
}
finally
{
LogMethodEnd(CM);
}
}
#endregion
#endregion

View File

@@ -4,7 +4,7 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:FasdDesktopUi.Pages.DetailsPage.UserControls"
xmlns:ico="clr-namespace:FasdDesktopUi.Basics.UserControls.AdaptableIcon"
xmlns:ico="clr-namespace:FasdDesktopUi.Basics.UserControls.AdaptableIcon;assembly=F4SD-AdaptableIcon"
xmlns:config="clr-namespace:C4IT.FASD.Base;assembly=F4SD-Cockpit-Client-Base"
xmlns:vc="clr-namespace:FasdDesktopUi.Basics.Converter"
mc:Ignorable="d"

View File

@@ -1,21 +1,15 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Globalization;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Threading;
using C4IT.Logging;
using C4IT.MultiLanguage;
using FasdDesktopUi.Basics;
using FasdDesktopUi.Basics.Enums;
using FasdDesktopUi.Pages.DetailsPage.Models;
@@ -509,7 +503,7 @@ namespace FasdDesktopUi.Pages.DetailsPage.UserControls
default:
subtitleStyle = titleColumnMainTitleStyle;
break;
};
}
double subtitleLength = MeasureStringSize(subtitle.Content, new TextBox { Style = subtitleStyle }).Width;
maxTitleLength = maxTitleLength < subtitleLength ? subtitleLength + 70 : maxTitleLength;

View File

@@ -19,6 +19,7 @@ using C4IT.FASD.Base;
using static C4IT.Logging.cLogManager;
using C4IT.FASD.Cockpit.Communication;
using FasdDesktopUi.Basics.Services.SupportCase.Controllers;
namespace FasdDesktopUi.Pages.DetailsPage.UserControls
{
@@ -41,6 +42,8 @@ namespace FasdDesktopUi.Pages.DetailsPage.UserControls
}
}
public SupportCaseController SupportCaseController { get; set; }
private List<Border> _highlightBorders;
private void UpdateHeaderHighlights()
@@ -457,6 +460,8 @@ namespace FasdDesktopUi.Pages.DetailsPage.UserControls
if (headingIcon != null)
{
headingIcon.Tag = heading.Realtion;
if (heading.IsOnline)
{
headingIcon.SetResourceReference(AdaptableIcon.PrimaryIconColorProperty, "Color.Green");
@@ -471,6 +476,7 @@ namespace FasdDesktopUi.Pages.DetailsPage.UserControls
if (headingTextBlock != null && string.IsNullOrWhiteSpace(heading.HeadingText) is false)
{
headingTextBlock.Tag = heading.Realtion;
headingTextBlock.Text = heading.HeadingText;
}
@@ -632,7 +638,7 @@ namespace FasdDesktopUi.Pages.DetailsPage.UserControls
var action = new cShowHeadingSelectionMenuAction();
ShowsRelations = true;
cUiActionBase.RaiseEvent(new cShowHeadingSelectionMenuAction(), this, sender);
DoShowRelations(swapCaseData, location);
DoShowRelations(swapCaseData, location, SupportCaseController);
//Dispatcher.Invoke(async () => await action.RunUiActionAsync(sender, location, false, DataProvider));
}
catch (Exception E)
@@ -642,7 +648,7 @@ namespace FasdDesktopUi.Pages.DetailsPage.UserControls
}
private void DoShowRelations(cSwapCaseInfo swapCaseData, CustomMenu customMenu)
private void DoShowRelations(cSwapCaseInfo swapCaseData, CustomMenu customMenu, SupportCaseController supportCaseController)
{
var CM = MethodBase.GetCurrentMethod();
@@ -669,7 +675,7 @@ namespace FasdDesktopUi.Pages.DetailsPage.UserControls
{
IsMatchingRelation = isMatchingRelation,
IsUsedForCaseEnrichment = true,
UiAction = new cChangeHealthCardAction(storedRelation)
UiAction = new cChangeHealthCardAction(storedRelation, supportCaseController)
});
}
}

View File

@@ -5,7 +5,7 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:FasdDesktopUi.Pages.DetailsPage.UserControls"
xmlns:uc="clr-namespace:FasdDesktopUi.Pages.DetailsPage.UserControls"
xmlns:ico="clr-namespace:FasdDesktopUi.Basics.UserControls.AdaptableIcon"
xmlns:ico="clr-namespace:FasdDesktopUi.Basics.UserControls.AdaptableIcon;assembly=F4SD-AdaptableIcon"
xmlns:config="clr-namespace:C4IT.FASD.Base;assembly=F4SD-Cockpit-Client-Base"
x:Name="_this"
mc:Ignorable="d"

View File

@@ -10,7 +10,7 @@
d:DesignHeight="450"
d:DesignWidth="800"
d:Background="White"
DataContext="{Binding RelativeSource={RelativeSource Self}}">
DataContext="{Binding RelativeSource={RelativeSource Self}}" Loaded="UserControl_Loaded">
<UserControl.Resources>
<vc:LanguageDefinitionsConverter x:Key="LanguageConverter" />
@@ -50,6 +50,15 @@
</Style>
</StackPanel.Resources>
<ico:AdaptableIcon x:Name="RawValuesButton"
Margin="7.5 0 0 0"
Visibility="Collapsed"
ToolTip="{Binding Converter={StaticResource LanguageConverter}, ConverterParameter=Global.NavBar.ShowRawValues}"
SelectedMaterialIcon="ic_view_list"
MouseUp="RawValuesButton_Click"
TouchDown="RawValuesButton_Click"
/>
<ico:AdaptableIcon x:Name="MinimizeButton"
BorderPadding="0 10 0 0"
VerticalAlignment="Bottom"

View File

@@ -1,7 +1,10 @@
using System.Windows;
using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
using FasdDesktopUi.Basics.UiActions;
namespace FasdDesktopUi.Pages.DetailsPage.UserControls
{
public partial class DetailsPageWindowStateBar : UserControl
@@ -11,6 +14,14 @@ namespace FasdDesktopUi.Pages.DetailsPage.UserControls
InitializeComponent();
}
private void UserControl_Loaded(object sender, RoutedEventArgs e)
{
if (cFasdCockpitConfig.Instance?.ShowRawHealthcardValues == true)
RawValuesButton.Visibility = Visibility.Visible;
else
RawValuesButton.Visibility = Visibility.Collapsed;
}
private void MinimizeButton_Click(object sender, InputEventArgs e)
{
if (sender is UIElement senderVisual)
@@ -28,5 +39,11 @@ namespace FasdDesktopUi.Pages.DetailsPage.UserControls
if (sender is UIElement senderVisual)
Window.GetWindow(senderVisual).Close();
}
private void RawValuesButton_Click(object sender, InputEventArgs e)
{
cUiActionBase.RaiseEvent(new UiShowRawHealthcardValues(), this, this);
}
}
}

View File

@@ -0,0 +1,109 @@
<Window x:Class="FasdDesktopUi.Pages.RawHealthCardValuesPage.RawHealthCardValuesPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:FasdDesktopUi.Pages.RawHealthCardValuesPage"
xmlns:ico="clr-namespace:FasdDesktopUi.Basics.UserControls.AdaptableIcon;assembly=F4SD-AdaptableIcon"
xmlns:vc="clr-namespace:FasdDesktopUi.Basics.Converter"
mc:Ignorable="d"
Title="F4SD Raw healthcard values"
Height="800" Width="1024"
MinHeight="800" MinWidth="1024" Loaded="Window_Loaded"
>
<WindowChrome.WindowChrome>
<WindowChrome CaptionHeight="20" />
</WindowChrome.WindowChrome>
<Window.Resources>
<vc:LanguageDefinitionsConverter x:Key="LanguageConverter" />
<Style x:Key="AdaptableIconButtonStyle" TargetType="ico:AdaptableIcon">
<Setter Property="Cursor" Value="Hand" />
<Setter Property="PrimaryIconColor" Value="{DynamicResource Color.Menu.Icon}" />
<Setter Property="Margin" Value="7.5 0" />
<Setter Property="BorderPadding" Value="0" />
<Setter Property="IconHeight" Value="25" />
<Setter Property="IconWidth" Value="25" />
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="PrimaryIconColor" Value="{DynamicResource Color.Menu.Icon.Hover}" />
</Trigger>
</Style.Triggers>
</Style>
</Window.Resources>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="45"/>
<RowDefinition Height="*"/>
<RowDefinition Height="20"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="20"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="20"/>
</Grid.ColumnDefinitions>
<StackPanel Grid.Row="0" Grid.Column="1" Orientation="Horizontal">
<TextBlock VerticalAlignment="Center" FontSize="12" Margin="0,0,0,0" Text="Dieter Sagawe | PC010089" />
<TextBlock VerticalAlignment="Center" Margin="20,0,0,0" FontSize="12" Text="Origin filter:" />
<ComboBox Name="OriginFilterComboBox" Width="150" Height="28" FontSize="12" Margin="5,0,0,0" SelectionChanged="OriginFilterComboBox_SelectionChanged">
<ComboBoxItem Content="All" IsSelected="True"/>
<ComboBoxItem Content="Main"/>
<ComboBoxItem Content="Active Directory"/>
<ComboBoxItem Content="Azure AD"/>
<ComboBoxItem Content="F4SD Agent"/>
<ComboBoxItem Content="Intune"/>
<ComboBoxItem Content="Citrix"/>
<ComboBoxItem Content="Matrix42"/>
</ComboBox>
</StackPanel>
<StackPanel Grid.Row="0" Grid.Column="1" Orientation="Horizontal" HorizontalAlignment="Right" VerticalAlignment="Center" WindowChrome.IsHitTestVisibleInChrome="True">
<ico:AdaptableIcon x:Name="MinimizeButton"
Style="{StaticResource AdaptableIconButtonStyle}"
BorderPadding="0 10 0 0"
VerticalAlignment="Bottom"
MouseUp="MinimizeButton_Click"
TouchDown="MinimizeButton_Click"
ToolTip="{Binding Converter={StaticResource LanguageConverter}, ConverterParameter=Global.NavBar.Minimize}"
SelectedInternIcon="window_minimize" />
<ico:AdaptableIcon x:Name="WindowSizeButton"
MouseUp="WindowSizeButton_Click"
TouchDown="WindowSizeButton_Click">
<ico:AdaptableIcon.Resources>
<Style TargetType="ico:AdaptableIcon"
BasedOn="{StaticResource AdaptableIconButtonStyle}">
<Setter Property="SelectedInternIcon"
Value="window_fullscreen" />
<Setter Property="ToolTip"
Value="{Binding Converter={StaticResource LanguageConverter}, ConverterParameter=Global.NavBar.Maximize}" />
<Style.Triggers>
<DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType=Window}, Path=WindowState}"
Value="Normal">
<Setter Property="SelectedInternIcon"
Value="window_fullscreen" />
</DataTrigger>
<DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType=Window}, Path=WindowState}"
Value="Maximized">
<Setter Property="SelectedInternIcon"
Value="window_fullscreenExit" />
<Setter Property="ToolTip"
Value="{Binding Converter={StaticResource LanguageConverter}, ConverterParameter=Global.NavBar.UnMaximize}" />
</DataTrigger>
</Style.Triggers>
</Style>
</ico:AdaptableIcon.Resources>
</ico:AdaptableIcon>
<ico:AdaptableIcon x:Name="CloseButton"
Style="{StaticResource AdaptableIconButtonStyle}"
HorizontalAlignment="Right"
VerticalAlignment="Center"
ToolTip="{Binding Converter={StaticResource LanguageConverter}, ConverterParameter=Global.NavBar.Close}"
MouseUp="CloseButton_Click"
TouchDown="CloseButton_Click"
SelectedInternIcon="window_close" />
</StackPanel>
<TreeView Grid.Row="1" Grid.Column="1" Name="RawValuesTreeView" />
</Grid>
</Window>

View File

@@ -0,0 +1,64 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using C4IT.FASD.Base;
using C4IT.MultiLanguage;
namespace FasdDesktopUi.Pages.RawHealthCardValuesPage
{
public partial class RawHealthCardValuesPage : Window
{
private enumDataHistoryOrigin originFilter = enumDataHistoryOrigin.Unknown;
public RawHealthCardValuesPage()
{
InitializeComponent();
}
private void CloseButton_Click(object sender, InputEventArgs e)
{
Close();
}
private void MinimizeButton_Click(object sender, InputEventArgs e)
{
this.WindowState = WindowState.Minimized;
}
private void WindowSizeButton_Click(object sender, InputEventArgs e)
{
this.WindowState = this.WindowState == WindowState.Maximized ? WindowState.Normal : WindowState.Maximized;
}
private void Window_Loaded(object sender, RoutedEventArgs e)
{
OriginFilterComboBox.Items.Clear();
foreach (enumDataHistoryOrigin origin in Enum.GetValues(typeof(enumDataHistoryOrigin)))
{
string _name = cMultiLanguageSupport.GetItem("Global.Enumeration.DataHistoryOrigin." + origin.ToString());
if (string.IsNullOrEmpty(_name))
_name = origin.ToString();
OriginFilterComboBox.Items.Add(new ComboBoxItem() { Content = _name, Tag = origin});
}
OriginFilterComboBox.SelectedIndex = 0;
}
private void OriginFilterComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
if (OriginFilterComboBox.SelectedItem is ComboBoxItem selectedItem && selectedItem.Tag is enumDataHistoryOrigin selectedOrigin)
originFilter = selectedOrigin;
}
}
}

View File

@@ -108,14 +108,25 @@
</Border>
<Border Grid.Row="0">
<StackPanel Orientation="Horizontal"
Margin="9 0 0 0"
VerticalAlignment="Top"
HorizontalAlignment="Left">
<Label x:Name="TicketOverviewLabel"
Content="{Binding Converter={StaticResource LanguageConverter}, ConverterParameter=TicketOverview.Header}"
Style="{DynamicResource DetailsPage.DataHistory.TitleColumn.OverviewTitle}"
Margin="9 0 0 0"
VerticalAlignment="Top"
HorizontalAlignment="Left"
FontWeight="Bold"
Visibility="Visible" />
<buc:Badge Margin="6 0 0 0"
VerticalAlignment="Center"
Text="Beta">
<buc:Badge.LayoutTransform>
<ScaleTransform ScaleX="0.85" ScaleY="0.85" />
</buc:Badge.LayoutTransform>
</buc:Badge>
</StackPanel>
</Border>
</Grid>
@@ -154,8 +165,11 @@
CornerRadius="10"
VerticalAlignment="Bottom"
Visibility="Collapsed">
<ScrollViewer VerticalScrollBarVisibility="Auto">
<buc:CustomSearchResultCollection x:Name="ResultMenu"
x:FieldModifier="private" />
x:FieldModifier="private"
PreviewMouseWheel="ResultMenu_PreviewMouseWheel"/>
</ScrollViewer>
</Border>
</Grid>

View File

@@ -21,6 +21,7 @@ using System.Reflection;
using System.Threading;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
using System.Windows.Interop;
using System.Windows.Media;
@@ -35,6 +36,9 @@ namespace FasdDesktopUi.Pages.SearchPage
private static SearchPageView _instance = null;
private const int WM_NCHITTEST = 0x0084;
private const int HTTRANSPARENT = -1;
private readonly HashSet<TileScope> _ticketOverviewNotificationScopesPrimed = new HashSet<TileScope>();
private bool _ticketOverviewFirstEventHandled;
private readonly HashSet<TileScope> _ticketOverviewInitWasEmptyScopes = new HashSet<TileScope>();
public static SearchPageView Instance
{
get
@@ -70,6 +74,8 @@ namespace FasdDesktopUi.Pages.SearchPage
Visibility = Visibility.Visible;
_instance = this;
GetPrimaryScreenSize();
// FilterToggleCheckBox-Events registrieren
FilterCheckbox.Checked += (s, e) => FilterToggleCheckedChanged?.Invoke(this, true);
FilterCheckbox.Unchecked += (s, e) => FilterToggleCheckedChanged?.Invoke(this, false);
@@ -78,17 +84,21 @@ namespace FasdDesktopUi.Pages.SearchPage
{
Hide();
SearchBarUc.ActivateManualSearch();
ScheduleSearchResultMaxHeightUpdate();
};
SizeChanged += (s, e) => ScheduleSearchResultMaxHeightUpdate();
SearchBarUc.SizeChanged += (s, e) => ScheduleSearchResultMaxHeightUpdate();
BodyStack_TicketOverview.SizeChanged += (s, e) => ScheduleSearchResultMaxHeightUpdate();
SearchHistoryBorder.SizeChanged += (s, e) => ScheduleSearchResultMaxHeightUpdate();
AddCustomEventHandlers();
UiSettingsChanged(null, null);
if (TicketOverviewUpdateService.Instance != null)
{
TicketOverviewUpdateService.Instance.Start();
TicketOverviewUpdateService.Instance.OverviewCountsChanged += TicketOverviewUpdateService_OverviewCountsChanged;
}
UiSettingsChanged(null, null);
}
catch (Exception E)
{
@@ -96,23 +106,99 @@ namespace FasdDesktopUi.Pages.SearchPage
}
}
public void GetPrimaryScreenSize()
{
UpdateSearchResultMaxHeight();
}
private void ScheduleSearchResultMaxHeightUpdate()
{
if (Dispatcher == null || Dispatcher.HasShutdownStarted)
return;
Dispatcher.BeginInvoke((Action)UpdateSearchResultMaxHeight, DispatcherPriority.Loaded);
}
private void UpdateSearchResultMaxHeight()
{
if (SearchResultBorder == null)
return;
var workAreaHeight = ActualHeight > 0 ? ActualHeight : SystemParameters.WorkArea.Height;
var reservedHeight = 0.0;
reservedHeight += GetVisibleHeightWithMargin(SearchBarUc);
reservedHeight += GetVisibleHeightWithMargin(BodyStack_TicketOverview);
reservedHeight += GetVisibleHeightWithMargin(SearchHistoryBorder);
if (MainBorder != null)
{
reservedHeight += MainBorder.Padding.Top + MainBorder.Padding.Bottom;
}
var searchResultMargin = SearchResultBorder.Margin;
var availableHeight = workAreaHeight - reservedHeight - searchResultMargin.Top - searchResultMargin.Bottom;
availableHeight = Math.Max(0, availableHeight);
SearchResultBorder.MaxHeight = availableHeight;
}
private static double GetVisibleHeightWithMargin(FrameworkElement element)
{
if (element == null || element.Visibility != Visibility.Visible)
return 0;
var margin = element.Margin;
return element.ActualHeight + margin.Top + margin.Bottom;
}
private void SetSearchResultVisibility(bool isVisible)
{
SearchResultBorder.Visibility = isVisible ? Visibility.Visible : Visibility.Collapsed;
BodyStack_SearchResults.Visibility = (isVisible || SearchResultBorder.IsVisible) ? Visibility.Visible : Visibility.Collapsed;
ScheduleSearchResultMaxHeightUpdate();
}
public void SetSearchHistoryVisibility(bool isVisible)
{
SearchHistoryBorder.Visibility = isVisible && !SearchHistory.IsEmpty() ? Visibility.Visible : Visibility.Collapsed;
BodyStack_SearchResults.Visibility = (isVisible || SearchResultBorder.IsVisible) ? Visibility.Visible : Visibility.Collapsed;
ScheduleSearchResultMaxHeightUpdate();
}
private bool CheckTicketOverviewAvailability()
{
if (cFasdCockpitCommunicationBase.Instance.IsDemo())
return true;
return false;
return cFasdCockpitConfig.Instance?.Global?.TicketConfiguration?.ShowOverview == true;
}
private void UpdateTicketOverviewAvailability()
{
var enabled = CheckTicketOverviewAvailability();
var service = TicketOverviewUpdateService.Instance;
service?.UpdateAvailability(enabled);
if (enabled)
_ = service?.FetchAsync();
if (!enabled)
{
if (Dispatcher.CheckAccess())
{
ApplyTicketOverviewDisabledState();
}
else
{
Dispatcher.Invoke(ApplyTicketOverviewDisabledState);
}
}
}
private void ApplyTicketOverviewDisabledState()
{
_renderTicketOverviewUserNames = false;
_ticketOverviewNotificationScopesPrimed.Clear();
_ticketOverviewFirstEventHandled = false;
_ticketOverviewInitWasEmptyScopes.Clear();
SetTicketOverviewVisibility(false);
(Application.Current as App)?.ClearTicketOverviewTrayNotification();
}
private void SetTicketOverviewVisibility(bool isVisible)
@@ -127,6 +213,7 @@ namespace FasdDesktopUi.Pages.SearchPage
RoleLabel.Visibility = b ? Visibility.Visible : Visibility.Collapsed;
OwnTicketsLabel.Visibility = b ? Visibility.Visible : Visibility.Collapsed;
TicketOverviewLabel.Visibility = b ? Visibility.Visible : Visibility.Collapsed;
ScheduleSearchResultMaxHeightUpdate();
}
public void ShowLoadingTextItem(string itemText)
@@ -156,6 +243,24 @@ namespace FasdDesktopUi.Pages.SearchPage
});
}
public void ShowTicketOverviewPaneForScope(TileScope? scope)
{
if (scope.HasValue)
{
Dispatcher.Invoke(() =>
{
if (TicketOverviewBorder.Visibility == Visibility.Visible)
return;
var useRoleScope = scope.Value == TileScope.Role;
if (FilterCheckbox != null && FilterCheckbox.IsChecked != useRoleScope)
FilterCheckbox.IsChecked = useRoleScope;
});
}
ShowTicketOverviewPane();
}
internal void CloseTicketOverviewResults()
{
_renderTicketOverviewUserNames = false;
@@ -192,7 +297,7 @@ namespace FasdDesktopUi.Pages.SearchPage
enumFasdInformationClass GetInformationClass(cF4sdApiSearchResultRelation relation) => cF4sdIdentityEntry.GetFromSearchResult(relation.Type);
cMenuDataBase GetMenuData(cF4sdApiSearchResultRelation relation, IRelationService trelationService)
cMenuDataBase GetMenuData(cF4sdApiSearchResultRelation relation, IRelationService subRelationService)
{
try
{
@@ -843,9 +948,28 @@ namespace FasdDesktopUi.Pages.SearchPage
{
ApplyLatestCounts();
var positiveChanges = e.Changes?.Where(change => change.Delta > 0).ToList();
TicketOverviewUc?.SetHighlights(positiveChanges, IsFilterChecked);
var app = Application.Current as FasdDesktopUi.App;
var service = TicketOverviewUpdateService.Instance;
if (!_ticketOverviewFirstEventHandled)
{
_ticketOverviewFirstEventHandled = true;
foreach (var scope in GetTicketOverviewEventScopes(e))
{
PrimeTicketOverviewScope(scope);
TrackEmptyInitScope(scope, e?.CurrentCounts);
}
app?.ClearTicketOverviewTrayNotification();
return;
}
if (e.InitializedScope.HasValue)
{
PrimeTicketOverviewScope(e.InitializedScope.Value);
TrackEmptyInitScope(e.InitializedScope.Value, e?.CurrentCounts);
app?.ClearTicketOverviewTrayNotification();
return;
}
if (positiveChanges == null || positiveChanges.Count == 0)
{
@@ -853,7 +977,25 @@ namespace FasdDesktopUi.Pages.SearchPage
return;
}
var message = BuildNotificationMessage(positiveChanges);
if (service != null && !service.AreAllScopesInitialized)
{
app?.ClearTicketOverviewTrayNotification();
return;
}
var filteredChanges = FilterChangesForPrimedScopes(positiveChanges);
if (filteredChanges.Count == 0)
{
app?.ClearTicketOverviewTrayNotification();
return;
}
TicketOverviewUc?.SetHighlights(filteredChanges, IsFilterChecked);
var pendingScope = ResolveSingleScope(filteredChanges);
app?.SetTicketOverviewNotificationScope(pendingScope);
var message = BuildNotificationMessage(filteredChanges);
if (string.IsNullOrWhiteSpace(message))
{
app?.ClearTicketOverviewTrayNotification();
@@ -869,6 +1011,110 @@ namespace FasdDesktopUi.Pages.SearchPage
}
}
private void PrimeTicketOverviewScope(TileScope scope)
{
if (_ticketOverviewNotificationScopesPrimed.Add(scope))
{
TicketOverviewUc?.ClearHighlightsForScope(scope);
}
}
private IReadOnlyList<TileCountChange> FilterChangesForPrimedScopes(IReadOnlyList<TileCountChange> changes)
{
if (changes == null || changes.Count == 0)
return Array.Empty<TileCountChange>();
var filteredChanges = new List<TileCountChange>(changes.Count);
var unprimedScopes = new HashSet<TileScope>();
var silentInitScopes = new HashSet<TileScope>();
foreach (var change in changes)
{
if (_ticketOverviewInitWasEmptyScopes.Contains(change.Scope))
{
silentInitScopes.Add(change.Scope);
continue;
}
if (_ticketOverviewNotificationScopesPrimed.Contains(change.Scope))
{
filteredChanges.Add(change);
}
else
{
unprimedScopes.Add(change.Scope);
}
}
foreach (var scope in unprimedScopes)
{
PrimeTicketOverviewScope(scope);
}
if (silentInitScopes.Count > 0)
{
foreach (var scope in silentInitScopes)
{
_ticketOverviewInitWasEmptyScopes.Remove(scope);
PrimeTicketOverviewScope(scope);
}
}
return filteredChanges;
}
private void TrackEmptyInitScope(TileScope scope, IReadOnlyDictionary<string, TileCounts> counts)
{
if (IsScopeCountsEmpty(scope, counts))
{
_ticketOverviewInitWasEmptyScopes.Add(scope);
}
}
private static bool IsScopeCountsEmpty(TileScope scope, IReadOnlyDictionary<string, TileCounts> counts)
{
if (counts == null || counts.Count == 0)
return true;
foreach (var kvp in counts)
{
var value = scope == TileScope.Role ? kvp.Value.Role : kvp.Value.Personal;
if (value != 0)
return false;
}
return true;
}
private static IEnumerable<TileScope> GetTicketOverviewEventScopes(TicketOverviewCountsChangedEventArgs e)
{
if (e == null)
return Enumerable.Empty<TileScope>();
if (e.InitializedScope.HasValue)
return new[] { e.InitializedScope.Value };
if (e.Changes == null || e.Changes.Count == 0)
return Enumerable.Empty<TileScope>();
return e.Changes.Select(change => change.Scope).Distinct();
}
private static TileScope? ResolveSingleScope(IReadOnlyList<TileCountChange> changes)
{
if (changes == null || changes.Count == 0)
return null;
var scope = changes[0].Scope;
for (int i = 1; i < changes.Count; i++)
{
if (changes[i].Scope != scope)
return null;
}
return scope;
}
private void ApplyLatestCounts()
{
var service = TicketOverviewUpdateService.Instance;
@@ -1084,6 +1330,7 @@ namespace FasdDesktopUi.Pages.SearchPage
var relations = await LoadRelationsForTileAsync(e.Key, e.UseRoleScope, Math.Max(0, e.Count));
Debug.WriteLine($"[TicketOverview] Relations loaded: {relations?.Count ?? 0}");
var ticketOverviewRelationService = new RelationService();
var firstRelation = relations.FirstOrDefault();
string displayText = header;
if (firstRelation != null)
@@ -1134,7 +1381,7 @@ namespace FasdDesktopUi.Pages.SearchPage
{
MenuText = r.DisplayName,
TrailingText = trailingUser,
UiAction = new cUiProcessSearchRelationAction(entry, r, null, this)
UiAction = new cUiProcessSearchRelationAction(entry, r, ticketOverviewRelationService, this)
{
DisplayType = isEnabled ? enumActionDisplayType.enabled : enumActionDisplayType.disabled,
Description = isEnabled ? string.Empty : disabledReason,
@@ -1399,6 +1646,8 @@ namespace FasdDesktopUi.Pages.SearchPage
Dispatcher.Invoke(() => MainBorder.HorizontalAlignment = HorizontalAlignment.Left);
break;
}
UpdateTicketOverviewAvailability();
}
catch (Exception E)
{
@@ -1409,5 +1658,34 @@ namespace FasdDesktopUi.Pages.SearchPage
public void SetPendingInformationClasses(HashSet<enumFasdInformationClass> informationClasses) => Dispatcher.Invoke(() => ResultMenu.SetPendingInformationClasses(informationClasses));
public void UpdatePendingInformationClasses(HashSet<enumFasdInformationClass> informationClasses) => Dispatcher.Invoke(() => ResultMenu.UpdatePendingInformationClasses(informationClasses));
private void ResultMenu_PreviewMouseWheel(object sender, MouseWheelEventArgs e)
{
var scrollViewer = FindParent<ScrollViewer>((DependencyObject)sender);
if (scrollViewer != null)
{
if (e.Delta > 0)
scrollViewer.LineUp();
else
scrollViewer.LineDown();
e.Handled = true;
}
}
private T FindParent<T>(DependencyObject child) where T : DependencyObject
{
DependencyObject parent = VisualTreeHelper.GetParent(child);
while (parent != null)
{
if (parent is T typed)
return typed;
parent = VisualTreeHelper.GetParent(parent);
}
return null;
}
}
}

View File

@@ -9,7 +9,7 @@
xmlns:vc="clr-namespace:FasdDesktopUi.Basics.Converter"
xmlns:sys="clr-namespace:System;assembly=mscorlib"
mc:Ignorable="d"
Title="PhoneSettingsPage"
Title="M42SettingsPage"
ResizeMode="NoResize"
WindowStyle="None"
AllowsTransparency="True"

View File

@@ -310,7 +310,7 @@ namespace FasdDesktopUi.Pages.SlimPage
return;
}
var data = await _supportCase?.SupportCaseDataProviderArtifact.HealthCardDataHelper.SlimCard.GetDataAsync();
var data = await _supportCaseController?.SupportCaseDataProviderArtifact.HealthCardDataHelper.SlimCard.GetDataAsync();
//todo: check if there is a more performant way solving this
Dispatcher.Invoke(() => WidgetCollectionUc.HeadingData = data.HeadingData);
Dispatcher.Invoke(() => WidgetCollectionUc.WidgetData = data.WidgetData);
@@ -339,17 +339,17 @@ namespace FasdDesktopUi.Pages.SlimPage
{
try
{
var data = await _supportCase?.SupportCaseDataProviderArtifact.HealthCardDataHelper.SlimCard.GetDataAsync();
var data = await _supportCaseController?.SupportCaseDataProviderArtifact.HealthCardDataHelper.SlimCard.GetDataAsync();
//todo: check if there is a more performant way solving this
Dispatcher.Invoke(() => WidgetCollectionUc.HeadingData = data.HeadingData);
Dispatcher.Invoke(() => WidgetCollectionUc.WidgetData = data.WidgetData);
Dispatcher.Invoke(() => MenuBarUc.MenuBarItemData = GetSlimpageMenuBarData(data.MenuBarData));
Dispatcher.Invoke(() => DataHistoryCollectionUc.UpdateHistory(data.DataHistoryList));
if (_supportCase != null)
if (_supportCaseController != null)
{
_supportCase.SupportCaseDataProviderArtifact.HealthCardDataHelper.LoadingHelper.DataChanged -= DataProvider_DataChanged;
_supportCase.SupportCaseDataProviderArtifact.HealthCardDataHelper.LoadingHelper.DataFullyLoaded -= DataProvider_DataFullyLoaded;
_supportCaseController.SupportCaseDataProviderArtifact.HealthCardDataHelper.LoadingHelper.DataChanged -= DataProvider_DataChanged;
_supportCaseController.SupportCaseDataProviderArtifact.HealthCardDataHelper.LoadingHelper.DataFullyLoaded -= DataProvider_DataFullyLoaded;
}
}
catch (Exception E)
@@ -364,7 +364,7 @@ namespace FasdDesktopUi.Pages.SlimPage
{
Dispatcher.Invoke(() =>
{
bool hasDirectConnection = _supportCase?.SupportCaseDataProviderArtifact?.DirectConnectionHelper?.IsDirectConnectionActive ?? false;
bool hasDirectConnection = _supportCaseController?.SupportCaseDataProviderArtifact?.DirectConnectionHelper?.IsDirectConnectionActive ?? false;
WidgetCollectionUc.HasDirectConnection = hasDirectConnection;
});
}
@@ -495,7 +495,7 @@ namespace FasdDesktopUi.Pages.SlimPage
break;
}
await e.UiAction?.RunUiActionAsync(e.OriginalSource, drawingArea, false, _supportCase?.SupportCaseDataProviderArtifact);
await e.UiAction?.RunUiActionAsync(e.OriginalSource, drawingArea, false, _supportCaseController?.SupportCaseDataProviderArtifact);
}
catch (Exception E)

View File

@@ -4,30 +4,30 @@ using System.Windows;
using FasdDesktopUi.Basics;
using FasdDesktopUi.Basics.Models;
using FasdDesktopUi.Basics.Services.SupportCase;
using FasdDesktopUi.Basics.Services.SupportCase.Controllers;
using static C4IT.Logging.cLogManager;
namespace FasdDesktopUi.Pages
{
public class SupportCasePageBase : Window, IBlurrable
{
protected ISupportCase _supportCase;
protected SupportCaseController _supportCaseController;
internal bool isDataChangedEventRunning = false;
public virtual void SetSupportCase(ISupportCase supportCase)
internal virtual void SetSupportCaseController(SupportCaseController supportCase)
{
if (_supportCase != null)
if (_supportCaseController != null)
{
_supportCase.SupportCaseDataProviderArtifact.HealthCardDataHelper.LoadingHelper.DataChanged -= DataProvider_DataChanged;
_supportCase.SupportCaseDataProviderArtifact.HealthCardDataHelper.LoadingHelper.DataFullyLoaded -= DataProvider_DataFullyLoaded;
_supportCase.SupportCaseDataProviderArtifact.DirectConnectionHelper.DirectConnectionChanged -= DirectConnectionHelper_DirectConnectionChanged;
_supportCaseController.SupportCaseDataProviderArtifact.HealthCardDataHelper.LoadingHelper.DataChanged -= DataProvider_DataChanged;
_supportCaseController.SupportCaseDataProviderArtifact.HealthCardDataHelper.LoadingHelper.DataFullyLoaded -= DataProvider_DataFullyLoaded;
_supportCaseController.SupportCaseDataProviderArtifact.DirectConnectionHelper.DirectConnectionChanged -= DirectConnectionHelper_DirectConnectionChanged;
}
_supportCase = supportCase;
_supportCase.SupportCaseDataProviderArtifact.HealthCardDataHelper.LoadingHelper.DataChanged += DataProvider_DataChanged;
_supportCase.SupportCaseDataProviderArtifact.HealthCardDataHelper.LoadingHelper.DataFullyLoaded += DataProvider_DataFullyLoaded;
_supportCase.SupportCaseDataProviderArtifact.DirectConnectionHelper.DirectConnectionChanged += DirectConnectionHelper_DirectConnectionChanged;
_supportCaseController = supportCase;
_supportCaseController.SupportCaseDataProviderArtifact.HealthCardDataHelper.LoadingHelper.DataChanged += DataProvider_DataChanged;
_supportCaseController.SupportCaseDataProviderArtifact.HealthCardDataHelper.LoadingHelper.DataFullyLoaded += DataProvider_DataFullyLoaded;
_supportCaseController.SupportCaseDataProviderArtifact.DirectConnectionHelper.DirectConnectionChanged += DirectConnectionHelper_DirectConnectionChanged;
}
internal async void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)

View File

@@ -106,4 +106,5 @@
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>

View File

@@ -73,6 +73,9 @@ namespace FasdDesktopUi
[RegConfig]
public string LastDownloadPath = "";
[RegConfig]
public bool ShowRawHealthcardValues = false;
[RegConfigSubItem]
public cFasdCockpitConfigPhoneSupport PhoneSupport = new cFasdCockpitConfigPhoneSupport();

View File

@@ -1,9 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="C4IT.F4SD.DisplayFormatting" version="0.0.1-preview-0.0.2" targetFramework="net472" />
<package id="C4IT.F4SD.DisplayFormatting" version="1.0.0" targetFramework="net472" />
<package id="C4IT.F4SD.SupportCaseProtocoll" version="1.0.0" targetFramework="net472" />
<package id="MaterialIcons" version="1.0.3" targetFramework="net472" />
<package id="Microsoft.Extensions.Logging.Abstractions" version="3.1.32" targetFramework="net472" />
<package id="Microsoft.Web.WebView2" version="1.0.3240.44" targetFramework="net472" />
<package id="Newtonsoft.Json" version="13.0.3" targetFramework="net472" />
<package id="Microsoft.Bcl.AsyncInterfaces" version="10.0.2" targetFramework="net472" />
<package id="Microsoft.Extensions.DependencyInjection.Abstractions" version="10.0.2" targetFramework="net472" />
<package id="Microsoft.Extensions.Logging.Abstractions" version="10.0.2" targetFramework="net472" />
<package id="Microsoft.Web.WebView2" version="1.0.3650.58" targetFramework="net472" />
<package id="Newtonsoft.Json" version="13.0.4" targetFramework="net472" />
<package id="System.Buffers" version="4.6.1" targetFramework="net472" />
<package id="System.Diagnostics.DiagnosticSource" version="10.0.2" targetFramework="net472" />
<package id="System.Memory" version="4.6.3" targetFramework="net472" />
<package id="System.Numerics.Vectors" version="4.6.1" targetFramework="net472" />
<package id="System.Runtime.CompilerServices.Unsafe" version="6.1.2" targetFramework="net472" />
<package id="System.Threading.Tasks.Extensions" version="4.6.3" targetFramework="net472" />
<package id="WpfAnimatedGif" version="2.0.2" targetFramework="net472" />
</packages>

View File

@@ -21,6 +21,10 @@
<assemblyIdentity name="Microsoft.Bcl.AsyncInterfaces" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-9.0.0.0" newVersion="9.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Extensions.Logging.Abstractions" publicKeyToken="adb9793829ddae60" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-10.0.0.2" newVersion="10.0.0.2" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>

View File

@@ -96,7 +96,7 @@ namespace FasdExcelToJsonConverter
if (tableDictionaryEntry.Columns.ContainsKey(columnName))
continue;
tableDictionaryEntry.Columns.Add(columnName, new cF4SDHealthCardRawData.cHealthCardTableColumn() { ColumnName = columnName, Values = values.ToList() });
tableDictionaryEntry.Columns.Add(columnName, new cF4SDHealthCardRawData.cHealthCardTableColumn(tableDictionaryEntry) { ColumnName = columnName, Values = values.ToList() });
if (tableDictionaryEntry.TimeFrames == null)
tableDictionaryEntry.TimeFrames = new DateTime[1, 2];

View File

@@ -79,7 +79,7 @@
</PropertyGroup>
<ItemGroup>
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.13.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
<HintPath>..\packages\Newtonsoft.Json.13.0.4\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Data" />

View File

@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Newtonsoft.Json" version="13.0.3" targetFramework="net472" />
<package id="Newtonsoft.Json" version="13.0.4" targetFramework="net472" />
</packages>

Some files were not shown because too many files have changed in this diff Show More