/// <summary> /// Begin the navigation /// </summary> private void _BeginNavigation() { if (BuildDBController.ShouldSync()) { NavigateToBuildView(); } else { NavigateToShellView(); } }
/// <summary> /// Fund Processed Callback /// </summary> /// <param name="sender"></param> /// <param name="evt"></param> void serviceadapter_OnFundProcessed(object sender, Data.Extentions.InvestProductEventArgs evt) { Step = String.Concat("Fund Processed - ", evt.InvestmentProduct.FullName); ProgressPct++; Task task = Tasks.SingleOrDefault(t => t.product.Code.ToString("F").ToUpper() == evt.InvestmentProduct.ProductCode.ToUpper()); String TaskDescription = task.TaskDescription; task.Processed++; if (task.Processed >= task.Total) { task.Completed = true; if (Deployment.Current.Dispatcher.CheckAccess()) { this.TasksComplete.Add(task.TaskDescription); } else { Deployment.Current.Dispatcher.BeginInvoke(() => this.TasksComplete.Add(TaskDescription)); } task = Tasks.FirstOrDefault(t => t.Completed == false); if (task != null) { ProcessTask(task); } else { ProgressPct = 0; Deployment.Current.Dispatcher.BeginInvoke(() => ShellViewService.Current.RebuildRequested += new EventHandler(BeginBuild)); Deployment.Current.Dispatcher.BeginInvoke(() => ShellViewService.Current.Navigator.NavigateToShellView()); BuildDBController.SetSyncNow(); } } }
/// <summary> /// Entry point /// </summary> public void BeginBuild(object sender, EventArgs args) { ShellViewService.Current.RebuildRequested -= new EventHandler(BeginBuild); try { Step = "Intilialize Database ..."; StepType = true; if (!BuildDBController.HasInitialized()) { BuildDBController.BuildCache(); } IEnumerable <Product> productlist = ProductController.GetAllProduct(); if (productlist.Count() > 0) { Step = "Clear Cached funds ..."; StepType = true; FundController.ClearFundData(); serviceadapter.Start(); } Tasks = (from a in productlist.Where(t => t.Code == ProductCode.IP) select new Task { product = a, TaskDescription = String.Concat("Retrieving Funds List for Product ", a.Name, " ...") }).ToObservableCollection(); Task task = Tasks[0]; ProcessTask(task); } catch (Exception Ex) { throw Ex; } }