private void navigateToReport() { int page = 0; switch (reportType) { case FINANCIAL_STATUS: page = 1; break; case FEE_TARGET: if (financeReport == null) { page = 1; } else { page = 3; } break; case MATTER_ANALYSIS: if (financeReport == null && feeTargetReport == null) { page = 1; } else { if (financeReport == null && feeTargetReport != null) { page = 3; } else { page = 6; } } break; } PagesConductor cont = new PagesConductor ( financeReport, matterAnalysisReport, feeTargetReport, reportType, page ); this.NavigationController.PushViewController (cont, true); }
void DataDownloaded(IAsyncResult result) { UIApplication.SharedApplication.NetworkActivityIndicatorVisible = false; isBusy = false; end = DateTime.Now; var request = result.AsyncState as HttpWebRequest; WebServiceResponseDTO dto; try { HttpWebResponse response = (HttpWebResponse)request.EndGetResponse (result); Stream receiveStream = response.GetResponseStream (); StreamReader readStream = new StreamReader (receiveStream, Encoding.UTF8); string resp = readStream.ReadToEnd (); Console.WriteLine ("## GetReport Response stream received.\n" + resp); response.Close (); readStream.Close (); dto = (WebServiceResponseDTO)JsonConvert.DeserializeObject ( resp, typeof(WebServiceResponseDTO) ); if (dto != null) { Tools.SendElapsedTime (start, end, dto.activityID); } InvokeOnMainThread (delegate { if (dto.responseCode > 0) { new UIAlertView ("Report Request", dto.responseMessage, null, "OK").Show (); return; } switch (reportType) { case FINANCIAL_STATUS: financeReport = dto.financialStatusReport; financeTime = DateTime.Now; break; case FEE_TARGET: feeTargetReport = dto.feeTargetProgressReport; feeTargetTime = DateTime.Now; break; case MATTER_ANALYSIS: matterAnalysisReport = dto.matterAnalysisByOwnerReport; matterAnalysisTime = DateTime.Now; break; } int xpage = 0; switch (reportType) { case FINANCIAL_STATUS: xpage = 0; break; case FEE_TARGET: xpage = 2; break; case MATTER_ANALYSIS: switch (xpage) { case 0: xpage = 2; break; case 1: xpage = 2; break; case 2: xpage = 5; break; case 3: xpage = 5; break; case 4: xpage = 5; break; case 5: xpage = 5; break; case 6: xpage = 5; break; case 7: xpage = 5; break; } break; } PagesConductor cont = new PagesConductor ( financeReport, matterAnalysisReport, feeTargetReport, reportType, xpage ); this.NavigationController.PushViewController (cont, true); isBusy = false; } ); } catch (Exception ex) { Console.WriteLine ("shit " + ex.ToString ()); isBusy = false; InvokeOnMainThread (delegate { isBusy = false; new UIAlertView ("Network Error", "Problem communicating with server, \n\nCheck your network connections and try again later", null, "Close" ).Show (); } ); } }