Skip to content

Commit

Permalink
添加项目文件。
Browse files Browse the repository at this point in the history
  • Loading branch information
VeryJokerJal committed Jan 16, 2025
1 parent 3efd798 commit 9cb0054
Show file tree
Hide file tree
Showing 99 changed files with 12,241 additions and 0 deletions.
31 changes: 31 additions & 0 deletions Alpha.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.13.35617.110 d17.13
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UIShell", "UIShell\UIShell.csproj", "{25136FF5-345F-FE98-37AF-CBF690B70510}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Alpha", "Alpha\Alpha.csproj", "{EE9CA942-E12D-9230-D3D5-1B63E2F95A73}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{25136FF5-345F-FE98-37AF-CBF690B70510}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{25136FF5-345F-FE98-37AF-CBF690B70510}.Debug|Any CPU.Build.0 = Debug|Any CPU
{25136FF5-345F-FE98-37AF-CBF690B70510}.Release|Any CPU.ActiveCfg = Release|Any CPU
{25136FF5-345F-FE98-37AF-CBF690B70510}.Release|Any CPU.Build.0 = Release|Any CPU
{EE9CA942-E12D-9230-D3D5-1B63E2F95A73}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{EE9CA942-E12D-9230-D3D5-1B63E2F95A73}.Debug|Any CPU.Build.0 = Debug|Any CPU
{EE9CA942-E12D-9230-D3D5-1B63E2F95A73}.Release|Any CPU.ActiveCfg = Release|Any CPU
{EE9CA942-E12D-9230-D3D5-1B63E2F95A73}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {1132CA7C-2F80-4134-9EBC-7EC9A58C8769}
EndGlobalSection
EndGlobal
22 changes: 22 additions & 0 deletions Alpha/Alpha.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net9.0-windows</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<UseWPF>true</UseWPF>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="ReactiveUI" Version="20.1.63" />
<PackageReference Include="ReactiveUI.Fody" Version="19.5.41" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\UIShell\UIShell.csproj" />
</ItemGroup>

</Project>
17 changes: 17 additions & 0 deletions Alpha/App.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<Application x:Class="Alpha.App" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:converters="clr-namespace:Alpha.Converters" xmlns:local="clr-namespace:Alpha" StartupUri="Views/MainWindow.xaml">
<Application.Resources>
<ResourceDictionary>
<converters:UniversalComparisonConverter x:Key="UniversalComparisonConverter" />
<converters:InverseUniversalComparisonConverter x:Key="InverseUniversalComparisonConverter" />
<converters:StatusToColorConverter x:Key="StatusToIconConverter" />
<converters:CheckResultColorConverter x:Key="CheckResultColorConverter" />
<converters:NullToVisibilityConverter x:Key="NullToVisibilityConverter" />
<converters:AlphaResultToColorConverter x:Key="AlphaResultToColorConverter" />
<converters:AlphaResultToTextConverter x:Key="AlphaResultToTextConverter" />
<converters:IgnoreStatusVisibilityMultiConverter x:Key="IgnoreStatusVisibilityMultiConverter" />
<ResourceDictionary.MergedDictionaries>
<XamlUIResources />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
</Application>
14 changes: 14 additions & 0 deletions Alpha/App.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
using System.Configuration;
using System.Data;
using System.Windows;

namespace Alpha
{
/// <summary>
/// Interaction logic for App.xaml
/// </summary>
public partial class App : Application
{
}

}
10 changes: 10 additions & 0 deletions Alpha/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
using System.Windows;

[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
//(used if a resource is not found in the page,
// or application resource dictionaries)
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
)]
36 changes: 36 additions & 0 deletions Alpha/Converters/AlphaResultToColorConverter.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
using System.Globalization;
using System.Windows.Data;
using System.Windows.Media;
using Alpha.Models;

namespace Alpha.Converters
{
public class AlphaResultToColorConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value is AlphaResponse response)
{
List<AlphaCheck>? checks;
checks = response.Is?.Checks;
if (checks != null)
{
return !checks.Any(delegate (AlphaCheck check)
{
string? result;
result = check.Result;
return result != null && (result.ToUpper()?.Equals("FAIL", StringComparison.OrdinalIgnoreCase)).GetValueOrDefault();
})
? new SolidColorBrush((Color)ColorConverter.ConvertFromString("#2E7D32"))
: (object)new SolidColorBrush((Color)ColorConverter.ConvertFromString("#C62828"));
}
}
return new SolidColorBrush(Colors.Transparent);
}

public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
}
35 changes: 35 additions & 0 deletions Alpha/Converters/AlphaResultToTextConverter.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
using System.Globalization;
using System.Windows.Data;
using Alpha.Models;

namespace Alpha.Converters
{
public class AlphaResultToTextConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value is AlphaResponse response)
{
List<AlphaCheck>? checks;
checks = response.Is?.Checks;
if (checks != null)
{
return !checks.Any(delegate (AlphaCheck check)
{
string? result;
result = check.Result;
return result != null && (result.ToUpper()?.Equals("FAIL", StringComparison.OrdinalIgnoreCase)).GetValueOrDefault();
})
? "已通过"
: (object)"未通过";
}
}
return "未知状态";
}

