// updates the local cache of the reports... public static async Task UpdateCacheFromServerAsync() { // create a service proxy to call up to the server... var proxy = TinyIoCContainer.Current.Resolve <IGetProfessionServiceProxy>(); var result = await proxy.GetReportsByUserAsync(); // did it actually work? result.AssertNoErrors(); // update... var conn = MFundiRuntime.GetUserDatabase(); foreach (var report in result.Reports) { // load the existing one, deleting it if we find it... var existing = await conn.Table <ReportItem>().Where(v => v.NativeId == report.NativeId).FirstOrDefaultAsync(); if (existing != null) { await conn.DeleteAsync(existing); } // create... await conn.InsertAsync(report); } }
public async Task Setup() { await MFundiRuntime.Start("Tests"); // set... ServiceProxyFactory.Current.SetHandler(typeof(IRegisterServiceProxy), typeof(FakeRegisterServiceProxy)); }
/// <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="e">Details about the launch request and process.</param> protected async override void OnLaunched(LaunchActivatedEventArgs e) { #if DEBUG if (System.Diagnostics.Debugger.IsAttached) { this.DebugSettings.EnableFrameRateCounter = true; } #endif // start... MFundiRuntime.Start("Client"); Frame 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(); Common.SuspensionManager.RegisterFrame(rootFrame, "appFrame"); // TODO: change this value to a cache size that is appropriate for your application rootFrame.CacheSize = 1; if (e.PreviousExecutionState == ApplicationExecutionState.Terminated) { await Common.SuspensionManager.RestoreAsync(); } // Place the frame in the current Window Window.Current.Content = rootFrame; } if (rootFrame.Content == null) { var values = ApplicationData.Current.LocalSettings.Values; // When the navigation stack isn't restored navigate to the home page, // configuring the new page by passing required information as a navigation // parameter if (values.ContainsKey("LogonToken")) { if (!rootFrame.Navigate(typeof(HomePage), e.Arguments)) { throw new Exception("Failed to create initial page"); } } else { if (!rootFrame.Navigate(typeof(RegisterPage), e.Arguments)) { throw new Exception("Failed to create initial page"); } } } // Ensure the current window is active Window.Current.Activate(); // settings... }