Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
lingrottin committed Oct 1, 2023
1 parent cc8e80c commit 88b57ba
Show file tree
Hide file tree
Showing 15 changed files with 291 additions and 336 deletions.
6 changes: 6 additions & 0 deletions Directory.Build.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<LangVersion>10.0</LangVersion>
</PropertyGroup>
</Project>
4 changes: 4 additions & 0 deletions MapTP.App/AboutWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
xmlns:local="clr-namespace:MapTP.App"
mc:Ignorable="d"
Title="About MapTP" Height="237" Width="400">
<WindowChrome.WindowChrome>
<WindowChrome GlassFrameThickness="0,0,0,1"/>
</WindowChrome.WindowChrome>
<StackPanel Height="450" Margin="20">
<TextBlock HorizontalAlignment="Left" Margin="5" Text="About MapTP" Style="{StaticResource TextBlockTitleBold}"/>
<TextBlock HorizontalAlignment="Left" Margin="5" Text="MapTP v1.0.0 © Lingrottin 2023, some rights reserved" Style="{StaticResource TextBlockDefault}"/>
Expand All @@ -16,5 +19,6 @@
Source code
</Hyperlink>
</TextBlock>
<Button Background="{x:Null}" Click="Close">Close</Button>
</StackPanel>
</Window>
17 changes: 8 additions & 9 deletions MapTP.App/AboutWindow.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,17 +1,9 @@
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.Imaging;
using System.Windows.Shapes;
using Walterlv.Windows.Effects;

namespace MapTP.App
{
Expand All @@ -27,6 +19,13 @@ private void Hyperlink_Click(object sender, RoutedEventArgs e)
Hyperlink link = sender as Hyperlink;
Process.Start(new ProcessStartInfo(link.NavigateUri.AbsoluteUri));
}



private void Close(object sender, RoutedEventArgs e)
{
Close();
}
}


Expand Down
6 changes: 3 additions & 3 deletions MapTP.App/App.config
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8"/>
</startup>
</configuration>
</configuration>
2 changes: 1 addition & 1 deletion MapTP.App/CalibrateWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
mc:Ignorable="d"
Title="Touchpad size calibration" Height="200" Width="400">
<UniformGrid Columns="1" FocusManager.FocusedElement="{Binding ElementName=OkButton}">
<TextBlock HorizontalAlignment="Center" Width="360" Margin="20,0,20,0" TextWrapping="Wrap" Text="Please touch the Bottom-Right corner of your touchpad." Style="{StaticResource TextBlockTitle}" TextAlignment="Center"/>
<TextBlock x:Name="PleaseTouch" HorizontalAlignment="Center" Width="360" Margin="20,0,20,0" TextWrapping="Wrap" Text="Please touch the Bottom-Right corner of your touchpad." Style="{StaticResource TextBlockTitle}" TextAlignment="Center"/>
<TextBlock x:Name="TouchpadSize" HorizontalAlignment="Center" Width="360" TextWrapping="Wrap" Text="touchpad size:" Style="{StaticResource TextBlockDefault}" TextAlignment="Center"/>
<Button x:Name="OkButton" IsDefault="True" Style="{StaticResource ButtonPrimary}" Content="OK (Enter)" Click="OkButton_Click"/>

Expand Down
19 changes: 5 additions & 14 deletions MapTP.App/CalibrateWindow.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,26 +1,16 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using MapTP.App.Touchpad;
using System;
using System.Windows;
using System.Windows.Interop;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using HandyControl.Controls;
using MapTP.App.Touchpad;
using Walterlv.Windows.Effects;

