public DataExampleViewModel() { StartLongRunningDataLoader = new DataLoader(); StartLongRunningWithExceptionDataLoader = new DataLoader(); //swallow exceptions by default CacheDataLoader = new DataLoader(); CacheWithExceptionDataLoader = new DataLoader(); //swallow exceptions by default SourceABDataLoader = new DataLoader(); //swallow exceptions by default CacheRefreshDataLoader = new DataLoader(); //swallow exceptions by default FailCacheDataLoader = new DataLoader(); FailCacheSuccessDataLoader = new DataLoader(); StartLongRunningCommand = new RelayCommand(() => StartLongRunningAction()); StartLongRunningWithExceptionCommand = new RelayCommand(() => StartLongRunningWithExceptionAction()); CacheCommand = new RelayCommand(() => CacheAction()); CacheWithExceptionCommand = new RelayCommand(() => CacheWithExceptionAction()); SourceABCommand = new RelayCommand(() => SourceABAction()); CacheRefreshCommand = new RelayCommand(() => CacheRefreshAction()); ClearCacheCommand = new RelayCommand(() => ClearCacheAction()); FailCacheCommand = new RelayCommand(() => FailCacheAction()); FailCacheSuccessCommand = new RelayCommand(() => FailCacheSuccessAction()); ClearWebDataCacheCommand = new RelayCommand(() => ClearWebDataCacheCommandAction()); GetUriCommand = new RelayCommand(() => GetUriCommandAction()); ImageBrushUri = new Uri("https://pbs.twimg.com/profile_images/478304416148099072/1_rxoQgR.png"); WebDataCache.Init(); }
// Code to execute when the application is activated (brought to foreground) // This code will not execute when the application is first launched private async void Application_Activated(object sender, ActivatedEventArgs e) { if (!e.IsApplicationInstancePreserved) { await WebDataCache.Init(); } }
/// <summary> /// Invoked when the application is launched normally by the end user. Other entry points /// will be used when the application is launched to open a specific file, to display /// search results, and so forth. /// </summary> /// <param name="args">Details about the launch request and process.</param> protected override async void OnLaunched(LaunchActivatedEventArgs args) { await WebDataCache.Init(); // Do not repeat app initialization when already running, just ensure that // the window is active if (args.PreviousExecutionState == ApplicationExecutionState.Running) { Window.Current.Activate(); return; } // Create a Frame to act as the navigation context and associate it with // a SuspensionManager key var rootFrame = new Frame(); SuspensionManager.RegisterFrame(rootFrame, "AppFrame"); if (args.PreviousExecutionState == ApplicationExecutionState.Terminated) { // Restore the saved session state only when appropriate await SuspensionManager.RestoreAsync(); } 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 if (!rootFrame.Navigate(typeof(MainPage))) { throw new Exception("Failed to create initial page"); } } // Place the frame in the current Window and ensure that it is active Window.Current.Content = rootFrame; Window.Current.Activate(); }
public async Task Init() { await WebDataCache.Init(); }
// Code to execute when the application is launching (eg, from Start) // This code will not execute when the application is reactivated private async void Application_Launching(object sender, LaunchingEventArgs e) { await WebDataCache.Init(); }
public static async void InitNavigationConfigurationInThisAssembly() { StartupFunctions.RunAllConfig(); await WebDataCache.Init(); }