Translate remaining text
parent
851d83ca51
commit
f42f210452
|
@ -2,7 +2,7 @@
|
|||
using System.Windows;
|
||||
|
||||
namespace WpfMaiTouchEmulator;
|
||||
internal class MaiTouchComConnector(MaiTouchSensorButtonStateManager buttonState)
|
||||
internal class MaiTouchComConnector(MaiTouchSensorButtonStateManager buttonState, MainWindowViewModel viewModel)
|
||||
{
|
||||
private static SerialPort? serialPort;
|
||||
private bool isActiveMode;
|
||||
|
@ -11,6 +11,7 @@ internal class MaiTouchComConnector(MaiTouchSensorButtonStateManager buttonState
|
|||
private Thread? _pollThread;
|
||||
private bool _shouldReconnect = true;
|
||||
private readonly MaiTouchSensorButtonStateManager _buttonState = buttonState;
|
||||
private readonly MainWindowViewModel _viewModel = viewModel;
|
||||
|
||||
public Action<string>? OnConnectStatusChange
|
||||
{
|
||||
|
@ -41,7 +42,7 @@ internal class MaiTouchComConnector(MaiTouchSensorButtonStateManager buttonState
|
|||
var virtualPort = "COM23"; // Adjust as needed
|
||||
try
|
||||
{
|
||||
OnConnectStatusChange?.Invoke("Conecting...");
|
||||
OnConnectStatusChange?.Invoke(_viewModel.TxtComPortConnecting);
|
||||
serialPort = new SerialPort(virtualPort, 9600, Parity.None, 8, StopBits.One)
|
||||
{
|
||||
WriteTimeout = 100
|
||||
|
@ -49,7 +50,7 @@ internal class MaiTouchComConnector(MaiTouchSensorButtonStateManager buttonState
|
|||
serialPort.DataReceived += SerialPort_DataReceived;
|
||||
serialPort.Open();
|
||||
Logger.Info("Serial port opened successfully.");
|
||||
OnConnectStatusChange?.Invoke("Connected to port");
|
||||
OnConnectStatusChange?.Invoke(_viewModel.TxtComPortConnected);
|
||||
_connected = true;
|
||||
|
||||
_tokenSource = new CancellationTokenSource(); // Create a token source.
|
||||
|
@ -64,12 +65,12 @@ internal class MaiTouchComConnector(MaiTouchSensorButtonStateManager buttonState
|
|||
OnConnectError?.Invoke();
|
||||
Application.Current.Dispatcher.Invoke(() =>
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Error connecting to COM port", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
MessageBox.Show(ex.Message, _viewModel.TxtErrorConnectingToPortHeader, MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
});
|
||||
|
||||
Logger.Error("Error on starting polling", ex);
|
||||
Logger.Info("Disconnecting from COM port");
|
||||
_connected = false;
|
||||
OnConnectStatusChange?.Invoke("Not Connected");
|
||||
OnConnectStatusChange?.Invoke(_viewModel.LbConnectionStateNotConnected);
|
||||
if (serialPort?.IsOpen == true)
|
||||
{
|
||||
serialPort.DiscardInBuffer();
|
||||
|
|
|
@ -3,45 +3,52 @@
|
|||
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:local="clr-namespace:WpfMaiTouchEmulator"
|
||||
mc:Ignorable="d"
|
||||
Closing="MainWindow_Closing"
|
||||
Title="MainWindow" Height="360" Width="500" ResizeMode="NoResize" WindowStartupLocation="CenterScreen">
|
||||
<Grid Background="Transparent" Height="317" VerticalAlignment="Top" >
|
||||
<Button x:Name="ConnectToPortButton" Content="{Binding LbConnectToPort}" HorizontalAlignment="Left" Margin="10,95,0,0" VerticalAlignment="Top" Click="ConnectToPortButton_Click" />
|
||||
<TextBox x:Name="RecievedLogBox"
|
||||
IsReadOnly="True"
|
||||
HorizontalScrollBarVisibility="Disabled"
|
||||
VerticalScrollBarVisibility="Auto"
|
||||
AcceptsReturn="True"
|
||||
AcceptsTab="True"
|
||||
TextWrapping="Wrap" Margin="376,34,0,219" HorizontalAlignment="Left" Width="88" />
|
||||
<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" />
|
||||
<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_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"/>
|
||||
<CheckBox x:Name="automaticTouchPanelPositioning" d:Content="Automatic touch panel positioning" HorizontalAlignment="Left" Margin="10,233,0,0" VerticalAlignment="Top" Height="17" Width="224" Content="{Binding LbAutoSensorPositioning}" IsChecked="{Binding Path=IsAutomaticPositioningEnabled}" Click="automaticTouchPanelPositioning_Click" ToolTip="Try and automatically move the touch sensor window into the correct position on top of Sinma.exe"/>
|
||||
<CheckBox x:Name="automaticPortConnecting" d:Content="Automatic port connecting" HorizontalAlignment="Left" Margin="10,255,0,0" VerticalAlignment="Top" Height="17" Width="224" Content="{Binding LbAutoPortConnecting}" IsChecked="{Binding Path=IsAutomaticPortConnectingEnabled}" Click="automaticPortConnecting_Click" ToolTip="Try to automatically connect to COM23 to send touchsensor updates on app start"/>
|
||||
<Label x:Name="label1" Content="{Binding LbConnectionState}" d:Content="Connection state" HorizontalAlignment="Left" Margin="238,8,0,0" VerticalAlignment="Top"/>
|
||||
<Label x:Name="connectionStateLabel" Content="{Binding LbConnectionStateNotConnected}" d:Content="Not connected" HorizontalAlignment="Left" Margin="238,31,0,0" VerticalAlignment="Top" FontSize="10"/>
|
||||
<CheckBox x:Name="exitWithSinmai" Content="{Binding LbExitWithSinmai}" d:Content="Exit with Sinmai" HorizontalAlignment="Left" Margin="10,277,0,0" VerticalAlignment="Top" Height="17" Width="224" IsChecked="{Binding IsExitWithSinmaiEnabled}" Click="exitWithSinmai_Click" ToolTip="Try and detect when Sinmai.exe exits and exit this app alongside it"/>
|
||||
<Button x:Name="buttonInstallComPort" Content="{Binding LbInstallComPort}" d:Content="Install COM port" HorizontalAlignment="Left" Margin="10,9,0,0" VerticalAlignment="Top" Click="buttonInstallComPort_Click" Width="126"/>
|
||||
<Button x:Name="buttonUninstallComPorts" Content="{Binding LbUninstallComPort}" d:Content="Uninstall COM port" HorizontalAlignment="Left" Margin="10,34,0,0" VerticalAlignment="Top" Click="buttonUninstallComPorts_Click" Width="126"/>
|
||||
<Button x:Name="buttonListComPorts" Content="{Binding LbListComPorts}" d:Content="List installed COM ports" HorizontalAlignment="Left" Margin="10,59,0,0" VerticalAlignment="Top" Click="buttonListComPorts_Click"/>
|
||||
<Separator HorizontalAlignment="Left" Margin="10,84,0,0" VerticalAlignment="Top" Height="6" Width="126"/>
|
||||
<ComboBox x:Name="languageSelector" HorizontalAlignment="Left" Margin="10,186,0,0" VerticalAlignment="Top" Width="149" ItemsSource="{Binding SupportedLanguages}"
|
||||
DisplayMemberPath="NativeName"
|
||||
SelectedItem="{Binding SelectedLanguage, Mode=TwoWay}"/>
|
||||
<Label x:Name="lagnuageLabel" Content="{Binding LbLanguageDropdown}" d:Content="Language" HorizontalAlignment="Left" Margin="10,155,0,0" VerticalAlignment="Top" Width="126"/>
|
||||
<StackPanel VerticalAlignment="Top">
|
||||
<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" >
|
||||
<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"
|
||||
HorizontalScrollBarVisibility="Disabled"
|
||||
VerticalScrollBarVisibility="Auto"
|
||||
AcceptsReturn="True"
|
||||
AcceptsTab="True"
|
||||
TextWrapping="Wrap" Margin="376,34,0,219" HorizontalAlignment="Left" Width="88" />
|
||||
<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" />
|
||||
<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_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"/>
|
||||
<CheckBox x:Name="automaticTouchPanelPositioning" d:Content="Automatic touch panel positioning" HorizontalAlignment="Left" Margin="10,233,0,0" VerticalAlignment="Top" Height="17" Width="224" Content="{Binding LbAutoSensorPositioning}" IsChecked="{Binding Path=IsAutomaticPositioningEnabled}" Click="automaticTouchPanelPositioning_Click" ToolTip="{Binding LbAutoSensorPositioningTT}"/>
|
||||
<CheckBox x:Name="automaticPortConnecting" d:Content="Automatic port connecting" HorizontalAlignment="Left" Margin="10,255,0,0" VerticalAlignment="Top" Height="17" Width="224" Content="{Binding LbAutoPortConnecting}" IsChecked="{Binding Path=IsAutomaticPortConnectingEnabled}" Click="automaticPortConnecting_Click" ToolTip="{Binding LbAutoPortConnectingTT}"/>
|
||||
<Label x:Name="label1" Content="{Binding LbConnectionState}" d:Content="Connection state" HorizontalAlignment="Left" Margin="238,8,0,0" VerticalAlignment="Top"/>
|
||||
<Label x:Name="connectionStateLabel" Content="{Binding LbConnectionStateNotConnected}" d:Content="Not connected" HorizontalAlignment="Left" Margin="238,31,0,0" VerticalAlignment="Top" FontSize="10"/>
|
||||
<CheckBox x:Name="exitWithSinmai" Content="{Binding LbExitWithSinmai}" d:Content="Exit with Sinmai" HorizontalAlignment="Left" Margin="10,277,0,0" VerticalAlignment="Top" Height="17" Width="224" IsChecked="{Binding IsExitWithSinmaiEnabled}" Click="exitWithSinmai_Click" ToolTip="{Binding LbExitWithSinmaiTT}"/>
|
||||
<Button x:Name="buttonInstallComPort" Content="{Binding LbInstallComPort}" d:Content="Install COM port" HorizontalAlignment="Left" Margin="10,9,0,0" VerticalAlignment="Top" Click="buttonInstallComPort_Click" Width="130"/>
|
||||
<Button x:Name="buttonUninstallComPorts" Content="{Binding LbUninstallComPort}" d:Content="Uninstall COM port" HorizontalAlignment="Left" Margin="10,34,0,0" VerticalAlignment="Top" Click="buttonUninstallComPorts_Click" Width="130"/>
|
||||
<Button x:Name="buttonListComPorts" Content="{Binding LbListComPorts}" d:Content="List installed COM ports" HorizontalAlignment="Left" Margin="10,59,0,0" VerticalAlignment="Top" Click="buttonListComPorts_Click" Width="130"/>
|
||||
<Separator HorizontalAlignment="Left" Margin="10,84,0,0" VerticalAlignment="Top" Height="6" Width="126"/>
|
||||
<ComboBox x:Name="languageSelector" HorizontalAlignment="Left" Margin="10,186,0,0" VerticalAlignment="Top" Width="149" ItemsSource="{Binding SupportedLanguages}"
|
||||
DisplayMemberPath="NativeName"
|
||||
SelectedItem="{Binding SelectedLanguage, Mode=TwoWay}"/>
|
||||
<Label x:Name="lagnuageLabel" Content="{Binding LbLanguageDropdown}" d:Content="Language" HorizontalAlignment="Left" Margin="10,155,0,0" VerticalAlignment="Top" Width="126"/>
|
||||
|
||||
</Grid>
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
|
||||
|
||||
</Window>
|
||||
|
|
|
@ -23,8 +23,8 @@ public partial class MainWindow : Window
|
|||
|
||||
Title = "Mai Touch Emulator";
|
||||
buttonState = new MaiTouchSensorButtonStateManager(buttonStateValue);
|
||||
connector = new MaiTouchComConnector(buttonState);
|
||||
comPortManager = new VirtualComPortManager();
|
||||
connector = new MaiTouchComConnector(buttonState, (MainWindowViewModel)DataContext);
|
||||
comPortManager = new VirtualComPortManager((MainWindowViewModel)DataContext);
|
||||
connector.OnConnectStatusChange = (status) =>
|
||||
{
|
||||
connectionStateLabel.Content = status;
|
||||
|
@ -56,7 +56,7 @@ public partial class MainWindow : Window
|
|||
if (Properties.Settings.Default.FirstOpen)
|
||||
{
|
||||
Logger.Info("First open occurred");
|
||||
MessageBox.Show("Please remove any COM devices using the COM3 port before installing the virtual COM port. In Device Manager click \"View\" then enabled \"Show hidden devices\" and uninstall any devices that are using the COM3 port.\n\nAfter ensuring COM3 is free please use the install COM port button in the app to register the app.\n\nThe app needs to connect to the port prior to Sinmai.exe being opened.", "First time setup", MessageBoxButton.OK, MessageBoxImage.Information);
|
||||
ShowSetupInstructionsDialog();
|
||||
Properties.Settings.Default.FirstOpen = false;
|
||||
Properties.Settings.Default.Save();
|
||||
}
|
||||
|
@ -71,6 +71,7 @@ public partial class MainWindow : Window
|
|||
_touchPanel.Owner = this;
|
||||
|
||||
var dataContext = (MainWindowViewModel)DataContext;
|
||||
_touchPanel.DataContext = dataContext;
|
||||
|
||||
_touchPanel.SetDebugMode(dataContext.IsDebugEnabled);
|
||||
if (Properties.Settings.Default.IsAutomaticPositioningEnabled)
|
||||
|
@ -134,11 +135,17 @@ public partial class MainWindow : Window
|
|||
dataContext.IsExitWithSinmaiEnabled = false;
|
||||
Properties.Settings.Default.IsExitWithSinmaiEnabled = dataContext.IsExitWithSinmaiEnabled;
|
||||
Properties.Settings.Default.Save();
|
||||
MessageBox.Show("Failed to listen for Sinmai exit signal, is it running as admin?\n\nAutomatic exiting disabled.", "Failed to listen for Sinmai exit", MessageBoxButton.OK, MessageBoxImage.Information);
|
||||
MessageBox.Show(dataContext.TxtFailedToSetupSinmaiExit, dataContext.TxtFailedToSetupSinmaiExitHeader, MessageBoxButton.OK, MessageBoxImage.Information);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void ShowSetupInstructionsDialog()
|
||||
{
|
||||
var dataContext = (MainWindowViewModel)DataContext;
|
||||
MessageBox.Show(dataContext.TxtSetupInstructions, dataContext.TxtSetupInstructionsHeader, MessageBoxButton.OK, MessageBoxImage.Information);
|
||||
}
|
||||
|
||||
private async void AutomaticTouchPanelPositioningLoop()
|
||||
{
|
||||
var dataContext = (MainWindowViewModel)DataContext;
|
||||
|
@ -226,6 +233,12 @@ public partial class MainWindow : Window
|
|||
private void buttonListComPorts_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
var output = comPortManager.GetInstalledPorts();
|
||||
MessageBox.Show(string.Join("\n", output), "Installed ports");
|
||||
var dataContext = (MainWindowViewModel)DataContext;
|
||||
MessageBox.Show(string.Join("\n", output), dataContext.TxtCurrentlyInstalledPorts);
|
||||
}
|
||||
|
||||
private void instructionsLabel_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
ShowSetupInstructionsDialog();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -69,7 +69,111 @@ public class MainWindowViewModel : INotifyPropertyChanged
|
|||
{
|
||||
get; set;
|
||||
}
|
||||
|
||||
public string? LbMenuCategoryHelp
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
}
|
||||
public string? LbMenuItemSetup
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
}
|
||||
public string? TxtSetupInstructions
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
}
|
||||
public string? TxtSetupInstructionsHeader
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
}
|
||||
public string? TxtFailedToSetupSinmaiExitHeader
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
}
|
||||
public string? TxtFailedToSetupSinmaiExit
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
}
|
||||
public string? TxtCurrentlyInstalledPorts
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
}
|
||||
public string? TxtErrorConnectingToPortHeader
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
}
|
||||
public string? TxtComPortConnected
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
}
|
||||
public string? TxtComPortConnecting
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
}
|
||||
public string? TxtCom3AlreadyInstalled
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
}
|
||||
public string? TxtCom3InstalledSuccessfully
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
}
|
||||
public string? TxtCom3InstallFailed
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
}
|
||||
public string? TxtCom3UninstallNotRequired
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
}
|
||||
public string? TxtCom3UninstalledSuccessfully
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
}
|
||||
public string? TxtCom3UninstallFailed
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
}
|
||||
public string? LbTouchPanelResize
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
}
|
||||
public string? LbTouchPanelDrag
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
}
|
||||
public string? LbAutoPortConnectingTT
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
}
|
||||
public string? LbAutoSensorPositioningTT
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
}
|
||||
public string? LbExitWithSinmaiTT
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
}
|
||||
|
||||
private bool _isAutomaticPortConnectingEnabled;
|
||||
private bool _isDebugEnabled;
|
||||
|
@ -184,6 +288,32 @@ public class MainWindowViewModel : INotifyPropertyChanged
|
|||
LbRecievedData = resourceManager.GetString("lbRecievedData");
|
||||
LbSentData = resourceManager.GetString("lbSentData");
|
||||
LbUninstallComPort = resourceManager.GetString("lbUninstallComPort");
|
||||
LbMenuCategoryHelp = resourceManager.GetString("lbMenuCategoryHelp");
|
||||
LbMenuItemSetup = resourceManager.GetString("lbMenuItemSetup");
|
||||
LbAutoPortConnectingTT = resourceManager.GetString("lbAutoPortConnectingTT");
|
||||
LbAutoSensorPositioningTT = resourceManager.GetString("lbAutoSensorPositioningTT");
|
||||
LbExitWithSinmaiTT = resourceManager.GetString("lbExitWithSinmaiTT");
|
||||
LbMenuCategoryHelp = resourceManager.GetString("lbMenuCategoryHelp");
|
||||
LbMenuItemSetup = resourceManager.GetString("lbMenuItemSetup");
|
||||
|
||||
TxtSetupInstructions = resourceManager.GetString("TxtSetupInstructions");
|
||||
TxtSetupInstructionsHeader = resourceManager.GetString("TxtSetupInstructionsHeader");
|
||||
TxtFailedToSetupSinmaiExitHeader = resourceManager.GetString("TxtFailedToSetupSinmaiExitHeader");
|
||||
TxtFailedToSetupSinmaiExit = resourceManager.GetString("TxtFailedToSetupSinmaiExit");
|
||||
TxtCurrentlyInstalledPorts = resourceManager.GetString("TxtCurrentlyInstalledPorts");
|
||||
TxtErrorConnectingToPortHeader = resourceManager.GetString("TxtErrorConnectingToPortHeader");
|
||||
TxtComPortConnected = resourceManager.GetString("TxtComPortConnected");
|
||||
TxtComPortConnecting = resourceManager.GetString("TxtComPortConnecting");
|
||||
|
||||
TxtCom3AlreadyInstalled = resourceManager.GetString("TxtCom3AlreadyInstalled");
|
||||
TxtCom3InstalledSuccessfully = resourceManager.GetString("TxtCom3InstalledSuccessfully");
|
||||
TxtCom3InstallFailed = resourceManager.GetString("TxtCom3InstallFailed");
|
||||
TxtCom3UninstallNotRequired = resourceManager.GetString("TxtCom3UninstallNotRequired");
|
||||
TxtCom3UninstalledSuccessfully = resourceManager.GetString("TxtCom3UninstalledSuccessfully");
|
||||
TxtCom3UninstallFailed = resourceManager.GetString("TxtCom3UninstallFailed");
|
||||
|
||||
LbTouchPanelResize = resourceManager.GetString("LbTouchPanelResize");
|
||||
LbTouchPanelDrag = resourceManager.GetString("LbTouchPanelDrag");
|
||||
|
||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(null));
|
||||
}
|
||||
|
|
|
@ -69,6 +69,15 @@ namespace WpfMaiTouchEmulator.Resources {
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Try to automatically connect to COM23 to send touch sensor updates on app start.
|
||||
/// </summary>
|
||||
internal static string lbAutoPortConnectingTT {
|
||||
get {
|
||||
return ResourceManager.GetString("lbAutoPortConnectingTT", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Automatic sensor window positioning.
|
||||
/// </summary>
|
||||
|
@ -78,6 +87,15 @@ namespace WpfMaiTouchEmulator.Resources {
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Try and automatically move the touch sensor window into the correct position on top of Sinmai.exe.
|
||||
/// </summary>
|
||||
internal static string lbAutoSensorPositioningTT {
|
||||
get {
|
||||
return ResourceManager.GetString("lbAutoSensorPositioningTT", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Button State.
|
||||
/// </summary>
|
||||
|
@ -132,6 +150,15 @@ namespace WpfMaiTouchEmulator.Resources {
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Try and detect when Sinmai.exe exits and exit this app alongside it.
|
||||
/// </summary>
|
||||
internal static string lbExitWithSinmaiTT {
|
||||
get {
|
||||
return ResourceManager.GetString("lbExitWithSinmaiTT", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Install com port.
|
||||
/// </summary>
|
||||
|
@ -159,6 +186,24 @@ namespace WpfMaiTouchEmulator.Resources {
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to _Help.
|
||||
/// </summary>
|
||||
internal static string lbMenuCategoryHelp {
|
||||
get {
|
||||
return ResourceManager.GetString("lbMenuCategoryHelp", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Show setup instructions.
|
||||
/// </summary>
|
||||
internal static string lbMenuItemSetup {
|
||||
get {
|
||||
return ResourceManager.GetString("lbMenuItemSetup", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Recieved.
|
||||
/// </summary>
|
||||
|
@ -177,6 +222,24 @@ namespace WpfMaiTouchEmulator.Resources {
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Drag.
|
||||
/// </summary>
|
||||
internal static string LbTouchPanelDrag {
|
||||
get {
|
||||
return ResourceManager.GetString("LbTouchPanelDrag", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Resize.
|
||||
/// </summary>
|
||||
internal static string LbTouchPanelResize {
|
||||
get {
|
||||
return ResourceManager.GetString("LbTouchPanelResize", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Uninstall com port.
|
||||
/// </summary>
|
||||
|
@ -185,5 +248,135 @@ namespace WpfMaiTouchEmulator.Resources {
|
|||
return ResourceManager.GetString("lbUninstallComPort", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Port COM3 already registered. Either remove it via Device Manager or uninstall the virtual port..
|
||||
/// </summary>
|
||||
internal static string TxtCom3AlreadyInstalled {
|
||||
get {
|
||||
return ResourceManager.GetString("TxtCom3AlreadyInstalled", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Port COM3 successfully installed..
|
||||
/// </summary>
|
||||
internal static string TxtCom3InstalledSuccessfully {
|
||||
get {
|
||||
return ResourceManager.GetString("TxtCom3InstalledSuccessfully", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Port COM3 failed to install.
|
||||
/// </summary>
|
||||
internal static string TxtCom3InstallFailed {
|
||||
get {
|
||||
return ResourceManager.GetString("TxtCom3InstallFailed", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Port COM3 successfully uninstalled..
|
||||
/// </summary>
|
||||
internal static string TxtCom3UninstalledSuccessfully {
|
||||
get {
|
||||
return ResourceManager.GetString("TxtCom3UninstalledSuccessfully", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Port COM3 failed to uninstall. It may be a real device, uninstall it from Device Manager.
|
||||
/// </summary>
|
||||
internal static string TxtCom3UninstallFailed {
|
||||
get {
|
||||
return ResourceManager.GetString("TxtCom3UninstallFailed", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Port COM3 not found. No need to uninstall..
|
||||
/// </summary>
|
||||
internal static string TxtCom3UninstallNotRequired {
|
||||
get {
|
||||
return ResourceManager.GetString("TxtCom3UninstallNotRequired", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Connected to port.
|
||||
/// </summary>
|
||||
internal static string TxtComPortConnected {
|
||||
get {
|
||||
return ResourceManager.GetString("TxtComPortConnected", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Conecting....
|
||||
/// </summary>
|
||||
internal static string TxtComPortConnecting {
|
||||
get {
|
||||
return ResourceManager.GetString("TxtComPortConnecting", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Installed ports.
|
||||
/// </summary>
|
||||
internal static string TxtCurrentlyInstalledPorts {
|
||||
get {
|
||||
return ResourceManager.GetString("TxtCurrentlyInstalledPorts", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Error connecting to COM port.
|
||||
/// </summary>
|
||||
internal static string TxtErrorConnectingToPortHeader {
|
||||
get {
|
||||
return ResourceManager.GetString("TxtErrorConnectingToPortHeader", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Failed to listen for Sinmai exit signal, this can happen when Sinmai.exe is being run as admin.\n\nAutomatic exiting disabled..
|
||||
/// </summary>
|
||||
internal static string TxtFailedToSetupSinmaiExit {
|
||||
get {
|
||||
return ResourceManager.GetString("TxtFailedToSetupSinmaiExit", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Failed to listen for Sinmai exit.
|
||||
/// </summary>
|
||||
internal static string TxtFailedToSetupSinmaiExitHeader {
|
||||
get {
|
||||
return ResourceManager.GetString("TxtFailedToSetupSinmaiExitHeader", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Please remove any COM devices using the COM3 port before installing the virtual COM port. In Device Manager click "View" then enabled "Show hidden devices" and uninstall any devices that are using the COM3 port.
|
||||
///
|
||||
///After ensuring COM3 is free please use the install COM port button in the app to register the app.
|
||||
///
|
||||
///The app needs to connect to the port prior to Sinmai.exe being opened..
|
||||
/// </summary>
|
||||
internal static string TxtSetupInstructions {
|
||||
get {
|
||||
return ResourceManager.GetString("TxtSetupInstructions", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to First time setup.
|
||||
/// </summary>
|
||||
internal static string TxtSetupInstructionsHeader {
|
||||
get {
|
||||
return ResourceManager.GetString("TxtSetupInstructionsHeader", resourceCulture);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -120,9 +120,15 @@
|
|||
<data name="lbAutoPortConnecting" xml:space="preserve">
|
||||
<value>Automatic port connecting</value>
|
||||
</data>
|
||||
<data name="lbAutoPortConnectingTT" xml:space="preserve">
|
||||
<value>Try to automatically connect to COM23 to send touch sensor updates on app start</value>
|
||||
</data>
|
||||
<data name="lbAutoSensorPositioning" xml:space="preserve">
|
||||
<value>Automatic sensor window positioning</value>
|
||||
</data>
|
||||
<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="lbButtonState" xml:space="preserve">
|
||||
<value>Button State</value>
|
||||
</data>
|
||||
|
@ -141,6 +147,9 @@
|
|||
<data name="lbExitWithSinmai" xml:space="preserve">
|
||||
<value>Exit when Sinmai exits</value>
|
||||
</data>
|
||||
<data name="lbExitWithSinmaiTT" xml:space="preserve">
|
||||
<value>Try and detect when Sinmai.exe exits and exit this app alongside it</value>
|
||||
</data>
|
||||
<data name="lbInstallComPort" xml:space="preserve">
|
||||
<value>Install com port</value>
|
||||
</data>
|
||||
|
@ -150,13 +159,71 @@
|
|||
<data name="lbListComPorts" xml:space="preserve">
|
||||
<value>List installed com ports</value>
|
||||
</data>
|
||||
<data name="lbMenuCategoryHelp" xml:space="preserve">
|
||||
<value>_Help</value>
|
||||
</data>
|
||||
<data name="lbMenuItemSetup" xml:space="preserve">
|
||||
<value>Show setup instructions</value>
|
||||
</data>
|
||||
<data name="lbRecievedData" xml:space="preserve">
|
||||
<value>Recieved</value>
|
||||
</data>
|
||||
<data name="lbSentData" xml:space="preserve">
|
||||
<value>Sent</value>
|
||||
</data>
|
||||
<data name="LbTouchPanelDrag" xml:space="preserve">
|
||||
<value>Drag</value>
|
||||
</data>
|
||||
<data name="LbTouchPanelResize" xml:space="preserve">
|
||||
<value>Resize</value>
|
||||
</data>
|
||||
<data name="lbUninstallComPort" xml:space="preserve">
|
||||
<value>Uninstall com port</value>
|
||||
</data>
|
||||
<data name="TxtCom3AlreadyInstalled" xml:space="preserve">
|
||||
<value>Port COM3 already registered. Either remove it via Device Manager or uninstall the virtual port.</value>
|
||||
</data>
|
||||
<data name="TxtCom3InstalledSuccessfully" xml:space="preserve">
|
||||
<value>Port COM3 successfully installed.</value>
|
||||
</data>
|
||||
<data name="TxtCom3InstallFailed" xml:space="preserve">
|
||||
<value>Port COM3 failed to install</value>
|
||||
</data>
|
||||
<data name="TxtCom3UninstalledSuccessfully" xml:space="preserve">
|
||||
<value>Port COM3 successfully uninstalled.</value>
|
||||
</data>
|
||||
<data name="TxtCom3UninstallFailed" xml:space="preserve">
|
||||
<value>Port COM3 failed to uninstall. It may be a real device, uninstall it from Device Manager</value>
|
||||
</data>
|
||||
<data name="TxtCom3UninstallNotRequired" xml:space="preserve">
|
||||
<value>Port COM3 not found. No need to uninstall.</value>
|
||||
</data>
|
||||
<data name="TxtComPortConnected" xml:space="preserve">
|
||||
<value>Connected to port</value>
|
||||
</data>
|
||||
<data name="TxtComPortConnecting" xml:space="preserve">
|
||||
<value>Conecting...</value>
|
||||
</data>
|
||||
<data name="TxtCurrentlyInstalledPorts" xml:space="preserve">
|
||||
<value>Installed ports</value>
|
||||
</data>
|
||||
<data name="TxtErrorConnectingToPortHeader" xml:space="preserve">
|
||||
<value>Error connecting to COM port</value>
|
||||
</data>
|
||||
<data name="TxtFailedToSetupSinmaiExit" xml:space="preserve">
|
||||
<value>Failed to listen for Sinmai exit signal, this can happen when Sinmai.exe is being run as admin.\n\nAutomatic exiting disabled.</value>
|
||||
</data>
|
||||
<data name="TxtFailedToSetupSinmaiExitHeader" xml:space="preserve">
|
||||
<value>Failed to listen for Sinmai exit</value>
|
||||
</data>
|
||||
<data name="TxtSetupInstructions" xml:space="preserve">
|
||||
<value>Please remove any COM devices using the COM3 port before installing the virtual COM port. In Device Manager click "View" then enabled "Show hidden devices" and uninstall any devices that are using the COM3 port.
|
||||
|
||||
After ensuring COM3 is free please use the install COM port button in the app to register the app.
|
||||
|
||||
The app needs to connect to the port prior to Sinmai.exe being opened.</value>
|
||||
</data>
|
||||
<data name="TxtSetupInstructionsHeader" xml:space="preserve">
|
||||
<value>First time setup</value>
|
||||
</data>
|
||||
</root>
|
|
@ -118,11 +118,17 @@
|
|||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<data name="lbAutoPortConnecting" xml:space="preserve">
|
||||
<value>自动端口连接</value>
|
||||
<value>自动连接端口</value>
|
||||
</data>
|
||||
<data name="lbAutoPortConnectingTT" xml:space="preserve">
|
||||
<value>尝试在应用启动时自动连接到COM23以发送触摸传感器更新</value>
|
||||
</data>
|
||||
<data name="lbAutoSensorPositioning" xml:space="preserve">
|
||||
<value>自动传感器窗口定位</value>
|
||||
</data>
|
||||
<data name="lbAutoSensorPositioningTT" xml:space="preserve">
|
||||
<value>尝试自动移动触摸传感器窗口到Sinmai.exe上方的正确位置</value>
|
||||
</data>
|
||||
<data name="lbButtonState" xml:space="preserve">
|
||||
<value>按钮状态</value>
|
||||
</data>
|
||||
|
@ -141,14 +147,23 @@
|
|||
<data name="lbExitWithSinmai" xml:space="preserve">
|
||||
<value>随Sinmai退出</value>
|
||||
</data>
|
||||
<data name="lbExitWithSinmaiTT" xml:space="preserve">
|
||||
<value>尝试检测Sinmai.exe何时退出,并与之同时退出此应用</value>
|
||||
</data>
|
||||
<data name="lbInstallComPort" xml:space="preserve">
|
||||
<value>安装串行端口</value>
|
||||
<value>安装COM端口</value>
|
||||
</data>
|
||||
<data name="lbLanguageDropdown" xml:space="preserve">
|
||||
<value>语言</value>
|
||||
</data>
|
||||
<data name="lbListComPorts" xml:space="preserve">
|
||||
<value>列出已安装的串行端口</value>
|
||||
<value>列出已安装的COM端口</value>
|
||||
</data>
|
||||
<data name="lbMenuCategoryHelp" xml:space="preserve">
|
||||
<value>_帮助</value>
|
||||
</data>
|
||||
<data name="lbMenuItemSetup" xml:space="preserve">
|
||||
<value>显示设置说明</value>
|
||||
</data>
|
||||
<data name="lbRecievedData" xml:space="preserve">
|
||||
<value>已接收数据</value>
|
||||
|
@ -156,7 +171,59 @@
|
|||
<data name="lbSentData" xml:space="preserve">
|
||||
<value>已发送数据</value>
|
||||
</data>
|
||||
<data name="LbTouchPanelDrag" xml:space="preserve">
|
||||
<value>拖动</value>
|
||||
</data>
|
||||
<data name="LbTouchPanelResize" xml:space="preserve">
|
||||
<value>调整大小</value>
|
||||
</data>
|
||||
<data name="lbUninstallComPort" xml:space="preserve">
|
||||
<value>卸载串行端口</value>
|
||||
<value>卸载COM端口</value>
|
||||
</data>
|
||||
<data name="TxtCom3AlreadyInstalled" xml:space="preserve">
|
||||
<value>COM3端口已注册。可通过设备管理器移除,或卸载虚拟端口。</value>
|
||||
</data>
|
||||
<data name="TxtCom3InstalledSuccessfully" xml:space="preserve">
|
||||
<value>COM3端口成功安装。</value>
|
||||
</data>
|
||||
<data name="TxtCom3InstallFailed" xml:space="preserve">
|
||||
<value>COM3端口安装失败</value>
|
||||
</data>
|
||||
<data name="TxtCom3UninstalledSuccessfully" xml:space="preserve">
|
||||
<value>COM3端口成功卸载。</value>
|
||||
</data>
|
||||
<data name="TxtCom3UninstallFailed" xml:space="preserve">
|
||||
<value>COM3端口卸载失败。可能是真实设备,请从设备管理器中卸载</value>
|
||||
</data>
|
||||
<data name="TxtCom3UninstallNotRequired" xml:space="preserve">
|
||||
<value>未找到COM3端口,无需卸载。</value>
|
||||
</data>
|
||||
<data name="TxtComPortConnected" xml:space="preserve">
|
||||
<value>已连接到端口</value>
|
||||
</data>
|
||||
<data name="TxtComPortConnecting" xml:space="preserve">
|
||||
<value>正在连接...</value>
|
||||
</data>
|
||||
<data name="TxtCurrentlyInstalledPorts" xml:space="preserve">
|
||||
<value>已安装端口</value>
|
||||
</data>
|
||||
<data name="TxtErrorConnectingToPortHeader" xml:space="preserve">
|
||||
<value>连接COM端口错误</value>
|
||||
</data>
|
||||
<data name="TxtFailedToSetupSinmaiExit" xml:space="preserve">
|
||||
<value>无法监听Sinmai退出信号,这可能是因为Sinmai.exe以管理员身份运行。\n\n自动退出功能已禁用。</value>
|
||||
</data>
|
||||
<data name="TxtFailedToSetupSinmaiExitHeader" xml:space="preserve">
|
||||
<value>监听Sinmai退出失败</value>
|
||||
</data>
|
||||
<data name="TxtSetupInstructions" xml:space="preserve">
|
||||
<value>请在安装虚拟COM端口之前,移除使用COM3端口的任何COM设备。在设备管理器中点击“查看”,然后启用“显示隐藏的设备”,并卸载任何使用COM3端口的设备。
|
||||
|
||||
确保COM3端口空闲后,请使用应用中的安装COM端口按钮来注册应用。
|
||||
|
||||
应用需要在打开Sinmai.exe之前连接到端口。</value>
|
||||
</data>
|
||||
<data name="TxtSetupInstructionsHeader" xml:space="preserve">
|
||||
<value>首次设置</value>
|
||||
</data>
|
||||
</root>
|
|
@ -15,7 +15,7 @@
|
|||
<Border x:Name="DragWindowHandle" HorizontalAlignment="Center" VerticalAlignment="Top"
|
||||
Height="95" Background="White" MouseLeftButtonDown="DragBar_MouseLeftButtonDown"
|
||||
Cursor="SizeAll" Width="130">
|
||||
<Label FontSize="50" Content="Drag" />
|
||||
<Label FontSize="50" Content="{Binding LbTouchPanelDrag}" d:Content="Drag" />
|
||||
</Border>
|
||||
<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" />
|
||||
|
@ -60,7 +60,7 @@
|
|||
<Border x:Name="ResizeGrip"
|
||||
Width="150" Height="90" Background="White"
|
||||
MouseDown="ResizeGrip_MouseDown" Canvas.Left="1290" Canvas.Top="1350" HorizontalAlignment="Center" VerticalAlignment="Top">
|
||||
<Label FontSize="50" Content="Resize" />
|
||||
<Label FontSize="50" Content="{Binding LbTouchPanelResize}" d:Content="Resize" />
|
||||
</Border>
|
||||
|
||||
</Canvas>
|
||||
|
|
|
@ -6,6 +6,13 @@ namespace WpfMaiTouchEmulator;
|
|||
|
||||
internal class VirtualComPortManager
|
||||
{
|
||||
private readonly MainWindowViewModel _viewModel;
|
||||
|
||||
public VirtualComPortManager(MainWindowViewModel viewModel)
|
||||
{
|
||||
_viewModel = viewModel;
|
||||
}
|
||||
|
||||
public IEnumerable<string> GetInstalledPorts()
|
||||
{
|
||||
return SerialPort.GetPortNames();
|
||||
|
@ -32,7 +39,7 @@ internal class VirtualComPortManager
|
|||
if (await CheckIfPortInstalled("COM3", false))
|
||||
{
|
||||
Logger.Warn("Port COM3 already registered.");
|
||||
MessageBox.Show("Port COM3 already registered. Either remove it via Device Manager or uninstall the virutal port.");
|
||||
MessageBox.Show(_viewModel.TxtCom3AlreadyInstalled);
|
||||
return;
|
||||
}
|
||||
try
|
||||
|
@ -42,18 +49,18 @@ internal class VirtualComPortManager
|
|||
if (await CheckIfPortInstalled("COM3", true))
|
||||
{
|
||||
Logger.Info("Port COM3 successfully installed.");
|
||||
MessageBox.Show("Port COM3 successfully installed.");
|
||||
MessageBox.Show(_viewModel.TxtCom3InstalledSuccessfully);
|
||||
}
|
||||
else
|
||||
{
|
||||
Logger.Error("Port COM3 failed to install");
|
||||
MessageBox.Show($"Port COM3 failed to install", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
MessageBox.Show(_viewModel.TxtCom3InstallFailed, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logger.Error("Port COM3 failed to install", ex);
|
||||
MessageBox.Show($"Port COM3 failed to install. {ex}", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
MessageBox.Show($"{_viewModel.TxtCom3InstallFailed} {ex}", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -63,7 +70,7 @@ internal class VirtualComPortManager
|
|||
if (!await CheckIfPortInstalled("COM3", true))
|
||||
{
|
||||
Logger.Warn("Port COM3 not found. No need to uninstall.");
|
||||
MessageBox.Show("Port COM3 not found. No need to uninstall.");
|
||||
MessageBox.Show(_viewModel.TxtCom3UninstallNotRequired);
|
||||
return;
|
||||
}
|
||||
try
|
||||
|
@ -73,18 +80,18 @@ internal class VirtualComPortManager
|
|||
if (!await CheckIfPortInstalled("COM3", false))
|
||||
{
|
||||
Logger.Info("Port COM3 successfully uninstalled.");
|
||||
MessageBox.Show("Port COM3 successfully uninstalled.");
|
||||
MessageBox.Show(_viewModel.TxtCom3UninstalledSuccessfully);
|
||||
}
|
||||
else
|
||||
{
|
||||
Logger.Error("Port COM3 failed to uninstall");
|
||||
MessageBox.Show($"Port COM3 failed to uninstall. It may be a real device, uninstall it from Device Manager", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
MessageBox.Show(_viewModel.TxtCom3UninstallFailed, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logger.Error("Port COM3 failed to uninstall", ex);
|
||||
MessageBox.Show($"Port COM3 failed to uninstall. {ex}", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
MessageBox.Show($"{_viewModel.TxtCom3UninstallFailed} {ex}", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue