added stylecop (#1933)

* added stylecop

* removed xml documentation

* used common stylecop file
This commit is contained in:
Lavius Motileng
2020-04-07 10:19:14 -07:00
parent 89b44f5126
commit cea6b7067a
53 changed files with 626 additions and 536 deletions

View File

@@ -1,4 +1,8 @@
using System;
// Copyright (c) Microsoft Corporation
// The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
@@ -15,48 +19,48 @@ namespace Microsoft.PowerToys.Settings.UI.Services
// https://github.com/Microsoft/WindowsTemplateStudio/blob/master/docs/activation.md
internal class ActivationService
{
private readonly App _app;
private readonly Type _defaultNavItem;
private Lazy<UIElement> _shell;
private readonly App app;
private readonly Type defaultNavItem;
private Lazy<UIElement> shell;
private object _lastActivationArgs;
private object lastActivationArgs;
public ActivationService(App app, Type defaultNavItem, Lazy<UIElement> shell = null)
{
_app = app;
_shell = shell;
_defaultNavItem = defaultNavItem;
this.app = app;
this.shell = shell;
this.defaultNavItem = defaultNavItem;
}
public async Task ActivateAsync(object activationArgs)
{
if (IsInteractive(activationArgs))
if (this.IsInteractive(activationArgs))
{
// Initialize services that you need before app activation
// take into account that the splash screen is shown while this code runs.
await InitializeAsync();
await this.InitializeAsync();
// Do not repeat app initialization when the Window already has content,
// just ensure that the window is active
if (Window.Current.Content == null)
{
// Create a Shell or Frame to act as the navigation context
Window.Current.Content = _shell?.Value ?? new Frame();
Window.Current.Content = this.shell?.Value ?? new Frame();
}
}
// Depending on activationArgs one of ActivationHandlers or DefaultActivationHandler
// will navigate to the first page
await HandleActivationAsync(activationArgs);
_lastActivationArgs = activationArgs;
await this.HandleActivationAsync(activationArgs);
this.lastActivationArgs = activationArgs;
if (IsInteractive(activationArgs))
if (this.IsInteractive(activationArgs))
{
// Ensure the current window is active
Window.Current.Activate();
// Tasks after activation
await StartupAsync();
await this.StartupAsync();
}
}
@@ -67,7 +71,7 @@ namespace Microsoft.PowerToys.Settings.UI.Services
private async Task HandleActivationAsync(object activationArgs)
{
var activationHandler = GetActivationHandlers()
var activationHandler = this.GetActivationHandlers()
.FirstOrDefault(h => h.CanHandle(activationArgs));
if (activationHandler != null)
@@ -75,9 +79,9 @@ namespace Microsoft.PowerToys.Settings.UI.Services
await activationHandler.HandleAsync(activationArgs);
}
if (IsInteractive(activationArgs))
if (this.IsInteractive(activationArgs))
{
var defaultHandler = new DefaultActivationHandler(_defaultNavItem);
var defaultHandler = new DefaultActivationHandler(this.defaultNavItem);
if (defaultHandler.CanHandle(activationArgs))
{
await defaultHandler.HandleAsync(activationArgs);