diff --git a/GpioOneWire/App.xaml b/GpioOneWire/CPP/App.xaml
similarity index 100%
rename from GpioOneWire/App.xaml
rename to GpioOneWire/CPP/App.xaml
diff --git a/GpioOneWire/App.xaml.cpp b/GpioOneWire/CPP/App.xaml.cpp
similarity index 100%
rename from GpioOneWire/App.xaml.cpp
rename to GpioOneWire/CPP/App.xaml.cpp
diff --git a/GpioOneWire/App.xaml.h b/GpioOneWire/CPP/App.xaml.h
similarity index 100%
rename from GpioOneWire/App.xaml.h
rename to GpioOneWire/CPP/App.xaml.h
diff --git a/GpioOneWire/Assets/LockScreenLogo.scale-200.png b/GpioOneWire/CPP/Assets/LockScreenLogo.scale-200.png
similarity index 100%
rename from GpioOneWire/Assets/LockScreenLogo.scale-200.png
rename to GpioOneWire/CPP/Assets/LockScreenLogo.scale-200.png
diff --git a/GpioOneWire/Assets/SplashScreen.scale-200.png b/GpioOneWire/CPP/Assets/SplashScreen.scale-200.png
similarity index 100%
rename from GpioOneWire/Assets/SplashScreen.scale-200.png
rename to GpioOneWire/CPP/Assets/SplashScreen.scale-200.png
diff --git a/GpioOneWire/Assets/Square150x150Logo.scale-200.png b/GpioOneWire/CPP/Assets/Square150x150Logo.scale-200.png
similarity index 100%
rename from GpioOneWire/Assets/Square150x150Logo.scale-200.png
rename to GpioOneWire/CPP/Assets/Square150x150Logo.scale-200.png
diff --git a/GpioOneWire/Assets/Square44x44Logo.scale-200.png b/GpioOneWire/CPP/Assets/Square44x44Logo.scale-200.png
similarity index 100%
rename from GpioOneWire/Assets/Square44x44Logo.scale-200.png
rename to GpioOneWire/CPP/Assets/Square44x44Logo.scale-200.png
diff --git a/GpioOneWire/Assets/Square44x44Logo.targetsize-24_altform-unplated.png b/GpioOneWire/CPP/Assets/Square44x44Logo.targetsize-24_altform-unplated.png
similarity index 100%
rename from GpioOneWire/Assets/Square44x44Logo.targetsize-24_altform-unplated.png
rename to GpioOneWire/CPP/Assets/Square44x44Logo.targetsize-24_altform-unplated.png
diff --git a/GpioOneWire/Assets/StoreLogo.png b/GpioOneWire/CPP/Assets/StoreLogo.png
similarity index 100%
rename from GpioOneWire/Assets/StoreLogo.png
rename to GpioOneWire/CPP/Assets/StoreLogo.png
diff --git a/GpioOneWire/Assets/Wide310x150Logo.scale-200.png b/GpioOneWire/CPP/Assets/Wide310x150Logo.scale-200.png
similarity index 100%
rename from GpioOneWire/Assets/Wide310x150Logo.scale-200.png
rename to GpioOneWire/CPP/Assets/Wide310x150Logo.scale-200.png
diff --git a/GpioOneWire/GpioOneWire.vcxproj b/GpioOneWire/CPP/GpioOneWire.vcxproj
similarity index 100%
rename from GpioOneWire/GpioOneWire.vcxproj
rename to GpioOneWire/CPP/GpioOneWire.vcxproj
diff --git a/GpioOneWire/GpioOneWire.vcxproj.filters b/GpioOneWire/CPP/GpioOneWire.vcxproj.filters
similarity index 100%
rename from GpioOneWire/GpioOneWire.vcxproj.filters
rename to GpioOneWire/CPP/GpioOneWire.vcxproj.filters
diff --git a/GpioOneWire/GpioOneWire_TemporaryKey.pfx b/GpioOneWire/CPP/GpioOneWire_TemporaryKey.pfx
similarity index 100%
rename from GpioOneWire/GpioOneWire_TemporaryKey.pfx
rename to GpioOneWire/CPP/GpioOneWire_TemporaryKey.pfx
diff --git a/GpioOneWire/MainPage.xaml b/GpioOneWire/CPP/MainPage.xaml
similarity index 100%
rename from GpioOneWire/MainPage.xaml
rename to GpioOneWire/CPP/MainPage.xaml
diff --git a/GpioOneWire/MainPage.xaml.cpp b/GpioOneWire/CPP/MainPage.xaml.cpp
similarity index 100%
rename from GpioOneWire/MainPage.xaml.cpp
rename to GpioOneWire/CPP/MainPage.xaml.cpp
diff --git a/GpioOneWire/MainPage.xaml.h b/GpioOneWire/CPP/MainPage.xaml.h
similarity index 100%
rename from GpioOneWire/MainPage.xaml.h
rename to GpioOneWire/CPP/MainPage.xaml.h
diff --git a/GpioOneWire/Package.appxmanifest b/GpioOneWire/CPP/Package.appxmanifest
similarity index 100%
rename from GpioOneWire/Package.appxmanifest
rename to GpioOneWire/CPP/Package.appxmanifest
diff --git a/GpioOneWire/pch.cpp b/GpioOneWire/CPP/pch.cpp
similarity index 100%
rename from GpioOneWire/pch.cpp
rename to GpioOneWire/CPP/pch.cpp
diff --git a/GpioOneWire/pch.h b/GpioOneWire/CPP/pch.h
similarity index 100%
rename from GpioOneWire/pch.h
rename to GpioOneWire/CPP/pch.h
diff --git a/GpioOneWire/CS/App.xaml b/GpioOneWire/CS/App.xaml
new file mode 100644
index 000000000..14420d92e
--- /dev/null
+++ b/GpioOneWire/CS/App.xaml
@@ -0,0 +1,8 @@
+
+
+
diff --git a/GpioOneWire/CS/App.xaml.cs b/GpioOneWire/CS/App.xaml.cs
new file mode 100644
index 000000000..a4b17de42
--- /dev/null
+++ b/GpioOneWire/CS/App.xaml.cs
@@ -0,0 +1,100 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Runtime.InteropServices.WindowsRuntime;
+using Windows.ApplicationModel;
+using Windows.ApplicationModel.Activation;
+using Windows.Foundation;
+using Windows.Foundation.Collections;
+using Windows.UI.Xaml;
+using Windows.UI.Xaml.Controls;
+using Windows.UI.Xaml.Controls.Primitives;
+using Windows.UI.Xaml.Data;
+using Windows.UI.Xaml.Input;
+using Windows.UI.Xaml.Media;
+using Windows.UI.Xaml.Navigation;
+
+namespace GpioOneWire
+{
+ ///
+ /// Provides application-specific behavior to supplement the default Application class.
+ ///
+ sealed partial class App : Application
+ {
+ ///
+ /// Initializes the singleton application object. This is the first line of authored code
+ /// executed, and as such is the logical equivalent of main() or WinMain().
+ ///
+ public App()
+ {
+ this.InitializeComponent();
+ this.Suspending += OnSuspending;
+ }
+
+ ///
+ /// Invoked when the application is launched normally by the end user. Other entry points
+ /// will be used such as when the application is launched to open a specific file.
+ ///
+ /// Details about the launch request and process.
+ protected override void OnLaunched(LaunchActivatedEventArgs e)
+ {
+ Frame rootFrame = Window.Current.Content as Frame;
+
+ // Do not repeat app initialization when the Window already has content,
+ // just ensure that the window is active
+ if (rootFrame == null)
+ {
+ // Create a Frame to act as the navigation context and navigate to the first page
+ rootFrame = new Frame();
+
+ rootFrame.NavigationFailed += OnNavigationFailed;
+
+ if (e.PreviousExecutionState == ApplicationExecutionState.Terminated)
+ {
+ //TODO: Load state from previously suspended application
+ }
+
+ // Place the frame in the current Window
+ Window.Current.Content = rootFrame;
+ }
+
+ if (e.PrelaunchActivated == false)
+ {
+ if (rootFrame.Content == null)
+ {
+ // When the navigation stack isn't restored navigate to the first page,
+ // configuring the new page by passing required information as a navigation
+ // parameter
+ rootFrame.Navigate(typeof(MainPage), e.Arguments);
+ }
+ // Ensure the current window is active
+ Window.Current.Activate();
+ }
+ }
+
+ ///
+ /// Invoked when Navigation to a certain page fails
+ ///
+ /// The Frame which failed navigation
+ /// Details about the navigation failure
+ void OnNavigationFailed(object sender, NavigationFailedEventArgs e)
+ {
+ throw new Exception("Failed to load Page " + e.SourcePageType.FullName);
+ }
+
+ ///
+ /// Invoked when application execution is being suspended. Application state is saved
+ /// without knowing whether the application will be terminated or resumed with the contents
+ /// of memory still intact.
+ ///
+ /// The source of the suspend request.
+ /// Details about the suspend request.
+ private void OnSuspending(object sender, SuspendingEventArgs e)
+ {
+ var deferral = e.SuspendingOperation.GetDeferral();
+ //TODO: Save application state and stop any background activity
+ deferral.Complete();
+ }
+ }
+}
diff --git a/GpioOneWire/CS/Assets/LockScreenLogo.scale-200.png b/GpioOneWire/CS/Assets/LockScreenLogo.scale-200.png
new file mode 100644
index 000000000..735f57adb
Binary files /dev/null and b/GpioOneWire/CS/Assets/LockScreenLogo.scale-200.png differ
diff --git a/GpioOneWire/CS/Assets/SplashScreen.scale-200.png b/GpioOneWire/CS/Assets/SplashScreen.scale-200.png
new file mode 100644
index 000000000..023e7f1fe
Binary files /dev/null and b/GpioOneWire/CS/Assets/SplashScreen.scale-200.png differ
diff --git a/GpioOneWire/CS/Assets/Square150x150Logo.scale-200.png b/GpioOneWire/CS/Assets/Square150x150Logo.scale-200.png
new file mode 100644
index 000000000..af49fec1a
Binary files /dev/null and b/GpioOneWire/CS/Assets/Square150x150Logo.scale-200.png differ
diff --git a/GpioOneWire/CS/Assets/Square44x44Logo.scale-200.png b/GpioOneWire/CS/Assets/Square44x44Logo.scale-200.png
new file mode 100644
index 000000000..ce342a2ec
Binary files /dev/null and b/GpioOneWire/CS/Assets/Square44x44Logo.scale-200.png differ
diff --git a/GpioOneWire/CS/Assets/Square44x44Logo.targetsize-24_altform-unplated.png b/GpioOneWire/CS/Assets/Square44x44Logo.targetsize-24_altform-unplated.png
new file mode 100644
index 000000000..f6c02ce97
Binary files /dev/null and b/GpioOneWire/CS/Assets/Square44x44Logo.targetsize-24_altform-unplated.png differ
diff --git a/GpioOneWire/CS/Assets/StoreLogo.png b/GpioOneWire/CS/Assets/StoreLogo.png
new file mode 100644
index 000000000..7385b56c0
Binary files /dev/null and b/GpioOneWire/CS/Assets/StoreLogo.png differ
diff --git a/GpioOneWire/CS/Assets/Wide310x150Logo.scale-200.png b/GpioOneWire/CS/Assets/Wide310x150Logo.scale-200.png
new file mode 100644
index 000000000..288995b39
Binary files /dev/null and b/GpioOneWire/CS/Assets/Wide310x150Logo.scale-200.png differ
diff --git a/GpioOneWire/CS/DhtSensorReading.cs b/GpioOneWire/CS/DhtSensorReading.cs
new file mode 100644
index 000000000..72649f720
--- /dev/null
+++ b/GpioOneWire/CS/DhtSensorReading.cs
@@ -0,0 +1,66 @@
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace GpioOneWire
+{
+ public class DhtSensorReading
+ {
+ public BitArray Bits { get; } = new BitArray(40, false);
+
+ public bool IsValid()
+ {
+ ulong value = GetBitsValue();
+
+ ulong checksum =
+ ((value >> 32) & 0xff) +
+ ((value >> 24) & 0xff) +
+ ((value >> 16) & 0xff) +
+ ((value >> 8) & 0xff);
+
+ return (checksum & 0xff) == (value & 0xff);
+ }
+
+ public double Humidity()
+ {
+ ulong value = GetBitsValue();
+
+ return ((value >> 24) & 0xffff) * 0.1;
+ }
+
+ public double Temperature()
+ {
+ ulong value = GetBitsValue();
+
+ double temp = ((value >> 8) & 0x7FFF) * 0.1;
+
+ if (((value >> 8) & 0x8000) == 0x8000)
+ {
+ temp = -temp;
+ }
+
+ return temp;
+ }
+
+ private ulong GetBitsValue()
+ {
+ ulong value = 0;
+ ulong mask = 1;
+
+ for (int i = 0; i < Bits.Length; i++)
+ {
+ if (Bits[i])
+ {
+ value ^= mask;
+ }
+
+ mask <<= 1;
+ }
+
+ return value;
+ }
+ };
+}
diff --git a/GpioOneWire/CS/GpioOneWire.csproj b/GpioOneWire/CS/GpioOneWire.csproj
new file mode 100644
index 000000000..65d03fbed
--- /dev/null
+++ b/GpioOneWire/CS/GpioOneWire.csproj
@@ -0,0 +1,146 @@
+
+
+
+
+ Debug
+ x86
+ {FAA91481-2C5F-4985-BD5B-463EAF46F313}
+ AppContainerExe
+ Properties
+ GpioOneWire
+ GpioOneWire
+ en-US
+ UAP
+ 10.0.15063.0
+ 10.0.15063.0
+ 14
+ 512
+ {A5A43C5B-DE2A-4C0C-9213-0A381AF9435A};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
+ true
+ GpioOneWire_TemporaryKey.pfx
+
+
+ true
+ bin\x86\Debug\
+ DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP
+ ;2008
+ full
+ x86
+ false
+ prompt
+ true
+
+
+ bin\x86\Release\
+ TRACE;NETFX_CORE;WINDOWS_UWP
+ true
+ ;2008
+ pdbonly
+ x86
+ false
+ prompt
+ true
+ true
+
+
+ true
+ bin\ARM\Debug\
+ DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP
+ ;2008
+ full
+ ARM
+ false
+ prompt
+ true
+
+
+ bin\ARM\Release\
+ TRACE;NETFX_CORE;WINDOWS_UWP
+ true
+ ;2008
+ pdbonly
+ ARM
+ false
+ prompt
+ true
+ true
+
+
+ true
+ bin\x64\Debug\
+ DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP
+ ;2008
+ full
+ x64
+ false
+ prompt
+ true
+
+
+ bin\x64\Release\
+ TRACE;NETFX_CORE;WINDOWS_UWP
+ true
+ ;2008
+ pdbonly
+ x64
+ false
+ prompt
+ true
+ true
+
+
+ PackageReference
+
+
+
+ App.xaml
+
+
+
+ MainPage.xaml
+
+
+
+
+
+ Designer
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ MSBuild:Compile
+ Designer
+
+
+ MSBuild:Compile
+ Designer
+
+
+
+
+ 5.3.3
+
+
+
+ 14.0
+
+
+
+
\ No newline at end of file
diff --git a/GpioOneWire/CS/GpioOneWire.sln b/GpioOneWire/CS/GpioOneWire.sln
new file mode 100644
index 000000000..e43fc9e6f
--- /dev/null
+++ b/GpioOneWire/CS/GpioOneWire.sln
@@ -0,0 +1,40 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio 15
+VisualStudioVersion = 15.0.26430.14
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GpioOneWire", "GpioOneWire.csproj", "{FAA91481-2C5F-4985-BD5B-463EAF46F313}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|ARM = Debug|ARM
+ Debug|x64 = Debug|x64
+ Debug|x86 = Debug|x86
+ Release|ARM = Release|ARM
+ Release|x64 = Release|x64
+ Release|x86 = Release|x86
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {FAA91481-2C5F-4985-BD5B-463EAF46F313}.Debug|ARM.ActiveCfg = Debug|ARM
+ {FAA91481-2C5F-4985-BD5B-463EAF46F313}.Debug|ARM.Build.0 = Debug|ARM
+ {FAA91481-2C5F-4985-BD5B-463EAF46F313}.Debug|ARM.Deploy.0 = Debug|ARM
+ {FAA91481-2C5F-4985-BD5B-463EAF46F313}.Debug|x64.ActiveCfg = Debug|x64
+ {FAA91481-2C5F-4985-BD5B-463EAF46F313}.Debug|x64.Build.0 = Debug|x64
+ {FAA91481-2C5F-4985-BD5B-463EAF46F313}.Debug|x64.Deploy.0 = Debug|x64
+ {FAA91481-2C5F-4985-BD5B-463EAF46F313}.Debug|x86.ActiveCfg = Debug|x86
+ {FAA91481-2C5F-4985-BD5B-463EAF46F313}.Debug|x86.Build.0 = Debug|x86
+ {FAA91481-2C5F-4985-BD5B-463EAF46F313}.Debug|x86.Deploy.0 = Debug|x86
+ {FAA91481-2C5F-4985-BD5B-463EAF46F313}.Release|ARM.ActiveCfg = Release|ARM
+ {FAA91481-2C5F-4985-BD5B-463EAF46F313}.Release|ARM.Build.0 = Release|ARM
+ {FAA91481-2C5F-4985-BD5B-463EAF46F313}.Release|ARM.Deploy.0 = Release|ARM
+ {FAA91481-2C5F-4985-BD5B-463EAF46F313}.Release|x64.ActiveCfg = Release|x64
+ {FAA91481-2C5F-4985-BD5B-463EAF46F313}.Release|x64.Build.0 = Release|x64
+ {FAA91481-2C5F-4985-BD5B-463EAF46F313}.Release|x64.Deploy.0 = Release|x64
+ {FAA91481-2C5F-4985-BD5B-463EAF46F313}.Release|x86.ActiveCfg = Release|x86
+ {FAA91481-2C5F-4985-BD5B-463EAF46F313}.Release|x86.Build.0 = Release|x86
+ {FAA91481-2C5F-4985-BD5B-463EAF46F313}.Release|x86.Deploy.0 = Release|x86
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
diff --git a/GpioOneWire/CS/GpioOneWire_TemporaryKey.pfx b/GpioOneWire/CS/GpioOneWire_TemporaryKey.pfx
new file mode 100644
index 000000000..f7d400193
Binary files /dev/null and b/GpioOneWire/CS/GpioOneWire_TemporaryKey.pfx differ
diff --git a/GpioOneWire/CS/MainPage.xaml b/GpioOneWire/CS/MainPage.xaml
new file mode 100644
index 000000000..719527149
--- /dev/null
+++ b/GpioOneWire/CS/MainPage.xaml
@@ -0,0 +1,32 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/GpioOneWire/CS/MainPage.xaml.cs b/GpioOneWire/CS/MainPage.xaml.cs
new file mode 100644
index 000000000..b023ab3b4
--- /dev/null
+++ b/GpioOneWire/CS/MainPage.xaml.cs
@@ -0,0 +1,189 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Runtime.InteropServices.WindowsRuntime;
+using System.Threading;
+using System.Threading.Tasks;
+using Windows.Devices.Gpio;
+using Windows.Foundation;
+using Windows.Foundation.Collections;
+using Windows.UI.Xaml;
+using Windows.UI.Xaml.Controls;
+using Windows.UI.Xaml.Controls.Primitives;
+using Windows.UI.Xaml.Data;
+using Windows.UI.Xaml.Input;
+using Windows.UI.Xaml.Media;
+using Windows.UI.Xaml.Navigation;
+
+// The Blank Page item template is documented at https://go.microsoft.com/fwlink/?LinkId=402352&clcid=0x409
+
+namespace GpioOneWire
+{
+ ///
+ /// An empty page that can be used on its own or navigated to within a Frame.
+ ///
+ public sealed partial class MainPage : Page
+ {
+ private const int INDEX_INPUT_PIN = 4;
+ private const int INDEX_OUTPUT_PIN = 5;
+
+ private const int INTERVAL_DATA_READING = 3000;
+ private const int TIMEOUT_DATA_READING = 100;
+
+ private readonly DispatcherTimer _timer;
+ private readonly GpioChangeReader _changeReader;
+
+ private GpioPin _outputPin;
+
+ private GpioPin _inputPin;
+ private GpioPinDriveMode _inputDriveMode;
+
+ public MainPage()
+ {
+ InitializeComponent();
+
+ try
+ {
+ var gpioController = GpioController.GetDefault();
+
+ _inputPin = gpioController.OpenPin(INDEX_INPUT_PIN, GpioSharingMode.Exclusive);
+ _outputPin = gpioController.OpenPin(INDEX_OUTPUT_PIN, GpioSharingMode.Exclusive);
+
+ // Use InputPullUp if supported, otherwise fall back to Input (floating)
+ _inputDriveMode =
+ _inputPin.IsDriveModeSupported(GpioPinDriveMode.InputPullUp) ?
+ GpioPinDriveMode.InputPullUp : GpioPinDriveMode.Input;
+
+ _inputPin.SetDriveMode(_inputDriveMode);
+
+ _outputPin.Write(GpioPinValue.Low);
+ _outputPin.SetDriveMode(GpioPinDriveMode.Output);
+
+ _changeReader = new GpioChangeReader(_inputPin, 43)
+ {
+ Polarity = GpioChangePolarity.Falling,
+ };
+
+ _timer = new DispatcherTimer();
+ _timer.Interval = TimeSpan.FromMilliseconds(INTERVAL_DATA_READING);
+ _timer.Tick += HandleEvent_DispatcherTimer_Tick;
+ }
+ catch (Exception ex)
+ {
+ UpdateStatus(ex.Message);
+ }
+ }
+
+ protected override void OnNavigatedTo(NavigationEventArgs e)
+ {
+ base.OnNavigatedTo(e);
+
+ _timer?.Start();
+ }
+
+ protected override void OnNavigatedFrom(NavigationEventArgs e)
+ {
+ base.OnNavigatedFrom(e);
+
+ _timer?.Stop();
+ _changeReader?.Stop();
+ }
+
+ private async Task SendInitialPulseAsync()
+ {
+ // Bring the DHT data line low for 10ms. The output pin is driving the
+ // gate of a transistor, so we bring the pin high to pull the DHT22 signal low.
+
+ _outputPin.Write(GpioPinValue.High);
+
+ await Task.Delay(10);
+
+ _outputPin.Write(GpioPinValue.Low);
+ }
+
+ private async Task ReadValuesFromDhtAsync()
+ {
+ try
+ {
+ var reading = new DhtSensorReading();
+
+ CancellationTokenSource cancellationSource = new CancellationTokenSource();
+ cancellationSource.CancelAfter(TIMEOUT_DATA_READING);
+
+ _changeReader.Clear();
+ _changeReader.Start();
+
+ await SendInitialPulseAsync();
+
+ // Wait for 43 falling edges to show up
+ await _changeReader.WaitForItemsAsync(43).AsTask(cancellationSource.Token);
+
+ // discard first two falling edges
+ _changeReader.GetNextItem();
+ _changeReader.GetNextItem();
+
+ // pulse widths greater than 110us are considered 1's
+ TimeSpan oneThreshold = new TimeSpan(110 * 10000000 / 1000000);
+
+ TimeSpan current = _changeReader.GetNextItem().RelativeTime;
+
+ for (int i = 0; i < 40; i++)
+ {
+ TimeSpan next = _changeReader.GetNextItem().RelativeTime;
+ TimeSpan pulseWidth = next.Duration() - current.Duration();
+
+ if (pulseWidth.Duration() > oneThreshold.Duration())
+ {
+ reading.Bits[40 - i - 1] = true;
+ }
+
+ current = next;
+ }
+
+ if (reading.IsValid())
+ {
+ UpdateValuesOnUI(reading.Temperature(), reading.Humidity());
+ UpdateStatus("OK");
+ }
+ else
+ {
+ throw new Exception("Invalid sensor data received!");
+ }
+ }
+ catch (Exception ex)
+ {
+ UpdateValuesOnUI(double.NaN, double.NaN);
+
+ if (ex is TaskCanceledException)
+ {
+ UpdateStatus("Timeout while reading sensor data!");
+ }
+ else
+ {
+ UpdateStatus(ex.Message);
+ }
+ }
+ finally
+ {
+ _changeReader.Stop();
+ }
+ }
+
+ private void UpdateStatus(string statusText)
+ {
+ txt_Status.Text = statusText;
+ }
+
+ private void UpdateValuesOnUI(double temperature, double humidity)
+ {
+ txt_Temperature.Text = double.IsNaN(temperature) ? "-" : temperature + "°C";
+ txt_Humidity.Text = double.IsNaN(humidity) ? "-" : humidity + "%";
+ }
+
+ private async void HandleEvent_DispatcherTimer_Tick(object sender, object eventArgs)
+ {
+ await ReadValuesFromDhtAsync();
+ }
+ }
+}
diff --git a/GpioOneWire/CS/Package.appxmanifest b/GpioOneWire/CS/Package.appxmanifest
new file mode 100644
index 000000000..d114c210b
--- /dev/null
+++ b/GpioOneWire/CS/Package.appxmanifest
@@ -0,0 +1,49 @@
+
+
+
+
+
+
+
+
+
+ GpioOneWire
+ ekler
+ Assets\StoreLogo.png
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/GpioOneWire/CS/Properties/AssemblyInfo.cs b/GpioOneWire/CS/Properties/AssemblyInfo.cs
new file mode 100644
index 000000000..6202ba071
--- /dev/null
+++ b/GpioOneWire/CS/Properties/AssemblyInfo.cs
@@ -0,0 +1,29 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("GpioOneWire")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("GpioOneWire")]
+[assembly: AssemblyCopyright("Copyright © 2017")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+// You can specify all the values or you can default the Build and Revision Numbers
+// by using the '*' as shown below:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
+[assembly: ComVisible(false)]
\ No newline at end of file
diff --git a/GpioOneWire/CS/Properties/Default.rd.xml b/GpioOneWire/CS/Properties/Default.rd.xml
new file mode 100644
index 000000000..7c40ffeb1
--- /dev/null
+++ b/GpioOneWire/CS/Properties/Default.rd.xml
@@ -0,0 +1,31 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file