Skip to content

Commit

Permalink
Add local control module
Browse files Browse the repository at this point in the history
  • Loading branch information
Lou Amadio committed Mar 26, 2016
1 parent be19682 commit 318ef42
Show file tree
Hide file tree
Showing 25 changed files with 16,322 additions and 0 deletions.
40 changes: 40 additions & 0 deletions LocalControl/Control.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.23107.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Control", "Control\Control.csproj", "{3F546C80-E3FD-4935-82F4-271256C5E01D}"
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
{3F546C80-E3FD-4935-82F4-271256C5E01D}.Debug|ARM.ActiveCfg = Debug|ARM
{3F546C80-E3FD-4935-82F4-271256C5E01D}.Debug|ARM.Build.0 = Debug|ARM
{3F546C80-E3FD-4935-82F4-271256C5E01D}.Debug|ARM.Deploy.0 = Debug|ARM
{3F546C80-E3FD-4935-82F4-271256C5E01D}.Debug|x64.ActiveCfg = Debug|x64
{3F546C80-E3FD-4935-82F4-271256C5E01D}.Debug|x64.Build.0 = Debug|x64
{3F546C80-E3FD-4935-82F4-271256C5E01D}.Debug|x64.Deploy.0 = Debug|x64
{3F546C80-E3FD-4935-82F4-271256C5E01D}.Debug|x86.ActiveCfg = Debug|x86
{3F546C80-E3FD-4935-82F4-271256C5E01D}.Debug|x86.Build.0 = Debug|x86
{3F546C80-E3FD-4935-82F4-271256C5E01D}.Debug|x86.Deploy.0 = Debug|x86
{3F546C80-E3FD-4935-82F4-271256C5E01D}.Release|ARM.ActiveCfg = Release|ARM
{3F546C80-E3FD-4935-82F4-271256C5E01D}.Release|ARM.Build.0 = Release|ARM
{3F546C80-E3FD-4935-82F4-271256C5E01D}.Release|ARM.Deploy.0 = Release|ARM
{3F546C80-E3FD-4935-82F4-271256C5E01D}.Release|x64.ActiveCfg = Release|x64
{3F546C80-E3FD-4935-82F4-271256C5E01D}.Release|x64.Build.0 = Release|x64
{3F546C80-E3FD-4935-82F4-271256C5E01D}.Release|x64.Deploy.0 = Release|x64
{3F546C80-E3FD-4935-82F4-271256C5E01D}.Release|x86.ActiveCfg = Release|x86
{3F546C80-E3FD-4935-82F4-271256C5E01D}.Release|x86.Build.0 = Release|x86
{3F546C80-E3FD-4935-82F4-271256C5E01D}.Release|x86.Deploy.0 = Release|x86
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
8 changes: 8 additions & 0 deletions LocalControl/Control/App.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<Application
x:Class="Control.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:Control"
RequestedTheme="Light">

</Application>
128 changes: 128 additions & 0 deletions LocalControl/Control/App.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
/*
Copyright(c) Microsoft Corp. All rights reserved.
The MIT License(MIT)
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.
*/

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;

// The Blank Application template is documented at http://go.microsoft.com/fwlink/?LinkId=402347&clcid=0x409

namespace Control
{
/// <summary>
/// Provides application-specific behavior to supplement the default Application class.
/// </summary>
sealed partial class App : Application
{
/// <summary>
/// Allows tracking page views, exceptions and other telemetry through the Microsoft Application Insights service.
/// </summary>
public static Microsoft.ApplicationInsights.TelemetryClient TelemetryClient;

/// <summary>
/// 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().
/// </summary>
public App()
{
TelemetryClient = new Microsoft.ApplicationInsights.TelemetryClient();

this.InitializeComponent();
this.Suspending += OnSuspending;
}

/// <summary>
/// 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.
/// </summary>
/// <param name="e">Details about the launch request and process.</param>
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 (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();
}

/// <summary>
/// Invoked when Navigation to a certain page fails
/// </summary>
/// <param name="sender">The Frame which failed navigation</param>
/// <param name="e">Details about the navigation failure</param>
void OnNavigationFailed(object sender, NavigationFailedEventArgs e)
{
throw new Exception("Failed to load Page " + e.SourcePageType.FullName);
}

/// <summary>
/// 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.
/// </summary>
/// <param name="sender">The source of the suspend request.</param>
/// <param name="e">Details about the suspend request.</param>
private void OnSuspending(object sender, SuspendingEventArgs e)
{
var deferral = e.SuspendingOperation.GetDeferral();
//TODO: Save application state and stop any background activity
deferral.Complete();
}
}
}
3 changes: 3 additions & 0 deletions LocalControl/Control/ApplicationInsights.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<?xml version="1.0" encoding="utf-8"?>
<ApplicationInsights xmlns = "http://schemas.microsoft.com/ApplicationInsights/2013/Settings">
</ApplicationInsights>
Loading

0 comments on commit 318ef42

Please sign in to comment.