本文整理汇总了C#中StartKind类的典型用法代码示例。如果您正苦于以下问题:C# StartKind类的具体用法?C# StartKind怎么用?C# StartKind使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
StartKind类属于命名空间,在下文中一共展示了StartKind类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnStartAsync
// runs only when not restored from state
public async override Task OnStartAsync(StartKind startKind, IActivatedEventArgs args)
{
// Handle toast activation
if (args is ToastNotificationActivatedEventArgs)
{
var toastActivationArgs = args as ToastNotificationActivatedEventArgs;
// Parse the query string
QueryString arguments = QueryString.Parse(toastActivationArgs.Argument);
// See what action is being requested
switch (arguments["action"])
{
case "openurl":
var url = arguments["url"];
await Launcher.LaunchUriAsync(new Uri(url));
break;
case "showtemperature":
var temperature = arguments["temperature"];
NavigationService.Navigate(typeof(Views.NotificationsPage), temperature);
break;
case "gettingfar":
var distance = arguments["distance"];
NavigationService.Navigate(typeof(Views.NotificationsPage), distance);
break;
}
}
if (NavigationService.CurrentPageType != typeof(Views.MainPage))
NavigationService.Navigate(typeof(Views.MainPage));
}
示例2: OnStartAsync
// runs only when not restored from state
public override async Task OnStartAsync(StartKind startKind, IActivatedEventArgs args)
{
// set hamburger menu to full screen mode on Mobile devices.
if (DeviceUtils.Current().IsPhone())
Views.Shell.HamburgerMenu.IsFullScreen = true;
if (!AuthHelper.IsCachedCredentialsAvailable())
{
Debug.WriteLine("App.OnStartAsync() : no cached credentials available, loading login page...");
NavigationService.Navigate(typeof(Views.LoginPage));
}
else
{
Debug.WriteLine("App.OnStartAsync() : cached credentials found, bypassing login page...");
await AuthHelper.AuthenticateAsync();
if (Settings.IsAlreadyConfigured)
{
Debug.WriteLine("App.OnStartAsync() : already set up, skipping to MainPage...");
NavigationService.Navigate(typeof(Views.MainPage));
}
else
{
Debug.WriteLine("App.OnStartAsync() : not configured, starting setup wizard...");
NavigationService.Navigate(typeof(Views.SetupWizardHomePage));
}
}
}
示例3: OnStartAsync
public override async Task OnStartAsync(StartKind startKind, IActivatedEventArgs args)
{
// long-running startup tasks go here
NavigationService.Navigate(typeof(Views.MainPage));
await Task.CompletedTask;
}
示例4: OnStartAsync
// runs only when not restored from state
public override Task OnStartAsync(StartKind startKind, IActivatedEventArgs args)
{
// navigate to first page
NavigationService.Navigate(typeof(Views.MainPage));
return Task.CompletedTask;
}
示例5: OnStartAsync
public override Task OnStartAsync(StartKind startKind, IActivatedEventArgs args)
{
// long-running startup tasks go here
db = new DataService();
db.createDB();
foreach (var device in db.DevicesTable)
{
IDevice dev = DeviceTypeFactory.MakeDevice(device.FirmwareName, device);
dev.DeviceDetails.Status = DeviceStatus.Missing;
devices.Add(dev);
}
NavigationService.Navigate(typeof(Views.MainPage));
ssdpClient.Search();
wifiClient.Search();
searchTimer.Tick += SearchTimer_Tick;
searchTimer.Interval = new TimeSpan(0, 1, 0);
searchTimer.Start();
return Task.CompletedTask;
}
示例6: OnStartAsync
public override async Task OnStartAsync(StartKind startKind, IActivatedEventArgs args)
{
GoogleAnalytics.EasyTracker.GetTracker().SendEvent("Lifecycle", startKind.ToString(), null, 0);
bool isNewLaunch = args.PreviousExecutionState == ApplicationExecutionState.NotRunning;
if (isNewLaunch)
{
await InitLibrary();
var nav = new MergedNavigationService(NavigationService);
nav.Configure(ViewModelLocator.SplashPageKey, typeof(Pages.SplashScreen));
nav.Configure(ViewModelLocator.FrontPageKey, typeof(FrontPage));
nav.Configure(ViewModelLocator.SubGalleryPageKey, typeof(SubGalleryPage));
nav.Configure(ViewModelLocator.SubredditBrowserPageKey, typeof(SubredditBrowserPage));
nav.Configure(ViewModelLocator.BrowserPageKey, typeof(BrowserPage));
if (!SimpleIoc.Default.IsRegistered<GalaSoft.MvvmLight.Views.INavigationService>())
SimpleIoc.Default.Register<GalaSoft.MvvmLight.Views.INavigationService>(() => nav);
SimpleIoc.Default.Register<IViewModelLocator>(() => ViewModelLocator.GetInstance());
SimpleIoc.Default.Register<RemoteDeviceHelper>();
}
JObject navigationParam = new JObject();
navigationParam["isNewLaunch"] = isNewLaunch;
if (args is ProtocolActivatedEventArgs)
{
var protoArgs = args as ProtocolActivatedEventArgs;
if (args.Kind == ActivationKind.Protocol)
navigationParam["url"] = protoArgs.Uri.AbsoluteUri;
}
Portable.Helpers.StateHelper.SessionState["LaunchData"] = navigationParam;
SimpleIoc.Default.GetInstance<GalaSoft.MvvmLight.Views.INavigationService>().NavigateTo(ViewModelLocator.SplashPageKey);
}
示例7: OnStartAsync
public override Task OnStartAsync(StartKind startKind, IActivatedEventArgs args)
{
if (args.Kind == ActivationKind.VoiceCommand)
{
var result = (args as VoiceCommandActivatedEventArgs).Result;
var properties = result.SemanticInterpretation.Properties
.ToDictionary(x => x.Key, x => x.Value);
var command = result.RulePath.First();
if (command.Equals("FreeTextCommand"))
{
// get spoken text
var text = properties.First(x => x.Key.Equals("textPhrase")).Value[0];
// remember to handle response appropriately
var mode = properties.First(x => x.Key.Equals("commandMode")).Value;
if (mode.Equals("voice")) { /* okay to speak */ }
else { /* not okay to speak */ }
// update value
ViewModels.MainPageViewModel.Instance.Value = text;
}
else { /* unexpected command */ }
}
else
{
NavigationService.Navigate(typeof(Views.MainPage));
}
return Task.CompletedTask;
}
示例8: OnStartAsync
public override async Task OnStartAsync(StartKind startKind, IActivatedEventArgs args)
{
CoreApp.Initialize(Services.LocationServices.LocationService.Current, Services.DataServices.ProtoDataService.Current);
await Task.Delay(500);
NavigationService.Navigate(typeof(Views.MainPage));
await Task.CompletedTask;
}
示例9: OnStartAsync
// runs only when not restored from state
public override async Task OnStartAsync(StartKind startKind, IActivatedEventArgs args)
{
await Task.Delay(50);
if (_settings.FirstRun)
{
Window.Current.Activate();
}
else
{
NavigationService.Navigate(typeof(Views.MainPage));
}
if (ApiInformation.IsTypePresent("Windows.UI.ViewManagement.StatusBar"))
{
var statusBar = StatusBar.GetForCurrentView();
if (statusBar != null)
{
statusBar.BackgroundOpacity = 1;
statusBar.BackgroundColor = (Color)Application.Current.Resources["AccentColour"];
statusBar.ForegroundColor = Colors.White;
}
}
}
示例10: OnStartAsync
public override async Task OnStartAsync(StartKind startKind, IActivatedEventArgs args)
{
await ViewModelController.RefreshLibrary();
await ViewModelController.RefreshCollections();
NavigationService.Navigate(typeof(Views.MainPage));
await Task.CompletedTask;
}
示例11: OnStartAsync
/// <summary>
/// The OnStartAsync implementation.
/// </summary>
/// <remarks>
/// Runs only when not restored from a state.
/// </remarks>
/// <param name="startKind">The kind of App start.</param>
/// <param name="args">The arguments from the activation.</param>
/// <returns>A <see cref="Task"/> representing the asynchronous operation.</returns>
public override async Task OnStartAsync(StartKind startKind, IActivatedEventArgs args)
{
// Perform any long-running load
await Task.Delay(0);
// Navigate to the first page inside the shell
this.NavigationService.Navigate(Pages.Main);
}
示例12: OnStartAsync
// runs only when not restored from state
public override async Task OnStartAsync(StartKind startKind, IActivatedEventArgs args)
{
// perform long-running load
await Task.Delay(0);
// navigate to first page
NavigationService.Navigate(typeof(Views.MainPage));
}
示例13: OnStartAsync
public override async Task OnStartAsync(StartKind startKind, IActivatedEventArgs args)
{
string arguments = string.Empty;
if (DetermineStartCause(args) == AdditionalKinds.JumpListItem)
{
arguments = (args as LaunchActivatedEventArgs).Arguments;
FileReceived?.Invoke(this, arguments);
}
NavigationService.Navigate(typeof(Views.MainPage), arguments);
}
示例14: OnStartAsync
public override Task OnStartAsync(StartKind startKind, IActivatedEventArgs args)
{
if ((args.Kind == ActivationKind.Launch) && ((args as LaunchActivatedEventArgs)?.PrelaunchActivated ?? false))
{
// update pre-launch live tile
}
// start the user experience
NavigationService.Navigate(typeof(Views.MainPage));
return Task.FromResult<object>(null);
}
示例15: OnStartAsync
// runs only when not restored from state
public override async Task OnStartAsync(StartKind startKind, IActivatedEventArgs args)
{
// perform long-running load
await Task.Delay(0);
// navigate to first page
if (SettingsService.Instance.UserInteractionMode == false)
NavigationService.Navigate(typeof(Views.MainPageHandleld));
else
NavigationService.Navigate(typeof(Views.MainPageTeam));
}