namespace MapTP.App
{
/// <summary>
/// CalibrateWindow.xaml 的交互逻辑
/// </summary>
public partial class CalibrateWindow : System.Windows.Window
public partial class CalibrateWindow : Window
{
private int X=0, Y=0;
private HwndSource MainWindowHwnd;
Expand All @@ -39,6 +29,7 @@ public CalibrateWindow(HwndSource _MainWindowHwnd) : base()
}



private IntPtr WndProc(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref bool handled)
{
switch (msg)
Expand Down
169 changes: 94 additions & 75 deletions MapTP.App/MainWindow.xaml

Large diffs are not rendered by default.

46 changes: 40 additions & 6 deletions MapTP.App/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
using HandyControl.Controls;
using MapTP.App.Touchpad;
using MapTP.App.Touchpad;
using System;
using System.IO;
using System.Text.RegularExpressions;
using System.Windows;
using System.Windows.Input;
using System.Windows.Interop;
using System.Windows.Media;
using System.Xml;
using System.Xml.Serialization;
using Walterlv.Windows.Effects;

namespace MapTP.App
{
/// <summary>
/// MainWindow.xaml
/// </summary>
public partial class MainWindow : BlurWindow
public partial class MainWindow : Window
{
/// <summary>
/// This variable describes if a PTP exists
Expand Down Expand Up @@ -106,12 +107,13 @@ public void ReceiveTouchpadSize(int X, int Y)
public MainWindow()
{
InitializeComponent();
Loaded += OnLoaded;
}

private void About_Click(object sender, RoutedEventArgs e)
{
var w = new AboutWindow();
w.ShowDialog();
w.Show();
}

private void SuggestButtonClick(object sender, RoutedEventArgs e)
Expand All @@ -133,6 +135,23 @@ private void SuggestButtonClick(object sender, RoutedEventArgs e)
}
}

private void OnTitleBarMouseDown(object sender, MouseButtonEventArgs e)
{
this.DragMove();
return;
}

private void OnMinButtonClick(object sender, RoutedEventArgs e)
{
WindowState = WindowState.Minimized;
}

private void OnCloseButtonClick(object sender, RoutedEventArgs e)
{
Close();
System.Windows.Application.Current.Shutdown();
}

protected override void OnSourceInitialized(EventArgs e)
{
base.OnSourceInitialized(e);
Expand Down Expand Up @@ -168,7 +187,23 @@ protected override void OnSourceInitialized(EventArgs e)
}
}


private void OnLoaded(object sender, RoutedEventArgs e)
{

var WalterlvCompositor = new WindowAccentCompositor(this)
{
Color = Color.FromArgb(0x33, 0x87, 0xce, 0xfa)
};
WalterlvCompositor.IsEnabled = true;

if (!(Environment.OSVersion.Version > new Version(10, 0, 17763)))
{
this.Background = Brushes.Aqua;
WalterlvCompositor.IsEnabled = false;
}
}


/// <summary>
/// This method is for limiting TextBoxes only to accept numbers
/// </summary>
Expand Down Expand Up @@ -384,7 +419,6 @@ private IntPtr WndProc(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref b
InputX = x.X;
InputY = x.Y;

ValueTextBox.Text = $"{x.X},{x.Y}";
if (started && (tpsx <= x.X && x.X <= tpex) && (tpsy <= x.Y && x.Y <= tpey))
{
try
Expand Down
131 changes: 13 additions & 118 deletions MapTP.App/MapTP.App.csproj
Original file line number Diff line number Diff line change
@@ -1,125 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{F5217DE5-48E8-404D-A4F0-15B88C21B5E4}</ProjectGuid>
<TargetFramework>net7.0-windows10.0.18362.0</TargetFramework>
<OutputType>WinExe</OutputType>
<RootNamespace>MapTP.App</RootNamespace>
<AssemblyName>MapTP.App</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<WarningLevel>4</WarningLevel>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Deterministic>true</Deterministic>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<UseWPF>true</UseWPF>
<ImportWindowsDesktopTargets>true</ImportWindowsDesktopTargets>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<PropertyGroup>
<ApplicationManifest>app.manifest</ApplicationManifest>
<SupportedOSPlatformVersion>10.0.18362.0</SupportedOSPlatformVersion>
</PropertyGroup>
<ItemGroup>
<Reference Include="HandyControl, Version=3.4.0.0, Culture=neutral, PublicKeyToken=45be8712787a1e5b, processorArchitecture=MSIL">
<HintPath>..\packages\HandyControl.3.4.0\lib\net472\HandyControl.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Drawing" />
<Reference Include="System.Drawing.Common, Version=7.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Drawing.Common.7.0.0\lib\net462\System.Drawing.Common.dll</HintPath>
</Reference>
<Reference Include="System.Xml" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xaml">
<RequiredTargetFramework>4.0</RequiredTargetFramework>
</Reference>
<Reference Include="WindowsBase" />
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
</ItemGroup>
<ItemGroup>
<ApplicationDefinition Include="App.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</ApplicationDefinition>
<Compile Include="AboutWindow.xaml.cs">
<DependentUpon>AboutWindow.xaml</DependentUpon>
</Compile>
<Compile Include="CalibrateWindow.xaml.cs">
<DependentUpon>CalibrateWindow.xaml</DependentUpon>
</Compile>
<Compile Include="MouseProcessor.cs" />
<Compile Include="ScreenManager.cs" />
<Compile Include="Touchpad\Contact.cs" />
<Compile Include="Touchpad\Handler.cs" />
<Compile Include="Touchpad\Win32.cs" />
<Page Include="AboutWindow.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="CalibrateWindow.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="MainWindow.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Compile Include="App.xaml.cs">
<DependentUpon>App.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Compile Include="MainWindow.xaml.cs">
<DependentUpon>MainWindow.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
</ItemGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
<None Include="packages.config" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
<PackageReference Include="HandyControl" Version="3.4.0" />
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
<PackageReference Include="System.Data.DataSetExtensions" Version="4.5.0" />
<PackageReference Include="System.Drawing.Common" Version="7.0.0" />
<PackageReference Include="Walterlv.Themes.FluentDesign" Version="7.6.0" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
Loading

0 comments on commit 88b57ba

Please sign in to comment.