Skip to content
This repository was archived by the owner on May 20, 2024. It is now read-only.

Commit 93ce082

Browse files
committed
Merge branch 'feature/ui' into develop
2 parents cf1b1bc + c7aff03 commit 93ce082

10 files changed

+135
-9
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -252,3 +252,4 @@ paket-files/
252252
*.sln.iml
253253
*.appx
254254
*.decrypted
255+
Nuki UWP/Nuki_StoreKey.snk

Nuki Test/Nuki Test.csproj

+7-2
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,8 @@
9191
<ItemGroup>
9292
<!--A reference to the entire .Net Framework and Windows SDK are automatically included-->
9393
<None Include="project.json" />
94-
<SDKReference Include="MSTestFramework.Universal, Version=$(UnitTestPlatformVersion)" />
95-
<SDKReference Include="TestPlatform.Universal, Version=$(UnitTestPlatformVersion)" />
94+
<SDKReference Include="MSTestFramework.Universal, Version=14.0" />
95+
<SDKReference Include="TestPlatform.Universal, Version=14.0" />
9696
</ItemGroup>
9797
<ItemGroup>
9898
<Compile Include="Properties\AssemblyInfo.cs" />
@@ -134,6 +134,11 @@
134134
<ItemGroup>
135135
<Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
136136
</ItemGroup>
137+
<ItemGroup>
138+
<Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework">
139+
<HintPath>..\..\..\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\PublicAssemblies\Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll</HintPath>
140+
</Reference>
141+
</ItemGroup>
137142
<PropertyGroup Condition=" '$(VisualStudioVersion)' == '' or '$(VisualStudioVersion)' &lt; '14.0' ">
138143
<VisualStudioVersion>14.0</VisualStudioVersion>
139144
</PropertyGroup>
+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Text;
5+
using System.Threading.Tasks;
6+
using Windows.UI.Xaml.Data;
7+
using Nuki.Communication.API;
8+
9+
namespace Nuki.Converter
10+
{
11+
public class LockStateConverter : IValueConverter
12+
{
13+
public NukiLockState LockState { get; set; }
14+
public bool Inverted { get; set; }
15+
public object Convert(object value, Type targetType, object parameter, string language)
16+
{
17+
bool blnRet = false;
18+
NukiLockState state;
19+
if (Enum.TryParse<NukiLockState>(value?.ToString(), out state))
20+
{
21+
blnRet = state == LockState;
22+
23+
}
24+
else { }
25+
26+
if (Inverted)
27+
blnRet = !blnRet;
28+
return blnRet;
29+
}
30+
31+
public object ConvertBack(object value, Type targetType, object parameter, string language)
32+
{
33+
throw new NotImplementedException();
34+
}
35+
}
36+
}

Nuki UWP/Nuki.csproj

+1
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@
114114
<Compile Include="App.xaml.cs">
115115
<DependentUpon>App.xaml</DependentUpon>
116116
</Compile>
117+
<Compile Include="Converter\LockStateConverter.cs" />
117118
<Compile Include="Converter\SubstractConverter.cs" />
118119
<Compile Include="Extensions.cs" />
119120
<Compile Include="Converter\MultiplyConverter.cs" />

Nuki UWP/Package.appxmanifest

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<Package xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10" xmlns:mp="http://schemas.microsoft.com/appx/2014/phone/manifest" xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10" IgnorableNamespaces="uap mp">
3-
<Identity Name="40193BoBiene.NukiSmartLock" Publisher="CN=1139BFB6-85C6-402C-A9E2-FE7C6E98DA8A" Version="1.1.25.0" />
3+
<Identity Name="40193BoBiene.NukiSmartLock" Publisher="CN=1139BFB6-85C6-402C-A9E2-FE7C6E98DA8A" Version="1.2.29.0" />
44
<mp:PhoneIdentity PhoneProductId="2456611c-a2cc-4135-a062-51ba35e9ea1d" PhonePublisherId="00000000-0000-0000-0000-000000000000" />
55
<Properties>
66
<DisplayName>Nuki Smart Lock</DisplayName>

