Skip to content

Commit

Permalink
[Added] Option to choose which keyboard keys to show (#12) & Ability …
Browse files Browse the repository at this point in the history
…to change opactiy (#9, #8)
  • Loading branch information
KaustubhPatange committed Sep 15, 2021
1 parent 060806f commit 0232e3e
Show file tree
Hide file tree
Showing 46 changed files with 1,050 additions and 665 deletions.
13 changes: 13 additions & 0 deletions .idea/.idea.Kling/.idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions .idea/.idea.Kling/.idea/encodings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/.idea.Kling/.idea/indexLayout.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/.idea.Kling/.idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file modified .vs/Kling/v16/.suo
Binary file not shown.
Binary file added .vs/Kling/v16/TestStore/0/000.testlog
Binary file not shown.
Binary file added .vs/Kling/v16/TestStore/0/testlog.manifest
Binary file not shown.
Binary file added .vs/Kling/v17/.suo
Binary file not shown.
20 changes: 16 additions & 4 deletions Components/SettingsUI.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
xmlns:local="clr-namespace:Components"
mc:Ignorable="d" ResizeMode="NoResize" Icon="Resources\keyboard.png"
Topmost="true" WindowStartupLocation="CenterScreen"
Title="Settings" Height="300" Width="360">
SizeToContent="Height"
Title="Settings" Width="360">
<Border Padding="7" >
<StackPanel Orientation="Vertical">

Expand Down Expand Up @@ -54,8 +55,14 @@
</Grid>
<TextBlock Name="_timeText" FontStyle="Italic" FontSize="11" Margin="110,5,0,0" Text="2 seconds, till the text will fade out."/>

<!-- Opacity -->
<StackPanel Margin="0,7,0,0" Orientation="Horizontal">
<TextBlock Margin="3,0,0,0" Text="Display Opacity:"/>
<TextBox Name="_opacityTb" Margin="30, 0,0,0" Width="68" PreviewTextInput="_opacityTb_OnPreviewTextInput"/>
</StackPanel>

<!-- Separater Other -->
<Grid Margin="0,5,0,0">
<Grid Margin="0,10,0,0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="320"/>
Expand Down Expand Up @@ -84,9 +91,14 @@
</CheckBox>

<!-- Buttons -->
<DockPanel Margin="0,15,0,0">
<Button Height="22" Width="90" Name="_ignore_keys" Content="Ignore Keys" HorizontalAlignment="Left"/>
<Button Margin="10,0,0,0" Height="22" Width="70" Name="_save" Content="Save" HorizontalAlignment="Right" DockPanel.Dock="Right"/>
<Button Height="22" Width="70" Name="_cancel" Content="Cancel" HorizontalAlignment="Right"/>
</DockPanel>
<StackPanel Margin="0,15,0,0" Orientation="Horizontal" HorizontalAlignment="Right">
<Button Height="22" Width="70" Name="_cancel" Content="Cancel"/>
<Button Margin="10,0,0,0" Height="22" Width="70" Name="_save" Content="Save"/>


</StackPanel>
</StackPanel>
</Border>
Expand Down
19 changes: 17 additions & 2 deletions Components/SettingsUI.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using Adb_gui_Apkbox_plugin;
using System;
using System.Diagnostics;
using System.IO;
using System.Text.RegularExpressions;
using System.Windows;
Expand Down Expand Up @@ -29,7 +30,7 @@ public SettingsUI(int height, int width)
_locationComBo.ItemsSource = new string[] { "Top Left", "Top Right", "Bottom Left", "Bottom Right" };
_cancel.Click += (o, e) => { Close(); };
_save.Click += (o, e) =>
{
{
File.WriteAllText(@"config.ini",
"[Settings]" + Environment.NewLine +
$"displayindex={_locationComBo.SelectedIndex.ToString()}" + Environment.NewLine +
Expand All @@ -38,10 +39,15 @@ public SettingsUI(int height, int width)
$"displaytime={(int)_timeSlider.Value}" + Environment.NewLine +
$"notify={_messageCheckBox.IsChecked.ToString()}" + Environment.NewLine +
$"logkeys={_logkeys.IsChecked.ToString()}" + Environment.NewLine +
$"opacity={_opacityTb.Text}" + Environment.NewLine +
$"stdkeys={_standardCheckBox.IsChecked.ToString()}" + Environment.NewLine);
System.Windows.MessageBox.Show("Restart the application in order to apply the settings", "Notice", MessageBoxButton.OK, MessageBoxImage.Information);
Close();
};
_ignore_keys.Click += (o, e) =>
{
Process.Start(@"keys.txt");
};
loadconfigs();
_locationComBo.SelectionChanged += (o, e) => {
var ht = SystemInformation.VirtualScreen.Height;
Expand Down Expand Up @@ -80,16 +86,25 @@ private void loadconfigs()
_messageCheckBox.IsChecked = Convert.ToBoolean(myIni.Read("notify", "Settings"));
_standardCheckBox.IsChecked = Convert.ToBoolean(myIni.Read("stdkeys", "Settings"));
_logkeys.IsChecked = Convert.ToBoolean(myIni.Read("logkeys", "Settings"));
_opacityTb.Text = myIni.Read("opacity", "Settings");
if (string.IsNullOrWhiteSpace(_opacityTb.Text))
_opacityTb.Text = "0.7";
}
}

private void _timeSlider_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
{
try
try
{
_timeText.Text = $"{(int)e.NewValue} seconds, till the text will fade out.";
}
catch { }
}

private void _opacityTb_OnPreviewTextInput(object Sender, TextCompositionEventArgs e)
{
if (!Regex.IsMatch(e.Text, "[0-9.]+"))
e.Handled = true;
}
}
}
Binary file modified Components/bin/Debug/Components.dll
Binary file not shown.
Binary file modified Components/bin/Debug/Components.pdb
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// <autogenerated />
using System;
using System.Reflection;
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETFramework,Version=v4.5", FrameworkDisplayName = ".NET Framework 4.5")]
Binary file modified Components/obj/Debug/Components.Properties.Resources.resources
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1 +1 @@
702d39ba4d269f59e823e436be437f2e00fbb818
3110e103aa144b02d314601a48e3b922fcdc4d68
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,4 @@ D:\VisualStudioProjects\Kling\Components\obj\Debug\Components.dll
D:\VisualStudioProjects\Kling\Components\obj\Debug\Components.pdb
D:\VisualStudioProjects\Kling\Components\obj\Debug\CodeUI.g.cs
D:\VisualStudioProjects\Kling\Components\obj\Debug\CodeUI.baml
D:\VisualStudioProjects\Kling\Components\obj\Debug\Components.csprojAssemblyReference.cache
D:\VisualStudioProjects\Kling\Components\obj\Debug\Components.csproj.AssemblyReference.cache
Binary file modified Components/obj/Debug/Components.csproj.GenerateResource.Cache
Binary file not shown.
Binary file not shown.
Binary file modified Components/obj/Debug/Components.dll
Binary file not shown.
Binary file modified Components/obj/Debug/Components.g.resources
Binary file not shown.
Binary file modified Components/obj/Debug/Components.pdb
Binary file not shown.
Binary file modified Components/obj/Debug/DesignTimeResolveAssemblyReferences.cache
Binary file not shown.
Binary file not shown.
Binary file modified Components/obj/Debug/SettingsUI.baml
Binary file not shown.
66 changes: 47 additions & 19 deletions Components/obj/Debug/SettingsUI.g.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#pragma checksum "..\..\SettingsUI.xaml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "7BC8464537027F81DC9679A44A03BC34DC35072F488F7CC4E884590A4D700D99"
#pragma checksum "..\..\SettingsUI.xaml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "86BC6A92FE26E7CCF5B2B2FC2C39BB6726217665FFD71A4EC58225B414B1A211"
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
Expand Down Expand Up @@ -41,85 +41,101 @@ namespace Components {
public partial class SettingsUI : System.Windows.Window, System.Windows.Markup.IComponentConnector {


#line 34 "..\..\SettingsUI.xaml"
#line 35 "..\..\SettingsUI.xaml"
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
internal System.Windows.Controls.ComboBox _locationComBo;

#line default
#line hidden


#line 38 "..\..\SettingsUI.xaml"
#line 39 "..\..\SettingsUI.xaml"
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
internal System.Windows.Controls.TextBox _xaxis;

#line default
#line hidden


#line 40 "..\..\SettingsUI.xaml"
#line 41 "..\..\SettingsUI.xaml"
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
internal System.Windows.Controls.TextBox _yaxis;

#line default
#line hidden


#line 53 "..\..\SettingsUI.xaml"
#line 54 "..\..\SettingsUI.xaml"
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
internal System.Windows.Controls.Slider _timeSlider;

#line default
#line hidden


#line 55 "..\..\SettingsUI.xaml"
#line 56 "..\..\SettingsUI.xaml"
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
internal System.Windows.Controls.TextBlock _timeText;

#line default
#line hidden


#line 72 "..\..\SettingsUI.xaml"
#line 61 "..\..\SettingsUI.xaml"
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
internal System.Windows.Controls.TextBox _opacityTb;

#line default
#line hidden


#line 79 "..\..\SettingsUI.xaml"
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
internal System.Windows.Controls.CheckBox _messageCheckBox;

#line default
#line hidden


#line 77 "..\..\SettingsUI.xaml"
#line 84 "..\..\SettingsUI.xaml"
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
internal System.Windows.Controls.CheckBox _standardCheckBox;

#line default
#line hidden


#line 82 "..\..\SettingsUI.xaml"
#line 89 "..\..\SettingsUI.xaml"
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
internal System.Windows.Controls.CheckBox _logkeys;

#line default
#line hidden


#line 88 "..\..\SettingsUI.xaml"
#line 95 "..\..\SettingsUI.xaml"
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
internal System.Windows.Controls.Button _cancel;
internal System.Windows.Controls.Button _ignore_keys;

#line default
#line hidden


#line 89 "..\..\SettingsUI.xaml"
#line 96 "..\..\SettingsUI.xaml"
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
internal System.Windows.Controls.Button _save;

#line default
#line hidden


#line 97 "..\..\SettingsUI.xaml"
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
internal System.Windows.Controls.Button _cancel;

#line default
#line hidden

private bool _contentLoaded;

/// <summary>
Expand Down Expand Up @@ -156,7 +172,7 @@ void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object
case 2:
this._xaxis = ((System.Windows.Controls.TextBox)(target));

#line 38 "..\..\SettingsUI.xaml"
#line 39 "..\..\SettingsUI.xaml"
this._xaxis.PreviewTextInput += new System.Windows.Input.TextCompositionEventHandler(this.NumberValidationTextBox);

#line default
Expand All @@ -165,7 +181,7 @@ void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object
case 3:
this._yaxis = ((System.Windows.Controls.TextBox)(target));

#line 40 "..\..\SettingsUI.xaml"
#line 41 "..\..\SettingsUI.xaml"
this._yaxis.PreviewTextInput += new System.Windows.Input.TextCompositionEventHandler(this.NumberValidationTextBox);

#line default
Expand All @@ -174,7 +190,7 @@ void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object
case 4:
this._timeSlider = ((System.Windows.Controls.Slider)(target));

#line 53 "..\..\SettingsUI.xaml"
#line 54 "..\..\SettingsUI.xaml"
this._timeSlider.ValueChanged += new System.Windows.RoutedPropertyChangedEventHandler<double>(this._timeSlider_ValueChanged);

#line default
Expand All @@ -184,20 +200,32 @@ void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object
this._timeText = ((System.Windows.Controls.TextBlock)(target));
return;
case 6:
this._messageCheckBox = ((System.Windows.Controls.CheckBox)(target));
this._opacityTb = ((System.Windows.Controls.TextBox)(target));

#line 61 "..\..\SettingsUI.xaml"
this._opacityTb.PreviewTextInput += new System.Windows.Input.TextCompositionEventHandler(this._opacityTb_OnPreviewTextInput);

#line default
#line hidden
return;
case 7:
this._standardCheckBox = ((System.Windows.Controls.CheckBox)(target));
this._messageCheckBox = ((System.Windows.Controls.CheckBox)(target));
return;
case 8:
this._logkeys = ((System.Windows.Controls.CheckBox)(target));
this._standardCheckBox = ((System.Windows.Controls.CheckBox)(target));
return;
case 9:
this._cancel = ((System.Windows.Controls.Button)(target));
this._logkeys = ((System.Windows.Controls.CheckBox)(target));
return;
case 10:
this._ignore_keys = ((System.Windows.Controls.Button)(target));
return;
case 11:
this._save = ((System.Windows.Controls.Button)(target));
return;
case 12:
this._cancel = ((System.Windows.Controls.Button)(target));
return;
}
this._contentLoaded = true;
}
Expand Down
Loading

0 comments on commit 0232e3e

Please sign in to comment.