mirror of
https://github.com/wismna/ModernKeePass.git
synced 2025-10-04 08:00:16 -04:00
Initial check-in
This commit is contained in:
7
ModernKeePass/ModernKeePass.Shared/App.xaml
Normal file
7
ModernKeePass/ModernKeePass.Shared/App.xaml
Normal file
@@ -0,0 +1,7 @@
|
||||
<Application
|
||||
x:Class="ModernKeePass.App"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:local="using:ModernKeePass">
|
||||
|
||||
</Application>
|
137
ModernKeePass/ModernKeePass.Shared/App.xaml.cs
Normal file
137
ModernKeePass/ModernKeePass.Shared/App.xaml.cs
Normal file
@@ -0,0 +1,137 @@
|
||||
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.Media.Animation;
|
||||
using Windows.UI.Xaml.Navigation;
|
||||
|
||||
// Pour plus d'informations sur le modèle Application vide, consultez la page http://go.microsoft.com/fwlink/?LinkId=234227
|
||||
|
||||
namespace ModernKeePass
|
||||
{
|
||||
/// <summary>
|
||||
/// Fournit un comportement spécifique à l'application afin de compléter la classe Application par défaut.
|
||||
/// </summary>
|
||||
public sealed partial class App : Application
|
||||
{
|
||||
#if WINDOWS_PHONE_APP
|
||||
private TransitionCollection transitions;
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
/// Initialise l'objet d'application de singleton. Il s'agit de la première ligne du code créé
|
||||
/// à être exécutée. Elle correspond donc à l'équivalent logique de main() ou WinMain().
|
||||
/// </summary>
|
||||
public App()
|
||||
{
|
||||
this.InitializeComponent();
|
||||
this.Suspending += this.OnSuspending;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Invoqué lorsque l'application est lancée normalement par l'utilisateur final. D'autres points d'entrée
|
||||
/// sont utilisés lorsque l'application est lancée pour ouvrir un fichier spécifique, pour afficher
|
||||
/// des résultats de recherche, etc.
|
||||
/// </summary>
|
||||
/// <param name="e">Détails concernant la requête et le processus de lancement.</param>
|
||||
protected override void OnLaunched(LaunchActivatedEventArgs e)
|
||||
{
|
||||
#if DEBUG
|
||||
if (System.Diagnostics.Debugger.IsAttached)
|
||||
{
|
||||
this.DebugSettings.EnableFrameRateCounter = true;
|
||||
}
|
||||
#endif
|
||||
|
||||
Frame rootFrame = Window.Current.Content as Frame;
|
||||
|
||||
// Ne répétez pas l'initialisation de l'application lorsque la fenêtre comporte déjà du contenu,
|
||||
// assurez-vous juste que la fenêtre est active
|
||||
if (rootFrame == null)
|
||||
{
|
||||
// Créez un Frame utilisable comme contexte de navigation et naviguez jusqu'à la première page
|
||||
rootFrame = new Frame();
|
||||
|
||||
// TODO: modifier cette valeur à une taille de cache qui contient à votre application
|
||||
rootFrame.CacheSize = 1;
|
||||
|
||||
if (e.PreviousExecutionState == ApplicationExecutionState.Terminated)
|
||||
{
|
||||
// TODO: chargez l'état de l'application précédemment suspendue
|
||||
}
|
||||
|
||||
// Placez le frame dans la fenêtre active
|
||||
Window.Current.Content = rootFrame;
|
||||
}
|
||||
|
||||
if (rootFrame.Content == null)
|
||||
{
|
||||
#if WINDOWS_PHONE_APP
|
||||
// Supprime la navigation tourniquet pour le démarrage.
|
||||
if (rootFrame.ContentTransitions != null)
|
||||
{
|
||||
this.transitions = new TransitionCollection();
|
||||
foreach (var c in rootFrame.ContentTransitions)
|
||||
{
|
||||
this.transitions.Add(c);
|
||||
}
|
||||
}
|
||||
|
||||
rootFrame.ContentTransitions = null;
|
||||
rootFrame.Navigated += this.RootFrame_FirstNavigated;
|
||||
#endif
|
||||
|
||||
// Quand la pile de navigation n'est pas restaurée, accédez à la première page,
|
||||
// puis configurez la nouvelle page en transmettant les informations requises en tant que
|
||||
// paramètre
|
||||
if (!rootFrame.Navigate(typeof(MainPage), e.Arguments))
|
||||
{
|
||||
throw new Exception("Failed to create initial page");
|
||||
}
|
||||
}
|
||||
|
||||
// Vérifiez que la fenêtre actuelle est active
|
||||
Window.Current.Activate();
|
||||
}
|
||||
|
||||
#if WINDOWS_PHONE_APP
|
||||
/// <summary>
|
||||
/// Restaure les transitions de contenu une fois l'application lancée.
|
||||
/// </summary>
|
||||
/// <param name="sender">Objet où le gestionnaire est attaché.</param>
|
||||
/// <param name="e">Détails sur l'événement de navigation.</param>
|
||||
private void RootFrame_FirstNavigated(object sender, NavigationEventArgs e)
|
||||
{
|
||||
var rootFrame = sender as Frame;
|
||||
rootFrame.ContentTransitions = this.transitions ?? new TransitionCollection() { new NavigationThemeTransition() };
|
||||
rootFrame.Navigated -= this.RootFrame_FirstNavigated;
|
||||
}
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
/// Appelé lorsque l'exécution de l'application est suspendue. L'état de l'application est enregistré
|
||||
/// sans savoir si l'application pourra se fermer ou reprendre sans endommager
|
||||
/// le contenu de la mémoire.
|
||||
/// </summary>
|
||||
/// <param name="sender">Source de la requête de suspension.</param>
|
||||
/// <param name="e">Détails de la requête de suspension.</param>
|
||||
private void OnSuspending(object sender, SuspendingEventArgs e)
|
||||
{
|
||||
var deferral = e.SuspendingOperation.GetDeferral();
|
||||
|
||||
// TODO: enregistrez l'état de l'application et arrêtez toute activité en arrière-plan
|
||||
deferral.Complete();
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects>
|
||||
<HasSharedItems>true</HasSharedItems>
|
||||
<SharedGUID>fde03897-a8b0-4c28-9068-7edbb649e676</SharedGUID>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Label="Configuration">
|
||||
<Import_RootNamespace>ModernKeePass</Import_RootNamespace>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<ApplicationDefinition Include="$(MSBuildThisFileDirectory)App.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
</ApplicationDefinition>
|
||||
<Compile Include="$(MSBuildThisFileDirectory)App.xaml.cs">
|
||||
<DependentUpon>App.xaml</DependentUpon>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
</Project>
|
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>fde03897-a8b0-4c28-9068-7edbb649e676</ProjectGuid>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\CodeSharing\Microsoft.CodeSharing.Common.Default.props" />
|
||||
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\CodeSharing\Microsoft.CodeSharing.Common.props" />
|
||||
<PropertyGroup />
|
||||
<Import Project="ModernKeePass.Shared.projitems" Label="Shared" />
|
||||
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\CodeSharing\Microsoft.CodeSharing.CSharp.targets" />
|
||||
</Project>
|
Reference in New Issue
Block a user