Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Start application GUI #592

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 24 additions & 1 deletion TabletDriverGUI/WindowButtonMapping.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
Padding="4"
FontWeight="Bold"
PreviewKeyDown="TextKeyboard_PreviewKeyDown"
>CTRL+SHIFT+Z</TextBox>
/>
</GroupBox>

<GroupBox Header="Multimedia" Padding="2">
Expand All @@ -48,6 +48,29 @@
</ComboBox>
</GroupBox>

<GroupBox Header="Start application" Padding="2">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<TextBox
Grid.Column="0"
Text=""
Name="textApplication"
Padding="2"
Margin="0,0,5,0"
/>
<Button
Grid.Column="1"
Name="buttonBrowse"
Content="Browse..."
Click="ButtonBrowse_Click"
Padding="15,3"
/>
</Grid>
</GroupBox>

<GroupBox Header="Custom" Padding="2">
<TextBox Grid.Column="1" Name="textCustom"
KeyUp="OnEnterKeyUp"
Expand Down
36 changes: 33 additions & 3 deletions TabletDriverGUI/WindowButtonMapping.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
using Microsoft.Win32;

namespace TabletDriverGUI
{
Expand Down Expand Up @@ -41,6 +42,7 @@ public override string ToString()

public OrderedDictionary mouseBindings;
public OrderedDictionary multimediaBindings;
public string applicationCommand = "RUN ";

public WindowButtonMapping()
{
Expand Down Expand Up @@ -179,13 +181,19 @@ public void CheckKeyValue()
}
}

// Launch application
else if (keys.StartsWith(applicationCommand))
{
textApplication.Text = keys.Remove(0, applicationCommand.Length);
}

// Keyboard
else
{
textKeyboard.Focus();
textKeyboard.Text = keys;
}

textKeyboard.Text = keys;
textCustom.Text = keys;
}

Expand All @@ -201,7 +209,8 @@ private void ComboBoxMouse_SelectionChanged(object sender, SelectionChangedEvent
ButtonBinding binding = (ButtonBinding)comboBoxMouse.SelectedItem;
if (comboBoxMouse.SelectedIndex > 0)
comboBoxMultimedia.SelectedIndex = 0;
textKeyboard.Text = binding.Key;
textKeyboard.Text = "";
textApplication.Text = "";
textCustom.Text = binding.Key;
}
}
Expand All @@ -217,7 +226,8 @@ private void ComboBoxMultimedia_SelectionChanged(object sender, SelectionChanged
ButtonBinding binding = (ButtonBinding)comboBoxMultimedia.SelectedItem;
if (comboBoxMultimedia.SelectedIndex > 0)
comboBoxMouse.SelectedIndex = 0;
textKeyboard.Text = binding.Key;
textKeyboard.Text = "";
textApplication.Text = "";
textCustom.Text = binding.Key;
}
}
Expand Down Expand Up @@ -278,6 +288,7 @@ private void TextKeyboard_PreviewKeyDown(object sender, KeyEventArgs e)
// Set textboxes
string keyText = string.Join("+", keys.ToArray());
textKeyboard.Text = keyText;
textApplication.Text = "";
textCustom.Text = keyText;

comboBoxMouse.SelectedIndex = 0;
Expand All @@ -291,6 +302,25 @@ private void Button_Click(object sender, RoutedEventArgs e)

}

//
// Browse...
//
private void ButtonBrowse_Click(object sender, RoutedEventArgs e)
{
OpenFileDialog openFileDialog = new OpenFileDialog();
if (openFileDialog.ShowDialog() == true)
{
string fileName = openFileDialog.FileName;

if (comboBoxMultimedia.SelectedIndex > 0)
comboBoxMouse.SelectedIndex = 0;
textKeyboard.Text = "";
textApplication.Text = fileName;
textCustom.Text = $"{applicationCommand}{fileName}";
}
}


//
// Set
//
Expand Down
2 changes: 1 addition & 1 deletion TabletDriverService/TabletDriverService.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<ProjectGuid>{3101CEC2-8F39-45FD-943B-79A488AD05EA}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>TabletDriverService</RootNamespace>
<WindowsTargetPlatformVersion>10.0.17763.0</WindowsTargetPlatformVersion>
<WindowsTargetPlatformVersion>10.0.18362.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
Expand Down