-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This is my largest commit yet. Please forgive me.
From this day on, all future commits in this repository will be of adequate size (I promise!) 👼 To be honest, I can't muster the energy to document each individual file change, so I'll make it brief: - The application now has a context menu! Just right click that juicy icon to see all the different possibilities! - Settings 1) CUSTOM HOTKEY(s)!: You can now bind your own hotkey instead of using the default one I created in a jiffy (WIN+SHIFT+K). 2) Adjust discovery time (the time in milliseconds the app should search for Bluetooth devices) - UI updated slightly - Some other negligible functionality that nobody will notice Also, I tried to clean the code base and implement some sweet tricks here and there... Personally, I ain't satisfied, but I'll keep working hard to reach omnipotence. Thanks for joining my TED talk.
- Loading branch information
Karsten
committed
Jun 11, 2022
1 parent
577b91f
commit 8da302a
Showing
59 changed files
with
1,996 additions
and
540 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,72 +1,21 @@ | ||
<Application x:Class="BTQuickie.App" | ||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:t="clr-namespace:System;assembly=mscorlib" | ||
xmlns:converters="clr-namespace:BTQuickie.Converters" | ||
Startup="OnStartup"> | ||
|
||
<Application.Resources> | ||
|
||
<!-- Colors --> | ||
<!-- Gray --> | ||
<Brush x:Key="Gray50"> #F9FAFB</Brush> | ||
<Brush x:Key="Gray100">#F3F4F6</Brush> | ||
<Brush x:Key="Gray200">#E5E7EB</Brush> | ||
<Brush x:Key="Gray300">#D1D5DB</Brush> | ||
<Brush x:Key="Gray400">#9CA3AF</Brush> | ||
<Brush x:Key="Gray500">#6B7280</Brush> | ||
<Brush x:Key="Gray600">#4B5563</Brush> | ||
<Brush x:Key="Gray700">#374151</Brush> | ||
<Brush x:Key="Gray800">#1F2937</Brush> | ||
<Brush x:Key="Gray900">#111827</Brush> | ||
<!-- Emerald --> | ||
<Brush x:Key="Emerald500">#10B981</Brush> | ||
|
||
<!-- Sizes --> | ||
<!-- Thickness --> | ||
<Thickness x:Key="ThicknessXMicro">1</Thickness> | ||
<Thickness x:Key="ThicknessMicro">5</Thickness> | ||
<Thickness x:Key="ThicknessXSmall">10</Thickness> | ||
<Thickness x:Key="ThicknessSmall">25</Thickness> | ||
<Thickness x:Key="ThicknessMedium">50</Thickness> | ||
<Thickness x:Key="ThicknessLarge">70</Thickness> | ||
|
||
<!-- Font Size --> | ||
<t:Double x:Key="FontSizeXSmall">8</t:Double> | ||
<t:Double x:Key="FontSizeSmall">11</t:Double> | ||
<t:Double x:Key="FontSizeMedium">14</t:Double> | ||
<t:Double x:Key="FontSizeLarge">22</t:Double> | ||
<t:Double x:Key="FontSizeXLarge">36</t:Double> | ||
|
||
<!-- Strings --> | ||
<t:String x:Key="UnknownDeviceString">Unknown Device</t:String> | ||
|
||
<!-- Converters --> | ||
<converters:VisibilityBooleanConverter x:Key="VisibilityBooleanConverter" /> | ||
<converters:InvertedVisibilityBooleanConverter x:Key="InvertedVisibilityBooleanConverter" /> | ||
<converters:StringToVisibilityConverter x:Key="StringToVisibilityConverter" /> | ||
<converters:EmptyStringToParameterConverter x:Key="EmptyStringToParameterConverter" /> | ||
|
||
<ImageSource x:Key="TrayIconSource">Resources/Icons/exported_small.ico</ImageSource> | ||
|
||
<!-- Styles --> | ||
|
||
<!-- Grid --> | ||
<Style TargetType="Grid" | ||
x:Key="MainGridStyle"> | ||
<Setter Property="Background" | ||
Value="{StaticResource Gray700}" /> | ||
</Style> | ||
<!-- Label --> | ||
<Style TargetType="Label"> | ||
<Setter Property="Foreground" | ||
Value="{StaticResource Gray200}" /> | ||
</Style> | ||
<!-- Button --> | ||
<Style TargetType="Button"> | ||
<Setter Property="Foreground" | ||
Value="{StaticResource Gray200}" /> | ||
</Style> | ||
|
||
<ResourceDictionary> | ||
|
||
<!-- Merged Dictionaries--> | ||
<ResourceDictionary.MergedDictionaries> | ||
<ResourceDictionary Source="Resources/Styles/Colors.xaml"/> | ||
<ResourceDictionary Source="Resources/Styles/Converters.xaml"/> | ||
<ResourceDictionary Source="Resources/Styles/Styles.xaml"/> | ||
<ResourceDictionary Source="Resources/Styles/Values.xaml"/> | ||
</ResourceDictionary.MergedDictionaries> | ||
|
||
<!-- Tray Icon --> | ||
<ImageSource x:Key="TrayIconSource">Resources/Icons/exported_small.ico</ImageSource> | ||
|
||
</ResourceDictionary> | ||
</Application.Resources> | ||
</Application> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
using System.Windows; | ||
using System.Windows.Controls; | ||
using System.Windows.Input; | ||
|
||
namespace BTQuickie.Behaviors; | ||
|
||
public class NumericTextBoxBehavior | ||
{ | ||
public static readonly DependencyProperty IsNumericInputProperty = | ||
DependencyProperty.RegisterAttached( | ||
"NumericInput", | ||
typeof(bool), | ||
typeof(NumericTextBoxBehavior), | ||
new PropertyMetadata(false, IsNumericInputPropertyChanged)); | ||
|
||
public static bool GetIsNumericInput(Control control) | ||
{ | ||
return (bool) control.GetValue(IsNumericInputProperty); | ||
} | ||
|
||
/// <summary> | ||
/// Forces focus on this element when its parent window is shown. | ||
/// </summary> | ||
public static void SetIsNumericInput(Control control, bool value) | ||
{ | ||
control.SetValue(IsNumericInputProperty, value); | ||
} | ||
|
||
private static void IsNumericInputPropertyChanged(DependencyObject dependencyObject, | ||
DependencyPropertyChangedEventArgs args) | ||
{ | ||
if (dependencyObject is not TextBox textBox) | ||
{ | ||
return; | ||
} | ||
|
||
if (args.NewValue is not true) | ||
{ | ||
return; | ||
} | ||
|
||
textBox.PreviewTextInput += TextBoxOnPreviewTextInput; | ||
} | ||
|
||
private static void TextBoxOnPreviewTextInput(object sender, TextCompositionEventArgs e) | ||
{ | ||
string text = e.Text; | ||
|
||
if (text.Length <= 0) | ||
{ | ||
e.Handled = true; | ||
return; | ||
} | ||
|
||
bool isNotDigit = !char.IsDigit(text[^1]); | ||
e.Handled = isNotDigit; | ||
} | ||
} |
Oops, something went wrong.