From 3acdc942bcd4a13a3b6a4cdcadccc60b78be22da Mon Sep 17 00:00:00 2001 From: shinichi Date: Mon, 19 Oct 2020 14:53:47 +0200 Subject: [PATCH 1/3] move files and copy code from stackoverflow :P --- Hashing/WPFStuff/FocusAdvancement.cs | 40 ++++++++++++ .../{ => WPFStuff}/MagicCode/WindowResizer.cs | 0 Hashing/{ => WPFStuff}/ObservableObject.cs | 0 Hashing/WPFStuff/Styles/Buttons.xaml | 65 +++++++++++++++++++ Hashing/WPFStuff/Styles/Colors.xaml | 25 +++++++ Hashing/WPFStuff/Styles/Fonts.xaml | 5 ++ Hashing/WPFStuff/Styles/Texts.xaml | 11 ++++ Hashing/WPFStuff/Styles/Windows.xaml | 5 ++ 8 files changed, 151 insertions(+) create mode 100644 Hashing/WPFStuff/FocusAdvancement.cs rename Hashing/{ => WPFStuff}/MagicCode/WindowResizer.cs (100%) rename Hashing/{ => WPFStuff}/ObservableObject.cs (100%) create mode 100644 Hashing/WPFStuff/Styles/Buttons.xaml create mode 100644 Hashing/WPFStuff/Styles/Colors.xaml create mode 100644 Hashing/WPFStuff/Styles/Fonts.xaml create mode 100644 Hashing/WPFStuff/Styles/Texts.xaml create mode 100644 Hashing/WPFStuff/Styles/Windows.xaml diff --git a/Hashing/WPFStuff/FocusAdvancement.cs b/Hashing/WPFStuff/FocusAdvancement.cs new file mode 100644 index 0000000..1f34e44 --- /dev/null +++ b/Hashing/WPFStuff/FocusAdvancement.cs @@ -0,0 +1,40 @@ +using System; +using System.Windows; +using System.Windows.Input; + +namespace Util.WPF +{ + public static class FocusAdvancement + { + public static bool GetAdvancesByEnterKey(DependencyObject obj) + { + return (bool)obj.GetValue(AdvancesByEnterKeyProperty); + } + + public static void SetAdvancesByEnterKey(DependencyObject obj, bool value) + { + obj.SetValue(AdvancesByEnterKeyProperty, value); + } + + public static readonly DependencyProperty AdvancesByEnterKeyProperty = + DependencyProperty.RegisterAttached("AdvancesByEnterKey", typeof(bool), typeof(FocusAdvancement), + new UIPropertyMetadata(OnAdvancesByEnterKeyPropertyChanged)); + + static void OnAdvancesByEnterKeyPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) + { + var element = d as UIElement; + if (element == null) return; + + if ((bool)e.NewValue) element.KeyDown += Keydown; + else element.KeyDown -= Keydown; + } + + static void Keydown(object sender, KeyEventArgs e) + { + if (!e.Key.Equals(Key.Enter)) return; + + var element = sender as UIElement; + if (element != null) element.MoveFocus(new TraversalRequest(FocusNavigationDirection.Next)); + } + } +} diff --git a/Hashing/MagicCode/WindowResizer.cs b/Hashing/WPFStuff/MagicCode/WindowResizer.cs similarity index 100% rename from Hashing/MagicCode/WindowResizer.cs rename to Hashing/WPFStuff/MagicCode/WindowResizer.cs diff --git a/Hashing/ObservableObject.cs b/Hashing/WPFStuff/ObservableObject.cs similarity index 100% rename from Hashing/ObservableObject.cs rename to Hashing/WPFStuff/ObservableObject.cs diff --git a/Hashing/WPFStuff/Styles/Buttons.xaml b/Hashing/WPFStuff/Styles/Buttons.xaml new file mode 100644 index 0000000..c951dd8 --- /dev/null +++ b/Hashing/WPFStuff/Styles/Buttons.xaml @@ -0,0 +1,65 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Hashing/WPFStuff/Styles/Colors.xaml b/Hashing/WPFStuff/Styles/Colors.xaml new file mode 100644 index 0000000..8e4f8ef --- /dev/null +++ b/Hashing/WPFStuff/Styles/Colors.xaml @@ -0,0 +1,25 @@ + + + #efefef + + + + #fafafa + + + #d7d7d7 + + + #686868 + + + #000 + + + #fff + + + + \ No newline at end of file diff --git a/Hashing/WPFStuff/Styles/Fonts.xaml b/Hashing/WPFStuff/Styles/Fonts.xaml new file mode 100644 index 0000000..b0e7544 --- /dev/null +++ b/Hashing/WPFStuff/Styles/Fonts.xaml @@ -0,0 +1,5 @@ + + + \ No newline at end of file diff --git a/Hashing/WPFStuff/Styles/Texts.xaml b/Hashing/WPFStuff/Styles/Texts.xaml new file mode 100644 index 0000000..4fdba93 --- /dev/null +++ b/Hashing/WPFStuff/Styles/Texts.xaml @@ -0,0 +1,11 @@ + + + + \ No newline at end of file diff --git a/Hashing/WPFStuff/Styles/Windows.xaml b/Hashing/WPFStuff/Styles/Windows.xaml new file mode 100644 index 0000000..b0e7544 --- /dev/null +++ b/Hashing/WPFStuff/Styles/Windows.xaml @@ -0,0 +1,5 @@ + + + \ No newline at end of file From f07c3f94844acfcc4d5cf5aa4827d6269afa7f00 Mon Sep 17 00:00:00 2001 From: shinichi Date: Mon, 19 Oct 2020 15:14:01 +0200 Subject: [PATCH 2/3] moving and fixing --- ClientApp/App.xaml | 10 +++++----- ClientApp/Views/LoginView.xaml | 5 +++-- DoctorApp/App.xaml | 10 +++++----- Hashing/Hashing.projitems | 15 ++++++++------- .../WPFStuff/{ => MagicCode}/FocusAdvancement.cs | 0 5 files changed, 21 insertions(+), 19 deletions(-) rename Hashing/WPFStuff/{ => MagicCode}/FocusAdvancement.cs (100%) diff --git a/ClientApp/App.xaml b/ClientApp/App.xaml index 61cadcc..daae7b7 100644 --- a/ClientApp/App.xaml +++ b/ClientApp/App.xaml @@ -19,11 +19,11 @@ - - - - - + + + + + diff --git a/ClientApp/Views/LoginView.xaml b/ClientApp/Views/LoginView.xaml index 9266c85..6dc238e 100644 --- a/ClientApp/Views/LoginView.xaml +++ b/ClientApp/Views/LoginView.xaml @@ -5,6 +5,7 @@ xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:local="clr-namespace:ClientApp.Views" xmlns:viewModels="clr-namespace:ClientApp.ViewModels" + xmlns:Util="clr-namespace:Util.WPF" mc:Ignorable="d" ShowsNavigationUI="False" d:DesignHeight="450" d:DesignWidth="800"> @@ -14,10 +15,10 @@