Nuki UWP/ViewModels/NukiLockHomePartViewModel.cs

+12
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,18 @@ public class NukiLockHomePartViewModel : NukiLockViewModel.Part
2727

2828
public Visibility IsFlyoutOpen { get { return m_IsFlyoutOpen; } set { Set(ref m_IsFlyoutOpen, value); } }
2929
public string LockRingState { get { return m_strLockRingState; } set { Set(ref m_strLockRingState, value); } }
30+
public int SelectedFlipViewIndex {
31+
get { return 1; }
32+
set
33+
{
34+
if (value == 0)
35+
SendLockCommand.Execute();
36+
else if (value == 2)
37+
SendUnlatchCommand.Execute();
38+
RaisePropertyChanged();
39+
}
40+
}
41+
3042
public bool CriticalBattery { get { return m_blnCriticalBattery; } set { Set(ref m_blnCriticalBattery, value); } }
3143
public NukiLockState LockState { get { return m_LockState; } set { Set(ref m_LockState, value); } }
3244
public NukiState NukiState { get { return m_NukiState; } set { Set(ref m_NukiState, value); } }

Nuki UWP/Views/NukiLockHome.xaml

+50-3
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222
<UserControl.Resources>
2323
<Converter:MultiplyConverter Value="0.5" x:Name="DiameterToRadius" />
2424
<Converter:SubstractConverter Value="10" x:Name="RadiusToInnerRadius" />
25+
<Converter:LockStateConverter LockState="Locked" x:Name="IsLocked" />
26+
<Converter:LockStateConverter LockState="Locked" Inverted="True" x:Name="IsNotLocked" />
2527
<Converter:SubstractConverter Value="40" x:Name="ContainerMargin" />
2628
<Style TargetType="Button" x:Key="CommandButton">
2729
<Setter Property="Width" Value="200"/>
@@ -31,6 +33,13 @@
3133
<Setter Property="Margin" Value="10,10,10,0" />
3234

3335
</Style>
36+
<Storyboard x:Name="lockActionInProgess" RepeatBehavior="Forever" AutoReverse="True">
37+
<DoubleAnimation
38+
Storyboard.TargetName="RingContainer"
39+
Storyboard.TargetProperty="Opacity"
40+
From="1.0" To="0.0" Duration="0:0:1"
41+
/>
42+
</Storyboard>
3443

