Add ability to add a custom border or rainbow border to the surrounding touch sensor input area
.NET Core Desktop / build (Release) (push) Has been cancelled
Details
.NET Core Desktop / build (Release) (push) Has been cancelled
Details
parent
a01cdd6dfa
commit
3a8d0e59c4
|
@ -28,6 +28,12 @@
|
|||
<setting name="IsRingButtonEmulationEnabled" serializeAs="String">
|
||||
<value>True</value>
|
||||
</setting>
|
||||
<setting name="BorderSetting" serializeAs="String">
|
||||
<value>0</value>
|
||||
</setting>
|
||||
<setting name="BorderColour" serializeAs="String">
|
||||
<value />
|
||||
</setting>
|
||||
</WpfMaiTouchEmulator.Properties.Settings>
|
||||
</userSettings>
|
||||
</configuration>
|
Binary file not shown.
After Width: | Height: | Size: 217 KiB |
|
@ -5,14 +5,14 @@
|
|||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
mc:Ignorable="d"
|
||||
Closing="MainWindow_Closing"
|
||||
Title="MainWindow" Height="384" Width="500" ResizeMode="CanMinimize" WindowStartupLocation="CenterScreen">
|
||||
<StackPanel VerticalAlignment="Top">
|
||||
Title="MainWindow" Height="400" Width="587" ResizeMode="CanMinimize" WindowStartupLocation="CenterScreen">
|
||||
<StackPanel Margin="0,0,0,0">
|
||||
<Menu Width="Auto" Height="20">
|
||||
<MenuItem Header="{Binding LbMenuCategoryHelp}" d:Header="_Help">
|
||||
<MenuItem x:Name="instructionsLabel" Header="{Binding LbMenuItemSetup}" HorizontalAlignment="Left" Width="220" Click="instructionsLabel_Click"/>
|
||||
</MenuItem>
|
||||
</Menu>
|
||||
<Grid Background="Transparent" Height="317" VerticalAlignment="Top" >
|
||||
<Grid Background="Transparent" >
|
||||
<Button x:Name="ConnectToPortButton" Content="{Binding LbConnectToPort}" d:Content="Connect to port" HorizontalAlignment="Left" Margin="10,95,0,0" VerticalAlignment="Top" Click="ConnectToPortButton_Click" Width="130" />
|
||||
<TextBox x:Name="RecievedLogBox"
|
||||
IsReadOnly="True"
|
||||
|
@ -20,16 +20,16 @@
|
|||
VerticalScrollBarVisibility="Auto"
|
||||
AcceptsReturn="True"
|
||||
AcceptsTab="True"
|
||||
TextWrapping="Wrap" Margin="376,34,0,219" HorizontalAlignment="Left" Width="88" />
|
||||
TextWrapping="Wrap" Margin="376,34,0,0" HorizontalAlignment="Left" Width="88" Height="80" VerticalAlignment="Top" />
|
||||
<TextBox x:Name="SentLogBox"
|
||||
IsReadOnly="True"
|
||||
HorizontalScrollBarVisibility="Disabled"
|
||||
VerticalScrollBarVisibility="Auto"
|
||||
AcceptsReturn="True"
|
||||
AcceptsTab="True"
|
||||
TextWrapping="Wrap" Margin="376,121,0,129" HorizontalAlignment="Left" Width="88" />
|
||||
TextWrapping="Wrap" Margin="480,34,0,0" HorizontalAlignment="Left" Width="88" Height="80" VerticalAlignment="Top" />
|
||||
<Label x:Name="label" Content="{Binding LbRecievedData}" d:Content="Recieved Data" HorizontalAlignment="Left" Margin="376,8,0,0" VerticalAlignment="Top" Width="88"/>
|
||||
<Label x:Name="label_Copy" Content="{Binding LbSentData}" d:Content="Sent Data" HorizontalAlignment="Left" Margin="376,95,0,0" VerticalAlignment="Top" Width="88"/>
|
||||
<Label x:Name="label_Copy" Content="{Binding LbSentData}" d:Content="Sent Data" HorizontalAlignment="Left" Margin="480,8,0,0" VerticalAlignment="Top" Width="88"/>
|
||||
<Label x:Name="label_Copy1" Content="{Binding LbButtonState}" d:Content="Button state" HorizontalAlignment="Left" Margin="238,56,0,0" VerticalAlignment="Top" Width="88"/>
|
||||
<Label x:Name="buttonStateValue" Content="0" HorizontalAlignment="Left" Margin="238,82,0,0" VerticalAlignment="Top" RenderTransformOrigin="3.566,1.468" FontSize="10"/>
|
||||
<CheckBox x:Name="debugMode" Content="{Binding LbDebugMode}" d:Content="Debug mode" HorizontalAlignment="Left" Margin="10,213,0,0" VerticalAlignment="Top" IsChecked="{Binding Path=IsDebugEnabled}" Click="debugMode_Click" Cursor="" Focusable="False" ToolTip="Show the touchpad with translucency and show inputs highlighted" Width="224"/>
|
||||
|
@ -47,6 +47,14 @@
|
|||
DisplayMemberPath="NativeName"
|
||||
SelectedItem="{Binding SelectedLanguage, Mode=TwoWay}"/>
|
||||
<Label x:Name="languageLabel" Content="{Binding LbLanguageDropdown}" d:Content="Language" HorizontalAlignment="Left" Margin="10,155,0,0" VerticalAlignment="Top" Width="126"/>
|
||||
<Label x:Name="borderSettingLabel" Content="{Binding LbBorderSettings}" d:Content="Border Settings" HorizontalAlignment="Left" Margin="238,155,0,0" VerticalAlignment="Top" Width="126"/>
|
||||
<StackPanel Margin="238,185,0,0" HorizontalAlignment="Left" Width="200" Height="91" VerticalAlignment="Top">
|
||||
<RadioButton x:Name="rbBorderDisabled" Content="{Binding LbBorderDisabled}" d:Content="Disabled" GroupName="ColorOptions" Checked="RadioButton1_Checked"/>
|
||||
<RadioButton x:Name="rbBorderSolidColour" Content="{Binding LbBorderSolid}" d:Content="Solid Colour (#AARRGGBB)" GroupName="ColorOptions" Checked="RadioButton2_Checked"/>
|
||||
<TextBox x:Name="txtBorderHexColor" Text="{Binding Path=BorderColour}" IsEnabled="False" Margin="10,10,0,10" Width="127" Height="25" TextChanged="txtBorderHexColor_TextChanged"/>
|
||||
|
||||
<RadioButton Name="rbBorderRainbow" Content="{Binding LbBorderRainbow}" d:Content="Rainbow" GroupName="ColorOptions" Checked="RadioButton3_Checked"/>
|
||||
</StackPanel>
|
||||
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
|
|
|
@ -4,12 +4,19 @@ using WpfMaiTouchEmulator.Managers;
|
|||
|
||||
namespace WpfMaiTouchEmulator;
|
||||
|
||||
public enum BorderSetting
|
||||
{
|
||||
Disabled,
|
||||
Solid,
|
||||
Rainbow
|
||||
}
|
||||
|
||||
public partial class MainWindow : Window
|
||||
{
|
||||
private readonly MaiTouchSensorButtonStateManager buttonState;
|
||||
private readonly MaiTouchComConnector connector;
|
||||
private readonly VirtualComPortManager comPortManager;
|
||||
private TouchPanel _touchPanel;
|
||||
private TouchPanel? _touchPanel;
|
||||
|
||||
public MainWindow()
|
||||
{
|
||||
|
@ -20,9 +27,12 @@ public partial class MainWindow : Window
|
|||
IsAutomaticPortConnectingEnabled = Properties.Settings.Default.IsAutomaticPortConnectingEnabled,
|
||||
IsAutomaticPositioningEnabled = Properties.Settings.Default.IsAutomaticPositioningEnabled,
|
||||
IsExitWithSinmaiEnabled = Properties.Settings.Default.IsExitWithSinmaiEnabled,
|
||||
IsRingButtonEmulationEnabled = Properties.Settings.Default.IsRingButtonEmulationEnabled
|
||||
IsRingButtonEmulationEnabled = Properties.Settings.Default.IsRingButtonEmulationEnabled,
|
||||
BorderColour = Properties.Settings.Default.BorderColour,
|
||||
};
|
||||
|
||||
LoadBorderRadioButtonSetting();
|
||||
|
||||
Title = "Mai Touch Emulator";
|
||||
buttonState = new MaiTouchSensorButtonStateManager(buttonStateValue);
|
||||
connector = new MaiTouchComConnector(buttonState, (MainWindowViewModel)DataContext);
|
||||
|
@ -65,14 +75,16 @@ public partial class MainWindow : Window
|
|||
|
||||
|
||||
Loaded += (s, e) => {
|
||||
var dataContext = (MainWindowViewModel)DataContext;
|
||||
|
||||
Logger.Info("Main window loaded, creating touch panel");
|
||||
_touchPanel = new TouchPanel();
|
||||
_touchPanel.onTouch = (value) => { buttonState.PressButton(value); };
|
||||
_touchPanel.onRelease = (value) => { buttonState.ReleaseButton(value); };
|
||||
_touchPanel.onInitialReposition = () => { WindowState = WindowState.Minimized; };
|
||||
_touchPanel.SetBorderMode((BorderSetting)Properties.Settings.Default.BorderSetting, dataContext.BorderColour);
|
||||
_touchPanel.Show();
|
||||
|
||||
var dataContext = (MainWindowViewModel)DataContext;
|
||||
_touchPanel.DataContext = dataContext;
|
||||
|
||||
_touchPanel.SetDebugMode(dataContext.IsDebugEnabled);
|
||||
|
@ -91,7 +103,7 @@ public partial class MainWindow : Window
|
|||
{
|
||||
e.Cancel = true;
|
||||
await connector.Disconnect();
|
||||
_touchPanel.Close();
|
||||
_touchPanel?.Close();
|
||||
Closing -= MainWindow_Closing;
|
||||
e.Cancel = false;
|
||||
Application.Current.Shutdown();
|
||||
|
@ -153,7 +165,7 @@ public partial class MainWindow : Window
|
|||
{
|
||||
if (dataContext.IsAutomaticPositioningEnabled)
|
||||
{
|
||||
_touchPanel.PositionTouchPanel();
|
||||
_touchPanel?.PositionTouchPanel();
|
||||
}
|
||||
|
||||
await Task.Delay(1000);
|
||||
|
@ -186,7 +198,7 @@ public partial class MainWindow : Window
|
|||
dataContext.IsDebugEnabled = !enabled;
|
||||
Properties.Settings.Default.IsDebugEnabled = dataContext.IsDebugEnabled;
|
||||
Properties.Settings.Default.Save();
|
||||
_touchPanel.SetDebugMode(dataContext.IsDebugEnabled);
|
||||
_touchPanel?.SetDebugMode(dataContext.IsDebugEnabled);
|
||||
}
|
||||
|
||||
private void automaticTouchPanelPositioning_Click(object sender, RoutedEventArgs e)
|
||||
|
@ -249,6 +261,55 @@ public partial class MainWindow : Window
|
|||
dataContext.IsRingButtonEmulationEnabled = !enabled;
|
||||
Properties.Settings.Default.IsRingButtonEmulationEnabled = dataContext.IsRingButtonEmulationEnabled;
|
||||
Properties.Settings.Default.Save();
|
||||
_touchPanel.SetEmulateRingButton(dataContext.IsRingButtonEmulationEnabled);
|
||||
_touchPanel?.SetEmulateRingButton(dataContext.IsRingButtonEmulationEnabled);
|
||||
}
|
||||
|
||||
private void LoadBorderRadioButtonSetting()
|
||||
{
|
||||
rbBorderDisabled.IsChecked = Properties.Settings.Default.BorderSetting == (int)BorderSetting.Disabled;
|
||||
txtBorderHexColor.IsEnabled = Properties.Settings.Default.BorderSetting == (int)BorderSetting.Solid;
|
||||
rbBorderSolidColour.IsChecked = Properties.Settings.Default.BorderSetting == (int)BorderSetting.Solid;
|
||||
rbBorderRainbow.IsChecked = Properties.Settings.Default.BorderSetting == (int)BorderSetting.Rainbow;
|
||||
}
|
||||
|
||||
private void RadioButton1_Checked(object sender, RoutedEventArgs e)
|
||||
{
|
||||
txtBorderHexColor.IsEnabled = false;
|
||||
Properties.Settings.Default.BorderSetting = (int)BorderSetting.Disabled;
|
||||
Properties.Settings.Default.Save();
|
||||
|
||||
_touchPanel?.SetBorderMode(BorderSetting.Disabled, "");
|
||||
}
|
||||
|
||||
private void RadioButton2_Checked(object sender, RoutedEventArgs e)
|
||||
{
|
||||
txtBorderHexColor.IsEnabled = true;
|
||||
Properties.Settings.Default.BorderSetting = (int)BorderSetting.Solid;
|
||||
|
||||
Properties.Settings.Default.Save();
|
||||
|
||||
_touchPanel?.SetBorderMode(BorderSetting.Solid, Properties.Settings.Default.BorderColour);
|
||||
}
|
||||
|
||||
private void RadioButton3_Checked(object sender, RoutedEventArgs e)
|
||||
{
|
||||
txtBorderHexColor.IsEnabled = false;
|
||||
Properties.Settings.Default.BorderSetting = (int)BorderSetting.Rainbow;
|
||||
|
||||
Properties.Settings.Default.Save();
|
||||
|
||||
_touchPanel?.SetBorderMode(BorderSetting.Rainbow, "");
|
||||
}
|
||||
|
||||
private void txtBorderHexColor_TextChanged(object sender, System.Windows.Controls.TextChangedEventArgs e)
|
||||
{
|
||||
var textWithoutHash = txtBorderHexColor.Text.TrimStart('#') ?? "";
|
||||
if (textWithoutHash.Length == 6 || textWithoutHash.Length == 8)
|
||||
{
|
||||
var textWithHash = "#" + textWithoutHash;
|
||||
Properties.Settings.Default.BorderColour = textWithHash;
|
||||
Properties.Settings.Default.Save();
|
||||
_touchPanel?.SetBorderMode(BorderSetting.Solid, textWithHash);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -52,6 +52,22 @@ public class MainWindowViewModel : INotifyPropertyChanged
|
|||
{
|
||||
get; set;
|
||||
}
|
||||
public string LbBorderSettings
|
||||
{
|
||||
get; set;
|
||||
}
|
||||
public string LbBorderDisabled
|
||||
{
|
||||
get; set;
|
||||
}
|
||||
public string LbBorderSolid
|
||||
{
|
||||
get; set;
|
||||
}
|
||||
public string LbBorderRainbow
|
||||
{
|
||||
get; set;
|
||||
}
|
||||
public string LbListComPorts
|
||||
{
|
||||
get; set;
|
||||
|
@ -190,6 +206,7 @@ public class MainWindowViewModel : INotifyPropertyChanged
|
|||
private bool _isExitWithSinmaiEnabled;
|
||||
private CultureInfo _selectedLanguage;
|
||||
private bool _isRingButtonEmulationEnabled;
|
||||
private string _borderColour;
|
||||
private readonly ResourceManager resourceManager;
|
||||
private readonly CultureInfo cultureInfo;
|
||||
|
||||
|
@ -268,6 +285,16 @@ public class MainWindowViewModel : INotifyPropertyChanged
|
|||
}
|
||||
}
|
||||
|
||||
public string BorderColour
|
||||
{
|
||||
get => _borderColour;
|
||||
set
|
||||
{
|
||||
_borderColour = value;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public CultureInfo SelectedLanguage
|
||||
{
|
||||
|
@ -306,6 +333,12 @@ public class MainWindowViewModel : INotifyPropertyChanged
|
|||
LbEmulateRingButtons = resourceManager.GetString("lbEmulateRingButtons");
|
||||
LbInstallComPort = resourceManager.GetString("lbInstallComPort");
|
||||
LbLanguageDropdown = resourceManager.GetString("lbLanguageDropdown");
|
||||
|
||||
LbBorderSettings = resourceManager.GetString("LbBorderSettings");
|
||||
LbBorderDisabled = resourceManager.GetString("LbBorderDisabled");
|
||||
LbBorderSolid = resourceManager.GetString("LbBorderSolid");
|
||||
LbBorderRainbow = resourceManager.GetString("LbBorderRainbow");
|
||||
|
||||
LbListComPorts = resourceManager.GetString("lbListComPorts");
|
||||
LbReceivedData = resourceManager.GetString("lbReceivedData");
|
||||
LbRecievedData = resourceManager.GetString("lbRecievedData");
|
||||
|
|
|
@ -106,5 +106,29 @@ namespace WpfMaiTouchEmulator.Properties {
|
|||
this["IsRingButtonEmulationEnabled"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("0")]
|
||||
public int BorderSetting {
|
||||
get {
|
||||
return ((int)(this["BorderSetting"]));
|
||||
}
|
||||
set {
|
||||
this["BorderSetting"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("")]
|
||||
public string BorderColour {
|
||||
get {
|
||||
return ((string)(this["BorderColour"]));
|
||||
}
|
||||
set {
|
||||
this["BorderColour"] = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,5 +23,11 @@
|
|||
<Setting Name="IsRingButtonEmulationEnabled" Type="System.Boolean" Scope="User">
|
||||
<Value Profile="(Default)">True</Value>
|
||||
</Setting>
|
||||
<Setting Name="BorderSetting" Type="System.Int32" Scope="User">
|
||||
<Value Profile="(Default)">0</Value>
|
||||
</Setting>
|
||||
<Setting Name="BorderColour" Type="System.String" Scope="User">
|
||||
<Value Profile="(Default)" />
|
||||
</Setting>
|
||||
</Settings>
|
||||
</SettingsFile>
|
|
@ -96,6 +96,42 @@ namespace WpfMaiTouchEmulator.Resources {
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Disabled.
|
||||
/// </summary>
|
||||
internal static string LbBorderDisabled {
|
||||
get {
|
||||
return ResourceManager.GetString("LbBorderDisabled", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Rainbow.
|
||||
/// </summary>
|
||||
internal static string LbBorderRainbow {
|
||||
get {
|
||||
return ResourceManager.GetString("LbBorderRainbow", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Border Settings.
|
||||
/// </summary>
|
||||
internal static string LbBorderSettings {
|
||||
get {
|
||||
return ResourceManager.GetString("LbBorderSettings", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Solid (#AARRGGBB).
|
||||
/// </summary>
|
||||
internal static string LbBorderSolid {
|
||||
get {
|
||||
return ResourceManager.GetString("LbBorderSolid", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Button State.
|
||||
/// </summary>
|
||||
|
|
|
@ -129,6 +129,18 @@
|
|||
<data name="lbAutoSensorPositioningTT" xml:space="preserve">
|
||||
<value>Sinmai.exeの上に正しい位置にタッチセンサーウィンドウを自動的に移動しようとする</value>
|
||||
</data>
|
||||
<data name="LbBorderDisabled" xml:space="preserve">
|
||||
<value>無効</value>
|
||||
</data>
|
||||
<data name="LbBorderRainbow" xml:space="preserve">
|
||||
<value>レインボー</value>
|
||||
</data>
|
||||
<data name="LbBorderSettings" xml:space="preserve">
|
||||
<value>境界線設定</value>
|
||||
</data>
|
||||
<data name="LbBorderSolid" xml:space="preserve">
|
||||
<value>単色(#AARRGGBB)</value>
|
||||
</data>
|
||||
<data name="lbButtonState" xml:space="preserve">
|
||||
<value>ボタン状態</value>
|
||||
</data>
|
||||
|
|
|
@ -129,6 +129,18 @@
|
|||
<data name="lbAutoSensorPositioningTT" xml:space="preserve">
|
||||
<value>Try and automatically move the touch sensor window into the correct position on top of Sinmai.exe</value>
|
||||
</data>
|
||||
<data name="LbBorderDisabled" xml:space="preserve">
|
||||
<value>Disabled</value>
|
||||
</data>
|
||||
<data name="LbBorderRainbow" xml:space="preserve">
|
||||
<value>Rainbow</value>
|
||||
</data>
|
||||
<data name="LbBorderSettings" xml:space="preserve">
|
||||
<value>Border Settings</value>
|
||||
</data>
|
||||
<data name="LbBorderSolid" xml:space="preserve">
|
||||
<value>Solid (#AARRGGBB)</value>
|
||||
</data>
|
||||
<data name="lbButtonState" xml:space="preserve">
|
||||
<value>Button State</value>
|
||||
</data>
|
||||
|
|
|
@ -129,6 +129,18 @@
|
|||
<data name="lbAutoSensorPositioningTT" xml:space="preserve">
|
||||
<value>尝试自动移动触摸传感器窗口到Sinmai.exe上方的正确位置</value>
|
||||
</data>
|
||||
<data name="LbBorderDisabled" xml:space="preserve">
|
||||
<value>無効</value>
|
||||
</data>
|
||||
<data name="LbBorderRainbow" xml:space="preserve">
|
||||
<value>彩虹</value>
|
||||
</data>
|
||||
<data name="LbBorderSettings" xml:space="preserve">
|
||||
<value>境界線設定</value>
|
||||
</data>
|
||||
<data name="LbBorderSolid" xml:space="preserve">
|
||||
<value>纯色(#AARRGGBB)</value>
|
||||
</data>
|
||||
<data name="lbButtonState" xml:space="preserve">
|
||||
<value>按钮状态</value>
|
||||
</data>
|
||||
|
|
|
@ -22,7 +22,10 @@
|
|||
</Border>
|
||||
<DockPanel VerticalAlignment="Bottom">
|
||||
<Viewbox Stretch="Uniform" Opacity="1">
|
||||
<Canvas x:Name="TouchCanvas" Width="1440" Height="1440">
|
||||
<Border x:Name="touchPanelBorder" BorderThickness="10"
|
||||
CornerRadius="720"
|
||||
Width="1440" VerticalAlignment="Bottom">
|
||||
<Canvas x:Name="TouchCanvas" Width="1440" Height="1440" Margin="-10,-10,-10,-10">
|
||||
|
||||
<Polygon Canvas.Left="699" Canvas.Top="6" Points="0,0 39,0 111,5 113,6 111,24 80,243 77,243 63,229 56,221 23,188 16,194 -34,244 -36,244 -70,4 -70,3 0,0" PreviewTouchDown="Element_TouchDown" PreviewTouchMove="Element_TouchMove" PreviewTouchUp="Element_TouchUp" Tag="{x:Static local:TouchValue.D1}" Fill="White" />
|
||||
<Polygon Canvas.Left="825" Canvas.Top="13" Points="0,0 10,1 95,19 145,37 179,50 207,64 230,75 254,87 297,116 318,130 316,135 300,156 286,175 270,196 256,215 240,236 226,255 210,276 197,294 181,315 168,333 101,333 66,318 21,299 9,293 -35,249 -34,237 -1,4 0,0" PreviewTouchDown="Element_TouchDown" PreviewTouchMove="Element_TouchMove" PreviewTouchUp="Element_TouchUp" Tag="{x:Static local:TouchValue.A1}" Fill="White" />
|
||||
|
@ -69,6 +72,7 @@
|
|||
</Border>
|
||||
|
||||
</Canvas>
|
||||
</Border>
|
||||
</Viewbox>
|
||||
</DockPanel>
|
||||
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
using System.Windows;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Animation;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Shapes;
|
||||
using WpfMaiTouchEmulator.Managers;
|
||||
|
||||
|
@ -197,6 +199,47 @@ public partial class TouchPanel : Window
|
|||
});
|
||||
}
|
||||
|
||||
public void SetBorderMode(BorderSetting borderSetting, string borderColour)
|
||||
{
|
||||
if (borderSetting == BorderSetting.Rainbow)
|
||||
{
|
||||
var rotateTransform = new RotateTransform { CenterX = 0.5, CenterY = 0.5 };
|
||||
touchPanelBorder.BorderBrush = new ImageBrush {
|
||||
ImageSource = new BitmapImage(new Uri(@"pack://application:,,,/Assets/conicalGradient.png")),
|
||||
ViewportUnits = BrushMappingMode.RelativeToBoundingBox,
|
||||
Viewport = new Rect(0, 0, 1, 1),
|
||||
TileMode = TileMode.Tile,
|
||||
RelativeTransform = rotateTransform,
|
||||
};
|
||||
|
||||
var animation = new DoubleAnimation
|
||||
{
|
||||
From = 0,
|
||||
To = 360,
|
||||
Duration = new Duration(TimeSpan.FromSeconds(10)),
|
||||
RepeatBehavior = RepeatBehavior.Forever
|
||||
};
|
||||
|
||||
rotateTransform.BeginAnimation(RotateTransform.AngleProperty, animation);
|
||||
return;
|
||||
}
|
||||
else if (borderSetting == BorderSetting.Solid)
|
||||
{
|
||||
try
|
||||
{
|
||||
var colour = (Color)ColorConverter.ConvertFromString(borderColour);
|
||||
touchPanelBorder.BorderBrush = new SolidColorBrush { Color = colour };
|
||||
return;
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logger.Error("Failed to parse solid colour", ex);
|
||||
}
|
||||
}
|
||||
touchPanelBorder.BorderBrush = null;
|
||||
}
|
||||
|
||||
public void SetEmulateRingButton(bool enabled)
|
||||
{
|
||||
isRingButtonEmulationEnabled = enabled;
|
||||
|
|
|
@ -9,6 +9,10 @@
|
|||
<ApplicationIcon>Assets\icon.ico</ApplicationIcon>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Remove="Assets\conicalGradient.png" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Content Include="Assets\icon.ico" />
|
||||
</ItemGroup>
|
||||
|
@ -18,6 +22,12 @@
|
|||
<PackageReference Include="System.IO.Ports" Version="8.0.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Resource Include="Assets\conicalGradient.png">
|
||||
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
|
||||
</Resource>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Update="Properties\Settings.Designer.cs">
|
||||
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||
|
|
Loading…
Reference in New Issue