support for doc
This commit is contained in:
1 parent
d15dda019a
commit
4a335f46cb
8 files changed
+86
-2
No files matched your search
@@ -1,5 +1,13 @@
|
|||||||
---
|
---
|
||||||
title: 建设中
|
title: IconSwitchElement 可切换图标的元素
|
||||||
---
|
---
|
||||||
|
|
||||||
建设中
|
{% note info no-icon %}
|
||||||
|
继承自 [IconElement](https://handyorg.github.io/handycontrol/attach/iconElement/)
|
||||||
|
{% endnote %}
|
||||||
|
|
||||||
|
# 属性
|
||||||
|
|
||||||
|
| 名称 | 用途 |
|
||||||
|
|-|-|
|
||||||
|
| GeometrySelected | 选中时的几何形状 |
|
||||||
@@ -391,6 +391,9 @@
|
|||||||
<Resource Include="..\..\Shared\HandyControlDemo_Shared\Resources\fabric-icons.ttf">
|
<Resource Include="..\..\Shared\HandyControlDemo_Shared\Resources\fabric-icons.ttf">
|
||||||
<Link>Resources\fabric-icons.ttf</Link>
|
<Link>Resources\fabric-icons.ttf</Link>
|
||||||
</Resource>
|
</Resource>
|
||||||
|
<Resource Include="..\..\Shared\HandyControlDemo_Shared\Resources\Registry.txt">
|
||||||
|
<Link>Resources\Registry.txt</Link>
|
||||||
|
</Resource>
|
||||||
<Resource Include="..\..\Shared\HandyControlDemo_Shared\Resources\Img\LeftMainContent\brackets_Square_16xLG.png">
|
<Resource Include="..\..\Shared\HandyControlDemo_Shared\Resources\Img\LeftMainContent\brackets_Square_16xLG.png">
|
||||||
<Link>Resources\Img\LeftMainContent\brackets_Square_16xLG.png</Link>
|
<Link>Resources\Img\LeftMainContent\brackets_Square_16xLG.png</Link>
|
||||||
</Resource>
|
</Resource>
|
||||||
|
|||||||
@@ -420,6 +420,9 @@
|
|||||||
<Resource Include="..\..\Shared\HandyControlDemo_Shared\Resources\fabric-icons.ttf">
|
<Resource Include="..\..\Shared\HandyControlDemo_Shared\Resources\fabric-icons.ttf">
|
||||||
<Link>Resources\fabric-icons.ttf</Link>
|
<Link>Resources\fabric-icons.ttf</Link>
|
||||||
</Resource>
|
</Resource>
|
||||||
|
<Resource Include="..\..\Shared\HandyControlDemo_Shared\Resources\Registry.txt">
|
||||||
|
<Link>Resources\Registry.txt</Link>
|
||||||
|
</Resource>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Content Include="..\..\Shared\HandyControlDemo_Shared\Data\MessageToken.tt">
|
<Content Include="..\..\Shared\HandyControlDemo_Shared\Data\MessageToken.tt">
|
||||||
|
|||||||
@@ -567,6 +567,9 @@
|
|||||||
<Resource Include="..\..\Shared\HandyControlDemo_Shared\Resources\fabric-icons.ttf">
|
<Resource Include="..\..\Shared\HandyControlDemo_Shared\Resources\fabric-icons.ttf">
|
||||||
<Link>Resources\fabric-icons.ttf</Link>
|
<Link>Resources\fabric-icons.ttf</Link>
|
||||||
</Resource>
|
</Resource>
|
||||||
|
<Resource Include="..\..\Shared\HandyControlDemo_Shared\Resources\Registry.txt">
|
||||||
|
<Link>Resources\Registry.txt</Link>
|
||||||
|
</Resource>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Import Project="..\..\Shared\HandyControlDemo_Shared\HandyControlDemo_Shared.projitems" Label="Shared" />
|
<Import Project="..\..\Shared\HandyControlDemo_Shared\HandyControlDemo_Shared.projitems" Label="Shared" />
|
||||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
|
|||||||
@@ -1,6 +1,10 @@
|
|||||||
using System;
|
using System;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using System.Diagnostics.CodeAnalysis;
|
||||||
|
using System.IO;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
using System.Security.Authentication;
|
using System.Security.Authentication;
|
||||||
|
using System.Threading;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using HandyControl.Data;
|
using HandyControl.Data;
|
||||||
using HandyControl.Tools;
|
using HandyControl.Tools;
|
||||||
@@ -11,10 +15,36 @@ namespace HandyControlDemo
|
|||||||
{
|
{
|
||||||
public partial class App
|
public partial class App
|
||||||
{
|
{
|
||||||
|
// ReSharper disable once NotAccessedField.Local
|
||||||
|
[SuppressMessage("代码质量", "IDE0052:删除未读的私有成员", Justification = "<挂起>")]
|
||||||
|
private static Mutex AppMutex;
|
||||||
|
|
||||||
|
public App()
|
||||||
|
{
|
||||||
|
AppMutex = new Mutex(true, "HandyControlDemo", out var createdNew);
|
||||||
|
|
||||||
|
if (!createdNew)
|
||||||
|
{
|
||||||
|
var current = Process.GetCurrentProcess();
|
||||||
|
|
||||||
|
foreach (var process in Process.GetProcessesByName(current.ProcessName))
|
||||||
|
{
|
||||||
|
if (process.Id != current.Id)
|
||||||
|
{
|
||||||
|
Win32Helper.SetForegroundWindow(process.MainWindowHandle);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Shutdown();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
protected override void OnStartup(StartupEventArgs e)
|
protected override void OnStartup(StartupEventArgs e)
|
||||||
{
|
{
|
||||||
base.OnStartup(e);
|
base.OnStartup(e);
|
||||||
|
|
||||||
|
UpdateRegistry();
|
||||||
|
|
||||||
ShutdownMode = ShutdownMode.OnMainWindowClose;
|
ShutdownMode = ShutdownMode.OnMainWindowClose;
|
||||||
GlobalData.Init();
|
GlobalData.Init();
|
||||||
ConfigHelper.Instance.SetLang(GlobalData.Config.Lang);
|
ConfigHelper.Instance.SetLang(GlobalData.Config.Lang);
|
||||||
@@ -54,5 +84,30 @@ namespace HandyControlDemo
|
|||||||
});
|
});
|
||||||
Current.MainWindow?.OnApplyTemplate();
|
Current.MainWindow?.OnApplyTemplate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void UpdateRegistry()
|
||||||
|
{
|
||||||
|
var processModule = Process.GetCurrentProcess().MainModule;
|
||||||
|
if (processModule != null)
|
||||||
|
{
|
||||||
|
var registryFilePath = $"{Path.GetDirectoryName(processModule.FileName)}\\Registry.reg";
|
||||||
|
if (!File.Exists(registryFilePath))
|
||||||
|
{
|
||||||
|
var streamResourceInfo = GetResourceStream(new Uri("pack://application:,,,/Resources/Registry.txt"));
|
||||||
|
if (streamResourceInfo != null)
|
||||||
|
{
|
||||||
|
using var reader = new StreamReader(streamResourceInfo.Stream);
|
||||||
|
var registryStr = reader.ReadToEnd();
|
||||||
|
var newRegistryStr = registryStr.Replace("#", processModule.FileName.Replace("\\", "\\\\"));
|
||||||
|
File.WriteAllText(registryFilePath, newRegistryStr);
|
||||||
|
Process.Start(new ProcessStartInfo("cmd", $"/c {registryFilePath}")
|
||||||
|
{
|
||||||
|
UseShellExecute = false,
|
||||||
|
CreateNoWindow = true
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -33,6 +33,7 @@
|
|||||||
<Compile Include="$(MSBuildThisFileDirectory)Tools\Helper\AssemblyHelper.cs" />
|
<Compile Include="$(MSBuildThisFileDirectory)Tools\Helper\AssemblyHelper.cs" />
|
||||||
<Compile Include="$(MSBuildThisFileDirectory)Tools\Helper\CommonHelper.cs" />
|
<Compile Include="$(MSBuildThisFileDirectory)Tools\Helper\CommonHelper.cs" />
|
||||||
<Compile Include="$(MSBuildThisFileDirectory)Tools\Helper\ExternDllHelper.cs" />
|
<Compile Include="$(MSBuildThisFileDirectory)Tools\Helper\ExternDllHelper.cs" />
|
||||||
|
<Compile Include="$(MSBuildThisFileDirectory)Tools\Helper\Win32Helper.cs" />
|
||||||
<Compile Include="$(MSBuildThisFileDirectory)UserControl\Basic\Avatar.xaml.cs">
|
<Compile Include="$(MSBuildThisFileDirectory)UserControl\Basic\Avatar.xaml.cs">
|
||||||
<DependentUpon>Avatar.xaml</DependentUpon>
|
<DependentUpon>Avatar.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
|||||||
Binary file not shown.
@@ -0,0 +1,11 @@
|
|||||||
|
using System;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
|
namespace HandyControlDemo.Tools
|
||||||
|
{
|
||||||
|
internal class Win32Helper
|
||||||
|
{
|
||||||
|
[DllImport("user32.dll", ExactSpelling = true, CharSet = CharSet.Auto)]
|
||||||
|
public static extern bool SetForegroundWindow(IntPtr hWnd);
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in new issue
Block a user