public override void ViewDidLoad() { base.ViewDidLoad(); fileAccessService = new FileAccessTestService(); RefreshUI(true); if (contentToWrite == null) { DispatchQueue.DefaultGlobalQueue.DispatchAsync(() => { contentToWrite = PerformanceTestService.Instance.CalculatePi(digits); DispatchQueue.MainQueue.DispatchAsync(() => RefreshUI(false)); }); } }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.FileAccessTest); Title = GetString(Resource.String.menuFileAccess); timeLabel = FindViewById<TextView>(Resource.Id.timeLabel); resultView = FindViewById<TextView>(Resource.Id.resultView); readButton = FindViewById<Button>(Resource.Id.readButton); writeButton = FindViewById<Button>(Resource.Id.writeButton); readButton.Click += StartReading; writeButton.Click += StartWriting; PerformanceTestService.Instance.PiCalculationCompleted += PiCalculationCompleted; fileAccessService = new FileAccessTestService(this); if (contentToWrite == null) { progressDialog = ProgressDialog.Show(this, "Przetwarzanie...", ""); new Thread(new Runnable(() => { PerformanceTestService.Instance.CalculatePi(digits); })).Start(); } }