[update] PerformanceDesktopWindow, ToggleSwitch控件大差不差, SettingsBaseView更新
This commit is contained in:
parent
39611a8807
commit
a8267ac03b
@ -11,7 +11,7 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "InkCanvasForClass.IACoreHel
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "InkCanvasForClass.PowerPoint.InteropHelper", "InkCanvasForClass.PowerPoint.InteropHelper\InkCanvasForClass.PowerPoint.InteropHelper.csproj", "{2D8A9217-465A-4F57-BD58-CE02450390C4}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "InkCanvasForClass.PowerPoint.Vsto", "InkCanvasForClass.PowerPoint.Vsto\InkCanvasForClass.PowerPoint.Vsto.csproj", "{E494CFFE-D2EC-4BAD-82D9-C92FE29616A7}"
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "InkCanvasForClass.PowerPoint.VstoPlugin", "InkCanvasForClass.PowerPoint.VstoPlugin\InkCanvasForClass.PowerPoint.VstoPlugin.csproj", "{8C593467-E54D-4FA7-881C-78F3CC48A867}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
@ -152,36 +152,36 @@ Global
|
||||
{2D8A9217-465A-4F57-BD58-CE02450390C4}.x86 Debug|x64.Build.0 = Debug|Any CPU
|
||||
{2D8A9217-465A-4F57-BD58-CE02450390C4}.x86 Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{2D8A9217-465A-4F57-BD58-CE02450390C4}.x86 Debug|x86.Build.0 = Debug|Any CPU
|
||||
{E494CFFE-D2EC-4BAD-82D9-C92FE29616A7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{E494CFFE-D2EC-4BAD-82D9-C92FE29616A7}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{E494CFFE-D2EC-4BAD-82D9-C92FE29616A7}.Debug|ARM.ActiveCfg = Debug|Any CPU
|
||||
{E494CFFE-D2EC-4BAD-82D9-C92FE29616A7}.Debug|ARM.Build.0 = Debug|Any CPU
|
||||
{E494CFFE-D2EC-4BAD-82D9-C92FE29616A7}.Debug|ARM64.ActiveCfg = Debug|Any CPU
|
||||
{E494CFFE-D2EC-4BAD-82D9-C92FE29616A7}.Debug|ARM64.Build.0 = Debug|Any CPU
|
||||
{E494CFFE-D2EC-4BAD-82D9-C92FE29616A7}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{E494CFFE-D2EC-4BAD-82D9-C92FE29616A7}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{E494CFFE-D2EC-4BAD-82D9-C92FE29616A7}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{E494CFFE-D2EC-4BAD-82D9-C92FE29616A7}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{E494CFFE-D2EC-4BAD-82D9-C92FE29616A7}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{E494CFFE-D2EC-4BAD-82D9-C92FE29616A7}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{E494CFFE-D2EC-4BAD-82D9-C92FE29616A7}.Release|ARM.ActiveCfg = Release|Any CPU
|
||||
{E494CFFE-D2EC-4BAD-82D9-C92FE29616A7}.Release|ARM.Build.0 = Release|Any CPU
|
||||
{E494CFFE-D2EC-4BAD-82D9-C92FE29616A7}.Release|ARM64.ActiveCfg = Release|Any CPU
|
||||
{E494CFFE-D2EC-4BAD-82D9-C92FE29616A7}.Release|ARM64.Build.0 = Release|Any CPU
|
||||
{E494CFFE-D2EC-4BAD-82D9-C92FE29616A7}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{E494CFFE-D2EC-4BAD-82D9-C92FE29616A7}.Release|x64.Build.0 = Release|Any CPU
|
||||
{E494CFFE-D2EC-4BAD-82D9-C92FE29616A7}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{E494CFFE-D2EC-4BAD-82D9-C92FE29616A7}.Release|x86.Build.0 = Release|Any CPU
|
||||
{E494CFFE-D2EC-4BAD-82D9-C92FE29616A7}.x86 Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{E494CFFE-D2EC-4BAD-82D9-C92FE29616A7}.x86 Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{E494CFFE-D2EC-4BAD-82D9-C92FE29616A7}.x86 Debug|ARM.ActiveCfg = Debug|Any CPU
|
||||
{E494CFFE-D2EC-4BAD-82D9-C92FE29616A7}.x86 Debug|ARM.Build.0 = Debug|Any CPU
|
||||
{E494CFFE-D2EC-4BAD-82D9-C92FE29616A7}.x86 Debug|ARM64.ActiveCfg = Debug|Any CPU
|
||||
{E494CFFE-D2EC-4BAD-82D9-C92FE29616A7}.x86 Debug|ARM64.Build.0 = Debug|Any CPU
|
||||
{E494CFFE-D2EC-4BAD-82D9-C92FE29616A7}.x86 Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{E494CFFE-D2EC-4BAD-82D9-C92FE29616A7}.x86 Debug|x64.Build.0 = Debug|Any CPU
|
||||
{E494CFFE-D2EC-4BAD-82D9-C92FE29616A7}.x86 Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{E494CFFE-D2EC-4BAD-82D9-C92FE29616A7}.x86 Debug|x86.Build.0 = Debug|Any CPU
|
||||
{8C593467-E54D-4FA7-881C-78F3CC48A867}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{8C593467-E54D-4FA7-881C-78F3CC48A867}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{8C593467-E54D-4FA7-881C-78F3CC48A867}.Debug|ARM.ActiveCfg = Debug|Any CPU
|
||||
{8C593467-E54D-4FA7-881C-78F3CC48A867}.Debug|ARM.Build.0 = Debug|Any CPU
|
||||
{8C593467-E54D-4FA7-881C-78F3CC48A867}.Debug|ARM64.ActiveCfg = Debug|Any CPU
|
||||
{8C593467-E54D-4FA7-881C-78F3CC48A867}.Debug|ARM64.Build.0 = Debug|Any CPU
|
||||
{8C593467-E54D-4FA7-881C-78F3CC48A867}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{8C593467-E54D-4FA7-881C-78F3CC48A867}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{8C593467-E54D-4FA7-881C-78F3CC48A867}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{8C593467-E54D-4FA7-881C-78F3CC48A867}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{8C593467-E54D-4FA7-881C-78F3CC48A867}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{8C593467-E54D-4FA7-881C-78F3CC48A867}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{8C593467-E54D-4FA7-881C-78F3CC48A867}.Release|ARM.ActiveCfg = Release|Any CPU
|
||||
{8C593467-E54D-4FA7-881C-78F3CC48A867}.Release|ARM.Build.0 = Release|Any CPU
|
||||
{8C593467-E54D-4FA7-881C-78F3CC48A867}.Release|ARM64.ActiveCfg = Release|Any CPU
|
||||
{8C593467-E54D-4FA7-881C-78F3CC48A867}.Release|ARM64.Build.0 = Release|Any CPU
|
||||
{8C593467-E54D-4FA7-881C-78F3CC48A867}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{8C593467-E54D-4FA7-881C-78F3CC48A867}.Release|x64.Build.0 = Release|Any CPU
|
||||
{8C593467-E54D-4FA7-881C-78F3CC48A867}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{8C593467-E54D-4FA7-881C-78F3CC48A867}.Release|x86.Build.0 = Release|Any CPU
|
||||
{8C593467-E54D-4FA7-881C-78F3CC48A867}.x86 Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{8C593467-E54D-4FA7-881C-78F3CC48A867}.x86 Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{8C593467-E54D-4FA7-881C-78F3CC48A867}.x86 Debug|ARM.ActiveCfg = Debug|Any CPU
|
||||
{8C593467-E54D-4FA7-881C-78F3CC48A867}.x86 Debug|ARM.Build.0 = Debug|Any CPU
|
||||
{8C593467-E54D-4FA7-881C-78F3CC48A867}.x86 Debug|ARM64.ActiveCfg = Debug|Any CPU
|
||||
{8C593467-E54D-4FA7-881C-78F3CC48A867}.x86 Debug|ARM64.Build.0 = Debug|Any CPU
|
||||
{8C593467-E54D-4FA7-881C-78F3CC48A867}.x86 Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{8C593467-E54D-4FA7-881C-78F3CC48A867}.x86 Debug|x64.Build.0 = Debug|Any CPU
|
||||
{8C593467-E54D-4FA7-881C-78F3CC48A867}.x86 Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{8C593467-E54D-4FA7-881C-78F3CC48A867}.x86 Debug|x86.Build.0 = Debug|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
Binary file not shown.
@ -1,18 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<customUI xmlns="http://schemas.microsoft.com/office/2009/07/customui" onLoad="Ribbon_Load">
|
||||
<ribbon>
|
||||
<tabs>
|
||||
<tab idMso="TabAddIns" label="InkCanvasForClass">
|
||||
<group id="ContentGroup" label="Content">
|
||||
<button id="textButton" label="Insert Text"
|
||||
screentip="Text" onAction="OnTextButton"
|
||||
supertip="Inserts text at the cursor location."/>
|
||||
<button id="tableButton" label="Insert Table"
|
||||
screentip="Table" onAction="OnTableButton"
|
||||
supertip="Inserts a table at the cursor location."/>
|
||||
</group>
|
||||
</tab>
|
||||
</tabs>
|
||||
</ribbon>
|
||||
</customUI>
|
||||
|
@ -21,11 +21,11 @@
|
||||
<ProjectTypeGuids>{BAA0C2D2-18E2-41B9-852F-F413020CAA33};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{E494CFFE-D2EC-4BAD-82D9-C92FE29616A7}</ProjectGuid>
|
||||
<ProjectGuid>{8C593467-E54D-4FA7-881C-78F3CC48A867}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<NoStandardLibraries>false</NoStandardLibraries>
|
||||
<RootNamespace>InkCanvasForClassPPTVsto</RootNamespace>
|
||||
<AssemblyName>InkCanvasForClassPPTVsto</AssemblyName>
|
||||
<RootNamespace>InkCanvasForClass.PowerPoint.VstoPlugin</RootNamespace>
|
||||
<AssemblyName>InkCanvasForClass.PowerPoint.VstoPlugin</AssemblyName>
|
||||
<LoadBehavior>3</LoadBehavior>
|
||||
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
|
||||
<DefineConstants>VSTO40</DefineConstants>
|
||||
@ -166,7 +166,6 @@
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Resources.resx</DependentUpon>
|
||||
</Compile>
|
||||
<None Include="InkCanvasForClassPPTVsto_TemporaryKey.pfx" />
|
||||
<None Include="Properties\Settings.settings">
|
||||
<Generator>SettingsSingleFileGenerator</Generator>
|
||||
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
||||
@ -193,15 +192,6 @@
|
||||
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
|
||||
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<SignManifests>true</SignManifests>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<ManifestKeyFile>InkCanvasForClassPPTVsto_TemporaryKey.pfx</ManifestKeyFile>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<ManifestCertificateThumbprint>E0DCEEAE8C0D178489A9D826E0280507E45B0283</ManifestCertificateThumbprint>
|
||||
</PropertyGroup>
|
||||
<!-- Include the build rules for a C# project. -->
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- Include additional build rules for an Office application add-in. -->
|
||||
@ -211,7 +201,7 @@
|
||||
<VisualStudio>
|
||||
<FlavorProperties GUID="{BAA0C2D2-18E2-41B9-852F-F413020CAA33}">
|
||||
<ProjectProperties HostName="PowerPoint" HostPackage="{29A7B9D7-A7F1-4328-8EF0-6B2D1A56B2C1}" OfficeVersion="15.0" VstxVersion="4.0" ApplicationType="PowerPoint" Language="cs" TemplatesPath="" DebugInfoExeName="#Software\Microsoft\Office\16.0\PowerPoint\InstallRoot\Path#powerpnt.exe" AddItemTemplatesGuid="{51063C3A-E220-4D12-8922-BDA915ACD783}" />
|
||||
<Host Name="PowerPoint" GeneratedCodeNamespace="InkCanvasForClassPPTVsto" IconIndex="0">
|
||||
<Host Name="PowerPoint" GeneratedCodeNamespace="InkCanvasForClass.PowerPoint.VstoPlugin" IconIndex="0">
|
||||
<HostItem Name="ThisAddIn" Code="ThisAddIn.cs" CanonicalName="AddIn" CanActivate="false" IconIndex="1" Blueprint="ThisAddIn.Designer.xml" GeneratedCode="ThisAddIn.Designer.cs" />
|
||||
</Host>
|
||||
</FlavorProperties>
|
@ -26,7 +26,7 @@ using Office = Microsoft.Office.Core;
|
||||
// 有关详细信息,请参见 Visual Studio Tools for Office 帮助中的功能区 XML 文档。
|
||||
|
||||
|
||||
namespace InkCanvasForClassPPTVsto {
|
||||
namespace InkCanvasForClass.PowerPoint.VstoPlugin {
|
||||
[ComVisible(true)]
|
||||
public class MainRibbon : Office.IRibbonExtensibility {
|
||||
private Office.IRibbonUI ribbon;
|
||||
@ -37,7 +37,7 @@ namespace InkCanvasForClassPPTVsto {
|
||||
#region IRibbonExtensibility 成员
|
||||
|
||||
public string GetCustomUI(string ribbonID) {
|
||||
return GetResourceText("InkCanvasForClassPPTVsto.MainRibbon.xml");
|
||||
return GetResourceText("InkCanvasForClass.PowerPoint.VstoPlugin.MainRibbon.xml");
|
||||
}
|
||||
|
||||
#endregion
|
13
InkCanvasForClass.PowerPoint.VstoPlugin/MainRibbon.xml
Normal file
13
InkCanvasForClass.PowerPoint.VstoPlugin/MainRibbon.xml
Normal file
@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<customUI xmlns="http://schemas.microsoft.com/office/2009/07/customui" onLoad="Ribbon_Load">
|
||||
<ribbon>
|
||||
<tabs>
|
||||
<tab idMso="TabAddIns">
|
||||
<group id="MyGroup"
|
||||
label="My Group">
|
||||
</group>
|
||||
</tab>
|
||||
</tabs>
|
||||
</ribbon>
|
||||
</customUI>
|
||||
|
@ -6,11 +6,11 @@ using System.Security;
|
||||
// 有关程序集的一般信息由以下
|
||||
// 控制。更改这些特性值可修改
|
||||
// 与程序集关联的信息。
|
||||
[assembly: AssemblyTitle("InkCanvasForClassPPTVsto")]
|
||||
[assembly: AssemblyTitle("InkCanvasForClass.PowerPoint.VstoPlugin")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("InkCanvasForClassPPTVsto")]
|
||||
[assembly: AssemblyProduct("InkCanvasForClass.PowerPoint.VstoPlugin")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2024")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
@ -21,7 +21,7 @@ using System.Security;
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
|
||||
[assembly: Guid("cfac1b17-2ab3-422a-9a48-a2d01a63f52d")]
|
||||
[assembly: Guid("d9844682-af03-445c-826b-7c1e2b7959a1")]
|
||||
|
||||
// 程序集的版本信息由下列四个值组成:
|
||||
//
|
@ -8,7 +8,7 @@
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace InkCanvasForClassPPTVsto.Properties {
|
||||
namespace InkCanvasForClass.PowerPoint.VstoPlugin.Properties {
|
||||
|
||||
|
||||
/// <summary>
|
||||
@ -38,7 +38,7 @@ namespace InkCanvasForClassPPTVsto.Properties {
|
||||
internal static global::System.Resources.ResourceManager ResourceManager {
|
||||
get {
|
||||
if (object.ReferenceEquals(resourceMan, null)) {
|
||||
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("InkCanvasForClassPPTVsto.Properties.Resources", typeof(Resources).Assembly);
|
||||
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("InkCanvasForClass.PowerPoint.VstoPlugin.Properties.Resources", typeof(Resources).Assembly);
|
||||
resourceMan = temp;
|
||||
}
|
||||
return resourceMan;
|
@ -8,7 +8,7 @@
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace InkCanvasForClassPPTVsto.Properties {
|
||||
namespace InkCanvasForClass.PowerPoint.VstoPlugin.Properties {
|
||||
|
||||
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
@ -9,7 +9,7 @@
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
#pragma warning disable 414
|
||||
namespace InkCanvasForClassPPTVsto {
|
||||
namespace InkCanvasForClass.PowerPoint.VstoPlugin {
|
||||
|
||||
|
||||
///
|
@ -1,4 +1,4 @@
|
||||
<hostitem:hostItem hostitem:baseType="Microsoft.Office.Tools.AddInBase" hostitem:namespace="InkCanvasForClassPPTVsto" hostitem:className="ThisAddIn" hostitem:identifier="ThisAddIn" hostitem:primaryCookie="AddIn" hostitem:master="true" hostitem:factoryType="Microsoft.Office.Tools.Factory" hostitem:startupIndex="0" xmlns:hostitem="http://schemas.microsoft.com/2004/VisualStudio/Tools/Applications/HostItem.xsd">
|
||||
<hostitem:hostItem hostitem:baseType="Microsoft.Office.Tools.AddInBase" hostitem:namespace="InkCanvasForClass.PowerPoint.VstoPlugin" hostitem:className="ThisAddIn" hostitem:identifier="ThisAddIn" hostitem:primaryCookie="AddIn" hostitem:master="true" hostitem:factoryType="Microsoft.Office.Tools.Factory" hostitem:startupIndex="0" xmlns:hostitem="http://schemas.microsoft.com/2004/VisualStudio/Tools/Applications/HostItem.xsd">
|
||||
<hostitem:hostObject hostitem:name="Application" hostitem:identifier="Application" hostitem:type="Microsoft.Office.Interop.PowerPoint.Application" hostitem:cookie="Application" hostitem:modifier="Internal" />
|
||||
<hostitem:hostControl hostitem:name="CustomTaskPanes" hostitem:identifier="CustomTaskPanes" hostitem:type="Microsoft.Office.Tools.CustomTaskPaneCollection" hostitem:primaryCookie="CustomTaskPanes" hostitem:modifier="Internal" />
|
||||
</hostitem:hostItem>
|
@ -6,7 +6,7 @@ using System.Xml.Linq;
|
||||
using PowerPoint = Microsoft.Office.Interop.PowerPoint;
|
||||
using Office = Microsoft.Office.Core;
|
||||
|
||||
namespace InkCanvasForClassPPTVsto
|
||||
namespace InkCanvasForClass.PowerPoint.VstoPlugin
|
||||
{
|
||||
public partial class ThisAddIn
|
||||
{
|
@ -0,0 +1,4 @@
|
||||
// <autogenerated />
|
||||
using System;
|
||||
using System.Reflection;
|
||||
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
|
Binary file not shown.
Binary file not shown.
@ -21,9 +21,6 @@ using Ink_Canvas.Resources.ICCConfiguration;
|
||||
|
||||
namespace Ink_Canvas {
|
||||
|
||||
/// <summary>
|
||||
/// Interaction logic for App.xaml
|
||||
/// </summary>
|
||||
public partial class App : Application {
|
||||
|
||||
[DllImport("UIAccessDLL_x86.dll", EntryPoint = "PrepareUIAccess", CallingConvention = CallingConvention.Cdecl)]
|
||||
@ -58,9 +55,9 @@ namespace Ink_Canvas {
|
||||
var identity = WindowsIdentity.GetCurrent();
|
||||
var principal = new WindowsPrincipal(identity);
|
||||
if (Environment.Is64BitProcess && principal.IsInRole(WindowsBuiltInRole.Administrator)) {
|
||||
Trace.WriteLine(PrepareUIAccessX64());
|
||||
//Trace.WriteLine(PrepareUIAccessX64());
|
||||
} else if (principal.IsInRole(WindowsBuiltInRole.Administrator)) {
|
||||
PrepareUIAccessX86();
|
||||
//PrepareUIAccessX86();
|
||||
}
|
||||
|
||||
RootPath = AppDomain.CurrentDomain.SetupInformation.ApplicationBase;
|
||||
@ -119,23 +116,10 @@ namespace Ink_Canvas {
|
||||
}
|
||||
|
||||
mainWin = new MainWindow();
|
||||
|
||||
if (isUsingWindowChrome && DwmCompositionHelper.DwmIsCompositionEnabled()) {
|
||||
mainWin.AllowsTransparency = false;
|
||||
WindowChrome wc = new WindowChrome();
|
||||
wc.GlassFrameThickness = new Thickness(-1);
|
||||
wc.CaptionHeight = 0;
|
||||
wc.CornerRadius = new CornerRadius(0);
|
||||
wc.ResizeBorderThickness = new Thickness(0);
|
||||
WindowChrome.SetWindowChrome(mainWin, wc);
|
||||
} else {
|
||||
mainWin.AllowsTransparency = true;
|
||||
WindowChrome.SetWindowChrome(mainWin, null);
|
||||
}
|
||||
mainWin.Show();
|
||||
|
||||
var setW = new SettingsWindow();
|
||||
setW.Show();
|
||||
//var setW = new SettingsWindow();
|
||||
//setW.Show();
|
||||
|
||||
_taskbar = (TaskbarIcon)FindResource("TaskbarTrayIcon");
|
||||
|
||||
|
12
InkCanvasForClass/Components/SegmentedButtons.xaml
Normal file
12
InkCanvasForClass/Components/SegmentedButtons.xaml
Normal file
@ -0,0 +1,12 @@
|
||||
<UserControl x:Class="Ink_Canvas.Components.SegmentedButtons"
|
||||
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:Ink_Canvas.Components"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="450" d:DesignWidth="800">
|
||||
<Grid>
|
||||
|
||||
</Grid>
|
||||
</UserControl>
|
25
InkCanvasForClass/Components/SegmentedButtons.xaml.cs
Normal file
25
InkCanvasForClass/Components/SegmentedButtons.xaml.cs
Normal file
@ -0,0 +1,25 @@
|
||||
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.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace Ink_Canvas.Components {
|
||||
/// <summary>
|
||||
/// SegmentedButtons.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class SegmentedButtons : UserControl {
|
||||
public SegmentedButtons() {
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
23
InkCanvasForClass/Components/ToggleSwitch.xaml
Normal file
23
InkCanvasForClass/Components/ToggleSwitch.xaml
Normal file
@ -0,0 +1,23 @@
|
||||
<UserControl x:Class="Ink_Canvas.Components.ToggleSwitch"
|
||||
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:Ink_Canvas.Components"
|
||||
mc:Ignorable="d">
|
||||
<Grid>
|
||||
<Border x:Name="BackgroundBorder" Width="48" Height="25" Background="{Binding SwitchBackground, RelativeSource={RelativeSource AncestorType=UserControl}}" VerticalAlignment="Center" HorizontalAlignment="Right" CornerRadius="12" Padding="3,0">
|
||||
<Grid>
|
||||
<Border x:Name="ThumbBorder" Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Left" VerticalAlignment="Center">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"></DropShadowEffect>
|
||||
</Border.Effect>
|
||||
<Border.RenderTransform>
|
||||
<TranslateTransform x:Name="ThumbTranslateTransform" X="0"></TranslateTransform>
|
||||
</Border.RenderTransform>
|
||||
</Border>
|
||||
<Border x:Name="OverlayBorder" Visibility="Hidden" IsHitTestVisible="False" Width="48" Height="25" Background="Black" Opacity="0.2" Margin="-3,0" VerticalAlignment="Center" HorizontalAlignment="Right" CornerRadius="12"/>
|
||||
</Grid>
|
||||
</Border>
|
||||
</Grid>
|
||||
</UserControl>
|
169
InkCanvasForClass/Components/ToggleSwitch.xaml.cs
Normal file
169
InkCanvasForClass/Components/ToggleSwitch.xaml.cs
Normal file
@ -0,0 +1,169 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
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.Animation;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
using Windows.UI.Xaml;
|
||||
using RoutedEventArgs = System.Windows.RoutedEventArgs;
|
||||
using UIElement = System.Windows.UIElement;
|
||||
using Visibility = System.Windows.Visibility;
|
||||
|
||||
namespace Ink_Canvas.Components {
|
||||
|
||||
/// <summary>
|
||||
/// ToggleSwitch 用于在 WPF 中实现功能完整的切换开关控件
|
||||
/// </summary>
|
||||
public partial class ToggleSwitch : UserControl {
|
||||
private bool isToggledByUser = false;
|
||||
private bool isAnimating { get; set; } = false;
|
||||
|
||||
public static readonly System.Windows.RoutedEvent OnToggledEvent = EventManager.RegisterRoutedEvent(
|
||||
name: "OnToggled",
|
||||
routingStrategy: RoutingStrategy.Bubble,
|
||||
handlerType: typeof(System.Windows.RoutedEventHandler),
|
||||
ownerType: typeof(ToggleSwitch));
|
||||
|
||||
public event System.Windows.RoutedEventHandler OnToggled {
|
||||
add => AddHandler(OnToggledEvent, value);
|
||||
remove => RemoveHandler(OnToggledEvent, value);
|
||||
}
|
||||
|
||||
private void RaiseOnToggledRoutedEvent() {
|
||||
RoutedEventArgs routedEventArgs = new RoutedEventArgs(routedEvent: OnToggledEvent);
|
||||
RaiseEvent(routedEventArgs);
|
||||
}
|
||||
|
||||
public bool IsOn {
|
||||
get => (bool)GetValue(IsOnProperty);
|
||||
set {
|
||||
if (IsOn == value) return;
|
||||
SetValue(IsOnProperty, value);
|
||||
UpdateToggleSwitchByState(!isToggledByUser);
|
||||
RaiseOnToggledRoutedEvent();
|
||||
}
|
||||
}
|
||||
|
||||
public static readonly System.Windows.DependencyProperty IsOnProperty =
|
||||
System.Windows.DependencyProperty.Register(
|
||||
name: nameof(IsOn),
|
||||
propertyType: typeof(bool),
|
||||
ownerType: typeof(ToggleSwitch),
|
||||
typeMetadata: new FrameworkPropertyMetadata(defaultValue: false, propertyChangedCallback: (o, args) => {
|
||||
var toggleSwitch = o as ToggleSwitch;
|
||||
toggleSwitch?.UpdateToggleSwitchByState(!toggleSwitch.isToggledByUser);
|
||||
toggleSwitch?.RaiseOnToggledRoutedEvent();
|
||||
}));
|
||||
|
||||
public Brush SwitchBackground {
|
||||
get => (Brush)GetValue(SwitchBackgroundProperty);
|
||||
set {
|
||||
SetValue(SwitchBackgroundProperty, value);
|
||||
UpdateToggleSwitchByState(!isToggledByUser);
|
||||
}
|
||||
}
|
||||
|
||||
public static readonly System.Windows.DependencyProperty SwitchBackgroundProperty =
|
||||
System.Windows.DependencyProperty.Register(
|
||||
nameof(SwitchBackground),
|
||||
typeof(Brush),
|
||||
typeof(ToggleSwitch),
|
||||
new FrameworkPropertyMetadata(new SolidColorBrush(Color.FromRgb(53, 132, 228)), // 默认颜色
|
||||
FrameworkPropertyMetadataOptions.AffectsRender,
|
||||
propertyChangedCallback: OnSwitchBackgroundChanged));
|
||||
|
||||
private static void OnSwitchBackgroundChanged(System.Windows.DependencyObject d, System.Windows.DependencyPropertyChangedEventArgs e) {
|
||||
var toggleSwitch = d as ToggleSwitch;
|
||||
toggleSwitch?.UpdateToggleSwitchByState(true);
|
||||
}
|
||||
|
||||
public new bool IsEnabled {
|
||||
get => (bool)GetValue(IsEnabledProperty);
|
||||
set {
|
||||
if (IsEnabled == value) return;
|
||||
SetValue(IsEnabledProperty, value);
|
||||
UpdateToggleSwitchByState();
|
||||
}
|
||||
}
|
||||
|
||||
public new static readonly System.Windows.DependencyProperty IsEnabledProperty =
|
||||
System.Windows.DependencyProperty.Register(
|
||||
name: nameof(IsEnabled),
|
||||
propertyType: typeof(bool),
|
||||
ownerType: typeof(ToggleSwitch),
|
||||
typeMetadata: new FrameworkPropertyMetadata(defaultValue: true, propertyChangedCallback: (o, args) => {
|
||||
var toggleSwitch = o as ToggleSwitch;
|
||||
toggleSwitch?.UpdateToggleSwitchByState(!toggleSwitch.isToggledByUser);
|
||||
}));
|
||||
|
||||
public ToggleSwitch() {
|
||||
InitializeComponent();
|
||||
UpdateToggleSwitchByState(true);
|
||||
BackgroundBorder.MouseUp += BackgroundBorder_MouseUp;
|
||||
BackgroundBorder.MouseDown += BackgroundBorder_MouseDown;
|
||||
BackgroundBorder.MouseLeave += BackgroundBorder_MouseLeave;
|
||||
}
|
||||
|
||||
private bool isBackgroundBorderMouseDown = false;
|
||||
|
||||
private void BackgroundBorder_MouseDown(object sender, MouseButtonEventArgs e) {
|
||||
if (isBackgroundBorderMouseDown || isAnimating) return;
|
||||
isBackgroundBorderMouseDown = true;
|
||||
OverlayBorder.Visibility = Visibility.Visible;
|
||||
}
|
||||
|
||||
private void BackgroundBorder_MouseUp(object sender, MouseButtonEventArgs e) {
|
||||
if (!isBackgroundBorderMouseDown || isAnimating) return;
|
||||
BackgroundBorder_MouseLeave(sender, null);
|
||||
isToggledByUser = true;
|
||||
IsOn = !IsOn;
|
||||
isToggledByUser = false;
|
||||
}
|
||||
|
||||
private void BackgroundBorder_MouseLeave(object sender, MouseEventArgs e) {
|
||||
if (!isBackgroundBorderMouseDown || isAnimating) return;
|
||||
isBackgroundBorderMouseDown = false;
|
||||
OverlayBorder.Visibility = Visibility.Hidden;
|
||||
}
|
||||
|
||||
private void UpdateToggleSwitchByState(bool isNoAnimation = false) {
|
||||
Opacity = IsEnabled ? 1 : 0.5;
|
||||
IsHitTestVisible = IsEnabled;
|
||||
IsTabStop = IsEnabled;
|
||||
if (isNoAnimation) {
|
||||
ThumbTranslateTransform.X = IsOn ? 23 : 0;
|
||||
BackgroundBorder.Background =
|
||||
IsOn ? SwitchBackground : new SolidColorBrush(Color.FromRgb(225, 225, 225));
|
||||
} else {
|
||||
isAnimating = true;
|
||||
var sb = new Storyboard();
|
||||
// 渐变动画
|
||||
var ani = new DoubleAnimation {
|
||||
From = IsOn?0:23,
|
||||
To = IsOn?23:0,
|
||||
Duration = TimeSpan.FromMilliseconds(125)
|
||||
};
|
||||
ani.EasingFunction = new CubicEase();
|
||||
Storyboard.SetTargetProperty(ani, new System.Windows.PropertyPath("(UIElement.RenderTransform).(TranslateTransform.X)"));
|
||||
sb.Children.Add(ani);
|
||||
if (IsOn) BackgroundBorder.Background = SwitchBackground;
|
||||
sb.Completed += (sender, args) => {
|
||||
isAnimating = false;
|
||||
BackgroundBorder.Background =
|
||||
IsOn ? SwitchBackground : new SolidColorBrush(Color.FromRgb(225, 225, 225));
|
||||
};
|
||||
ThumbBorder.BeginStoryboard(sb);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -108,7 +108,7 @@ namespace Ink_Canvas.Helpers
|
||||
ResizeMode = ResizeMode.NoResize;
|
||||
|
||||
WindowChrome.SetWindowChrome(this,
|
||||
new WindowChrome { GlassFrameThickness = WindowChrome.GlassFrameCompleteThickness, CaptionHeight = 0 });
|
||||
new WindowChrome { GlassFrameThickness = WindowChrome.GlassFrameCompleteThickness, CaptionHeight = 0, CornerRadius = new CornerRadius(0), ResizeBorderThickness = new Thickness(0)});
|
||||
|
||||
var visualTree = new FrameworkElementFactory(typeof(Border));
|
||||
visualTree.SetValue(Border.BackgroundProperty, new TemplateBindingExtension(Window.BackgroundProperty));
|
||||
|
@ -166,6 +166,7 @@
|
||||
<None Include="app.manifest" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="gong-wpf-dragdrop" Version="3.2.1" />
|
||||
<PackageReference Include="Hardcodet.NotifyIcon.Wpf" Version="1.1.0" />
|
||||
<PackageReference Include="ILRepack" Version="2.0.34">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
|
@ -8,6 +8,12 @@
|
||||
<DebuggerFlavor>ProjectDebugger</DebuggerFlavor>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Compile Update="Components\SegmentedButtons.xaml.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Update="Components\ToggleSwitch.xaml.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Update="MainWindow_cs\MW_ShapeDrawingLayer.xaml.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
@ -32,6 +38,12 @@
|
||||
<Compile Update="Windows\SettingsViews\AboutPanel.xaml.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Update="Windows\SettingsViews\AppearancePanel.xaml.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Update="Windows\SettingsViews\FloatingBarDnDSettingsPanel.xaml.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Update="Windows\SettingsViews\SettingsBaseView.xaml.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
@ -40,6 +52,12 @@
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Page Update="Components\SegmentedButtons.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Update="Components\ToggleSwitch.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Update="MainWindow_cs\MW_ContextMenus.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
@ -73,6 +91,12 @@
|
||||
<Page Update="Windows\SettingsViews\AboutPanel.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Update="Windows\SettingsViews\AppearancePanel.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Update="Windows\SettingsViews\FloatingBarDnDSettingsPanel.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Update="Windows\SettingsViews\SettingsBaseView.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
|
@ -1,42 +1,42 @@
|
||||
<Window Name="window" x:Class="Ink_Canvas.MainWindow"
|
||||
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:ui="http://schemas.inkore.net/lib/ui/wpf/modern"
|
||||
xmlns:c="clr-namespace:Ink_Canvas.Converter"
|
||||
xmlns:Controls="http://schemas.microsoft.com/netfx/2009/xaml/presentation" xmlns:popups="clr-namespace:Ink_Canvas.Popups"
|
||||
xmlns:inkCanvas="clr-namespace:Ink_Canvas"
|
||||
xmlns:helpers="clr-namespace:Ink_Canvas.Helpers"
|
||||
mc:Ignorable="d"
|
||||
WindowStyle="None"
|
||||
ResizeMode="NoResize"
|
||||
WindowState="Maximized"
|
||||
Loaded="Window_Loaded"
|
||||
Background="Transparent"
|
||||
ShowInTaskbar="False"
|
||||
Title="InkCanvasforClass"
|
||||
Topmost="True"
|
||||
KeyDown="Window_KeyDown"
|
||||
Closing="Window_Closing"
|
||||
Closed="Window_Closed"
|
||||
PreviewKeyDown="Main_Grid_PreviewKeyDown"
|
||||
PreviewKeyUp="Main_Grid_PreviewKeyUp"
|
||||
Height="18000" Width="1440"
|
||||
FontFamily="Microsoft YaHei UI"
|
||||
MouseWheel="Window_MouseWheel"
|
||||
Foreground="Black"
|
||||
SizeChanged="MainWindow_OnSizeChanged"
|
||||
MouseMove="MainWindow_OnMouseMove"
|
||||
Stylus.IsPressAndHoldEnabled="False"
|
||||
Stylus.IsFlicksEnabled="False"
|
||||
Stylus.IsTapFeedbackEnabled="False"
|
||||
DpiChanged="MainWindow_OnDpiChanged"
|
||||
PreviewStylusButtonDown="mainWin_StylusButtonDown"
|
||||
PreviewStylusButtonUp="mainWin_StylusButtonUp"
|
||||
PreviewStylusMove="mainWin_StylusMove"
|
||||
PreviewStylusInAirMove="mainWin_StylusInAirMove"
|
||||
Stylus.IsTouchFeedbackEnabled="False">
|
||||
<helpers:PerformanceTransparentWin x:Name="window" x:Class="Ink_Canvas.MainWindow"
|
||||
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:ui="http://schemas.inkore.net/lib/ui/wpf/modern"
|
||||
xmlns:c="clr-namespace:Ink_Canvas.Converter"
|
||||
xmlns:Controls="http://schemas.microsoft.com/netfx/2009/xaml/presentation" xmlns:popups="clr-namespace:Ink_Canvas.Popups"
|
||||
xmlns:inkCanvas="clr-namespace:Ink_Canvas"
|
||||
xmlns:helpers="clr-namespace:Ink_Canvas.Helpers"
|
||||
mc:Ignorable="d"
|
||||
WindowStyle="None"
|
||||
ResizeMode="NoResize"
|
||||
WindowState="Maximized"
|
||||
Loaded="Window_Loaded"
|
||||
Background="Transparent"
|
||||
ShowInTaskbar="False"
|
||||
Title="InkCanvasforClass"
|
||||
Topmost="True"
|
||||
KeyDown="Window_KeyDown"
|
||||
Closing="Window_Closing"
|
||||
Closed="Window_Closed"
|
||||
PreviewKeyDown="Main_Grid_PreviewKeyDown"
|
||||
PreviewKeyUp="Main_Grid_PreviewKeyUp"
|
||||
Height="18000" Width="1440"
|
||||
FontFamily="Microsoft YaHei UI"
|
||||
MouseWheel="Window_MouseWheel"
|
||||
Foreground="Black"
|
||||
SizeChanged="MainWindow_OnSizeChanged"
|
||||
MouseMove="MainWindow_OnMouseMove"
|
||||
Stylus.IsPressAndHoldEnabled="False"
|
||||
Stylus.IsFlicksEnabled="False"
|
||||
Stylus.IsTapFeedbackEnabled="False"
|
||||
DpiChanged="MainWindow_OnDpiChanged"
|
||||
PreviewStylusButtonDown="mainWin_StylusButtonDown"
|
||||
PreviewStylusButtonUp="mainWin_StylusButtonUp"
|
||||
PreviewStylusMove="mainWin_StylusMove"
|
||||
PreviewStylusInAirMove="mainWin_StylusInAirMove"
|
||||
Stylus.IsTouchFeedbackEnabled="False">
|
||||
<!--资源中添加命令-->
|
||||
<Window.Resources>
|
||||
<ResourceDictionary>
|
||||
@ -9364,4 +9364,4 @@
|
||||
</Border>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</Window>
|
||||
</helpers:PerformanceTransparentWin>
|
@ -30,7 +30,7 @@ using Button = System.Windows.Controls.Button;
|
||||
using TextBox = System.Windows.Controls.TextBox;
|
||||
|
||||
namespace Ink_Canvas {
|
||||
public partial class MainWindow : Window {
|
||||
public partial class MainWindow : PerformanceTransparentWin {
|
||||
|
||||
protected override void OnPropertyChanged(DependencyPropertyChangedEventArgs e)
|
||||
{
|
||||
@ -108,7 +108,7 @@ namespace Ink_Canvas {
|
||||
timeMachine.OnUndoStateChanged += TimeMachine_OnUndoStateChanged;
|
||||
inkCanvas.Strokes.StrokesChanged += StrokesOnStrokesChanged;
|
||||
|
||||
Microsoft.Win32.SystemEvents.UserPreferenceChanged += SystemEvents_UserPreferenceChanged;
|
||||
//Microsoft.Win32.SystemEvents.UserPreferenceChanged += SystemEvents_UserPreferenceChanged;
|
||||
try {
|
||||
if (File.Exists("SpecialVersion.ini")) SpecialVersionResetToSuggestion_Click();
|
||||
}
|
||||
@ -212,8 +212,6 @@ namespace Ink_Canvas {
|
||||
analyzer.Analyze();
|
||||
}
|
||||
|
||||
public FloatingToolBarV2 FloatingToolBarV2;
|
||||
|
||||
private async void Window_Loaded(object sender, RoutedEventArgs e) {
|
||||
loadPenCanvas();
|
||||
//加载设置
|
||||
@ -222,7 +220,7 @@ namespace Ink_Canvas {
|
||||
if (Environment.Is64BitProcess) SettingsInkRecognitionGroupBox.Visibility = Visibility.Collapsed;
|
||||
|
||||
ThemeManager.Current.ApplicationTheme = ApplicationTheme.Light;
|
||||
SystemEvents_UserPreferenceChanged(null, null);
|
||||
//SystemEvents_UserPreferenceChanged(null, null);
|
||||
|
||||
//TextBlockVersion.Text = Assembly.GetExecutingAssembly().GetName().Version.ToString();
|
||||
LogHelper.WriteLogToFile("Ink Canvas Loaded", LogHelper.LogType.Event);
|
||||
@ -231,10 +229,7 @@ namespace Ink_Canvas {
|
||||
|
||||
isLoaded = true;
|
||||
|
||||
FloatingToolBarV2 = new FloatingToolBarV2();
|
||||
FloatingToolBarV2.Topmost = false;
|
||||
FloatingToolBarV2.Show();
|
||||
FloatingToolBarV2.Owner = this;
|
||||
InitFloatingToolbarV2();
|
||||
|
||||
BlackBoardLeftSidePageListView.ItemsSource = blackBoardSidePageListViewObservableCollection;
|
||||
BlackBoardRightSidePageListView.ItemsSource = blackBoardSidePageListViewObservableCollection;
|
||||
|
@ -13,7 +13,7 @@ using System.Windows.Media.Animation;
|
||||
using System.Windows.Media.Imaging;
|
||||
|
||||
namespace Ink_Canvas {
|
||||
public partial class MainWindow : Window {
|
||||
public partial class MainWindow : PerformanceTransparentWin {
|
||||
public bool isFloatingBarFolded = false;
|
||||
private bool isFloatingBarChangingHideMode = false;
|
||||
|
||||
|
@ -1,9 +1,10 @@
|
||||
using IWshRuntimeLibrary;
|
||||
using Ink_Canvas.Helpers;
|
||||
using IWshRuntimeLibrary;
|
||||
using System;
|
||||
using System.Windows;
|
||||
|
||||
namespace Ink_Canvas {
|
||||
public partial class MainWindow : Window {
|
||||
public partial class MainWindow : PerformanceTransparentWin {
|
||||
public static bool StartAutomaticallyCreate(string exeName) {
|
||||
try {
|
||||
var shell = new WshShell();
|
||||
|
@ -3,10 +3,11 @@ using iNKORE.UI.WPF.Modern;
|
||||
using System;
|
||||
using System.Windows;
|
||||
using System.Windows.Media;
|
||||
using Ink_Canvas.Helpers;
|
||||
using Application = System.Windows.Application;
|
||||
|
||||
namespace Ink_Canvas {
|
||||
public partial class MainWindow : Window {
|
||||
/*public partial class MainWindow : PerformanceTransparentWin {
|
||||
private Color FloatBarForegroundColor = Color.FromRgb(102, 102, 102);
|
||||
|
||||
private void SetTheme(string theme) {
|
||||
@ -82,5 +83,5 @@ namespace Ink_Canvas {
|
||||
|
||||
return light;
|
||||
}
|
||||
}
|
||||
}*/
|
||||
}
|
@ -15,7 +15,7 @@ using System.Xml.Linq;
|
||||
using System.Windows.Controls;
|
||||
|
||||
namespace Ink_Canvas {
|
||||
public partial class MainWindow : Window {
|
||||
public partial class MainWindow : PerformanceTransparentWin {
|
||||
private StrokeCollection[] strokeCollections = new StrokeCollection[101];
|
||||
private bool[] whiteboadLastModeIsRedo = new bool[101];
|
||||
private StrokeCollection lastTouchDownStrokeCollection = new StrokeCollection();
|
||||
|
@ -7,7 +7,7 @@ using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
|
||||
namespace Ink_Canvas {
|
||||
public partial class MainWindow : Window {
|
||||
public partial class MainWindow : PerformanceTransparentWin {
|
||||
|
||||
private Border lastBoardToolBtnDownBorder = null;
|
||||
private Border lastBoardSideBtnDownBorder = null;
|
||||
|
@ -15,7 +15,7 @@ using System.Windows.Media.Animation;
|
||||
using Ink_Canvas.Popups;
|
||||
|
||||
namespace Ink_Canvas {
|
||||
public partial class MainWindow : Window {
|
||||
public partial class MainWindow : PerformanceTransparentWin {
|
||||
private int inkColor = 1;
|
||||
|
||||
private void ColorSwitchCheck() {
|
||||
|
@ -9,9 +9,10 @@ using System.Windows.Controls;
|
||||
using System.Windows.Ink;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using Ink_Canvas.Helpers;
|
||||
|
||||
namespace Ink_Canvas {
|
||||
public partial class MainWindow : Window {
|
||||
public partial class MainWindow : PerformanceTransparentWin {
|
||||
|
||||
public bool isUsingGeometryEraser = false;
|
||||
private IncrementalStrokeHitTester hitTester = null;
|
||||
|
@ -28,7 +28,7 @@ using Ink_Canvas.Popups;
|
||||
using Image = System.Windows.Controls.Image;
|
||||
|
||||
namespace Ink_Canvas {
|
||||
public partial class MainWindow : Window {
|
||||
public partial class MainWindow : PerformanceTransparentWin {
|
||||
#region “手勢”按鈕
|
||||
|
||||
/// <summary>
|
||||
@ -787,22 +787,14 @@ namespace Ink_Canvas {
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Settings.PowerPointSettings.IsShowStrokeOnSelectInPowerPoint)
|
||||
if (Settings.Canvas.HideStrokeWhenSelecting)
|
||||
{
|
||||
inkCanvas.Visibility = Visibility.Visible;
|
||||
inkCanvas.IsHitTestVisible = true;
|
||||
inkCanvas.Visibility = Visibility.Collapsed;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Settings.Canvas.HideStrokeWhenSelecting)
|
||||
{
|
||||
inkCanvas.Visibility = Visibility.Collapsed;
|
||||
}
|
||||
else
|
||||
{
|
||||
inkCanvas.IsHitTestVisible = false;
|
||||
inkCanvas.Visibility = Visibility.Visible;
|
||||
}
|
||||
inkCanvas.IsHitTestVisible = false;
|
||||
inkCanvas.Visibility = Visibility.Visible;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1293,208 +1285,6 @@ namespace Ink_Canvas {
|
||||
new RandWindow(Settings,true).ShowDialog();
|
||||
}
|
||||
|
||||
private void GridInkReplayButton_MouseUp(object sender, MouseButtonEventArgs e) {
|
||||
if (lastBorderMouseDownObject != sender) return;
|
||||
if (inkCanvas.Strokes.Count == 0) {
|
||||
HideSubPanels();
|
||||
return;
|
||||
};
|
||||
|
||||
AnimationsHelper.HideWithSlideAndFade(BorderTools);
|
||||
AnimationsHelper.HideWithSlideAndFade(BoardBorderTools);
|
||||
|
||||
CollapseBorderDrawShape();
|
||||
|
||||
InkCanvasForInkReplay.Visibility = Visibility.Visible;
|
||||
InkCanvasGridForInkReplay.Visibility = Visibility.Hidden;
|
||||
InkCanvasGridForInkReplay.IsHitTestVisible = false;
|
||||
FloatingbarUIForInkReplay.Visibility = Visibility.Hidden;
|
||||
FloatingbarUIForInkReplay.IsHitTestVisible = false;
|
||||
BlackboardUIGridForInkReplay.Visibility = Visibility.Hidden;
|
||||
BlackboardUIGridForInkReplay.IsHitTestVisible = false;
|
||||
|
||||
AnimationsHelper.ShowWithFadeIn(BorderInkReplayToolBox);
|
||||
InkReplayPanelStatusText.Text = "正在重播墨迹...";
|
||||
InkReplayPlayPauseBorder.Background = new SolidColorBrush(Colors.Transparent);
|
||||
InkReplayPlayButtonImage.Visibility = Visibility.Collapsed;
|
||||
InkReplayPauseButtonImage.Visibility = Visibility.Visible;
|
||||
|
||||
isStopInkReplay = false;
|
||||
isPauseInkReplay = false;
|
||||
isRestartInkReplay = false;
|
||||
inkReplaySpeed = 1;
|
||||
InkCanvasForInkReplay.Strokes.Clear();
|
||||
var strokes = inkCanvas.Strokes.Clone();
|
||||
if (inkCanvas.GetSelectedStrokes().Count != 0) strokes = inkCanvas.GetSelectedStrokes().Clone();
|
||||
int k = 1, i = 0;
|
||||
new Thread(() => {
|
||||
isRestartInkReplay = true;
|
||||
while (isRestartInkReplay) {
|
||||
isRestartInkReplay = false;
|
||||
Application.Current.Dispatcher.Invoke(() => {
|
||||
InkCanvasForInkReplay.Strokes.Clear();
|
||||
});
|
||||
foreach (var stroke in strokes) {
|
||||
|
||||
if (isRestartInkReplay) break;
|
||||
|
||||
var stylusPoints = new StylusPointCollection();
|
||||
if (stroke.StylusPoints.Count == 629) //圆或椭圆
|
||||
{
|
||||
Stroke s = null;
|
||||
foreach (var stylusPoint in stroke.StylusPoints) {
|
||||
|
||||
if (isRestartInkReplay) break;
|
||||
|
||||
while (isPauseInkReplay) {
|
||||
Thread.Sleep(10);
|
||||
}
|
||||
|
||||
if (i++ >= 50) {
|
||||
i = 0;
|
||||
Thread.Sleep((int)(10 / inkReplaySpeed));
|
||||
if (isStopInkReplay) return;
|
||||
}
|
||||
|
||||
Application.Current.Dispatcher.Invoke(() => {
|
||||
try {
|
||||
InkCanvasForInkReplay.Strokes.Remove(s);
|
||||
}
|
||||
catch { }
|
||||
|
||||
stylusPoints.Add(stylusPoint);
|
||||
s = new Stroke(stylusPoints.Clone());
|
||||
s.DrawingAttributes = stroke.DrawingAttributes;
|
||||
InkCanvasForInkReplay.Strokes.Add(s);
|
||||
});
|
||||
}
|
||||
} else {
|
||||
Stroke s = null;
|
||||
foreach (var stylusPoint in stroke.StylusPoints) {
|
||||
|
||||
if (isRestartInkReplay) break;
|
||||
|
||||
while (isPauseInkReplay) {
|
||||
Thread.Sleep(10);
|
||||
}
|
||||
|
||||
if (i++ >= k) {
|
||||
i = 0;
|
||||
Thread.Sleep((int)(10 / inkReplaySpeed));
|
||||
if (isStopInkReplay) return;
|
||||
}
|
||||
|
||||
Application.Current.Dispatcher.Invoke(() => {
|
||||
try {
|
||||
InkCanvasForInkReplay.Strokes.Remove(s);
|
||||
}
|
||||
catch { }
|
||||
|
||||
stylusPoints.Add(stylusPoint);
|
||||
s = new Stroke(stylusPoints.Clone());
|
||||
s.DrawingAttributes = stroke.DrawingAttributes;
|
||||
InkCanvasForInkReplay.Strokes.Add(s);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Thread.Sleep(100);
|
||||
Application.Current.Dispatcher.Invoke(() => {
|
||||
InkCanvasForInkReplay.Visibility = Visibility.Collapsed;
|
||||
InkCanvasGridForInkReplay.Visibility = Visibility.Visible;
|
||||
InkCanvasGridForInkReplay.IsHitTestVisible = true;
|
||||
AnimationsHelper.HideWithFadeOut(BorderInkReplayToolBox);
|
||||
FloatingbarUIForInkReplay.Visibility = Visibility.Visible;
|
||||
FloatingbarUIForInkReplay.IsHitTestVisible = true;
|
||||
BlackboardUIGridForInkReplay.Visibility = Visibility.Visible;
|
||||
BlackboardUIGridForInkReplay.IsHitTestVisible = true;
|
||||
});
|
||||
}).Start();
|
||||
}
|
||||
|
||||
private bool isStopInkReplay = false;
|
||||
private bool isPauseInkReplay = false;
|
||||
private bool isRestartInkReplay = false;
|
||||
private double inkReplaySpeed = 1;
|
||||
|
||||
private void InkCanvasForInkReplay_MouseDown(object sender, MouseButtonEventArgs e) {
|
||||
if (e.ClickCount == 2) {
|
||||
InkCanvasForInkReplay.Visibility = Visibility.Collapsed;
|
||||
InkCanvasGridForInkReplay.Visibility = Visibility.Visible;
|
||||
InkCanvasGridForInkReplay.IsHitTestVisible = true;
|
||||
FloatingbarUIForInkReplay.Visibility = Visibility.Visible;
|
||||
FloatingbarUIForInkReplay.IsHitTestVisible = true;
|
||||
BlackboardUIGridForInkReplay.Visibility = Visibility.Visible;
|
||||
BlackboardUIGridForInkReplay.IsHitTestVisible = true;
|
||||
AnimationsHelper.HideWithFadeOut(BorderInkReplayToolBox);
|
||||
isStopInkReplay = true;
|
||||
}
|
||||
}
|
||||
|
||||
private void InkReplayPlayPauseBorder_OnMouseDown(object sender, MouseButtonEventArgs e) {
|
||||
InkReplayPlayPauseBorder.Background = new SolidColorBrush(Color.FromArgb(34, 9, 9, 11));
|
||||
}
|
||||
|
||||
private void InkReplayPlayPauseBorder_OnMouseUp(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
InkReplayPlayPauseBorder.Background = new SolidColorBrush(Colors.Transparent);
|
||||
isPauseInkReplay = !isPauseInkReplay;
|
||||
InkReplayPanelStatusText.Text = isPauseInkReplay?"已暂停!":"正在重播墨迹...";
|
||||
InkReplayPlayButtonImage.Visibility = isPauseInkReplay ? Visibility.Visible: Visibility.Collapsed;
|
||||
InkReplayPauseButtonImage.Visibility = !isPauseInkReplay ? Visibility.Visible : Visibility.Collapsed;
|
||||
}
|
||||
|
||||
private void InkReplayStopButtonBorder_OnMouseDown(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
InkReplayStopButtonBorder.Background = new SolidColorBrush(Color.FromArgb(34, 9, 9, 11));
|
||||
}
|
||||
|
||||
private void InkReplayStopButtonBorder_OnMouseUp(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
InkReplayStopButtonBorder.Background = new SolidColorBrush(Colors.Transparent);
|
||||
InkCanvasForInkReplay.Visibility = Visibility.Collapsed;
|
||||
InkCanvasGridForInkReplay.Visibility = Visibility.Visible;
|
||||
InkCanvasGridForInkReplay.IsHitTestVisible = true;
|
||||
FloatingbarUIForInkReplay.Visibility = Visibility.Visible;
|
||||
FloatingbarUIForInkReplay.IsHitTestVisible = true;
|
||||
BlackboardUIGridForInkReplay.Visibility = Visibility.Visible;
|
||||
BlackboardUIGridForInkReplay.IsHitTestVisible = true;
|
||||
AnimationsHelper.HideWithFadeOut(BorderInkReplayToolBox);
|
||||
isStopInkReplay = true;
|
||||
}
|
||||
|
||||
private void InkReplayReplayButtonBorder_OnMouseDown(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
InkReplayReplayButtonBorder.Background = new SolidColorBrush(Color.FromArgb(34, 9, 9, 11));
|
||||
}
|
||||
|
||||
private void InkReplayReplayButtonBorder_OnMouseUp(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
InkReplayReplayButtonBorder.Background = new SolidColorBrush(Colors.Transparent);
|
||||
isRestartInkReplay = true;
|
||||
isPauseInkReplay = false;
|
||||
InkReplayPanelStatusText.Text = "正在重播墨迹...";
|
||||
InkReplayPlayButtonImage.Visibility = Visibility.Collapsed;
|
||||
InkReplayPauseButtonImage.Visibility = Visibility.Visible;
|
||||
}
|
||||
|
||||
private void InkReplaySpeedButtonBorder_OnMouseDown(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
InkReplaySpeedButtonBorder.Background = new SolidColorBrush(Color.FromArgb(34, 9, 9, 11));
|
||||
}
|
||||
|
||||
private void InkReplaySpeedButtonBorder_OnMouseUp(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
InkReplaySpeedButtonBorder.Background = new SolidColorBrush(Colors.Transparent);
|
||||
inkReplaySpeed = inkReplaySpeed == 0.5 ? 1 :
|
||||
inkReplaySpeed == 1 ? 2 :
|
||||
inkReplaySpeed == 2 ? 4 :
|
||||
inkReplaySpeed == 4 ? 8 : 0.5;
|
||||
InkReplaySpeedTextBlock.Text = inkReplaySpeed + "x";
|
||||
}
|
||||
|
||||
private void SymbolIconTools_MouseUp(object sender, MouseButtonEventArgs e) {
|
||||
|
||||
if (lastBorderMouseDownObject != null && lastBorderMouseDownObject is Panel)
|
||||
@ -1747,7 +1537,7 @@ namespace Ink_Canvas {
|
||||
HideSubPanels();
|
||||
}
|
||||
|
||||
#region Left Side Panel
|
||||
#region Left Side Panel(ic屎山代码)
|
||||
|
||||
private void BtnFingerDragMode_Click(object sender, RoutedEventArgs e) {
|
||||
isSingleFingerDragMode = !isSingleFingerDragMode;
|
||||
@ -1790,7 +1580,7 @@ namespace Ink_Canvas {
|
||||
|
||||
#endregion Left Side Panel
|
||||
|
||||
#region Right Side Panel
|
||||
#region Right Side Panel(ic屎山代码)
|
||||
|
||||
public static bool CloseIsFromButton = false;
|
||||
|
||||
@ -1989,14 +1779,17 @@ namespace Ink_Canvas {
|
||||
}
|
||||
|
||||
|
||||
if (Settings.PowerPointSettings.IsShowStrokeOnSelectInPowerPoint) {
|
||||
/*if (Settings.PowerPointSettings.IsShowStrokeOnSelectInPowerPoint) {
|
||||
inkCanvas.Visibility = Visibility.Visible;
|
||||
inkCanvas.IsHitTestVisible = true;
|
||||
}
|
||||
else {
|
||||
inkCanvas.IsHitTestVisible = true;
|
||||
inkCanvas.Visibility = Visibility.Visible;
|
||||
}
|
||||
}*/
|
||||
|
||||
inkCanvas.IsHitTestVisible = true;
|
||||
inkCanvas.Visibility = Visibility.Visible;
|
||||
}
|
||||
|
||||
GridTransparencyFakeBackground.Opacity = 0;
|
||||
|
@ -7,10 +7,11 @@ using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using Ink_Canvas.Helpers;
|
||||
using Vanara.PInvoke;
|
||||
|
||||
namespace Ink_Canvas {
|
||||
public partial class MainWindow : Window {
|
||||
public partial class MainWindow : PerformanceTransparentWin {
|
||||
|
||||
public IntPtr MagnificationWinHandle;
|
||||
public IntPtr MagnificationHostWindowHandle;
|
||||
|
@ -2,10 +2,11 @@
|
||||
using System.Diagnostics;
|
||||
using System.Windows;
|
||||
using System.Windows.Input;
|
||||
using Ink_Canvas.Helpers;
|
||||
using static Ink_Canvas.Popups.ColorPalette;
|
||||
|
||||
namespace Ink_Canvas {
|
||||
public partial class MainWindow : Window {
|
||||
public partial class MainWindow : PerformanceTransparentWin {
|
||||
private void Window_MouseWheel(object sender, MouseWheelEventArgs e) {
|
||||
if (BorderFloatingBarExitPPTBtn.Visibility != Visibility.Visible || currentMode != 0) return;
|
||||
if (e.Delta >= 120)
|
||||
|
223
InkCanvasForClass/MainWindow_cs/MW_InkReplay.cs
Normal file
223
InkCanvasForClass/MainWindow_cs/MW_InkReplay.cs
Normal file
@ -0,0 +1,223 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Ink;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using Ink_Canvas.Helpers;
|
||||
|
||||
namespace Ink_Canvas {
|
||||
public partial class MainWindow : PerformanceTransparentWin {
|
||||
|
||||
private void GridInkReplayButton_MouseUp(object sender, MouseButtonEventArgs e) {
|
||||
if (lastBorderMouseDownObject != sender) return;
|
||||
if (inkCanvas.Strokes.Count == 0) {
|
||||
HideSubPanels();
|
||||
return;
|
||||
};
|
||||
|
||||
AnimationsHelper.HideWithSlideAndFade(BorderTools);
|
||||
AnimationsHelper.HideWithSlideAndFade(BoardBorderTools);
|
||||
|
||||
CollapseBorderDrawShape();
|
||||
|
||||
InkCanvasForInkReplay.Visibility = Visibility.Visible;
|
||||
InkCanvasGridForInkReplay.Visibility = Visibility.Hidden;
|
||||
InkCanvasGridForInkReplay.IsHitTestVisible = false;
|
||||
FloatingbarUIForInkReplay.Visibility = Visibility.Hidden;
|
||||
FloatingbarUIForInkReplay.IsHitTestVisible = false;
|
||||
BlackboardUIGridForInkReplay.Visibility = Visibility.Hidden;
|
||||
BlackboardUIGridForInkReplay.IsHitTestVisible = false;
|
||||
|
||||
AnimationsHelper.ShowWithFadeIn(BorderInkReplayToolBox);
|
||||
InkReplayPanelStatusText.Text = "正在重播墨迹...";
|
||||
InkReplayPlayPauseBorder.Background = new SolidColorBrush(Colors.Transparent);
|
||||
InkReplayPlayButtonImage.Visibility = Visibility.Collapsed;
|
||||
InkReplayPauseButtonImage.Visibility = Visibility.Visible;
|
||||
|
||||
isStopInkReplay = false;
|
||||
isPauseInkReplay = false;
|
||||
isRestartInkReplay = false;
|
||||
inkReplaySpeed = 1;
|
||||
InkCanvasForInkReplay.Strokes.Clear();
|
||||
var strokes = inkCanvas.Strokes.Clone();
|
||||
if (inkCanvas.GetSelectedStrokes().Count != 0) strokes = inkCanvas.GetSelectedStrokes().Clone();
|
||||
int k = 1, i = 0;
|
||||
new Thread(() => {
|
||||
isRestartInkReplay = true;
|
||||
while (isRestartInkReplay) {
|
||||
isRestartInkReplay = false;
|
||||
Application.Current.Dispatcher.Invoke(() => {
|
||||
InkCanvasForInkReplay.Strokes.Clear();
|
||||
});
|
||||
foreach (var stroke in strokes) {
|
||||
|
||||
if (isRestartInkReplay) break;
|
||||
|
||||
var stylusPoints = new StylusPointCollection();
|
||||
if (stroke.StylusPoints.Count == 629) //圆或椭圆
|
||||
{
|
||||
Stroke s = null;
|
||||
foreach (var stylusPoint in stroke.StylusPoints) {
|
||||
|
||||
if (isRestartInkReplay) break;
|
||||
|
||||
while (isPauseInkReplay) {
|
||||
Thread.Sleep(10);
|
||||
}
|
||||
|
||||
if (i++ >= 50) {
|
||||
i = 0;
|
||||
Thread.Sleep((int)(10 / inkReplaySpeed));
|
||||
if (isStopInkReplay) return;
|
||||
}
|
||||
|
||||
Application.Current.Dispatcher.Invoke(() => {
|
||||
try {
|
||||
InkCanvasForInkReplay.Strokes.Remove(s);
|
||||
}
|
||||
catch { }
|
||||
|
||||
stylusPoints.Add(stylusPoint);
|
||||
s = new Stroke(stylusPoints.Clone());
|
||||
s.DrawingAttributes = stroke.DrawingAttributes;
|
||||
InkCanvasForInkReplay.Strokes.Add(s);
|
||||
});
|
||||
}
|
||||
} else {
|
||||
Stroke s = null;
|
||||
foreach (var stylusPoint in stroke.StylusPoints) {
|
||||
|
||||
if (isRestartInkReplay) break;
|
||||
|
||||
while (isPauseInkReplay) {
|
||||
Thread.Sleep(10);
|
||||
}
|
||||
|
||||
if (i++ >= k) {
|
||||
i = 0;
|
||||
Thread.Sleep((int)(10 / inkReplaySpeed));
|
||||
if (isStopInkReplay) return;
|
||||
}
|
||||
|
||||
Application.Current.Dispatcher.Invoke(() => {
|
||||
try {
|
||||
InkCanvasForInkReplay.Strokes.Remove(s);
|
||||
}
|
||||
catch { }
|
||||
|
||||
stylusPoints.Add(stylusPoint);
|
||||
s = new Stroke(stylusPoints.Clone());
|
||||
s.DrawingAttributes = stroke.DrawingAttributes;
|
||||
InkCanvasForInkReplay.Strokes.Add(s);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Thread.Sleep(100);
|
||||
Application.Current.Dispatcher.Invoke(() => {
|
||||
InkCanvasForInkReplay.Visibility = Visibility.Collapsed;
|
||||
InkCanvasGridForInkReplay.Visibility = Visibility.Visible;
|
||||
InkCanvasGridForInkReplay.IsHitTestVisible = true;
|
||||
AnimationsHelper.HideWithFadeOut(BorderInkReplayToolBox);
|
||||
FloatingbarUIForInkReplay.Visibility = Visibility.Visible;
|
||||
FloatingbarUIForInkReplay.IsHitTestVisible = true;
|
||||
BlackboardUIGridForInkReplay.Visibility = Visibility.Visible;
|
||||
BlackboardUIGridForInkReplay.IsHitTestVisible = true;
|
||||
});
|
||||
}).Start();
|
||||
}
|
||||
|
||||
#region 墨迹回放(旧版,等待重构)
|
||||
|
||||
private bool isStopInkReplay = false;
|
||||
private bool isPauseInkReplay = false;
|
||||
private bool isRestartInkReplay = false;
|
||||
private double inkReplaySpeed = 1;
|
||||
|
||||
private void InkCanvasForInkReplay_MouseDown(object sender, MouseButtonEventArgs e) {
|
||||
if (e.ClickCount == 2) {
|
||||
InkCanvasForInkReplay.Visibility = Visibility.Collapsed;
|
||||
InkCanvasGridForInkReplay.Visibility = Visibility.Visible;
|
||||
InkCanvasGridForInkReplay.IsHitTestVisible = true;
|
||||
FloatingbarUIForInkReplay.Visibility = Visibility.Visible;
|
||||
FloatingbarUIForInkReplay.IsHitTestVisible = true;
|
||||
BlackboardUIGridForInkReplay.Visibility = Visibility.Visible;
|
||||
BlackboardUIGridForInkReplay.IsHitTestVisible = true;
|
||||
AnimationsHelper.HideWithFadeOut(BorderInkReplayToolBox);
|
||||
isStopInkReplay = true;
|
||||
}
|
||||
}
|
||||
|
||||
private void InkReplayPlayPauseBorder_OnMouseDown(object sender, MouseButtonEventArgs e) {
|
||||
InkReplayPlayPauseBorder.Background = new SolidColorBrush(Color.FromArgb(34, 9, 9, 11));
|
||||
}
|
||||
|
||||
private void InkReplayPlayPauseBorder_OnMouseUp(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
InkReplayPlayPauseBorder.Background = new SolidColorBrush(Colors.Transparent);
|
||||
isPauseInkReplay = !isPauseInkReplay;
|
||||
InkReplayPanelStatusText.Text = isPauseInkReplay?"已暂停!":"正在重播墨迹...";
|
||||
InkReplayPlayButtonImage.Visibility = isPauseInkReplay ? Visibility.Visible: Visibility.Collapsed;
|
||||
InkReplayPauseButtonImage.Visibility = !isPauseInkReplay ? Visibility.Visible : Visibility.Collapsed;
|
||||
}
|
||||
|
||||
private void InkReplayStopButtonBorder_OnMouseDown(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
InkReplayStopButtonBorder.Background = new SolidColorBrush(Color.FromArgb(34, 9, 9, 11));
|
||||
}
|
||||
|
||||
private void InkReplayStopButtonBorder_OnMouseUp(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
InkReplayStopButtonBorder.Background = new SolidColorBrush(Colors.Transparent);
|
||||
InkCanvasForInkReplay.Visibility = Visibility.Collapsed;
|
||||
InkCanvasGridForInkReplay.Visibility = Visibility.Visible;
|
||||
InkCanvasGridForInkReplay.IsHitTestVisible = true;
|
||||
FloatingbarUIForInkReplay.Visibility = Visibility.Visible;
|
||||
FloatingbarUIForInkReplay.IsHitTestVisible = true;
|
||||
BlackboardUIGridForInkReplay.Visibility = Visibility.Visible;
|
||||
BlackboardUIGridForInkReplay.IsHitTestVisible = true;
|
||||
AnimationsHelper.HideWithFadeOut(BorderInkReplayToolBox);
|
||||
isStopInkReplay = true;
|
||||
}
|
||||
|
||||
private void InkReplayReplayButtonBorder_OnMouseDown(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
InkReplayReplayButtonBorder.Background = new SolidColorBrush(Color.FromArgb(34, 9, 9, 11));
|
||||
}
|
||||
|
||||
private void InkReplayReplayButtonBorder_OnMouseUp(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
InkReplayReplayButtonBorder.Background = new SolidColorBrush(Colors.Transparent);
|
||||
isRestartInkReplay = true;
|
||||
isPauseInkReplay = false;
|
||||
InkReplayPanelStatusText.Text = "正在重播墨迹...";
|
||||
InkReplayPlayButtonImage.Visibility = Visibility.Collapsed;
|
||||
InkReplayPauseButtonImage.Visibility = Visibility.Visible;
|
||||
}
|
||||
|
||||
private void InkReplaySpeedButtonBorder_OnMouseDown(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
InkReplaySpeedButtonBorder.Background = new SolidColorBrush(Color.FromArgb(34, 9, 9, 11));
|
||||
}
|
||||
|
||||
private void InkReplaySpeedButtonBorder_OnMouseUp(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
InkReplaySpeedButtonBorder.Background = new SolidColorBrush(Colors.Transparent);
|
||||
inkReplaySpeed = inkReplaySpeed == 0.5 ? 1 :
|
||||
inkReplaySpeed == 1 ? 2 :
|
||||
inkReplaySpeed == 2 ? 4 :
|
||||
inkReplaySpeed == 4 ? 8 : 0.5;
|
||||
InkReplaySpeedTextBlock.Text = inkReplaySpeed + "x";
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using Ink_Canvas.Helpers;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
@ -13,7 +14,7 @@ using System.Windows.Resources;
|
||||
|
||||
namespace Ink_Canvas
|
||||
{
|
||||
public partial class MainWindow : Window {
|
||||
public partial class MainWindow : PerformanceTransparentWin {
|
||||
|
||||
private bool isMouseGesturing = false;
|
||||
private Point startPoint;
|
||||
|
@ -5,7 +5,7 @@ using System.Windows;
|
||||
|
||||
namespace Ink_Canvas
|
||||
{
|
||||
public partial class MainWindow : Window
|
||||
public partial class MainWindow : PerformanceTransparentWin
|
||||
{
|
||||
int lastNotificationShowTime = 0;
|
||||
int notificationShowTime = 2500;
|
||||
|
@ -19,7 +19,7 @@ using iNKORE.UI.WPF.Modern;
|
||||
using Microsoft.Office.Core;
|
||||
|
||||
namespace Ink_Canvas {
|
||||
public partial class MainWindow : Window {
|
||||
public partial class MainWindow : PerformanceTransparentWin {
|
||||
public static Microsoft.Office.Interop.PowerPoint.Application pptApplication = null;
|
||||
public static Presentation presentation = null;
|
||||
public static Slides slides = null;
|
||||
|
@ -16,7 +16,7 @@ using Ink_Canvas.Helpers;
|
||||
|
||||
namespace Ink_Canvas
|
||||
{
|
||||
public partial class MainWindow : Window
|
||||
public partial class MainWindow : PerformanceTransparentWin
|
||||
{
|
||||
private class PageListViewItem
|
||||
{
|
||||
|
@ -8,7 +8,7 @@ using System.Windows.Input;
|
||||
using File = System.IO.File;
|
||||
|
||||
namespace Ink_Canvas {
|
||||
public partial class MainWindow : Window {
|
||||
public partial class MainWindow : PerformanceTransparentWin {
|
||||
private void SymbolIconSaveStrokes_MouseUp(object sender, MouseButtonEventArgs e) {
|
||||
if (lastBorderMouseDownObject != sender || inkCanvas.Visibility != Visibility.Visible) return;
|
||||
|
||||
|
@ -22,9 +22,10 @@ using System.Reflection;
|
||||
using System.Windows.Shapes;
|
||||
using Path = System.IO.Path;
|
||||
using Rectangle = System.Drawing.Rectangle;
|
||||
using Ink_Canvas.Helpers;
|
||||
|
||||
namespace Ink_Canvas {
|
||||
public partial class MainWindow : Window {
|
||||
public partial class MainWindow : PerformanceTransparentWin {
|
||||
#region MagnificationAPI 获取屏幕截图并过滤ICC窗口
|
||||
|
||||
#region Dubi906w 的轮子
|
||||
|
@ -20,9 +20,10 @@ using static System.Windows.Forms.VisualStyles.VisualStyleElement.StartPanel;
|
||||
using Application = System.Windows.Application;
|
||||
using Matrix = System.Windows.Media.Matrix;
|
||||
using Point = System.Windows.Point;
|
||||
using Ink_Canvas.Helpers;
|
||||
|
||||
namespace Ink_Canvas {
|
||||
public partial class MainWindow : Window {
|
||||
public partial class MainWindow : PerformanceTransparentWin {
|
||||
#region Floating Control
|
||||
|
||||
private object lastBorderMouseDownObject;
|
||||
|
@ -31,7 +31,7 @@ using Application = System.Windows.Application;
|
||||
using Point = System.Windows.Point;
|
||||
|
||||
namespace Ink_Canvas {
|
||||
public partial class MainWindow : Window {
|
||||
public partial class MainWindow : PerformanceTransparentWin {
|
||||
#region Behavior
|
||||
|
||||
private void ToggleSwitchIsAutoUpdate_Toggled(object sender, RoutedEventArgs e) {
|
||||
@ -1650,7 +1650,7 @@ namespace Ink_Canvas {
|
||||
Settings.PowerPointSettings.PowerPointSupport = true;
|
||||
Settings.PowerPointSettings.IsShowCanvasAtNewSlideShow = false;
|
||||
Settings.PowerPointSettings.IsNoClearStrokeOnSelectWhenInPowerPoint = true;
|
||||
Settings.PowerPointSettings.IsShowStrokeOnSelectInPowerPoint = false;
|
||||
//Settings.PowerPointSettings.IsShowStrokeOnSelectInPowerPoint = false;
|
||||
Settings.PowerPointSettings.IsAutoSaveStrokesInPowerPoint = true;
|
||||
Settings.PowerPointSettings.IsAutoSaveScreenShotInPowerPoint = true;
|
||||
Settings.PowerPointSettings.IsNotifyPreviousPage = false;
|
||||
|
@ -22,7 +22,7 @@ using File = System.IO.File;
|
||||
using OperatingSystem = OSVersionExtension.OperatingSystem;
|
||||
|
||||
namespace Ink_Canvas {
|
||||
public partial class MainWindow : System.Windows.Window {
|
||||
public partial class MainWindow : PerformanceTransparentWin {
|
||||
|
||||
private void DisplayWelcomePopup() {
|
||||
if( TaskDialog.OSSupportsTaskDialogs ) {
|
||||
@ -360,7 +360,7 @@ namespace Ink_Canvas {
|
||||
|
||||
FloatingBarTextVisibilityBindingLikeAPieceOfShit.Visibility = Settings.Appearance.FloatingBarButtonLabelVisibility ? Visibility.Visible : Visibility.Collapsed;
|
||||
|
||||
SystemEvents_UserPreferenceChanged(null, null);
|
||||
//SystemEvents_UserPreferenceChanged(null, null);
|
||||
} else {
|
||||
Settings.Appearance = new Appearance();
|
||||
}
|
||||
|
@ -13,7 +13,7 @@ using MessageBox = System.Windows.MessageBox;
|
||||
using Point = System.Windows.Point;
|
||||
|
||||
namespace Ink_Canvas {
|
||||
public partial class MainWindow : Window {
|
||||
public partial class MainWindow : PerformanceTransparentWin {
|
||||
#region Floating Bar Control
|
||||
|
||||
private void ImageDrawShape_MouseUp(object sender, MouseButtonEventArgs e) {
|
||||
|
@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using Ink_Canvas.Helpers;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Windows;
|
||||
using System.Windows.Ink;
|
||||
@ -7,7 +8,7 @@ using System.Windows.Media;
|
||||
|
||||
namespace Ink_Canvas {
|
||||
|
||||
public partial class MainWindow : Window {
|
||||
public partial class MainWindow : PerformanceTransparentWin {
|
||||
|
||||
public StrokeCollection DrawShapeCore(PointCollection pts, ShapeDrawingType type, bool doNotDisturbutePoints, bool isPreview) {
|
||||
// 线
|
||||
|
@ -14,7 +14,7 @@ using System.Windows.Threading;
|
||||
using Point = System.Windows.Point;
|
||||
|
||||
namespace Ink_Canvas {
|
||||
public partial class MainWindow : Window {
|
||||
public partial class MainWindow : PerformanceTransparentWin {
|
||||
private StrokeCollection newStrokes = new StrokeCollection();
|
||||
private List<Circle> circles = new List<Circle>();
|
||||
|
||||
|
@ -17,7 +17,7 @@ using Ink_Canvas.Helpers;
|
||||
using JetBrains.Annotations;
|
||||
|
||||
namespace Ink_Canvas {
|
||||
public partial class MainWindow : Window {
|
||||
public partial class MainWindow : PerformanceTransparentWin {
|
||||
|
||||
public class StorageLocationItem {
|
||||
public string Path { get; set; }
|
||||
|
@ -10,7 +10,7 @@ using System.Diagnostics;
|
||||
using System.Windows.Media.Imaging;
|
||||
|
||||
namespace Ink_Canvas {
|
||||
public partial class MainWindow : Window {
|
||||
public partial class MainWindow : PerformanceTransparentWin {
|
||||
private enum CommitReason {
|
||||
UserInput,
|
||||
CodeInput,
|
||||
|
@ -39,7 +39,7 @@ namespace Ink_Canvas {
|
||||
}
|
||||
}
|
||||
|
||||
public partial class MainWindow : Window {
|
||||
public partial class MainWindow : PerformanceTransparentWin {
|
||||
private Timer timerCheckPPT = new Timer();
|
||||
private Timer timerKillProcess = new Timer();
|
||||
private Timer timerCheckAutoFold = new Timer();
|
||||
|
@ -12,7 +12,7 @@ using System.Windows.Media;
|
||||
using Point = System.Windows.Point;
|
||||
|
||||
namespace Ink_Canvas {
|
||||
public partial class MainWindow : Window {
|
||||
public partial class MainWindow : PerformanceTransparentWin {
|
||||
#region Multi-Touch
|
||||
|
||||
private bool isInMultiTouchMode = false;
|
||||
|
137
InkCanvasForClass/MainWindow_cs/MW_V2_FloatingBar.cs
Normal file
137
InkCanvasForClass/MainWindow_cs/MW_V2_FloatingBar.cs
Normal file
@ -0,0 +1,137 @@
|
||||
using Ink_Canvas.Helpers;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Ink;
|
||||
using System.Windows.Media;
|
||||
|
||||
namespace Ink_Canvas {
|
||||
public partial class MainWindow : PerformanceTransparentWin {
|
||||
|
||||
public FloatingToolBarV2 FloatingToolBarV2;
|
||||
|
||||
private void InitFloatingToolbarV2() {
|
||||
FloatingToolBarV2 = new FloatingToolBarV2();
|
||||
FloatingToolBarV2.Topmost = false;
|
||||
FloatingToolBarV2.Show();
|
||||
FloatingToolBarV2.Owner = this;
|
||||
|
||||
FloatingToolBarV2.FloatingBarToolSelectionChanged += FloatingToolBarV2_ToolSelectionChanged;
|
||||
FloatingToolBarV2.FloatingBarToolButtonClicked += FloatingToolBarV2_ToolButtonClicked;
|
||||
}
|
||||
|
||||
#region 工具切换
|
||||
|
||||
private void SwitchToCursorMode() {
|
||||
// 结束未完成的形状绘制
|
||||
if (ShapeDrawingV2Layer.IsInShapeDrawingMode) ShapeDrawingV2Layer.EndShapeDrawing();
|
||||
|
||||
// 切换前自动截图保存墨迹
|
||||
if (inkCanvas.Strokes.Count > 0 &&
|
||||
inkCanvas.Strokes.Count > Settings.Automation.MinimumAutomationStrokeNumber) {
|
||||
if (BorderFloatingBarExitPPTBtn.Visibility == Visibility.Visible) SavePPTScreenshot($"{pptName}/{previousSlideID}_{DateTime.Now:HH-mm-ss}");
|
||||
else SaveScreenshot(true);
|
||||
}
|
||||
|
||||
|
||||
inkCanvas.Visibility = Settings.Canvas.HideStrokeWhenSelecting ? Visibility.Collapsed : Visibility.Visible;
|
||||
inkCanvas.IsHitTestVisible = false;
|
||||
SetTransparentHitThrough();
|
||||
|
||||
GridBackgroundCoverHolder.Visibility = Visibility.Collapsed;
|
||||
inkCanvas.Select(new StrokeCollection());
|
||||
GridInkCanvasSelectionCover.Visibility = Visibility.Collapsed;
|
||||
|
||||
RectangleSelectionHitTestBorder.Visibility = Visibility.Collapsed;
|
||||
|
||||
if (currentMode != 0) {
|
||||
SaveStrokes();
|
||||
RestoreStrokes(true);
|
||||
}
|
||||
}
|
||||
|
||||
private void SwitchToPenMode() {
|
||||
// 结束未完成的形状绘制
|
||||
if (ShapeDrawingV2Layer.IsInShapeDrawingMode) ShapeDrawingV2Layer.EndShapeDrawing();
|
||||
|
||||
inkCanvas.EditingMode = InkCanvasEditingMode.Ink;
|
||||
|
||||
SetTransparentNotHitThrough();
|
||||
inkCanvas.IsHitTestVisible = true;
|
||||
inkCanvas.Visibility = Visibility.Visible;
|
||||
|
||||
GridBackgroundCoverHolder.Visibility = Visibility.Visible;
|
||||
GridInkCanvasSelectionCover.Visibility = Visibility.Collapsed;
|
||||
|
||||
ColorSwitchCheck();
|
||||
}
|
||||
|
||||
private void ClearInkCanvasStrokes(bool isClearTimeMachineHistory, bool isErasedByCode) {
|
||||
if (inkCanvas.GetSelectedStrokes().Count > 0) {
|
||||
inkCanvas.Strokes.Remove(inkCanvas.GetSelectedStrokes());
|
||||
// cancel
|
||||
GridInkCanvasSelectionCover.Visibility = Visibility.Collapsed;
|
||||
inkCanvas.Opacity = 1;
|
||||
InkSelectionStrokesOverlay.Visibility = Visibility.Collapsed;
|
||||
InkSelectionStrokesBackgroundInkCanvas.Visibility = Visibility.Collapsed;
|
||||
InkSelectionStrokesOverlay.DrawStrokes(new StrokeCollection(), new Matrix());
|
||||
UpdateStrokeSelectionBorder(false, null);
|
||||
RectangleSelectionHitTestBorder.Visibility = Visibility.Visible;
|
||||
} else if (inkCanvas.Strokes.Count > 0) {
|
||||
if (Settings.Automation.IsAutoSaveStrokesAtClear &&
|
||||
inkCanvas.Strokes.Count > Settings.Automation.MinimumAutomationStrokeNumber) {
|
||||
if (BorderFloatingBarExitPPTBtn.Visibility == Visibility.Visible)
|
||||
SavePPTScreenshot($"{pptName}/{previousSlideID}_{DateTime.Now:HH-mm-ss}");
|
||||
else
|
||||
SaveScreenshot(true);
|
||||
}
|
||||
|
||||
forceEraser = false;
|
||||
|
||||
if (currentMode == 0) {
|
||||
// 先回到画笔再清屏,避免 TimeMachine 的相关 bug 影响
|
||||
if (Pen_Icon.Background == null && StackPanelCanvasControls.Visibility == Visibility.Visible) SwitchToPenMode();
|
||||
} else if (Pen_Icon.Background == null) SwitchToPenMode();
|
||||
|
||||
if (inkCanvas.Strokes.Count != 0) {
|
||||
var whiteboardIndex = CurrentWhiteboardIndex;
|
||||
if (currentMode == 0) whiteboardIndex = 0;
|
||||
strokeCollections[whiteboardIndex] = inkCanvas.Strokes.Clone();
|
||||
}
|
||||
|
||||
ClearStrokes(false);
|
||||
inkCanvas.Children.Clear();
|
||||
|
||||
CancelSingleFingerDragMode();
|
||||
|
||||
if (isClearTimeMachineHistory) {
|
||||
inkCanvas.Strokes.Clear();
|
||||
timeMachine.ClearStrokeHistory();
|
||||
} else {
|
||||
_currentCommitType = CommitReason.ClearingCanvas;
|
||||
if (isErasedByCode) _currentCommitType = CommitReason.CodeInput;
|
||||
inkCanvas.Strokes.Clear();
|
||||
_currentCommitType = CommitReason.UserInput;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private void FloatingToolBarV2_ToolSelectionChanged(object sender, EventArgs e) {
|
||||
var item = (FloatingBarItem)sender;
|
||||
if (item.ToolType == ICCToolsEnum.CursorMode) SwitchToCursorMode();
|
||||
if (item.ToolType == ICCToolsEnum.PenMode) SwitchToPenMode();
|
||||
}
|
||||
|
||||
private void FloatingToolBarV2_ToolButtonClicked(object sender, EventArgs e) {
|
||||
var item = (FloatingBarItem)sender;
|
||||
if (item.Name == "Clear") ClearInkCanvasStrokes(Settings.Canvas.ClearCanvasAndClearTimeMachine,false);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using Ink_Canvas.Helpers;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
@ -10,7 +11,7 @@ using System.Windows.Input;
|
||||
|
||||
namespace Ink_Canvas
|
||||
{
|
||||
public partial class MainWindow : Window {
|
||||
public partial class MainWindow : PerformanceTransparentWin {
|
||||
|
||||
private bool _stylusInverted = false;
|
||||
private int _stylusInvertedInit = 0;
|
||||
|
@ -583,18 +583,21 @@ namespace Ink_Canvas
|
||||
}
|
||||
}
|
||||
|
||||
public event EventHandler<EventArgs> FloatingBarToolSelectionChanged;
|
||||
public event EventHandler<EventArgs> FloatingBarToolButtonClicked;
|
||||
|
||||
private void OnToolSelectionChanged(FloatingBarItem sender) {
|
||||
if (ToolBarNowVariantMode == 3) return;
|
||||
HideAllPopups();
|
||||
Dispatcher.InvokeAsync(() => HideAllPopups());
|
||||
if (sender.Selected && sender.ToolType != MainWindow.ICCToolsEnum.CursorMode) {
|
||||
if (ToolBarNowVariantMode != 0) UpdateToolBarVariant(0);
|
||||
} else {
|
||||
if (ToolBarNowVariantMode != 1) UpdateToolBarVariant(1);
|
||||
}
|
||||
FloatingBarToolSelectionChanged?.Invoke(sender,EventArgs.Empty);
|
||||
}
|
||||
|
||||
private void OnToolButtonClicked(FloatingBarItem sender, Grid container) {
|
||||
|
||||
if (sender.ToolType == MainWindow.ICCToolsEnum.PenMode) {
|
||||
if (PenPaletteV2Popup.IsOpen) {
|
||||
HideAllPopups();
|
||||
@ -626,6 +629,7 @@ namespace Ink_Canvas
|
||||
ShapeDrawingPopupV2.IsOpen = true;
|
||||
}
|
||||
}
|
||||
FloatingBarToolButtonClicked?.Invoke(sender,EventArgs.Empty);
|
||||
}
|
||||
|
||||
private void ToolbarButton_MouseDown(object sender, MouseButtonEventArgs e) {
|
||||
|
@ -276,8 +276,7 @@ namespace Ink_Canvas
|
||||
public bool IsShowCanvasAtNewSlideShow { get; set; } = true;
|
||||
[JsonProperty("isNoClearStrokeOnSelectWhenInPowerPoint")]
|
||||
public bool IsNoClearStrokeOnSelectWhenInPowerPoint { get; set; } = true;
|
||||
[JsonProperty("isShowStrokeOnSelectInPowerPoint")]
|
||||
public bool IsShowStrokeOnSelectInPowerPoint { get; set; } = false;
|
||||
|
||||
[JsonProperty("isAutoSaveStrokesInPowerPoint")]
|
||||
public bool IsAutoSaveStrokesInPowerPoint { get; set; } = true;
|
||||
[JsonProperty("isAutoSaveScreenShotInPowerPoint")]
|
||||
|
12
InkCanvasForClass/Windows/SettingsViews/AppearancePanel.xaml
Normal file
12
InkCanvasForClass/Windows/SettingsViews/AppearancePanel.xaml
Normal file
@ -0,0 +1,12 @@
|
||||
<UserControl x:Class="Ink_Canvas.Windows.SettingsViews.AppearancePanel"
|
||||
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:Ink_Canvas.Windows.SettingsViews"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="450" d:DesignWidth="800">
|
||||
<Grid>
|
||||
<local:SettingsBaseView x:Name="BaseView"/>
|
||||
</Grid>
|
||||
</UserControl>
|
@ -0,0 +1,77 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
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.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
using Windows.UI.ApplicationSettings;
|
||||
|
||||
namespace Ink_Canvas.Windows.SettingsViews {
|
||||
public partial class AppearancePanel : UserControl {
|
||||
public AppearancePanel() {
|
||||
InitializeComponent();
|
||||
BaseView.SettingsPanels.Add(new SettingsViewPanel() {
|
||||
Title = "新版设置测试",
|
||||
Items = new ObservableCollection<SettingsItem>(new SettingsItem[] {
|
||||
new SettingsItem() {
|
||||
Title = "默认ToggleSwitch",
|
||||
Description = "这是测试文本,这是测试文本",
|
||||
Type = SettingsItemType.SingleToggleSwtich,
|
||||
IsSeparatorVisible = true
|
||||
},
|
||||
new SettingsItem() {
|
||||
Title = "默认开启的ToggleSwitch",
|
||||
Description = "这是测试文本,这是测试文本324234324",
|
||||
Type = SettingsItemType.SingleToggleSwtich,
|
||||
IsSeparatorVisible = true,
|
||||
ToggleSwitchToggled = true,
|
||||
},
|
||||
new SettingsItem() {
|
||||
Title = "默认关闭的ToggleSwitch",
|
||||
Description = "这是测试文本,这是测试文本fsdsdffsd",
|
||||
Type = SettingsItemType.SingleToggleSwtich,
|
||||
IsSeparatorVisible = true,
|
||||
ToggleSwitchToggled = false,
|
||||
},
|
||||
new SettingsItem() {
|
||||
Title = "绿色的ToggleSwitch",
|
||||
Description = "这是测试文本,这是测试文本fs大风刮过4sd",
|
||||
Type = SettingsItemType.SingleToggleSwtich,
|
||||
IsSeparatorVisible = true,
|
||||
ToggleSwitchToggled = true,
|
||||
ToggleSwitchBackground = new SolidColorBrush(Color.FromRgb(51, 209, 122)),
|
||||
},
|
||||
new SettingsItem() {
|
||||
Title = "默认禁用的的ToggleSwitch",
|
||||
Description = "这是测试文本",
|
||||
Type = SettingsItemType.SingleToggleSwtich,
|
||||
IsSeparatorVisible = true,
|
||||
ToggleSwitchToggled = true,
|
||||
ToggleSwitchEnabled = false,
|
||||
ToggleSwitchBackground = new SolidColorBrush(Color.FromRgb(51, 209, 122)),
|
||||
},
|
||||
new SettingsItem() {
|
||||
Title = "控制上面的ToggleSwitch是否启用",
|
||||
Description = "12423432452312322335",
|
||||
Type = SettingsItemType.SingleToggleSwtich,
|
||||
IsSeparatorVisible = true,
|
||||
ToggleSwitchToggled = false,
|
||||
},
|
||||
})
|
||||
});
|
||||
BaseView.SettingsPanels[0].Items[5].OnToggleSwitchToggled += (sender, args) => {
|
||||
var item = (SettingsItem)sender;
|
||||
BaseView.SettingsPanels[0].Items[4].ToggleSwitchEnabled = item.ToggleSwitchToggled;
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,97 @@
|
||||
<UserControl x:Class="Ink_Canvas.Windows.SettingsViews.FloatingBarDnDSettingsPanel"
|
||||
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:Ink_Canvas.Windows.SettingsViews"
|
||||
xmlns:dd="urn:gong-wpf-dragdrop"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="450" d:DesignWidth="600">
|
||||
<UserControl.Resources>
|
||||
<DrawingImage x:Key="CursorIcon">
|
||||
<DrawingImage.Drawing>
|
||||
<DrawingGroup ClipGeometry="M0,0 V24 H24 V0 H0 Z">
|
||||
<GeometryDrawing Brush="#FF222222" Geometry="F1 M24,24z M0,0z M5.19409,16.3124C5.46422,18.0658 5.69121,19.539 5.8351,20.4621 5.9631,21.2477 6.80568,21.3359 7.22902,20.5643 7.93608,19.3044 9.20443,17.1009 10.0921,15.5636L14.9921,22.5615C15.1915,22.8462,15.5839,22.9154,15.8687,22.716L17.9309,21.272C18.2157,21.0727,18.2848,20.6802,18.0854,20.3955L13.5037,13.8522C15.6284,13.8519 18.6266,13.8518 20.2609,13.8524 21.1847,13.8201 21.258,12.9461 20.5777,12.4184 16.9666,9.91811 8.45126,4.12632 4.34164,1.42431 3.63839,0.928666 2.78717,1.12985 3.00557,2.27077 3.59731,5.94841 4.52718,11.9839 5.19409,16.3124z" />
|
||||
</DrawingGroup>
|
||||
</DrawingImage.Drawing>
|
||||
</DrawingImage>
|
||||
<DrawingImage x:Key="PenIcon">
|
||||
<DrawingImage.Drawing>
|
||||
<DrawingGroup ClipGeometry="M0,0 V24 H24 V0 H0 Z">
|
||||
<GeometryDrawing Brush="#222222" Geometry="F1 M24,24z M0,0z M20.4786,1.42438C19.9985,1.23743 19.4847,1.15194 18.9698,1.17319 18.4549,1.19444 17.9499,1.32197 17.4869,1.54789 17.0368,1.76752 16.6358,2.07554 16.3083,2.45361L3.85516,14.9067 9.08243,20.134 21.5311,7.68529C21.9113,7.36382 22.223,6.96912 22.447,6.52438 22.6786,6.06462 22.8113,5.56167 22.8365,5.04763 22.8616,4.5336 22.7787,4.02012 22.593,3.54002 22.4073,3.05994 22.1232,2.62403 21.759,2.25988 21.3949,1.89574 20.9587,1.61132 20.4786,1.42438z" />
|
||||
<GeometryDrawing Brush="#222222" Geometry="F1 M24,24z M0,0z M7.28056,21.1605L2.8286,16.7086 1.15912,22.83 7.28056,21.1605z" />
|
||||
</DrawingGroup>
|
||||
</DrawingImage.Drawing>
|
||||
</DrawingImage>
|
||||
<DrawingImage x:Key="EraserIcon">
|
||||
<DrawingImage.Drawing>
|
||||
<DrawingGroup ClipGeometry="M0,0 V24 H24 V0 H0 Z">
|
||||
<GeometryDrawing Brush="#222222" Geometry="F1 M24,24z M0,0z M15.6314,20.7262L22.7921,13.5655C24.3494,12.141,24.2819,9.81776,22.8105,8.34633L16.7793,2.31508C15.3547,0.757753,13.0315,0.825236,11.5601,2.29666L4.38099,9.47574 15.6314,20.7262z" />
|
||||
<GeometryDrawing Brush="#222222" Geometry="F1 M24,24z M0,0z M14.2172,22.1404L2.96677,10.89 1.20761,12.6491C-0.34971,14.0737,-0.281711,16.3974,1.18971,17.8688L6.15089,22.83 13.5276,22.83 14.2172,22.1404z" />
|
||||
</DrawingGroup>
|
||||
</DrawingImage.Drawing>
|
||||
</DrawingImage>
|
||||
</UserControl.Resources>
|
||||
<Grid>
|
||||
<StackPanel Orientation="Vertical">
|
||||
<Border Name="ToolbarItemsControl" Height="46" Background="#ebebeb" Margin="0,0,6,0">
|
||||
<Grid Margin="4,0">
|
||||
<ItemsControl dd:DragDrop.IsDragSource="True"
|
||||
dd:DragDrop.IsDropTarget="True"
|
||||
dd:DragDrop.DragMouseAnchorPoint="0.5,0.5"
|
||||
dd:DragDrop.DropHandler="{Binding}"
|
||||
ItemsSource="{Binding BarItems}">
|
||||
<dd:DragDrop.DragAdornerTemplate>
|
||||
<DataTemplate>
|
||||
<Border HorizontalAlignment="Center" CornerRadius="6" Background="#fafafa" BorderBrush="#a3a3a3" BorderThickness="1" Width="38" Height="38">
|
||||
<Image Source="{Binding IconSource}" Width="20" Height="20"></Image>
|
||||
</Border>
|
||||
</DataTemplate>
|
||||
</dd:DragDrop.DragAdornerTemplate>
|
||||
<ItemsControl.ItemsPanel>
|
||||
<ItemsPanelTemplate>
|
||||
<StackPanel Background="Transparent" Orientation="Horizontal" Width="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Border},AncestorLevel=1},Path=ActualWidth}"></StackPanel>
|
||||
</ItemsPanelTemplate>
|
||||
</ItemsControl.ItemsPanel>
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<Border HorizontalAlignment="Center" CornerRadius="6" Margin="4,0,0,0" Background="#fafafa" BorderBrush="#a3a3a3" BorderThickness="1" Width="38" Height="38">
|
||||
<Image Source="{Binding IconSource}" Width="20" Height="20"></Image>
|
||||
</Border>
|
||||
</DataTemplate>
|
||||
</ItemsControl.ItemTemplate>
|
||||
</ItemsControl>
|
||||
</Grid>
|
||||
</Border>
|
||||
<Border Name="ToolbarDrawerItemsControl" Height="46" Background="#ebebeb" Margin="0,0,6,0">
|
||||
<Grid Margin="4,0">
|
||||
<ItemsControl dd:DragDrop.IsDragSource="True"
|
||||
dd:DragDrop.IsDropTarget="True"
|
||||
dd:DragDrop.DragMouseAnchorPoint="0,0"
|
||||
dd:DragDrop.DropHandler="{Binding}"
|
||||
ItemsSource="{Binding BarDrawerItems}">
|
||||
<dd:DragDrop.DragAdornerTemplate>
|
||||
<DataTemplate>
|
||||
<Border HorizontalAlignment="Center" CornerRadius="6" Background="#fafafa" BorderBrush="#a3a3a3" BorderThickness="1" Width="38" Height="38">
|
||||
<Image Source="{Binding IconSource}" Width="20" Height="20"></Image>
|
||||
</Border>
|
||||
</DataTemplate>
|
||||
</dd:DragDrop.DragAdornerTemplate>
|
||||
<ItemsControl.ItemsPanel>
|
||||
<ItemsPanelTemplate>
|
||||
<StackPanel Background="Transparent" Orientation="Horizontal" Width="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Border},AncestorLevel=1},Path=ActualWidth}" HorizontalAlignment="Center"></StackPanel>
|
||||
</ItemsPanelTemplate>
|
||||
</ItemsControl.ItemsPanel>
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<Border HorizontalAlignment="Center" CornerRadius="6" Margin="4,0,0,0" Background="#fafafa" BorderBrush="#a3a3a3" BorderThickness="1" Width="38" Height="38">
|
||||
<Image Source="{Binding IconSource}" Width="20" Height="20"/>
|
||||
</Border>
|
||||
</DataTemplate>
|
||||
</ItemsControl.ItemTemplate>
|
||||
</ItemsControl>
|
||||
</Grid>
|
||||
</Border>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</UserControl>
|
@ -0,0 +1,124 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Diagnostics;
|
||||
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.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
using GongSolutions.Wpf.DragDrop;
|
||||
using static System.Windows.Forms.VisualStyles.VisualStyleElement.Menu;
|
||||
|
||||
namespace Ink_Canvas.Windows.SettingsViews {
|
||||
|
||||
public partial class FloatingBarDnDSettingsPanel : UserControl {
|
||||
|
||||
public class BarItemsDropTarget : IDropTarget {
|
||||
public ObservableCollection<FloatingBarItem> BarItems { get; set; } =
|
||||
new ObservableCollection<FloatingBarItem>();
|
||||
|
||||
void IDropTarget.DragOver(IDropInfo info) {
|
||||
info.Effects = DragDropEffects.Move;
|
||||
info.DropTargetAdorner = DropTargetAdorners.Insert;
|
||||
}
|
||||
|
||||
void IDropTarget.Drop(IDropInfo info) {
|
||||
if (info.Data is FloatingBarItem draggedItem) {
|
||||
var targetCollection = info.TargetCollection as ObservableCollection<FloatingBarItem>;
|
||||
var sourceCollection = info.DragInfo.SourceCollection as ObservableCollection<FloatingBarItem>;
|
||||
|
||||
Trace.WriteLine(info.InsertIndex);
|
||||
|
||||
// 在同一个 ObservableCollection 中移动
|
||||
if (targetCollection.Equals(sourceCollection)) {
|
||||
if (info.InsertIndex == 0) {
|
||||
targetCollection.Move(targetCollection.IndexOf(info.Data as FloatingBarItem),0);
|
||||
} else if (info.InsertIndex == targetCollection.Count) {
|
||||
targetCollection.Remove(info.Data as FloatingBarItem);
|
||||
targetCollection.Add(info.Data as FloatingBarItem);
|
||||
} else if ((info.InsertIndex - targetCollection.IndexOf(info.Data as FloatingBarItem) == 1 &&
|
||||
info.InsertPosition == RelativeInsertPosition.AfterTargetItem) ||
|
||||
(info.InsertIndex - targetCollection.IndexOf(info.Data as FloatingBarItem) == 0 &&
|
||||
info.InsertPosition == RelativeInsertPosition.BeforeTargetItem)) { } else {
|
||||
targetCollection.Move(targetCollection.IndexOf(info.Data as FloatingBarItem),info.InsertIndex - 1);
|
||||
}
|
||||
} else { // 跨 ObservableCollection 移动
|
||||
sourceCollection.Remove(info.Data as FloatingBarItem);
|
||||
targetCollection.Insert(info.InsertIndex, info.Data as FloatingBarItem);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void IDropTarget.DragEnter(IDropInfo info) {
|
||||
|
||||
}
|
||||
|
||||
void IDropTarget.DragLeave(IDropInfo info) {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public class BarDrawerItemsDropTarget : IDropTarget {
|
||||
public ObservableCollection<FloatingBarItem> BarDrawerItems { get; set; } =
|
||||
new ObservableCollection<FloatingBarItem>();
|
||||
|
||||
void IDropTarget.DragOver(IDropInfo info) {
|
||||
info.Effects = DragDropEffects.Move;
|
||||
info.DropTargetAdorner = DropTargetAdorners.Insert;
|
||||
}
|
||||
|
||||
void IDropTarget.Drop(IDropInfo info) {
|
||||
if (info.Data is FloatingBarItem draggedItem) {
|
||||
var targetCollection = info.TargetCollection as ObservableCollection<FloatingBarItem>;
|
||||
var sourceCollection = info.DragInfo.SourceCollection as ObservableCollection<FloatingBarItem>;
|
||||
|
||||
// 在同一个 ObservableCollection 中移动
|
||||
if (targetCollection.Equals(sourceCollection)) {
|
||||
targetCollection.Insert(info.InsertIndex, info.Data as FloatingBarItem);
|
||||
} else { // 跨 ObservableCollection 移动
|
||||
sourceCollection.Remove(info.Data as FloatingBarItem);
|
||||
targetCollection.Insert(info.InsertIndex, info.Data as FloatingBarItem);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void IDropTarget.DragEnter(IDropInfo info) {
|
||||
|
||||
}
|
||||
|
||||
void IDropTarget.DragLeave(IDropInfo info) {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public BarItemsDropTarget barItems { get; set; } = new BarItemsDropTarget();
|
||||
public BarDrawerItemsDropTarget barDrawerItems { get; set; } = new BarDrawerItemsDropTarget();
|
||||
|
||||
public FloatingBarDnDSettingsPanel() {
|
||||
InitializeComponent();
|
||||
|
||||
ToolbarItemsControl.DataContext = barItems;
|
||||
ToolbarDrawerItemsControl.DataContext = barDrawerItems;
|
||||
|
||||
barItems.BarItems.Add(new FloatingBarItem() {
|
||||
IconSource = FindResource("EraserIcon") as DrawingImage,
|
||||
});
|
||||
barDrawerItems.BarDrawerItems.Add(new FloatingBarItem() {
|
||||
IconSource = FindResource("CursorIcon") as DrawingImage,
|
||||
});
|
||||
barDrawerItems.BarDrawerItems.Add(new FloatingBarItem() {
|
||||
IconSource = FindResource("PenIcon") as DrawingImage,
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
@ -4,11 +4,12 @@
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="clr-namespace:Ink_Canvas.Windows.SettingsViews"
|
||||
xmlns:components="clr-namespace:Ink_Canvas.Components"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="450" d:DesignWidth="800">
|
||||
<Grid>
|
||||
<ScrollViewer ScrollChanged="ScrollViewerEx_ScrollChanged" IsManipulationEnabled="True" Name="SettingsViewScrollViewer" IsDeferredScrollingEnabled="True" VerticalScrollBarVisibility="Visible" HorizontalScrollBarVisibility="Disabled" IsTabStop="False" TabIndex="-1" Margin="0,0,2,2">
|
||||
<ItemsControl>
|
||||
<ItemsControl Name="SettingsViewBaseItemsControl">
|
||||
<ItemsControl.ItemsPanel>
|
||||
<ItemsPanelTemplate>
|
||||
<StackPanel Margin="0,12,0,24" HorizontalAlignment="Center" Width="524"/>
|
||||
@ -16,6 +17,34 @@
|
||||
</ItemsControl.ItemsPanel>
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<StackPanel Orientation="Vertical" Margin="0,0,0,25">
|
||||
<TextBlock Visibility="{Binding _TitleVisibility}" Text="{Binding Title}" FontSize="15" FontWeight="Bold" Foreground="#2e3436"/>
|
||||
<Border Margin="{Binding _PanelMargin}" Background="#fafafa" BorderBrush="#e6e6e6" BorderThickness="1.25,1.25,1.25,4" CornerRadius="8">
|
||||
<StackPanel Orientation="Vertical">
|
||||
<ItemsControl ItemsSource="{Binding Items}">
|
||||
<ItemsControl.ItemsPanel>
|
||||
<ItemsPanelTemplate>
|
||||
<StackPanel Orientation="Vertical"></StackPanel>
|
||||
</ItemsPanelTemplate>
|
||||
</ItemsControl.ItemsPanel>
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<StackPanel Orientation="Vertical">
|
||||
<Grid Height="54">
|
||||
<StackPanel Orientation="Vertical" Margin="18,0,0,0" VerticalAlignment="Center" HorizontalAlignment="Left">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="{Binding Title}" HorizontalAlignment="Left"/>
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="{Binding Description}" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<components:ToggleSwitch IsEnabled="{Binding ToggleSwitchEnabled}" SwitchBackground="{Binding ToggleSwitchBackground, Mode=TwoWay}" IsOn="{Binding ToggleSwitchToggled, Mode=TwoWay}" Tag="{Binding}" Visibility="{Binding _ToggleSwitchVisibility}" Margin="0,0,15,0"/>
|
||||
</Grid>
|
||||
<Border Visibility="{Binding _SeparatorVisibility}" Height="1" Background="#ebebeb"/>
|
||||
</StackPanel>
|
||||
</DataTemplate>
|
||||
</ItemsControl.ItemTemplate>
|
||||
</ItemsControl>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
</StackPanel>
|
||||
</DataTemplate>
|
||||
</ItemsControl.ItemTemplate>
|
||||
</ItemsControl>
|
||||
|
@ -1,5 +1,8 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.ComponentModel;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
@ -13,17 +16,84 @@ using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
using Ink_Canvas.Components;
|
||||
using iNKORE.UI.WPF.Helpers;
|
||||
|
||||
namespace Ink_Canvas.Windows.SettingsViews {
|
||||
/// <summary>
|
||||
/// SettingsBaseView.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
|
||||
public class SettingsViewPanel {
|
||||
public string Title { get; set; }
|
||||
public Visibility _TitleVisibility => String.IsNullOrWhiteSpace(Title) ? Visibility.Collapsed : Visibility.Visible;
|
||||
public Thickness _PanelMargin =>
|
||||
String.IsNullOrWhiteSpace(Title) ? new Thickness(0) : new Thickness(0, 12, 0, 0);
|
||||
public ObservableCollection<SettingsItem> Items { get; set; } = new ObservableCollection<SettingsItem>() { };
|
||||
}
|
||||
|
||||
public enum SettingsItemType {
|
||||
Plain, // 只显示Title和Description
|
||||
SingleToggleSwtich,
|
||||
ToggleSwitchWithArrowButton,
|
||||
SelectionButtons,
|
||||
}
|
||||
|
||||
public class SettingsItem : INotifyPropertyChanged {
|
||||
public string Title { get; set; }
|
||||
public string Description { get; set; }
|
||||
public SettingsItemType Type { get; set; } = SettingsItemType.Plain;
|
||||
public bool IsClickable { get; set; } = false;
|
||||
public bool IsSeparatorVisible { get; set; } = true;
|
||||
public Visibility _SeparatorVisibility => IsSeparatorVisible ? Visibility.Visible : Visibility.Collapsed;
|
||||
public Visibility _ToggleSwitchVisibility =>
|
||||
Type == SettingsItemType.SingleToggleSwtich || Type == SettingsItemType.ToggleSwitchWithArrowButton ? Visibility.Visible : Visibility.Collapsed;
|
||||
private bool _toggleSwitchToggled;
|
||||
public bool ToggleSwitchToggled {
|
||||
get => _toggleSwitchToggled;
|
||||
set {
|
||||
if (_toggleSwitchToggled != value) {
|
||||
_toggleSwitchToggled = value;
|
||||
OnPropertyChanged(nameof(ToggleSwitchToggled)); // 通知绑定控件属性变化
|
||||
OnToggleSwitchToggled?.Invoke(this, EventArgs.Empty); // 触发事件
|
||||
}
|
||||
}
|
||||
}
|
||||
public event EventHandler OnToggleSwitchToggled;
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
protected virtual void OnPropertyChanged(string propertyName) {
|
||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
||||
}
|
||||
|
||||
private SolidColorBrush _toggleSwitchBackground = new SolidColorBrush(Color.FromRgb(53, 132, 228));
|
||||
public SolidColorBrush ToggleSwitchBackground {
|
||||
get => _toggleSwitchBackground;
|
||||
set {
|
||||
if (_toggleSwitchBackground != value) {
|
||||
_toggleSwitchBackground = value;
|
||||
OnPropertyChanged(nameof(ToggleSwitchBackground)); // 通知绑定控件属性变化
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private bool _toggleSwitchEnabled = true;
|
||||
public bool ToggleSwitchEnabled {
|
||||
get => _toggleSwitchEnabled;
|
||||
set {
|
||||
if (_toggleSwitchEnabled != value) {
|
||||
_toggleSwitchEnabled = value;
|
||||
OnPropertyChanged(nameof(ToggleSwitchEnabled)); // 通知绑定控件属性变化
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public partial class SettingsBaseView : UserControl {
|
||||
public SettingsBaseView() {
|
||||
InitializeComponent();
|
||||
SettingsViewBaseItemsControl.ItemsSource = SettingsPanels;
|
||||
}
|
||||
|
||||
public ObservableCollection<SettingsViewPanel> SettingsPanels { get; set; } =
|
||||
new ObservableCollection<SettingsViewPanel>() { };
|
||||
|
||||
public event EventHandler<RoutedEventArgs> IsTopBarNeedShadowEffect;
|
||||
public event EventHandler<RoutedEventArgs> IsTopBarNeedNoShadowEffect;
|
||||
|
||||
@ -66,6 +136,12 @@ namespace Ink_Canvas.Windows.SettingsViews {
|
||||
}
|
||||
}
|
||||
|
||||
private void ToggleSwitch_OnToggled(object sender, RoutedEventArgs e) {
|
||||
var toggleswitch = sender as ToggleSwitch;
|
||||
var item = toggleswitch.Tag as SettingsItem;
|
||||
item.ToggleSwitchToggled = toggleswitch.IsOn;
|
||||
}
|
||||
|
||||
private void ScrollBarTrack_MouseLeave(object sender, MouseEventArgs e) {
|
||||
var border = (Border)sender;
|
||||
border.Background = new SolidColorBrush(Colors.Transparent);
|
||||
|
@ -568,7 +568,7 @@
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
<!--CanvasAndInkPanel-->
|
||||
<Grid Margin="250,48,0,0" Visibility="Collapsed" Name="CanvasAndInkPane">
|
||||
<Grid Margin="250,48,0,0" Visibility="Visible" Name="CanvasAndInkPane">
|
||||
<ScrollViewer ScrollChanged="ScrollViewerEx_ScrollChanged" IsManipulationEnabled="True" Name="CanvasAndInkScrollViewerEx" IsDeferredScrollingEnabled="True" VerticalScrollBarVisibility="Visible" HorizontalScrollBarVisibility="Disabled" IsTabStop="False" TabIndex="-1" Margin="0,0,2,2">
|
||||
<StackPanel Margin="60,12,60,24">
|
||||
<Border BorderBrush="#e6e6e6" BorderThickness="1.25,1.25,1.25,4" CornerRadius="8">
|
||||
@ -862,6 +862,7 @@
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
<settingsViews:FloatingBarDnDSettingsPanel/>
|
||||
</StackPanel>
|
||||
</ScrollViewer>
|
||||
</Grid>
|
||||
@ -1328,8 +1329,8 @@
|
||||
</ScrollViewer>
|
||||
</Grid>
|
||||
<!--AppearancePanel-->
|
||||
<Grid Margin="250,48,0,0" Visibility="Visible" Name="AppearancePane">
|
||||
<ScrollViewer ScrollChanged="ScrollViewerEx_ScrollChanged" IsManipulationEnabled="True" Name="AppearanceScrollViewerEx" IsDeferredScrollingEnabled="True" VerticalScrollBarVisibility="Visible" HorizontalScrollBarVisibility="Disabled" IsTabStop="False" TabIndex="-1" Margin="0,0,2,2">
|
||||
<Grid Margin="250,48,0,0" Visibility="Collapsed" Name="AppearancePaneEx">
|
||||
<ScrollViewer ScrollChanged="ScrollViewerEx_ScrollChanged" IsManipulationEnabled="True" Name="AppearanceScrollViewerExEx" IsDeferredScrollingEnabled="True" VerticalScrollBarVisibility="Visible" HorizontalScrollBarVisibility="Disabled" IsTabStop="False" TabIndex="-1" Margin="0,0,2,2">
|
||||
<StackPanel Margin="0,12,0,24" HorizontalAlignment="Center" Width="524">
|
||||
<Border BorderBrush="#e6e6e6" BorderThickness="1.25,1.25,1.25,4" CornerRadius="8">
|
||||
<StackPanel Orientation="Vertical">
|
||||
@ -1843,6 +1844,9 @@
|
||||
</StackPanel>
|
||||
</ScrollViewer>
|
||||
</Grid>
|
||||
<Grid Margin="250,48,0,0" Visibility="Collapsed" Name="AppearancePane">
|
||||
<settingsViews:AppearancePanel/>
|
||||
</Grid>
|
||||
<!--InkRecognitionPanel-->
|
||||
<Grid Margin="250,48,0,0" Visibility="Collapsed" Name="InkRecognitionPane">
|
||||
<ScrollViewer ScrollChanged="ScrollViewerEx_ScrollChanged" IsManipulationEnabled="True" Name="InkRecognitionScrollViewerEx" IsDeferredScrollingEnabled="True" VerticalScrollBarVisibility="Visible" HorizontalScrollBarVisibility="Disabled" IsTabStop="False" TabIndex="-1" Margin="0,0,2,2">
|
||||
|
@ -22,6 +22,7 @@ using System.Windows.Media.Animation;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Shapes;
|
||||
using Ink_Canvas.Popups;
|
||||
using Ink_Canvas.Windows.SettingsViews;
|
||||
using iNKORE.UI.WPF.Helpers;
|
||||
using iNKORE.UI.WPF.Modern.Controls;
|
||||
using OSVersionExtension;
|
||||
@ -161,7 +162,7 @@ namespace Ink_Canvas.Windows {
|
||||
CanvasAndInkScrollViewerEx,
|
||||
GesturesScrollViewerEx,
|
||||
StartupScrollViewerEx,
|
||||
AppearanceScrollViewerEx,
|
||||
(AppearancePane.Children[0] as AppearancePanel).BaseView.SettingsViewScrollViewer,
|
||||
InkRecognitionScrollViewerEx,
|
||||
AutomationScrollViewerEx,
|
||||
PowerPointScrollViewerEx
|
||||
|
8
docs/README.md
Normal file
8
docs/README.md
Normal file
@ -0,0 +1,8 @@
|
||||
# ICC 开发文档
|
||||
|
||||
## 组件库
|
||||
|
||||
ICC 自己造了一套风格类似于 Gnome Gtk4 的 WPF 组件库,下面有具体每个控件的文档:
|
||||
|
||||
1. [`ToggleSwitch`](./components/ToggleSwitch.md) Gtk.Switch 青春版,切换开关状态的按钮控件
|
||||
2. [`SegmentedButtons`]() 类似 Gtk.StackSwitcher 的分段单选按钮
|
0
docs/components/SegmentedButtons.md
Normal file
0
docs/components/SegmentedButtons.md
Normal file
31
docs/components/ToggleSwitch.md
Normal file
31
docs/components/ToggleSwitch.md
Normal file
@ -0,0 +1,31 @@
|
||||
# ToggleSwitch
|
||||
|
||||
## 定义
|
||||
|
||||
命名空间:`Ink_Canvas.Components`
|
||||
|
||||
ToggleSwitch 开关按钮,只有开和关两种状态,可通过点击来切换状态。
|
||||
|
||||
## 属性
|
||||
|
||||
| Name | Description |
|
||||
|------|-------------|
|
||||
| `IsOn` | 指示是否为开启状态 |
|
||||
| `IsEnabled` | 指示是否可用,不可用透明度减半且无HitTest,无TabStop |
|
||||
| `IsDisplayTextIndicator` | 指示是否显示文字提示,I 和 O (WIP) |
|
||||
| `OnContent` | 指示开启时的文字,为空或不指定则不显示 (WIP) |
|
||||
| `OffContent` | 指示关闭时的文字,为空或不指定则不显示 (WIP) |
|
||||
| `SwitchBackground` | 指示切换按钮的背景色,不设置则采用默认颜色 |
|
||||
| `ThumbForeground` | 指示切换按钮Thumb的颜色,不设置则采用默认颜色 (WIP) |
|
||||
| `IsEnableClickFeedback` | 指示是否启用点击时的变暗反馈 (WIP) |
|
||||
| `IsReduceAnimations` | 指示是否减弱动画效果 (WIP) |
|
||||
| `SwitchSize` | 指示ToggleSwitch的大小 (WIP) |
|
||||
|
||||
## 事件
|
||||
|
||||
| Name | Description |
|
||||
|------|-------------|
|
||||
| `OnToggled` | 当切换按钮的开关状态被修改时触发 |
|
||||
| `IsEnableClickFeedbackChanged` | 当 `IsEnableClickFeedback` 被修改时触发 (WIP) |
|
||||
| `IsReduceAnimationsChanged` | 当 `IsReduceAnimations` 被修改时触发 (WIP) |
|
||||
| `OnSwitchsizeChanged` | 当 `SwitchSize` 变化时触发 (WIP) |
|
Loading…
Reference in New Issue
Block a user