3544
</UserControl.Resources>
3645
<Grid>
@@ -71,8 +80,37 @@
7180
</VisualState.Setters>
7281
</VisualState>
7382
</VisualStateGroup>
74-
</VisualStateManager.VisualStateGroups>
83+
<VisualStateGroup x:Name="RingState">
84+
<VisualState>
85+
<VisualState.StateTriggers>
86+
<StateTrigger IsActive="{x:Bind ViewModel.LockState, Converter={StaticResource IsLocked}, Mode=OneWay}"></StateTrigger>
87+
</VisualState.StateTriggers>
88+
<VisualState.Setters>
89+
<Setter Target="MyRingSlice.StartAngle" Value="1"></Setter>
90+
<Setter Target="MyRingSlice.EndAngle" Value="359"></Setter>
91+
</VisualState.Setters>
92+
</VisualState>
93+
<VisualState>
94+
<VisualState.StateTriggers>
95+
<StateTrigger IsActive="{x:Bind ViewModel.LockState, Converter={StaticResource IsNotLocked}, Mode=OneWay}"></StateTrigger>
96+
</VisualState.StateTriggers>
97+
<VisualState.Setters>
98+
<Setter Target="MyRingSlice.StartAngle" Value="50"></Setter>
99+
<Setter Target="MyRingSlice.EndAngle" Value="310"></Setter>
100+
</VisualState.Setters>
101+
</VisualState>
102+
</VisualStateGroup>
103+
</VisualStateManager.VisualStateGroups>
104+
<FlipView SelectedIndex="{x:Bind ViewModel.SelectedFlipViewIndex, Mode=TwoWay}">
105+
<Grid Background="{StaticResource ResourceKey=ContrastColorBrush}" >
106+
<TextBlock VerticalAlignment="Center" HorizontalAlignment="Right" Margin="50" FontSize="30" Text="Lock">
107+
<!--<TextBlock.RenderTransform>
108+
<RotateTransform Angle="90"/>
109+
</TextBlock.RenderTransform>-->
110+
</TextBlock>
111+
</Grid>
75112
<RelativePanel Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
113+
76114
<RelativePanel x:Name="RingContainer" VerticalAlignment="Center"
77115
RelativePanel.AlignBottomWithPanel="True"
78116
RelativePanel.AlignLeftWithPanel="True"
@@ -97,16 +135,17 @@
97135
RelativePanel.AlignTopWithPanel="True"
98136
RelativePanel.AlignRightWithPanel="True"
99137
RelativePanel.AlignLeftWithPanel="True">
138+
100139
<controls:RingSegment x:Name="MyRingSlice"
101140
HorizontalAlignment="Center"
102141
VerticalAlignment="Center" StartAngle="50" EndAngle="310"
103142
Fill="{StaticResource ApplicationForegroundThemeBrush}"
104143
Radius="100"
105144
InnerRadius="90">
145+
106146
</controls:RingSegment>
107-
147+
108148
</Grid>
109-
110149
</RelativePanel>
111150
<Grid
112151
RelativePanel.AlignBottomWithPanel="True"
@@ -164,5 +203,13 @@
164203
</i:Interaction.Behaviors>
165204

166205
</RelativePanel>
206+
<Grid Background="{StaticResource ResourceKey=ContrastColorBrush}" >
207+
<TextBlock VerticalAlignment="Center" HorizontalAlignment="Left" Margin="50" FontSize="30" Text="Unlock">
208+
<!--<TextBlock.RenderTransform>
209+
<RotateTransform Angle="270"/>
210+
</TextBlock.RenderTransform>-->
211+
</TextBlock>
212+
</Grid>
213+
</FlipView>
167214
</Grid>
168215
</UserControl>

Nuki UWP/Views/NukiLockHome.xaml.cs

+24
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,30 @@ public sealed partial class NukiLockHome : UserControl
2222
public NukiLockHome()
2323
{
2424
this.InitializeComponent();
25+
ViewModel.PropertyChanged += ViewModel_PropertyChanged;
26+
lockActionInProgess.Begin();
27+
}
28+
29+
private void ViewModel_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
30+
{
31+
if (e.PropertyName == nameof(ViewModel.LockState))
32+
{
33+
switch (ViewModel.LockState)
34+
{
35+
36+
case Communication.API.NukiLockState.Unlocking:
37+
38+
case Communication.API.NukiLockState.Locking:
39+
40+
case Communication.API.NukiLockState.Unlatching:
41+
lockActionInProgess.Begin();
42+
break;
43+
default:
44+
lockActionInProgess.Stop();
45+
break;
46+
}
47+
}
48+
else { }
2549
}
2650
}
2751
}

Nuki.sln

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
Microsoft Visual Studio Solution File, Format Version 12.00
3-
# Visual Studio 14
4-
VisualStudioVersion = 14.0.25420.1
3+
# Visual Studio 15
4+
VisualStudioVersion = 15.0.26020.0
55
MinimumVisualStudioVersion = 10.0.40219.1
66
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Nuki", "Nuki UWP\Nuki.csproj", "{F2DC7D23-C393-4CAD-959F-B2CBC459FEEB}"
77
EndProject

0 commit comments

Comments
 (0)