Skip to content

Commit

Permalink
Added 2 TimePicker tests
Browse files Browse the repository at this point in the history
  • Loading branch information
GregaMohorko committed Dec 26, 2018
1 parent 586fac7 commit 0707089
Show file tree
Hide file tree
Showing 28 changed files with 1,275 additions and 193 deletions.
3 changes: 0 additions & 3 deletions src/GM.WPF/GM.WPF.Test/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,6 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE

namespace GM.WPF.Test
{
/// <summary>
/// Interaction logic for App.xaml
/// </summary>
public partial class App : Application
{
private MainWindow mainWindow;
Expand Down
50 changes: 50 additions & 0 deletions src/GM.WPF/GM.WPF.Test/Controls/ControlsTest.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<!--
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
-->
<controls:BaseControl x:Class="GM.WPF.Test.Controls.ControlsTest"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:GM.WPF.Test.Controls"
xmlns:controls="clr-namespace:GM.WPF.Controls;assembly=GM.WPF"
mc:Ignorable="d"
d:DesignHeight="450"
d:DesignWidth="800"
>
<TabControl>
<TabItem Header="ProgressOverlay">
<local:ProgressOverlayTest />
</TabItem>
<TabItem Header="TimeControl">
<local:TimeControlTest />
</TabItem>
<TabItem Header="TimePicker" IsSelected="True">
<local:TimePickerTest />
</TabItem>
</TabControl>
</controls:BaseControl>
54 changes: 54 additions & 0 deletions src/GM.WPF/GM.WPF.Test/Controls/ControlsTest.xaml.cs
Original file line number Diff line number Diff line change
@@ -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();
}
}
}
67 changes: 67 additions & 0 deletions src/GM.WPF/GM.WPF.Test/Controls/ProgressOverlayTest.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
<!--
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
-->
<controls:BaseControl x:Class="GM.WPF.Test.Controls.ProgressOverlayTest"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:GM.WPF.Test.Controls"
xmlns:controls="clr-namespace:GM.WPF.Controls;assembly=GM.WPF"
mc:Ignorable="d"
d:DesignHeight="450"
d:DesignWidth="800"
d:DataContext="{d:DesignInstance Type=local:ProgressOverlayTestViewModel,IsDesignTimeCreatable=True}"
>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" MinWidth="150" />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<StackPanel Background="LightGray">
<Label FontWeight="Bold">Message:</Label>
<TextBox Text="{Binding Message,UpdateSourceTrigger=PropertyChanged,Mode=OneWayToSource}" Margin="5 0" />
<StackPanel Orientation="Horizontal">
<Label FontWeight="Bold">Progress value:</Label>
<Label Content="{Binding Value,Mode=OneWay}" />
</StackPanel>
<Slider Value="{Binding Value,Mode=TwoWay}" Maximum="100" Margin="10 0" TickFrequency="1" IsSnapToTickEnabled="True" />
<CheckBox IsChecked="{Binding IsIndeterminate,Mode=TwoWay}" Content="Is indeterminate" Margin="10 10" />
</StackPanel>
<Grid Grid.Column="1">
<StackPanel>
<TextBlock>Some random content ...</TextBlock>
<TextBlock>Some random content ...</TextBlock>
<TextBlock>Some random content ...</TextBlock>
<TextBlock>Some random content ...</TextBlock>
<TextBlock>Some random content ...</TextBlock>
<TextBlock>Some random content ...</TextBlock>
</StackPanel>
<controls:ProgressOverlay Message="{Binding Message,Mode=OneWay}" ProgressValue="{Binding Value,Mode=OneWay}" />
</Grid>
</Grid>
</controls:BaseControl>
57 changes: 57 additions & 0 deletions src/GM.WPF/GM.WPF.Test/Controls/ProgressOverlayTest.xaml.cs
Original file line number Diff line number Diff line change
@@ -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;
}
}
}
78 changes: 78 additions & 0 deletions src/GM.WPF/GM.WPF.Test/Controls/ProgressOverlayTestViewModel.cs
Original file line number Diff line number Diff line change
@@ -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;
}
}
}
}
57 changes: 57 additions & 0 deletions src/GM.WPF/GM.WPF.Test/Controls/TimeControlTest.xaml
Original file line number Diff line number Diff line change
@@ -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
-->
<controls:BaseControl x:Class="GM.WPF.Test.Controls.TimeControlTest"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:GM.WPF.Test.Controls"
xmlns:controls="clr-namespace:GM.WPF.Controls;assembly=GM.WPF"
mc:Ignorable="d"
d:DesignHeight="450"
d:DesignWidth="800"
>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition Width="Auto" />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition Height="Auto" />
<RowDefinition />
</Grid.RowDefinitions>
<controls:TimeControl Name="_TimeControl_Top" TimeChanged="Top_TimeChanged" />
<controls:TimeControl Name="_TimeControl_Bottom" Time="{Binding ElementName=_TimeControl_Top,Path=Time,Mode=TwoWay}" TimeChanged="Bottom_TimeChanged" Grid.Row="2" Grid.Column="2" />
<TextBox Name="_TextBox_Event_Top" Grid.Column="2" IsReadOnly="True" ScrollViewer.HorizontalScrollBarVisibility="Auto" ScrollViewer.VerticalScrollBarVisibility="Auto" />
<TextBox Name="_TextBox_Event_Bottom" Grid.Row="2" IsReadOnly="True" HorizontalContentAlignment="Right" ScrollViewer.HorizontalScrollBarVisibility="Auto" ScrollViewer.VerticalScrollBarVisibility="Auto" />
<GridSplitter Grid.Column="1" Grid.RowSpan="3" Width="5" VerticalAlignment="Stretch" ResizeBehavior="PreviousAndNext" />
<GridSplitter Grid.Row="1" Grid.ColumnSpan="3" Height="5" HorizontalAlignment="Stretch" ResizeBehavior="PreviousAndNext" />
</Grid>
</controls:BaseControl>
Loading

0 comments on commit 0707089

Please sign in to comment.