Main页面

This commit is contained in:
chfei committed 2026-11-11 14:33:39 +08:00
1 parent a003d90b0e
commit f03e2b08f4
33 files changed
+54543 -34

No files matched your search

@@ -0,0 +1,42 @@
using PipeReviewReport.Resources.Fonts;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
namespace Store.Management.Framework.Controls
{
public class IconText : TextBlock
{
static IconText()
{
DefaultStyleKeyProperty.OverrideMetadata(typeof(IconText), new FrameworkPropertyMetadata(typeof(IconText)));
}
public IconNameEnum Icon
{
get => (IconNameEnum)GetValue(IconNameProperty);
set => SetValue(IconNameProperty, value);
}
public static readonly DependencyProperty IconNameProperty = DependencyProperty.Register(
nameof(Icon),
typeof(IconNameEnum),
typeof(IconText),
new PropertyMetadata(IconNameEnum.Empty, OnIconChanged)
);
private static void OnIconChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
if (d is IconText self)
{
self.Text = self.Icon.GetGlyphString();
}
}
}
}
@@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Store.Management.Framework
{
public class Navigation
{
public static string MainContext { get; } = nameof(MainContext);
}
}
@@ -0,0 +1,65 @@
<#@ template debug="false" hostspecific="true" language="C#" #>
<#@ assembly name="System.Core" #>
<#@ import namespace="System.Linq" #>
<#@ import namespace="System.IO" #>
<#@ import namespace="System.Text" #>
<#@ import namespace="System.Collections.Generic" #>
<#@ import namespace="System.Text.RegularExpressions" #>
<#@ output extension=".xaml" encoding="utf-8" #>
<#
StringBuilder FontString = new StringBuilder();
FontString.AppendLine("<ResourceDictionary");
FontString.AppendLine("\txmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/presentation\"");
FontString.AppendLine("\txmlns:PresentationOptions=\"http://schemas.microsoft.com/winfx/2006/xaml/presentation/options\"");
FontString.AppendLine("\txmlns:x=\"http://schemas.microsoft.com/winfx/2006/xaml\"");
FontString.AppendLine("\txmlns:sys=\"clr-namespace:System;assembly=mscorlib\"");
FontString.AppendLine("\t>");
FontString.AppendLine("");
FontString.AppendLine("");
string cssPath = this.Host.ResolvePath("iconfont.css");
string svgPath = this.Host.ResolvePath("iconfont.js");
if (File.Exists(cssPath))
{
string cssContent = File.ReadAllText(cssPath, Encoding.UTF8);
MatchCollection matchs = Regex.Matches(cssContent, "\\.icon-(?<name>.+?):before.+?\\{.+?content:.+?\"\\\\(?<value>e.+?)\";.+?\\}", RegexOptions.Singleline);
foreach (Match match in matchs)
{
string name = match.Groups["name"].Value;
//name = Regex.Replace(name,"(a-(\\d{4,}(.*)?_fluent_|SegoeFluentIconsRegular-))|(_regular_icon|$)","",RegexOptions.Singleline);
string value = match.Groups["value"].Value;
FontString.AppendLine(string.Format("\t<sys:String x:Key=\"txt-{0}\">&#x{1};</sys:String>", name, value));
}
}
if (File.Exists(svgPath))
{
FontString.AppendLine("");
FontString.AppendLine("");
string svgContent = File.ReadAllText(svgPath, Encoding.UTF8);
MatchCollection matchs = Regex.Matches(svgContent, "<symbol.+?id=\"(?<name>.+?)\".+?>(?<value>.+?)</symbol>");
foreach (Match match in matchs)
{
string name = match.Groups["name"].Value;
string symbol = match.Groups["value"].Value;
StringBuilder value =new StringBuilder();
MatchCollection pathMatchs = Regex.Matches(symbol,"<path.+?d=\"(?<value>.+?)\"");
foreach(Match pathMatch in pathMatchs)
{
value.AppendLine("\t\t"+pathMatch.Groups["value"].Value);
}
FontString.AppendLine(string.Format("\t<Geometry x:Key=\"{0}\" PresentationOptions:Freeze=\"True\">\n{1}\t</Geometry>", name, value));
}
}
FontString.AppendLine("");
FontString.AppendLine("");
FontString.AppendLine("</ResourceDictionary>");
string content = FontString.ToString();
string savePath =Path.Combine(this.Host.ResolvePath(""),@"..\Themes\FontGeometry.xaml");
//File.WriteAllText(savePath,content,Encoding.UTF8);
#>
<#=content#>
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,284 @@
<#@ template debug="false" hostspecific="true" language="C#" #>
<#@ assembly name="System.Core" #>
<#@ import namespace="System.Linq" #>
<#@ import namespace="System.Text" #>
<#@ import namespace="System.IO" #>
<#@ import namespace="System.Collections.Generic" #>
<#@ import namespace="System.Text.RegularExpressions" #>
<#@ import namespace="Microsoft.VisualStudio.TextTemplating" #>
<#@ assembly name="$(ProjectDir)\Resources\DLLs\IconResourcesGenerator.dll" #>
<#@ import namespace="IconResourcesGenerator" #>
<#@ output extension=".cs" encoding="utf-8" #>
<#
ITextTemplatingEngineHost host = this.Host;
string jsPath = host.ResolvePath("iconfont.js");
string cssPath = host.ResolvePath("iconfont.css");
string namespaceName = "PipeReviewReport.Resources.Fonts";
Generator generator = new Generator(jsPath, cssPath);
Dictionary<string, string> glyphToKey = generator.ExecuteGlyphToKey();
Dictionary<string, string> keyToGlyph = generator.ExecuteKeyToGlyph();
(Dictionary<string, string> simpleNameToKey, Dictionary<string, string> keyToSimpleName) = generator.ExecuteSimpleNameToKey();
#>
using System;
// using System.ComponentModel;
using System.Diagnostics.CodeAnalysis;
using System.Globalization;
using System.Windows;
using System.Windows.Data;
using System.Windows.Media;
namespace <#= namespaceName #>;
[SuppressMessage("Style", "IDE1006:Naming Styles", Justification = "<Pending>")]
internal class __________________Temp__________________
{
[SuppressMessage("CodeQuality", "IDE0051:Remove unused private members", Justification = "<Pending>")]
private void Test()
{
}
};
/// <summary>
/// 图标名称枚举
/// </summary>
// [TypeConverter(typeof(EnumConverter))]
public enum IconNameEnum
{
Empty,
<#
foreach (var entry in simpleNameToKey)
{
#>
/// <summary>
/// <#= keyToGlyph[entry.Value] #>
/// <br/>
/// icon-<#= entry.Value #>
/// </summary>
<#= entry.Key #>,
<#
}
#>
}
public static class IconNameEnumExtensions
{
/// <summary>
/// 根据图标名称枚举获取 Key
/// </summary>
/// <param name="e">图标名称枚举</param>
/// <returns>注册到资源中的 Key</returns>
/// <exception cref="NotImplementedException"></exception>
public static string GetKey(this IconNameEnum e) {
return e switch
{
IconNameEnum.Empty => null,
<#
foreach (var entry in simpleNameToKey)
{
#>
IconNameEnum.<#= entry.Key #> => "icon-<#= entry.Value #>",
<#
}
#>
_ => throw new NotImplementedException(),
};
}
/// <summary>
/// 根据图标名称获取 Glyph 枚举
/// </summary>
/// <param name="e">图标名称枚举</param>
/// <returns>图标 Glyph 枚举</returns>
/// <exception cref="NotImplementedException"></exception>
public static IconGlyphEnum GetGlyphEnum(this IconNameEnum e) {
return e switch
{
IconNameEnum.Empty => IconGlyphEnum.Empty,
<#
foreach (var entry in simpleNameToKey)
{
#>
IconNameEnum.<#= entry.Key #> => IconGlyphEnum.<#= keyToGlyph[entry.Value] #>,
<#
}
#>
_ => throw new NotImplementedException(),
};
}
/// <summary>
/// 根据图标名称获取 Glyph 字符串
/// </summary>
/// <param name="e">图标名称枚举</param>
/// <returns>图标 Glyph 字符串</returns>
/// <exception cref="NotImplementedException"></exception>
public static string GetGlyphString(this IconNameEnum e) {
return e switch
{
IconNameEnum.Empty => string.Empty,
<#
foreach (var entry in simpleNameToKey)
{
#>
IconNameEnum.<#= entry.Key #> => "\u<#= keyToGlyph[entry.Value] #>",
<#
}
#>
_ => throw new NotImplementedException(),
};
}
public static string GetImageSourceKey(this IconNameEnum e) {
return GetKey(e) + "_Image";
}
}
/// <summary>
/// 图标 Glyph 枚举
/// </summary>
// [TypeConverter(typeof(EnumConverter))]
public enum IconGlyphEnum
{
Empty,
<#
foreach (var entry in glyphToKey)
{
#>
/// <summary>
/// <#= keyToSimpleName[entry.Value] #>
/// <br/>
/// icon-<#= entry.Value #>
/// </summary>
<#= entry.Key #>,
<#
}
#>
}
public static class IconGlyphEnumExtensions
{
/// <summary>
/// 根据 Glyph 枚举获取 Key
/// </summary>
/// <param name="e">Glyph 枚举</param>
/// <returns>注册到资源中的 Key</returns>
/// <exception cref="NotImplementedException"></exception>
public static string GetKey(this IconGlyphEnum e)
{
return e switch
{
IconGlyphEnum.Empty => null,
<#
foreach (var entry in glyphToKey)
{
#>
IconGlyphEnum.<#= entry.Key #> => "icon-<#= entry.Value #>",
<#
}
#>
_ => throw new NotImplementedException(),
};
}
/// <summary>
/// 根据图标 Glyph 枚举获取图标名称枚举
/// </summary>
/// <param name="e">图标 Glyph 枚举</param>
/// <returns>图标名称枚举</returns>
/// <exception cref="NotImplementedException"></exception>
public static IconNameEnum GetNameEnum(this IconGlyphEnum e) {
return e switch
{
IconGlyphEnum.Empty => IconNameEnum.Empty,
<#
foreach (var entry in glyphToKey)
{
#>
IconGlyphEnum.<#= entry.Key #> => IconNameEnum.<#= keyToSimpleName[entry.Value] #>,
<#
}
#>
_ => throw new NotImplementedException(),
};
}
/// <summary>
/// 根据图标 Glyph 枚举获取 Glyph 字符串
/// </summary>
/// <param name="e">图标 Glyph 枚举</param>
/// <returns>图标 Glyph 字符串</returns>
/// <exception cref="NotImplementedException"></exception>
public static string GetGlyphString(this IconGlyphEnum e) {
return e switch
{
IconGlyphEnum.Empty => string.Empty,
<#
foreach (var entry in glyphToKey)
{
#>
IconGlyphEnum.<#= entry.Key #> => "\u<#= keyToGlyph[entry.Value] #>",
<#
}
#>
_ => throw new NotImplementedException(),
};
}
public static string GetImageSourceKey(this IconGlyphEnum e) {
return GetKey(e) + "_Image";
}
}
public class IconEnumNameToGlyphConverter : IValueConverter {
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) {
if (value is IconNameEnum nameEnum) {
return nameEnum.GetGlyphEnum();
}
return DependencyProperty.UnsetValue;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) {
if (value is IconGlyphEnum glyphEnum) {
return glyphEnum.GetNameEnum();
}
return DependencyProperty.UnsetValue;
}
}
public class IconGlyphNameToNameConverter : IValueConverter {
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) {
if (value is IconGlyphEnum glyphEnum) {
return glyphEnum.GetNameEnum();
}
return DependencyProperty.UnsetValue;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) {
if (value is IconNameEnum nameEnum) {
return nameEnum.GetGlyphEnum();
}
return DependencyProperty.UnsetValue;
}
}
File diff suppressed because it is too large. Load diff
@@ -0,0 +1 @@
window._iconfont_svg_string_5223831='<svg><symbol id="icon-fapiao" viewBox="0 0 1024 1024"><path d="M170.666667 868.693333l98.346666-94.72a21.333333 21.333333 0 0 1 30.72 1.173334l98.176 110.122666 98.176-110.122666a21.333333 21.333333 0 0 1 31.829334 0l98.176 110.122666 98.176-110.122666a21.333333 21.333333 0 0 1 30.72-1.173334L853.333333 868.693333V128H170.666667v740.693333z m-42.666667 49.386667V106.709333C128 94.890667 137.706667 85.333333 149.333333 85.333333h725.333334c11.776 0 21.333333 9.642667 21.333333 21.184v811.541334a21.333333 21.333333 0 0 1-36.117333 16.149333l-118.506667-114.133333-99.349333 111.445333a21.333333 21.333333 0 0 1-31.850667 0L512 821.397333l-98.176 110.122667a21.333333 21.333333 0 0 1-31.850667 0l-99.349333-111.445333-118.485333 114.133333A21.333333 21.333333 0 0 1 128 918.08zM298.666667 320c0-11.776 9.493333-21.333333 21.184-21.333333h341.632c11.690667 0 21.184 9.472 21.184 21.333333 0 11.776-9.493333 21.333333-21.184 21.333333H319.850667A21.205333 21.205333 0 0 1 298.666667 320z m0 128c0-11.776 9.6-21.333333 21.482666-21.333333h255.701334c11.861333 0 21.482667 9.472 21.482666 21.333333 0 11.776-9.6 21.333333-21.482666 21.333333H320.149333A21.354667 21.354667 0 0 1 298.666667 448z m0 128c0-11.776 9.6-21.333333 21.482666-21.333333h255.701334c11.861333 0 21.482667 9.472 21.482666 21.333333 0 11.776-9.6 21.333333-21.482666 21.333333H320.149333A21.354667 21.354667 0 0 1 298.666667 576z" fill="#3D3D3D" ></path></symbol><symbol id="icon-calendar_work_week" viewBox="0 0 1024 1024"><path d="M330.666667 298.666667a32 32 0 0 0-32 32v170.666666c0 17.664 14.336 32 32 32h362.666666a32 32 0 0 0 32-32v-170.666666a32 32 0 0 0-32-32h-362.666666z m32 170.666666V362.666667h298.666666V469.333333h-298.666666z" ></path><path d="M757.333333 896A138.666667 138.666667 0 0 0 896 757.333333V266.666667A138.666667 138.666667 0 0 0 757.333333 128H266.666667A138.666667 138.666667 0 0 0 128 266.666667v490.666666A138.666667 138.666667 0 0 0 266.666667 896h490.666666zM832 266.666667v490.666666a74.666667 74.666667 0 0 1-74.666667 74.666667H266.666667a74.666667 74.666667 0 0 1-74.666667-74.666667V266.666667c0-41.216 33.450667-74.666667 74.666667-74.666667h490.666666c41.216 0 74.666667 33.450667 74.666667 74.666667z" ></path></symbol><symbol id="icon-document_endnote" viewBox="0 0 1024 1024"><path d="M234.666667 181.333333a32 32 0 0 1 32-32H512V341.333333a85.333333 85.333333 0 0 0 85.333333 85.333334h192v416a32 32 0 0 1-32 32H554.666667V938.666667h202.666666A96 96 0 0 0 853.333333 842.666667V412.330667c0-19.797333-7.850667-38.784-21.888-52.778667l-252.330666-252.330667A74.666667 74.666667 0 0 0 526.336 85.333333H266.666667A96 96 0 0 0 170.666667 181.333333V512h64V181.333333z m341.333333 160V194.56l168.106667 168.106667H597.333333a21.333333 21.333333 0 0 1-21.333333-21.333334zM192 586.666667a32 32 0 0 1-32 32H106.666667v298.666666h53.333333a32 32 0 0 1 0 64H106.666667A64 64 0 0 1 42.666667 917.333333v-298.666666A64 64 0 0 1 106.666667 554.666667h53.333333a32 32 0 0 1 32 32z" ></path><path d="M394.666667 618.666667a32 32 0 0 1 0-64h53.333333a64 64 0 0 1 64 64v298.666666a64 64 0 0 1-64 64H394.666667a32 32 0 0 1 0-64h53.333333v-298.666666H394.666667zM277.333333 714.666667a32 32 0 0 1 32 32V896a32 32 0 0 1-64 0v-149.333333a32 32 0 0 1 32-32zM277.333333 682.666667a32 32 0 1 0 0-64 32 32 0 0 0 0 64z" ></path></symbol><symbol id="icon-leaf_three" viewBox="0 0 1024 1024"><path d="M810.666667 320c0 22.186667-3.072 43.648-8.832 64h69.12C908.373333 384 938.666667 414.293333 938.666667 451.669333V661.333333a277.333333 277.333333 0 0 1-449.493334 217.429334L438.613333 929.28a32 32 0 1 1-45.226666-45.226667l50.517333-50.56a277.077333 277.077333 0 0 1-40.704-70.613333A256 256 0 0 1 96 512V320.597333C96 284.928 124.928 256 160.597333 256h189.568A234.752 234.752 0 0 1 576 85.333333h173.226667c33.92 0 61.44 27.52 61.44 61.44V320zM414.805333 263.765333a256.554667 256.554667 0 0 1 165.504 132.266667A277.290667 277.290667 0 0 1 661.333333 384h72.96c7.978667-19.754667 12.373333-41.386667 12.373334-64v-170.666667h-170.666667a170.752 170.752 0 0 0-161.194667 114.432z m120.021334 569.344A213.333333 213.333333 0 0 0 874.666667 661.333333v-209.664a3.669333 3.669333 0 0 0-3.669334-3.669333H661.333333a213.333333 213.333333 0 0 0-171.776 339.84l181.162667-181.12a32 32 0 1 1 45.226667 45.226667l-181.12 181.162666zM384 661.333333c0-25.258667 3.413333-49.749333 9.728-73.002666L276.053333 470.613333a32 32 0 1 1 45.226667-45.226666l98.901333 98.858666a278.698667 278.698667 0 0 1 101.333334-102.485333A192 192 0 0 0 352 320H160.384l-0.213333 0.170667a0.938667 0.938667 0 0 0-0.128 0.213333l-0.042667 0.213333V512a192 192 0 0 0 226.816 188.842667A279.765333 279.765333 0 0 1 384 661.333333z" ></path></symbol><symbol id="icon-re_order_dots_horizontal" viewBox="0 0 1024 1024"><path d="M298.666667 661.333333a64 64 0 1 1-128 0 64 64 0 0 1 128 0z m0-298.666666a64 64 0 1 1-128 0 64 64 0 0 1 128 0z m298.666666 298.666666a64 64 0 1 1-128 0 64 64 0 0 1 128 Line truncated
File diff suppressed because it is too large. Load diff
@@ -2,13 +2,22 @@
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:f="clr-namespace:Store.Management.Framework.Controls">
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="Fonts/FontGeometry.xaml" />
<ResourceDictionary Source="pack://application:,,,/MAX.Common.WPF;component/Resources/Generic.xaml" />
<ResourceDictionary Source="/Store.Management.Framework;component/Controls/DataGridEx/DataGridEx.xaml" />
</ResourceDictionary.MergedDictionaries>
<FontFamily x:Key="IconPack">Fonts/iconfont.ttf#iconfont</FontFamily>
<Style x:Key="TextBlockIcon" TargetType="{x:Type TextBlock}">
<Setter Property="FontFamily" Value="{StaticResource IconPack}" />
<Setter Property="HorizontalAlignment" Value="Center" />
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="FontSize" Value="18" />
</Style>
<Style BasedOn="{StaticResource TextBlockIcon}" TargetType="{x:Type f:IconText}" />
<Style
x:Key="WindowBase"
BasedOn="{StaticResource WindowWin10}"
@@ -2,8 +2,10 @@
using MAX.Common.WPF.Converters;
using MAX.Common.WPF.Utilities;
using MAX.Core;
using MAX.Core.Autofac;
using MAX.Framework.Interfaces;
using Store.Management.Api;
using Store.Management.Framework.Extensions;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -28,6 +30,31 @@ namespace Store.Management.Framework
BaseUrl = new Uri("http://localhost:14312/api/")
});
builder.Register(_ => client).SingleInstance().PreserveExistingDefaults();
DISource.Resolver = Resolve;
}
protected virtual object? Resolve(Type? type, string? name)
{
if (type == null)
{
return null;
}
if (IocManager.Container is not null)
{
if (name != null)
{
if (IocManager.Container.IsRegisteredWithName(name, type))
{
return IocManager.Container.ResolveNamed(name, type);
}
return null;
}
return IocManager.Resolve(type);
}
return Activator.CreateInstance(type);
}
}
}
@@ -9,6 +9,10 @@
<Content Remove="C:\Users\chaih\.nuget\packages\handycontrol\3.6.2.1\contentFiles\any\net8.0-windows7.0\LangProvider.tt" />
</ItemGroup>
<ItemGroup>
<None Remove="Resources\Fonts\iconfont.ttf" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="HandyControl" Version="3.6.2.1" />
<PackageReference Include="MAX.Common.WPF" Version="1.4.23" />
@@ -22,4 +26,31 @@
<Folder Include="DependencyInjection\" />
</ItemGroup>
<ItemGroup>
<Resource Include="Resources\Fonts\iconfont.ttf" />
</ItemGroup>
<ItemGroup>
<None Update="Resources\Fonts\FontGeometry.tt">
<Generator>TextTemplatingFileGenerator</Generator>
<LastGenOutput>FontGeometry.xaml</LastGenOutput>
</None>
<None Update="Resources\Fonts\IconEnum.tt">
<Generator>TextTemplatingFileGenerator</Generator>
<LastGenOutput>IconEnum.cs</LastGenOutput>
</None>
</ItemGroup>
<ItemGroup>
<Service Include="{508349b6-6b84-4df5-91f0-309beebad82d}" />
</ItemGroup>
<ItemGroup>
<Compile Update="Resources\Fonts\IconEnum.cs">
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
<DependentUpon>IconEnum.tt</DependentUpon>
</Compile>
</ItemGroup>
</Project>