From 070708989e1f19df0b50a0d6612b2a20fa51823e Mon Sep 17 00:00:00 2001 From: "GREGA-AW\\grega" Date: Wed, 26 Dec 2018 17:57:51 +0100 Subject: [PATCH] Added 2 TimePicker tests --- src/GM.WPF/GM.WPF.Test/App.xaml.cs | 3 - .../GM.WPF.Test/Controls/ControlsTest.xaml | 50 ++++++++++ .../GM.WPF.Test/Controls/ControlsTest.xaml.cs | 54 +++++++++++ .../Controls/ProgressOverlayTest.xaml | 67 +++++++++++++ .../Controls/ProgressOverlayTest.xaml.cs | 57 +++++++++++ .../Controls/ProgressOverlayTestViewModel.cs | 78 +++++++++++++++ .../GM.WPF.Test/Controls/TimeControlTest.xaml | 57 +++++++++++ .../Controls/TimeControlTest.xaml.cs | 75 +++++++++++++++ .../GM.WPF.Test/Controls/TimePickerTest.xaml | 51 ++++++++++ .../Controls/TimePickerTest.xaml.cs | 54 +++++++++++ .../TimePickerBindingTest.xaml | 53 +++++++++++ .../TimePickerBindingTest.xaml.cs | 68 +++++++++++++ .../TimePickerBindingTestViewModel.cs | 67 +++++++++++++ .../TimePickerGeneralTest.xaml | 58 +++++++++++ .../TimePickerGeneralTest.xaml.cs | 95 +++++++++++++++++++ .../TimePickerInDataGridTest.xaml | 76 +++++++++++++++ .../TimePickerInDataGridTest.xaml.cs | 77 +++++++++++++++ .../TimePickerInDataGridTestModel.cs | 44 +++++++++ .../TimePickerInDataGridTestViewModel.cs | 61 ++++++++++++ src/GM.WPF/GM.WPF.Test/FodyWeavers.xml | 6 +- src/GM.WPF/GM.WPF.Test/FodyWeavers.xsd | 54 +++++++++++ src/GM.WPF/GM.WPF.Test/GM.WPF.Test.csproj | 69 ++++++++++++-- src/GM.WPF/GM.WPF.Test/MainWindow.xaml | 72 +------------- src/GM.WPF/GM.WPF.Test/MainWindow.xaml.cs | 69 -------------- src/GM.WPF/GM.WPF.Test/MainWindowViewModel.cs | 35 ------- src/GM.WPF/GM.WPF.Test/packages.config | 6 +- src/GM.WPF/GM.WPF/GM.WPF.nuspec | 8 +- src/GM.WPF/GM.WPF/Properties/AssemblyInfo.cs | 4 +- 28 files changed, 1275 insertions(+), 193 deletions(-) create mode 100644 src/GM.WPF/GM.WPF.Test/Controls/ControlsTest.xaml create mode 100644 src/GM.WPF/GM.WPF.Test/Controls/ControlsTest.xaml.cs create mode 100644 src/GM.WPF/GM.WPF.Test/Controls/ProgressOverlayTest.xaml create mode 100644 src/GM.WPF/GM.WPF.Test/Controls/ProgressOverlayTest.xaml.cs create mode 100644 src/GM.WPF/GM.WPF.Test/Controls/ProgressOverlayTestViewModel.cs create mode 100644 src/GM.WPF/GM.WPF.Test/Controls/TimeControlTest.xaml create mode 100644 src/GM.WPF/GM.WPF.Test/Controls/TimeControlTest.xaml.cs create mode 100644 src/GM.WPF/GM.WPF.Test/Controls/TimePickerTest.xaml create mode 100644 src/GM.WPF/GM.WPF.Test/Controls/TimePickerTest.xaml.cs create mode 100644 src/GM.WPF/GM.WPF.Test/Controls/TimePickerTests/TimePickerBindingTest.xaml create mode 100644 src/GM.WPF/GM.WPF.Test/Controls/TimePickerTests/TimePickerBindingTest.xaml.cs create mode 100644 src/GM.WPF/GM.WPF.Test/Controls/TimePickerTests/TimePickerBindingTestViewModel.cs create mode 100644 src/GM.WPF/GM.WPF.Test/Controls/TimePickerTests/TimePickerGeneralTest.xaml create mode 100644 src/GM.WPF/GM.WPF.Test/Controls/TimePickerTests/TimePickerGeneralTest.xaml.cs create mode 100644 src/GM.WPF/GM.WPF.Test/Controls/TimePickerTests/TimePickerInDataGridTest.xaml create mode 100644 src/GM.WPF/GM.WPF.Test/Controls/TimePickerTests/TimePickerInDataGridTest.xaml.cs create mode 100644 src/GM.WPF/GM.WPF.Test/Controls/TimePickerTests/TimePickerInDataGridTestModel.cs create mode 100644 src/GM.WPF/GM.WPF.Test/Controls/TimePickerTests/TimePickerInDataGridTestViewModel.cs create mode 100644 src/GM.WPF/GM.WPF.Test/FodyWeavers.xsd diff --git a/src/GM.WPF/GM.WPF.Test/App.xaml.cs b/src/GM.WPF/GM.WPF.Test/App.xaml.cs index 9a2c0d0..6e3581c 100644 --- a/src/GM.WPF/GM.WPF.Test/App.xaml.cs +++ b/src/GM.WPF/GM.WPF.Test/App.xaml.cs @@ -37,9 +37,6 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE namespace GM.WPF.Test { - /// - /// Interaction logic for App.xaml - /// public partial class App : Application { private MainWindow mainWindow; diff --git a/src/GM.WPF/GM.WPF.Test/Controls/ControlsTest.xaml b/src/GM.WPF/GM.WPF.Test/Controls/ControlsTest.xaml new file mode 100644 index 0000000..c385c71 --- /dev/null +++ b/src/GM.WPF/GM.WPF.Test/Controls/ControlsTest.xaml @@ -0,0 +1,50 @@ + + + + + + + + + + + + + + diff --git a/src/GM.WPF/GM.WPF.Test/Controls/ControlsTest.xaml.cs b/src/GM.WPF/GM.WPF.Test/Controls/ControlsTest.xaml.cs new file mode 100644 index 0000000..aa9155c --- /dev/null +++ b/src/GM.WPF/GM.WPF.Test/Controls/ControlsTest.xaml.cs @@ -0,0 +1,54 @@ +/* +MIT License + +Copyright (c) 2018 Grega Mohorko + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +Project: GM.WPF.Test +Created: 2018-12-26 +Author: GregaMohorko +*/ + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; +using GM.WPF.Controls; + +namespace GM.WPF.Test.Controls +{ + public partial class ControlsTest : BaseControl + { + public ControlsTest() + { + InitializeComponent(); + } + } +} diff --git a/src/GM.WPF/GM.WPF.Test/Controls/ProgressOverlayTest.xaml b/src/GM.WPF/GM.WPF.Test/Controls/ProgressOverlayTest.xaml new file mode 100644 index 0000000..a943fb1 --- /dev/null +++ b/src/GM.WPF/GM.WPF.Test/Controls/ProgressOverlayTest.xaml @@ -0,0 +1,67 @@ + + + + + + + + + + + + + + + + + + + Some random content ... + Some random content ... + Some random content ... + Some random content ... + Some random content ... + Some random content ... + + + + + diff --git a/src/GM.WPF/GM.WPF.Test/Controls/ProgressOverlayTest.xaml.cs b/src/GM.WPF/GM.WPF.Test/Controls/ProgressOverlayTest.xaml.cs new file mode 100644 index 0000000..bc3ce43 --- /dev/null +++ b/src/GM.WPF/GM.WPF.Test/Controls/ProgressOverlayTest.xaml.cs @@ -0,0 +1,57 @@ +/* +MIT License + +Copyright (c) 2018 Grega Mohorko + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +Project: GM.WPF.Test +Created: 2018-12-26 +Author: GregaMohorko +*/ + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; +using GM.WPF.Controls; + +namespace GM.WPF.Test.Controls +{ + public partial class ProgressOverlayTest : BaseControl + { + public ProgressOverlayTest() + { + InitializeComponent(); + + var vm = new ProgressOverlayTestViewModel(); + ViewModel = vm; + } + } +} diff --git a/src/GM.WPF/GM.WPF.Test/Controls/ProgressOverlayTestViewModel.cs b/src/GM.WPF/GM.WPF.Test/Controls/ProgressOverlayTestViewModel.cs new file mode 100644 index 0000000..2937ca1 --- /dev/null +++ b/src/GM.WPF/GM.WPF.Test/Controls/ProgressOverlayTestViewModel.cs @@ -0,0 +1,78 @@ +/* +MIT License + +Copyright (c) 2018 Grega Mohorko + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +Project: GM.WPF.Test +Created: 2018-12-26 +Author: GregaMohorko +*/ + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using GM.WPF.MVVM; + +namespace GM.WPF.Test.Controls +{ + class ProgressOverlayTestViewModel:ViewModel + { + public string Message { get; set; } + + private double? _value; + public double? Value + { + get => _value; + set + { + _value = value; + if(value != null) { + IsIndeterminate = false; + } + } + } + + private bool _isIndeterminate; + public bool IsIndeterminate + { + get => _isIndeterminate; + set + { + _isIndeterminate = value; + if(value) { + Value = null; + } else if(Value == null) { + Value = 0; + } + } + } + + public ProgressOverlayTestViewModel() + { + if(IsInDesignMode) { + Message = "Loading ..."; + return; + } + } + } +} diff --git a/src/GM.WPF/GM.WPF.Test/Controls/TimeControlTest.xaml b/src/GM.WPF/GM.WPF.Test/Controls/TimeControlTest.xaml new file mode 100644 index 0000000..ecdf2dc --- /dev/null +++ b/src/GM.WPF/GM.WPF.Test/Controls/TimeControlTest.xaml @@ -0,0 +1,57 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/src/GM.WPF/GM.WPF.Test/Controls/TimeControlTest.xaml.cs b/src/GM.WPF/GM.WPF.Test/Controls/TimeControlTest.xaml.cs new file mode 100644 index 0000000..b9a3fe4 --- /dev/null +++ b/src/GM.WPF/GM.WPF.Test/Controls/TimeControlTest.xaml.cs @@ -0,0 +1,75 @@ +/* +MIT License + +Copyright (c) 2018 Grega Mohorko + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +Project: GM.WPF.Test +Created: 2018-12-26 +Author: GregaMohorko +*/ + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; +using GM.WPF.Controls; + +namespace GM.WPF.Test.Controls +{ + public partial class TimeControlTest : BaseControl + { + public TimeControlTest() + { + InitializeComponent(); + } + + private void Top_TimeChanged(object sender, TimeSpan e) + { + TimeChanged(e, _TextBox_Event_Top); + } + + private void Bottom_TimeChanged(object sender, TimeSpan e) + { + TimeChanged(e, _TextBox_Event_Bottom); + } + + private void TimeChanged(TimeSpan newValue, TextBox associatedTextBox) + { + string text = $"TimeChanged event fired. Current time value: {newValue}"; + if(!string.IsNullOrEmpty(associatedTextBox.Text)) { + text = Environment.NewLine + text; + } + + associatedTextBox.AppendText(text); + associatedTextBox.ScrollToEnd(); + } + } +} diff --git a/src/GM.WPF/GM.WPF.Test/Controls/TimePickerTest.xaml b/src/GM.WPF/GM.WPF.Test/Controls/TimePickerTest.xaml new file mode 100644 index 0000000..8d070ef --- /dev/null +++ b/src/GM.WPF/GM.WPF.Test/Controls/TimePickerTest.xaml @@ -0,0 +1,51 @@ + + + + + + + + + + + + + + diff --git a/src/GM.WPF/GM.WPF.Test/Controls/TimePickerTest.xaml.cs b/src/GM.WPF/GM.WPF.Test/Controls/TimePickerTest.xaml.cs new file mode 100644 index 0000000..8611711 --- /dev/null +++ b/src/GM.WPF/GM.WPF.Test/Controls/TimePickerTest.xaml.cs @@ -0,0 +1,54 @@ +/* +MIT License + +Copyright (c) 2018 Grega Mohorko + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +Project: GM.WPF.Test +Created: 2018-12-26 +Author: GregaMohorko +*/ + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; +using GM.WPF.Controls; + +namespace GM.WPF.Test.Controls +{ + public partial class TimePickerTest : BaseControl + { + public TimePickerTest() + { + InitializeComponent(); + } + } +} diff --git a/src/GM.WPF/GM.WPF.Test/Controls/TimePickerTests/TimePickerBindingTest.xaml b/src/GM.WPF/GM.WPF.Test/Controls/TimePickerTests/TimePickerBindingTest.xaml new file mode 100644 index 0000000..d9c8aa0 --- /dev/null +++ b/src/GM.WPF/GM.WPF.Test/Controls/TimePickerTests/TimePickerBindingTest.xaml @@ -0,0 +1,53 @@ + + + + + + + + + +