public void SetUpApp(UIApplication app) { try { Strings.Culture = new System.Globalization.CultureInfo(NSLocale.CurrentLocale.LanguageCode); } catch (Exception ex) { LogManager.Shared.Log($"Error setting Culture {System.Threading.Thread.CurrentThread.CurrentCulture}"); } SimpleAuth.OnePassword.Activate(); ApiManager.Shared.Load(); App.AlertFunction = (t, m) => { new UIAlertView(t, m, null, "Ok").Show(); }; App.Invoker = app.BeginInvokeOnMainThread; App.OnPlaying = () => { if (playingBackground != 0) { return; } playingBackground = app.BeginBackgroundTask(() => { app.EndBackgroundTask(playingBackground); playingBackground = 0; }); }; App.OnStopped = () => { if (playingBackground == 0) { return; } app.EndBackgroundTask(playingBackground); playingBackground = 0; }; App.OnShowSpinner = (title) => { BTProgressHUD.ShowContinuousProgress(title, ProgressHUD.MaskType.Clear); }; App.OnDismissSpinner = BTProgressHUD.Dismiss; App.OnCheckForOffline = (message) => { var tcs = new System.Threading.Tasks.TaskCompletionSource <bool>(); new AlertView(Strings.DoYouWantToContinue, message) { { Strings.Continue, () => tcs.TrySetResult(true) }, { Strings.Nevermind, () => tcs.TrySetResult(false), true }, }.Show(window.RootViewController); return(tcs.Task); }; NotificationManager.Shared.LanguageChanged += (s, e) => { window.RootViewController = new RootViewController(); }; #pragma warning disable 4014 App.Start(); #pragma warning restore 4014 AutolockPowerWatcher.Shared.CheckStatus(); }
private async Task Activate(Func <Task> activation) { BTProgressHUD.ShowContinuousProgress("Activating...", ProgressHUD.MaskType.Gradient); using (Disposable.Create(BTProgressHUD.Dismiss)) await activation(); BTProgressHUD.ShowSuccessWithStatus("Activated!"); await Load(); }
partial void AddCustomer_TouchUpInside(UIButton sender) { Error.Hidden = true; // BTProgressHUD.ShowContinuousProgress("Добаване на абонат ...", ProgressHUD.MaskType.Black); InvokeOnMainThread(() => { BTProgressHUD.ShowContinuousProgress("Добавяне на абонат ...", ProgressHUD.MaskType.Black); }); //var documents = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments); //var filename = Path.Combine(documents, "Customers.txt"); // File.WriteAllText(filename, string.Empty); //// get customers from file try { listOfCustomersAsJsonString = File.ReadAllText(mFilename); if (listOfCustomersAsJsonString == null || listOfCustomersAsJsonString == string.Empty) { mCustomers = new List <Customer>(); } else { mCustomers = JsonConvert.DeserializeObject <List <Customer> >(listOfCustomersAsJsonString); } if (mCustomers == null) { mCustomers = new List <Customer>(); } } catch (Exception) { if (listOfCustomersAsJsonString == null) { mCustomers = new List <Customer>(); } else { mCustomers = JsonConvert.DeserializeObject <List <Customer> >(listOfCustomersAsJsonString); } if (mCustomers == null) { mCustomers = new List <Customer>(); } } Thread thread = new Thread(AllJobInAddCustomer); thread.Start(); // AllJobInAddCustomer(); }
private async Task Activate(Func <Task> activation) { try { BTProgressHUD.ShowContinuousProgress("Activating...", ProgressHUD.MaskType.Gradient); using (Disposable.Create(BTProgressHUD.Dismiss)) await activation(); Load().ToBackground(); } catch (Exception e) { AlertDialogService.ShowAlert("Error", e.Message); } }
public void SetUpApp(UIApplication app) { SimpleAuth.OnePassword.Activate(); ApiManager.Shared.Load(); App.AlertFunction = (t, m) => { new UIAlertView(t, m, null, "Ok").Show(); }; App.Invoker = app.BeginInvokeOnMainThread; App.OnPlaying = () => { if (playingBackground != 0) { return; } playingBackground = app.BeginBackgroundTask(() => { app.EndBackgroundTask(playingBackground); playingBackground = 0; }); }; App.OnStopped = () => { if (playingBackground == 0) { return; } app.EndBackgroundTask(playingBackground); playingBackground = 0; }; App.OnShowSpinner = (title) => { BTProgressHUD.ShowContinuousProgress(title, ProgressHUD.MaskType.Clear); }; App.OnDismissSpinner = BTProgressHUD.Dismiss; App.OnCheckForOffline = (message) => { var tcs = new System.Threading.Tasks.TaskCompletionSource <bool>(); new AlertView(Strings.DoYouWantToContinue, message) { { Strings.Continue, () => tcs.TrySetResult(true) }, { Strings.Nevermind, () => tcs.TrySetResult(false), true }, }.Show(window.RootViewController); return(tcs.Task); }; #pragma warning disable 4014 App.Start(); #pragma warning restore 4014 }