public void Show() { Device.BeginInvokeOnMainThread(() => { BTProgressHUD.Show(); }); }
public async void BlockContact(long id) { BTProgressHUD.Show("Block Contact", maskType: ProgressHUD.MaskType.Black); var model = new userdetails { BlockUserID = id }; var result = await new SettingService().PostBlockUserInterest(model); if (result.Status == 1) { lblBlockUser.Text = "UnBlock"; ChatConversationRepository.UpdateBlock(contactViewModel.ChatConvId); BTProgressHUD.Dismiss(); new UIAlertView("Block Contact", result.Message, null, "OK", null).Show(); } else { BTProgressHUD.Dismiss(); new UIAlertView("Block Contact", result.Message, null, "OK", null).Show(); } BTProgressHUD.Dismiss(); }
private async void GetContactNo() { try { BTProgressHUD.Show(); Task.Factory.StartNew( // tasks allow you to use the lambda syntax to pass wor () => { ContactNo = WebService.GetContactNo(); }).ContinueWith( t => { if (ContactNo != string.Empty) { } else { BTProgressHUD.ShowToast("Unable to fetch contact details.", false, 1000); } BTProgressHUD.Dismiss(); }, TaskScheduler.FromCurrentSynchronizationContext() ); } catch (Exception ex) { } finally { } }
#pragma warning disable RECS0165 // Asynchronous methods should return a Task instead of void private async void geoCodeLocation(string location) #pragma warning restore RECS0165 // Asynchronous methods should return a Task instead of void { NetworkStatus remoteHostStatus = Reachability.RemoteHostStatus(); if (remoteHostStatus == NetworkStatus.NotReachable) { var alert = UIAlertController.Create("Network Error", "Please check your internet connection", UIAlertControllerStyle.Alert); alert.AddAction(UIAlertAction.Create("Ok", UIAlertActionStyle.Default, null)); PresentViewController(alert, animated: true, completionHandler: null); return; } BTProgressHUD.Show("Searching Branches...", -1, ProgressHUD.MaskType.Black); //AsyncGeocodeLocation ServiceManager jobService = new ServiceManager(); string latLong = await jobService.AsyncGeocodeLocation(location); Console.WriteLine(latLong); if (!string.IsNullOrEmpty(latLong)) { // validate request first then start searching this.getBranchList(); } else { BTProgressHUD.Dismiss(); } }
async void OnFetchDataTap(object sender, EventArgs e) { InitialiseChart(); BTProgressHUD.Show("Fetching data"); var data = await GetDataAsync(); // set data source var barSeriesSource = new IGCategorySeriesDataSourceHelper(); barSeriesSource.Values = data.ProductSales.ToArray(); barSeriesSource.Labels = data.ProductName.ToArray(); // Create axis types and add it to the chart var xAxisBar = new IGNumericXAxis("xAxis"); var yAxisBar = new IGCategoryYAxis("yAxis"); yAxisBar.LabelAlignment = IGHorizontalAlign.IGHorizontalAlignRight; chart.AddAxis(xAxisBar); chart.AddAxis(yAxisBar); // decide on what series need to be displayed on the chart var barSeries = new IGBarSeries("series"); barSeries.XAxis = xAxisBar; barSeries.YAxis = yAxisBar; // set the appropriate data sources barSeries.DataSource = barSeriesSource; chart.AddSeries(barSeries); BTProgressHUD.Dismiss(); }
public async override void ViewDidLoad() { base.ViewDidLoad(); var azureService = new AzureService(); var data = await azureService.GetEmployee(Constants.Id); if (data != null) { TxtEmployeeName.Text = data.Name; TxtEmployeeDOB.Text = data.DOB.ToShortDateString(); TxtEmployeeAge.Text = Convert.ToString(data.Age); } var btnUpdate = new UIButton(UIButtonType.Custom); btnUpdate.SetBackgroundImage(UIImage.FromBundle("Save"), UIControlState.Normal); btnUpdate.Frame = new CGRect(0, 0, 19, 19); btnUpdate.TouchUpInside += async(sender, e) => { BTProgressHUD.Show("Loading", -1, ProgressHUD.MaskType.Black); EmployeeInfo emp = new EmployeeInfo(); emp.Id = data.Id; emp.Name = TxtEmployeeName.Text; emp.DOB = Convert.ToDateTime(TxtEmployeeDOB.Text); emp.Age = Convert.ToInt32(TxtEmployeeAge.Text); await azureService.UpdateEmployee(emp); this.NavigationController.PopViewController(true); BTProgressHUD.Dismiss(); }; this.NavigationItem.SetRightBarButtonItem(null, true); this.NavigationItem.SetRightBarButtonItem( new UIBarButtonItem(btnUpdate), true); }
async void Login(string username, string password) { BTProgressHUD.Show("Logging in..."); var success = await WebService.Shared.Login(username, password); if (success) { var canContinue = await WebService.Shared.PlaceOrder(WebService.Shared.CurrentUser, true); if (!canContinue.Success) { new UIAlertView("Sorry", "Only one shirt per person. Edit your cart and try again.", null, "OK").Show(); BTProgressHUD.Dismiss(); return; } } BTProgressHUD.Dismiss(); if (success) { LoginSucceeded(); } else { var alert = new UIAlertView("Could Not Log In", "Please verify your Xamarin account credentials and try again", null, "OK"); alert.Show(); alert.Clicked += delegate { LoginView.PasswordField.SelectAll(this); LoginView.PasswordField.BecomeFirstResponder(); }; } }
public async Task <CustomerResponse> UpdateMail(string email, string userid) { sw.Start(); CustomerResponse output = null; try { BTProgressHUD.Show(LoggingClass.txtpleasewait); var uri = new Uri(ServiceURL + "UpdateEmailAddress/" + email + "/user/" + userid); var content = JsonConvert.SerializeObject(email); var cont = new StringContent(content, System.Text.Encoding.UTF8, "application/json"); string Token = CurrentUser.GetAuthToken(); client.DefaultRequestHeaders.Accept.Clear(); client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", Token); var response = await client.GetStringAsync(uri).ConfigureAwait(false); output = JsonConvert.DeserializeObject <CustomerResponse>(response); BTProgressHUD.Dismiss(); } catch (Exception ex) { LoggingClass.LogError(ex.ToString(), screen, ex.StackTrace); } sw.Stop(); LoggingClass.LogServiceInfo(userid + "user updated Service," + email, "Email Service,"); LoggingClass.LogServiceInfo("Service " + sw.Elapsed.TotalSeconds, "Email Service,"); return(output); }
private void Process(SettingsModel sm) { int ResponseCode = 0; try { BTProgressHUD.Show(); Task.Factory.StartNew( // tasks allow you to use the lambda syntax to pass wo () => { ResponseCode = WebService.SaveSettings(sm); } /// ).ContinueWith( t => { if (ResponseCode == 200) { SaveSettings(this, null); BTProgressHUD.ShowToast("Settings Saved successfully.", false, 1000); this.DismissModalViewController(false); } else { BTProgressHUD.ShowToast("Failed to save settings.", false, 1000); } BTProgressHUD.Dismiss(); }, TaskScheduler.FromCurrentSynchronizationContext() ); } catch (Exception ex) { } }
public override void ViewDidLoad() { base.ViewDidLoad(); locationSwitch.ValueChanged += delegate { if (locationSwitch.On) { LocationHelper.Instance.StartLocationUpdates(); BTProgressHUD.Show("Tracking location"); } else { LocationHelper.Instance.StopLocationUpdates(); BTProgressHUD.Dismiss(); CreateSpreadsheet(); } }; emailButton.TouchUpInside += (sender, e) => { SendMail(); }; previewButton.TouchUpInside += (sender, e) => { ShowPreview(); }; }
private void GetAttendance() { try { BTProgressHUD.Show("Loading..."); Task.Factory.StartNew( // tasks allow you to use the lambda syntax to pass wor () => { WebService.GetStudentAttendance(StaticDataModel.StudentId); } /// ).ContinueWith( t => { if (WebService.Holidaylist != null) { CreateCalanderView(); } else { } BTProgressHUD.Dismiss(); }, TaskScheduler.FromCurrentSynchronizationContext() ); } catch (Exception ex) { } finally { } }
public void InitializeMyGames() { BTProgressHUD.Show("Loading Games", -1, ProgressHUD.MaskType.Black); var repository = AppDelegate.Repository; if (repository != null) { this.viewModel = new MyGamesViewModel(AppDelegate.Repository); this.viewModel.InitializeAsync().ContinueWith((t) => { if (!t.IsFaulted && t.Result) { BeginInvokeOnMainThread(() => { LoadGameControllers(); gamesControllers[0].SetData(this.viewModel.MyTurnGames); gamesControllers[1].SetData(this.viewModel.TheirTurnGames); gamesControllers[2].SetData(this.viewModel.CompletedGames); BTProgressHUD.Dismiss(); }); } // TODO handle error }); } }
private void PublicarPost() { BTProgressHUD.Show(); byte[] Fotografia; if (ImagenPublicacion != null) { Fotografia = ImagenPublicacion?.AsPNG().ToArray(); } else { Fotografia = new byte[0]; } if (InternetConectionHelper.VerificarConexion()) { if (new Controllers.EscritorioController().SetPost(KeyChainHelper.GetKey("Usuario_Id"), KeyChainHelper.GetKey("Usuario_Tipo"), txtPublicacion.Text, Fotografia)) { this.PostPublicadoDelegate.PostPublicado(); this.SendMessage(); this.DismissViewController(true, null); BTProgressHUD.Dismiss(); } else { BTProgressHUD.Dismiss(); new MessageDialog().SendToast("No pudimos publicar tu mensaje, intenta de nuevo"); } } else { BTProgressHUD.Dismiss(); new MessageDialog().SendToast("No tienes conexión a internet, intenta de nuevo"); } }
public override void ViewWillAppear(bool animated) { InvokeOnMainThread(() => { base.ViewWillAppear(animated); BTProgressHUD.Show("Loading Image", maskType: ProgressHUD.MaskType.Black); scrollView = new UIScrollView(new CGRect(0, 0, View.Frame.Width, View.Frame.Height - NavigationController.NavigationBar.Frame.Height)); View.AddSubview(scrollView); image = ImageClass.FromUrl(filepath); imageView = new UIImageView(image); scrollView.ContentSize = imageView.Image.Size; scrollView.AddSubview(imageView); scrollView.MaximumZoomScale = 3f; scrollView.MinimumZoomScale = .1f; scrollView.ViewForZoomingInScrollView += (UIScrollView sv) => { return(imageView); }; UITapGestureRecognizer doubletap = new UITapGestureRecognizer(OnDoubleTap) { NumberOfTapsRequired = 2 // double tap }; scrollView.AddGestureRecognizer(doubletap); // detect when the scrollView is double-tapped scrollView.SetZoomScale(0.25f, true); BTProgressHUD.Dismiss(); }); }
void OnViewModelPropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e) { InvokeOnMainThread(() => { switch (e.PropertyName) { case SignUpViewModel.ValidatePinEnabledPropertyName: ContinueBtn.Enabled = ViewModel.ValidatePinEnabled; SausageButtons.UpdateBackgoundColor(ContinueBtn); break; case BaseViewModel.IsBusyPropertyName: if (ViewModel.IsBusy) { BTProgressHUD.Show(null, -1, ProgressHUD.MaskType.Black); } else { BTProgressHUD.Dismiss(); } break; case SignUpViewModel.CanProgressPropertyName: if (ViewModel.CanProgress) { GoToMainScreen(); } break; } }); }
private async void DeleteCommentSelector() { nint button = await Utils.ShowAlert("Delete Comment", "The comment will be deleted. Continue?", "Ok", "Cancel"); try { if (button == 0) { BTProgressHUD.Show(null, -1, ProgressHUD.MaskType.Clear); await new CommentManager().DeleteSurveyComment(comment, LoginController.tokenModel.access_token); comments.Remove(comment); if (survey.totalComments > 0) { survey.totalComments--; } feedCell.updateTotalComments(survey.totalComments); feed.Source = new CommentsCollectionViewSource(comments, feedCell, this); feed.Delegate = new CommentsCollectionViewDelegate((float)feedCell.Frame.Height); feed.ReloadData(); } BTProgressHUD.Dismiss(); } catch (Exception ex) { BTProgressHUD.Dismiss(); Utils.HandleException(ex); } }
public async void SaveReview() { try { BTProgressHUD.Show("Saving the review..."); ServiceWrapper sw = new ServiceWrapper(); Review review = new Review(); review.ReviewDate = DateTime.Now; review.ReviewUserId = Convert.ToInt32(CurrentUser.RetreiveUserId()); if (txtComments.Text == "Describe your tasting") { txtComments.Text = ""; } string reviewtxt = txtComments.Text; reviewtxt.Trim(); review.RatingText = reviewtxt; review.IsActive = true; review.PlantFinal = storeid.ToString(); review.RatingStars = Convert.ToInt32(StartsSelected); //review.SKU = SKU; review.Barcode = WineId; await sw.InsertUpdateReview(review); //NavController.DismissViewController(true, null); BTProgressHUD.ShowSuccessWithStatus("Thank you!!!", 2000); ((IPopupParent)parent).RefreshParent(); } catch (Exception ex) { LoggingClass.LogError(ex.Message, screen, ex.StackTrace); } }
private async void ReportCommentUser() { nint button = await Utils.ShowAlert("Report Comment User", "The user will be reported. Continue?", "Ok", "Cancel"); try { if (button == 0) { BTProgressHUD.Show(null, -1, ProgressHUD.MaskType.Clear); await new UserManager().BlockUser(LoginController.userModel.id, comment.userId, LoginController.tokenModel.access_token); //comments.Remove(comment); comments = await new CommentManager().GetSurveyComments(this.userId + this.creationDate, LoginController.userModel.id, LoginController.tokenModel.access_token); feed.Source = new CommentsCollectionViewSource(comments, feedCell, this); feed.Delegate = new CommentsCollectionViewDelegate((float)feedCell.Frame.Height); feed.ReloadData(); } BTProgressHUD.Dismiss(); } catch (Exception ex) { BTProgressHUD.Dismiss(); Utils.HandleException(ex); } }
public override void ViewDidLoad() { base.ViewDidLoad(); this.RestrictRotation(UIInterfaceOrientationMask.Portrait); UINavigationBar.Appearance.TitleTextAttributes = new UIStringAttributes { ForegroundColor = UIColor.FromRGB(90, 89, 89) }; TableView.RegisterClassForCellReuse(typeof(NotificationsTableViewCell), notificationCellId); TableView.SeparatorInset = new UIEdgeInsets(0, 10, 0, 10); notifications = new List <UserNotificationModel>(); refreshControl = new UIRefreshControl(); refreshControl.ValueChanged += (sender, e) => { refreshControl.BeginRefreshing(); fetchNotifications(); }; TableView.Add(refreshControl); BTProgressHUD.Show(null, -1, ProgressHUD.MaskType.Clear); fetchNotifications(); }
private void Process() { int ResponseCode = 0; try { BTProgressHUD.Show(); Task.Factory.StartNew( // tasks allow you to use the lambda syntax to pass wo () => { ResponseCode = WebService.ForgotPassword(txtEmail.Text); } /// ).ContinueWith( t => { if (ResponseCode == 200) { BTProgressHUD.ShowToast("A link was sent on your email address please check your inbox to change your password.", false, 1000); } else { BTProgressHUD.ShowToast("Please enter a valid email.", false, 1000); } BTProgressHUD.Dismiss(); }, TaskScheduler.FromCurrentSynchronizationContext() ); } catch (Exception ex) { } }
async partial void BtnVerifyFace_Action(UIBarButtonItem sender) { if (CrossMedia.Current.IsPickPhotoSupported) { try { var result = await CrossMedia.Current.PickPhotoAsync(); if (result == null) { return; } BTProgressHUD.Show("Searching"); var person = await Service.Instance.FindSimilarFace(result.GetStream()); BTProgressHUD.Dismiss(); if (person == null) { BTProgressHUD.Dismiss(); return; } await Task.Delay(1000); BTProgressHUD.ShowSuccessWithStatus(person.Name); } catch { BTProgressHUD.Dismiss(); } } }
public override void ViewDidLoad() { base.ViewDidLoad(); profileType = ProfileType.ListGroupMembers; Title = ""; NavigationController.NavigationBar.TitleTextAttributes = new UIStringAttributes { ForegroundColor = UIColor.FromRGB(90, 89, 89) }; groupProfileBtn = new UIButton(UIButtonType.System); groupProfileBtn.Frame = new CGRect(0, 0, 100, 40); groupProfileBtn.BackgroundColor = UIColor.White; groupProfileBtn.SetTitleColor(UIColor.FromRGB(90, 89, 89), UIControlState.Normal); //groupProfileBtn.ImageView.ContentMode = UIViewContentMode.ScaleAspectFill; //groupProfileBtn.ImageView.Layer.CornerRadius = 22; //groupProfileBtn.ImageView.Layer.MasksToBounds = true; //groupProfileBtn.ImageView.Layer.Frame = new CGRect(0, 0, 44, 44); groupProfileBtn.SetImage(UIImage.FromBundle("MyGroup"), UIControlState.Normal); //Utils.SetImageFromNSUrlSession(groupProfilePicture, groupProfileBtn.ImageView, this, PictureType.Profile); groupProfileBtn.SetTitle("View Group Details", UIControlState.Normal); groupProfileBtn.TitleEdgeInsets = new UIEdgeInsets(0, groupProfileBtn.ImageView.Frame.Size.Width / 4, 0, -groupProfileBtn.ImageView.Frame.Size.Width); groupProfileBtn.ImageEdgeInsets = new UIEdgeInsets(0, -groupProfileBtn.TitleLabel.Frame.Size.Width / 4, 0, groupProfileBtn.TitleLabel.Frame.Size.Width); groupProfileBtn.AddTarget(Self, new ObjCRuntime.Selector("GroupProfileBtn:"), UIControlEvent.TouchUpInside); NavigationItem.TitleView = groupProfileBtn; BTProgressHUD.Show(null, -1, ProgressHUD.MaskType.Clear); fetchTableItems(); }
public override void ViewDidAppear(bool animated) { base.ViewDidAppear(animated); BTProgressHUD.Show("Loading"); RaiseOnFinishedBootstrapping(); }
private async Task RemoveFromBlackListAsync(long id) { try { BTProgressHUD.Show("UnBlocked Contacts", maskType: ProgressHUD.MaskType.Black); var model = new userdetails { BlockUserID = id }; var result = await new SettingService().PostUnBlockUserInterest(model); if (result.Status == 1) { ChatConversationRepository.UpdateUnBlock(chatConversation.ChatId); new UIAlertView("Blocked Contacts", result.Message, null, "OK", null).Show(); BTProgressHUD.Dismiss(); } else { new UIAlertView("Blocked Contacts", result.Message, null, "OK", null).Show(); BTProgressHUD.Dismiss(); } BTProgressHUD.Dismiss(); } catch (Exception ex) { Crashes.TrackError(ex); BTProgressHUD.Dismiss(); } }
public override void ViewDidLoad() { base.ViewDidLoad(); this.Title = "Employee"; var btnSave = new UIButton(UIButtonType.Custom); btnSave.SetBackgroundImage(UIImage.FromBundle("Save"), UIControlState.Normal); btnSave.Frame = new CGRect(0, 0, 19, 19); btnSave.TouchUpInside += async(sender, e) => { BTProgressHUD.Show("Loading", -1, ProgressHUD.MaskType.Black); EmployeeInfo emp = new EmployeeInfo(); emp.Name = TxtEmployeeName.Text; emp.DOB = Convert.ToDateTime(TxtEmployeeDOB.Text); emp.Age = Convert.ToInt32(TxtEmployeeAge.Text); var azureService = new AzureService(); await azureService.InsertEmployee(emp); this.NavigationController.PopViewController(true); BTProgressHUD.Dismiss(); }; this.NavigationItem.SetRightBarButtonItem(null, true); this.NavigationItem.SetRightBarButtonItem( new UIBarButtonItem(btnSave), true); }
/// <summary> /// Set text to loading indicator. /// </summary> /// <param name="text">Text to display.</param> public void SetText(string text) { if (!isHudVisible) { return; } Device.BeginInvokeOnMainThread(() => { BTProgressHUD.Show(status: text, maskType: ProgressHUD.MaskType.Black); try { //if (_load == null) { // _load = CustomLoadingView (text); // ProgressHUD.Shared.AddSubview (_load); //} lblTitle.Text = text; UIView[] subView = ProgressHUD.Shared.Subviews; for (int i = 0; i < subView.Length; i++) { subView[i].Hidden = true; } _load.Hidden = false; ProgressHUD.Shared.BringSubviewToFront(_load); } catch (Exception ex) { #if DEBUG Console.WriteLine("IosHudService.cs - SetText() " + ex.Message); #endif } }); }
public void AddNavigationButtons(UINavigationController nav) { UIImage profile = UIImage.FromFile("profile.png"); profile = ResizeImage(profile, 25, 25); UIImage info = UIImage.FromFile("Info.png"); info = ResizeImage(info, 25, 25); var topBtn = new UIBarButtonItem(profile, UIBarButtonItemStyle.Plain, (sender, args) => { BTProgressHUD.Show("Loading,,,"); //nav.PushViewController(new ProfileViewController(nav), false); nav.PushViewController(new proview(nav), false); nav.NavigationBar.TopItem.Title = "Profile"; //BTProgressHUD.Dismiss(); }); var optbtn = new UIBarButtonItem(info, UIBarButtonItemStyle.Plain, (sender, args) => { BTProgressHUD.Show("Loading,,,"); nav.PushViewController(new AboutController1(nav), false); nav.NavigationBar.TopItem.Title = "About Us"; BTProgressHUD.Dismiss(); }); nav.NavigationBar.TopItem.SetRightBarButtonItem(optbtn, true); nav.NavigationBar.TopItem.SetLeftBarButtonItem(topBtn, true); }
public void Decrypt(Passphrase passphrase) { BTProgressHUD.Show("Opening ...", maskType: BTProgressHUD.MaskType.Gradient); CreateWorker(); this.key = passphrase.DerivedPassphrase; worker.Run(); }
public override void LoadView() { base.LoadView(); View.BackgroundColor = UIColor.LightGray; MakeButton("Show", () => { BTProgressHUD.Show(); KillAfter(); }); MakeButton("Show Message", () => { BTProgressHUD.Show(status: "Processing your image"); KillAfter(); }); MakeButton("Show Success", () => { BTProgressHUD.ShowSuccessWithStatus("Great success!"); }); MakeButton("Show Fail", () => { BTProgressHUD.ShowErrorWithStatus("Oh, thats bad"); }); MakeButton("Toast", () => { BTProgressHUD.ShowToast("Hello from the toast", showToastCentered: false); }); MakeButton("Dismiss", () => { BTProgressHUD.Dismiss(); }); MakeButton("Progress", () => { progress = 0; BTProgressHUD.Show("Hello!", progress); if (timer != null) { timer.Invalidate(); } timer = NSTimer.CreateRepeatingTimer(0.5f, delegate { progress += 0.1f; if (progress > 1) { timer.Invalidate(); timer = null; BTProgressHUD.Dismiss(); } else { BTProgressHUD.Show("Hello!", progress); } }); NSRunLoop.Current.AddTimer(timer, NSRunLoopMode.Common); }); MakeButton("Dismiss", () => { BTProgressHUD.Dismiss(); }); }
partial void AttahmentImageButton_TouchUpInside(UIButton sender) { var imageViewcontroller = (ImageViewController)uiNewView.Storyboard.InstantiateViewController("ImageViewController"); imageViewcontroller.filepath = ImagePath; BTProgressHUD.Show("Loading Image"); uiNewView.NavigationController.PushViewController(imageViewcontroller, true); }