Skip to content

Commit

Permalink
No commit message
Browse files Browse the repository at this point in the history
  • Loading branch information
hauerCodes committed Dec 15, 2014
1 parent 5d215aa commit 3dd29a2
Show file tree
Hide file tree
Showing 67 changed files with 6,594 additions and 1 deletion.
17 changes: 17 additions & 0 deletions NumberRecognizer/NumberRecognizer.App/App.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<Application
x:Class="NumberRecognizer.App.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:NumberRecognizer.App"
xmlns:localData="using:NumberRecognizer.App.DataModel">

<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="Style/AppStyle.xaml"/>
</ResourceDictionary.MergedDictionaries>
<!-- Application-specific resources -->
<x:String x:Key="AppName">Number Recognizer</x:String>
</ResourceDictionary>
</Application.Resources>
</Application>
126 changes: 126 additions & 0 deletions NumberRecognizer/NumberRecognizer.App/App.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
//-----------------------------------------------------------------------
// <copyright file="App.xaml.cs" company="FH Wr.Neustadt">
// Copyright Markus Zytek. All rights reserved.
// </copyright>
// <author>Markus Zytek</author>
// <summary>App.</summary>
//-----------------------------------------------------------------------
namespace NumberRecognizer.App
{
using System;
using NumberRecognizer.App.Common;
using NumberRecognizer.App.View;
using Windows.ApplicationModel;
using Windows.ApplicationModel.Activation;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Navigation;

/// <summary>
/// Provides application-specific behavior to supplement the default Application class.
/// </summary>
public sealed partial class App : Application
{
/// <summary>
/// Initializes a new instance of the <see cref="App"/> class.
/// </summary>
public App()
{
this.InitializeComponent();
this.Suspending += this.OnSuspending;
}

/// <summary>
/// Gets the root frame.
/// </summary>
/// <value>
/// The root frame.
/// </value>
public static Frame RootFrame { get; private set; }

/// <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>
public void OnNavigationFailed(object sender, NavigationFailedEventArgs e)
{
throw new Exception("Failed to load Page " + e.SourcePageType.FullName);
}

/// <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 storageFile.
/// </summary>
/// <param name="e">Details about the launch request and process.</param>
protected override async void OnLaunched(LaunchActivatedEventArgs e)
{
#if DEBUG
// Show graphics profiling information while debugging.
if (System.Diagnostics.Debugger.IsAttached)
{
// Display the current frame rate counters
this.DebugSettings.EnableFrameRateCounter = true;
}
#endif

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();
////Associate the frame with a SuspensionManager key
SuspensionManager.RegisterFrame(RootFrame, "AppFrame");
//// Set the default language
RootFrame.Language = Windows.Globalization.ApplicationLanguages.Languages[0];

RootFrame.NavigationFailed += this.OnNavigationFailed;

if (e.PreviousExecutionState == ApplicationExecutionState.Terminated)
{
//// Restore the saved session state only when appropriate
try
{
await SuspensionManager.RestoreAsync();
}
catch (SuspensionManagerException)
{
////Something went wrong restoring state.
////Assume there is no state and continue
}
}

// 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(GroupedNetworksPage), e.Arguments);
}
//// Ensure the current window is active
Window.Current.Activate();
}

/// <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 async void OnSuspending(object sender, SuspendingEventArgs e)
{
var deferral = e.SuspendingOperation.GetDeferral();
await SuspensionManager.SaveAsync();
deferral.Complete();
}
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
46 changes: 46 additions & 0 deletions NumberRecognizer/NumberRecognizer.App/Common/LoadStateEventArgs.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
//-----------------------------------------------------------------------
// <copyright file="LoadStateEventArgs.cs" company="FH Wr.Neustadt">
// Copyright Markus Zytek. All rights reserved.
// </copyright>
// <author>Markus Zytek</author>
// <summary>Load State Event Args.</summary>
//-----------------------------------------------------------------------
namespace NumberRecognizer.App.Common
{
using System;
using System.Collections.Generic;

/// <summary>
/// Class used to hold the event data required when a page attempts to load state.
/// </summary>
public class LoadStateEventArgs : EventArgs
{
/// <summary>
/// Initializes a new instance of the <see cref="LoadStateEventArgs"/> class.
/// </summary>
/// <param name="navigationParameter">The navigation parameter.</param>
/// <param name="pageState">State of the page.</param>
public LoadStateEventArgs(object navigationParameter, Dictionary<string, object> pageState)
: base()
{
this.NavigationParameter = navigationParameter;
this.PageState = pageState;
}

/// <summary>
/// Gets the navigation parameter.
/// </summary>
/// <value>
/// The navigation parameter.
/// </value>
public object NavigationParameter { get; private set; }

/// <summary>
/// Gets the state of the page.
/// </summary>
/// <value>
/// The state of the page.
/// </value>
public Dictionary<string, object> PageState { get; private set; }
}
}
Loading

0 comments on commit 3dd29a2

Please sign in to comment.