public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
}
27 changes: 27 additions & 0 deletions Alpha/Converters/CheckResultColorConverter.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
using System.Globalization;
using System.Windows.Data;
using System.Windows.Media;

namespace Alpha.Converters
{
public class CheckResultColorConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
return value is string result
? result.ToUpper() switch
{
"PASS" => new SolidColorBrush(Color.FromRgb(40, 167, 69)),
"FAIL" => new SolidColorBrush(Color.FromRgb(220, 53, 69)),
"PENDING" => new SolidColorBrush(Color.FromRgb(byte.MaxValue, 193, 7)),
_ => new SolidColorBrush(Color.FromRgb(108, 117, 125)),
}
: (object)new SolidColorBrush(Color.FromRgb(108, 117, 125));
}

public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
}
39 changes: 39 additions & 0 deletions Alpha/Converters/ExpiryToDateTimeConverter.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
using Newtonsoft.Json;

namespace Alpha.Converters
{
public class ExpiryToDateTimeConverter : JsonConverter
{
public override void WriteJson(JsonWriter writer, object? value, JsonSerializer serializer)
{
if (value is DateTime)
{
writer.WriteValue(((DateTime)value - new DateTime(1970, 1, 1)).TotalSeconds);
}
else
{
writer.WriteNull();
}
}

public override object? ReadJson(JsonReader reader, Type objectType, object? existingValue, JsonSerializer serializer)
{
if (reader.TokenType == JsonToken.Null)
{
return null;
}
if ((uint)(reader.TokenType - 7) <= 1u)
{
double totalSeconds;
totalSeconds = Convert.ToDouble(reader.Value);
return DateTime.Now.AddSeconds(totalSeconds);
}
throw new JsonSerializationException("Unexpected token type: " + reader.TokenType);
}

public override bool CanConvert(Type objectType)
{
return objectType == typeof(DateTime);
}
}
}
87 changes: 87 additions & 0 deletions Alpha/Converters/IgnoreStatusVisibilityMultiConverter.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
using System.Globalization;
using System.Windows;
using System.Windows.Data;
using Alpha.Models;

namespace Alpha.Converters
{
public class IgnoreStatusVisibilityMultiConverter : IMultiValueConverter
{
public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
{
if (values.Length == 2 && values[0] is IgnoreStatus status && values[1] is SimulationCompletedData param)
{
if ((status & IgnoreStatus.Stop) == IgnoreStatus.Stop)
{
AlphaResponse? alphaResult;
alphaResult = param.AlphaResult;
if (alphaResult != null && (alphaResult.Is?.Checks?.Any(delegate (AlphaCheck check)
{
string? result2;
result2 = check.Result;
return result2 != null && (result2.ToUpper()?.Equals("FAIL", StringComparison.OrdinalIgnoreCase)).GetValueOrDefault();
})).GetValueOrDefault())
{
return Visibility.Collapsed;
}
}
if ((status & IgnoreStatus.Pass) == IgnoreStatus.Pass)
{
AlphaResponse? alphaResult2;
alphaResult2 = param.AlphaResult;
if (alphaResult2 != null && alphaResult2.Is?.Checks?.Any(delegate (AlphaCheck check)
{
string? result;
result = check.Result;
return result != null && (result.ToUpper()?.Equals("FAIL", StringComparison.OrdinalIgnoreCase)).GetValueOrDefault();
}) == false)
{
return Visibility.Collapsed;
}
}
if ((status & IgnoreStatus.Failure) == IgnoreStatus.Failure)
{
string? status2;
status2 = param.Status;
if (status2 != null && (status2.ToUpper()?.Equals("FAIL", StringComparison.OrdinalIgnoreCase)).GetValueOrDefault())
{
return Visibility.Collapsed;
}
}
if ((status & IgnoreStatus.Warning) == IgnoreStatus.Warning)
{
string? status3;
status3 = param.Status;
if (status3 != null && (status3.ToUpper()?.Equals("WARNING", StringComparison.OrdinalIgnoreCase)).GetValueOrDefault())
{
return Visibility.Collapsed;
}
}
if ((status & IgnoreStatus.Complete) == IgnoreStatus.Complete)
{
string? status4;
status4 = param.Status;
if (status4 != null && (status4.ToUpper()?.Equals("COMPLETE", StringComparison.OrdinalIgnoreCase)).GetValueOrDefault())
{
return Visibility.Collapsed;
}
}
if ((status & IgnoreStatus.Error) == IgnoreStatus.Error)
{
string? status5;
status5 = param.Status;
if (status5 != null && (status5.ToUpper()?.Equals("ERROR", StringComparison.OrdinalIgnoreCase)).GetValueOrDefault())
{
return Visibility.Collapsed;
}
}
}
return Visibility.Visible;
}

public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
}
Loading

0 comments on commit 9cb0054

Please sign in to comment.