public void SyncWebBrowserError(Exception ex) { InvokeOnMainThread(() => { UIAlertView alertView = new UIAlertView("Sync Web Browser Error", ex.Message, null, "OK", null); alertView.Show(); }); }
public override void Clicked(UIAlertView alertview, int buttonIndex) { if (buttonIndex == 0) { Application.LaunchAppstoreProEdition(); } }
partial void JoinButton_TouchUpInside(UIButton sender) { var clientId = this.HandleTextField.Text; var alertView = new UIAlertView(this.View.Bounds); alertView.Message = clientId; alertView.Show(); }
public override void WillMoveToSuperview (UIView newsuper) { base.WillMoveToSuperview (newsuper); SetUpToggle (AVSSwitch, JudoSDKManager.AVSEnabled, () => { JudoSDKManager.AVSEnabled = !JudoSDKManager.AVSEnabled; }); SetUpToggle (ThreeDSwitch, JudoSDKManager.ThreeDSecureEnabled, () => { JudoSDKManager.ThreeDSecureEnabled = !JudoSDKManager.ThreeDSecureEnabled; }); SetUpToggle (RiskSwitch, JudoSDKManager.RiskSignals, () => { JudoSDKManager.RiskSignals = !JudoSDKManager.RiskSignals; }); SetUpToggle (MaestroSwitch, JudoSDKManager.MaestroAccepted, () => { JudoSDKManager.MaestroAccepted = !JudoSDKManager.MaestroAccepted; }); SetUpToggle (AmexSwitch, JudoSDKManager.AmExAccepted, () => { JudoSDKManager.AmExAccepted = !JudoSDKManager.AmExAccepted; }); SetUpToggle (NoneUISwitch, !JudoSDKManager.UIMode, () => { JudoSDKManager.UIMode = !JudoSDKManager.UIMode; if (JudoSDKManager.UIMode) return; UIAlertView nonUIWarning = new UIAlertView ("Non-UI Mode", "You are about to use non UI Mode so please look at the source code to understand the usage of Non-UI APIs.", null, "OK", null); nonUIWarning.Show (); }); AttachTouchEvents (); ArrowIcon.Transform = CGAffineTransform.MakeRotation ((nfloat)(180.0f * Math.PI) / 180.0f); }
private static Task<string> PlatformShow(string title, string description, string defaultText, bool usePasswordMode) { tcs = new TaskCompletionSource<string>(); UIApplication.SharedApplication.InvokeOnMainThread(delegate { alert = new UIAlertView(); alert.Title = title; alert.Message = description; alert.AlertViewStyle = usePasswordMode ? UIAlertViewStyle.SecureTextInput : UIAlertViewStyle.PlainTextInput; alert.AddButton("Cancel"); alert.AddButton("Ok"); UITextField alertTextField = alert.GetTextField(0); alertTextField.KeyboardType = UIKeyboardType.ASCIICapable; alertTextField.AutocorrectionType = UITextAutocorrectionType.No; alertTextField.AutocapitalizationType = UITextAutocapitalizationType.Sentences; alertTextField.Text = defaultText; alert.Dismissed += (sender, e) => { if (!tcs.Task.IsCompleted) tcs.SetResult(e.ButtonIndex == 0 ? null : alert.GetTextField(0).Text); }; // UIAlertView's textfield does not show keyboard in iOS8 // http://stackoverflow.com/questions/25563108/uialertviews-textfield-does-not-show-keyboard-in-ios8 if (UIDevice.CurrentDevice.CheckSystemVersion(8, 0)) alert.Presented += (sender, args) => alertTextField.SelectAll(alert); alert.Show(); }); return tcs.Task; }
public override void ViewDidLoad() { DispatchQueue.DefaultGlobalQueue.DispatchAsync(() => { try { var update = CurrencyUpdate.Latest(); DispatchQueue.MainQueue.DispatchSync(() => { (InfosTableView.Source as InfosTableSource).UpdateAll(update.Infos); InfosTableView.ReloadData(); (SearchController.Delegate as SearchDisplayDelegate).UpdateAll(update.Infos); Title = "Last Update: " + update.Timestamp.ToString("HH:mm"); }); } catch (Exception ex) { DispatchQueue.MainQueue.DispatchSync(() => { var alert = new UIAlertView(); alert.Message = ex.Message; alert.AddButton("OK"); alert.Show(); }); } }); }
protected void Handle_FinishedPickingMedia (object sender, UIImagePickerMediaPickedEventArgs e) { // determine what was selected, video or image bool isImage = false; if (e.Info [UIImagePickerController.MediaType].ToString () == "public.image") { isImage = true; } // // get common info (shared between images and video) // NSUrl referenceURL = e.Info[new NSString("UIImagePickerControllerReferenceUrl")] as NSUrl; // if (referenceURL != null) // Console.WriteLine("Url:"+referenceURL.ToString ()); // if it was an image, get the other image info if(isImage) { // get the original image originalImage = e.Info[UIImagePickerController.OriginalImage] as UIImage; if(originalImage != null) { // do something with the image imgProfilePic.Image = originalImage; // display } } else { // if it's a video UIAlertView alert = new UIAlertView ("Invalid Format", "Looks like you selected a video", null, "OK", null); alert.Show (); } // dismiss the picker imagePicker.DismissViewController (true, null); }
public void SyncDownloadError(Exception ex) { InvokeOnMainThread(() => { var alertView = new UIAlertView("Sync Download Error", ex.Message, null, "OK", null); alertView.Show(); }); }
partial void btnCalc_TouchUpInside(UIButton sender) { UIAlertView _error = new UIAlertView("Error", "Please fill in all fields with positive values", null, "OK", null); try { double interest = double.Parse (txtRate.Text); int principal = int.Parse (txtPrincipal.Text); int monthly = int.Parse (txtMonthly.Text); double rate = interest / 1200; double payments = (Math.Log(monthly) - Math.Log(monthly - (principal * rate))) / (Math.Log(1 + rate)); decimal numberOfPayments = Convert.ToDecimal(payments); numberOfPayments = Math.Ceiling(numberOfPayments); UIAlertView good = new UIAlertView("Number of monthly payments (rounded up):", numberOfPayments.ToString(), null, "OK", null); good.Show(); } catch (Exception) { _error.Show(); } //double monthly = rate > 0 ? ((rate + rate / (Math.Pow (1 + rate, months) - 1)) * principal) : principal / months; }
private async void Login(MobileServiceAuthenticationProvider provider) { var client = new MobileServiceClient(this.uriEntry.Value, this.keyEntry.Value); var user = await client.LoginAsync(this, provider); var alert = new UIAlertView("Welcome", "Your userId is: " + user.UserId, null, "OK"); alert.Show(); }
private void Alert(string caption, string msg) { using (UIAlertView av = new UIAlertView(caption, msg, null, "OK", null)) { av.Show(); } }
public async override void ViewDidLoad() { base.ViewDidLoad(); #warning first we have to setup connection info and create a session var instanceUrl = "http://my.site.com"; using (var credentials = new SecureStringPasswordProvider("login", "password")) using ( var session = SitecoreWebApiSessionBuilder.AuthenticatedSessionWithHost(instanceUrl) .Credentials(credentials) .WebApiVersion("v1") .DefaultDatabase("web") .DefaultLanguage("en") .BuildSession()) { // In order to fetch some data we have to build a request var request = ItemWebApiRequestBuilder.ReadItemsRequestWithPath("/sitecore/content/home") .AddFieldsToRead("text") .AddScope(ScopeType.Self) .Build(); // And execute it on a session asynchronously var response = await session.ReadItemAsync(request); // Now that it has succeeded we are able to access downloaded items ISitecoreItem item = response[0]; // And content stored it its fields string fieldContent = item["text"].RawValue; UIAlertView alert = new UIAlertView("Sitecore SDK Demo", fieldContent, null, "Ok", null); alert.Show(); } }
void HandleTodaysMenuCompleted (object sender, TodaysMenuCompletedEventArgs args) { InvokeOnMainThread (delegate { if (Util.IsAsynchCompletedError (args, "TodaysMenu")) { //Util.PopNetworkActive (); _hud.StopAnimating (); //_hud.Hide (true); this.NavigationItem.RightBarButtonItem.Enabled = true; return; } try { DishesOfTheDay result = args.Result; this.tblTageskarte.Source = new TableSource (result.DishOfTheDay.ToList ()); this.tblTageskarte.ReloadData (); } catch (Exception ex) { using (UIAlertView alert = new UIAlertView("TodaysMenuCompleted",ex.Message,null,"OK",null)) { alert.Show (); } } finally { //Util.PopNetworkActive (); this.NavigationItem.RightBarButtonItem.Enabled = true; _hud.StopAnimating (); //_hud.Hide (true); //_hud.RemoveFromSuperview (); //_hud = null; } }); }
public void Display (string body, string title, GoalsAvailable goalAvailable, string cancelButtonTitle, string acceptButtonTitle = "", Action<GoalsAvailable, int> action = null) { UIAlertView alert = new UIAlertView(); alert.Title = title; alert.AddButton(acceptButtonTitle); alert.AddButton(cancelButtonTitle); alert.Message = body; alert.AlertViewStyle = UIAlertViewStyle.PlainTextInput; alert.GetTextField(0).KeyboardType=UIKeyboardType.NumberPad; const int maxCharacters =7; alert.GetTextField(0).ShouldChangeCharacters = (textField, range, replacement) => { var newContent = new NSString(textField.Text).Replace(range, new NSString(replacement)).ToString(); int number; return newContent.Length <= maxCharacters && (replacement.Length == 0 || int.TryParse(replacement, out number)); }; alert.Clicked += (object s, UIButtonEventArgs ev) => { if(action != null) { if(ev.ButtonIndex ==0) { string input = alert.GetTextField(0).Text; int goalValue; int.TryParse(input, out goalValue); action.Invoke(goalAvailable, goalValue); } } }; alert.Show(); }
public override void ViewDidLoad () { base.ViewDidLoad (); TableView.SeparatorColor = UIColor.Clear; if (UIDevice.CurrentDevice.UserInterfaceIdiom != UIUserInterfaceIdiom.Pad) { NSNotificationCenter defaultCenter = NSNotificationCenter.DefaultCenter; defaultCenter.AddObserver (UIKeyboard.WillHideNotification, OnKeyboardNotification); defaultCenter.AddObserver (UIKeyboard.WillShowNotification, OnKeyboardNotification); } if (String.IsNullOrEmpty(tokenPayment.Token)) { DispatchQueue.MainQueue.DispatchAfter (DispatchTime.Now, () => { UIAlertView _error = new UIAlertView ("Missing Token", "No Card Token found. Please provide application with token via Pre-Authentication or Payment", null, "ok", null); _error.Show (); _error.Clicked += (sender, args) => { PaymentButton.Disable(); if (UIDevice.CurrentDevice.UserInterfaceIdiom == UIUserInterfaceIdiom.Pad) { this.DismissViewController (true, null); } else { this.NavigationController.PopToRootViewController (true); } }; }); } else { SetUpTableView (); UITapGestureRecognizer tapRecognizer = new UITapGestureRecognizer (); tapRecognizer.AddTarget (() => { if (KeyboardVisible) { DismissKeyboardAction (); } }); tapRecognizer.NumberOfTapsRequired = 1; tapRecognizer.NumberOfTouchesRequired = 1; EncapsulatingView.AddGestureRecognizer (tapRecognizer); PaymentButton.Disable(); PaymentButton.SetTitleColor (UIColor.Black, UIControlState.Application); PaymentButton.TouchUpInside += (sender, ev) => { MakeTokenPayment (); }; if (UIDevice.CurrentDevice.UserInterfaceIdiom == UIUserInterfaceIdiom.Pad) { FormClose.TouchUpInside += (sender, ev) => { this.DismissViewController (true, null); }; } } }
public ListApiViewController () : base(null, false) { //plain makes a bit more sense for a list of data Style = UITableViewStyle.Plain; //out banks need to be sorted, so the button below can work. We just get the index into the LIST, // not into the List<string>. But we can make them the same! data = new List<string> { "Bank of America", "First National Bank", "Simple", "Bank Direct", "Barclays Bank", "Second Bank of Madison", "Monkey Bank" }.OrderBy (x => x).ToList(); NavigationItem.RightBarButtonItem = new UIBarButtonItem (UIBarButtonSystemItem.Save, (o,e) => { string bankName = data[bankSelection.Selected]; var alert = new UIAlertView ("Tapped", string.Format ("You picked {0}", bankName), null, "Ok"); alert.Show (); }); }
public override void ViewDidLoad() { base.ViewDidLoad (); btnBeginCheckIn.BackgroundColor = new UIColor(new CoreGraphics.CGColor(0.1f,0.1f,0.1f)); btnBeginCheckIn.Layer.CornerRadius = 1; btnBeginCheckIn.TouchUpInside += (object sender, EventArgs e) => { var locSvc = new ROMPLocation (); myFacilities = locSvc.GetLocations (sessionKey, groupID); string geofenceAnnounce = "Geofences Active At The Following Locations:\n"; foreach (FacilityCoordinates fc in myFacilities) { geofenceAnnounce += fc.LocationName + "\n"; var region = new CLCircularRegion (new CLLocationCoordinate2D (fc.Latitude, fc.Longitude), 50.0f, fc.LocationID.ToString()); geoMan.StartMonitoringRegion (region, locSvc, sessionKey, fc.LocationID, fc.LocationName); } UIAlertView _alert = new UIAlertView ("Monitoring Locations", geofenceAnnounce, null, "Ok", null); _alert.Show (); btnBeginCheckIn.Hidden = true; lblInfo.Text = "A record that you have checked-in will be made in the log of your education activity for this ROMP rotation when this device enters a 100m radius surrounding the facility of your ROMP rotation."; }; btnExit.BackgroundColor = new UIColor(new CoreGraphics.CGColor(0.9f,0.9f,0.9f)); btnExit.Layer.CornerRadius = 1; btnExit.TouchUpInside += (object sender, EventArgs e) => { Environment.Exit(0); }; }
public async Task<bool> LogoutAsync() { bool success = false; try { if (user != null) { foreach (var cookie in NSHttpCookieStorage.SharedStorage.Cookies) { NSHttpCookieStorage.SharedStorage.DeleteCookie(cookie); } await TodoItemManager.DefaultManager.CurrentClient.LogoutAsync(); var logoutAlert = new UIAlertView("Authentication", "You are now logged out " + user.UserId, null, "OK", null); logoutAlert.Show(); } user = null; success = true; } catch (Exception ex) { var logoutAlert = new UIAlertView("Logout failed", ex.Message, null, "OK", null); logoutAlert.Show(); } return success; }
/// <summary> /// Event when complete is pressed /// </summary> partial void Complete () { //Check if they signed if (assignmentViewModel.Signature == null) { new UIAlertView(string.Empty, "Signature is required.", null, "Ok").Show (); return; } alertView = new UIAlertView("Complete?", "Are you sure?", null, "Yes", "No"); alertView.Dismissed += (sender, e) => { alertView.Dispose (); alertView = null; if (e.ButtonIndex == 0) { completeButton.Enabled = false; assignment.Status = AssignmentStatus.Complete; assignmentViewModel .SaveAssignmentAsync (assignment) .ContinueWith (_ => { BeginInvokeOnMainThread (() => { tableView.ReloadData (); var detailsController = controller.ParentViewController as AssignmentDetailsController; detailsController.UpdateAssignment (); var menuController = detailsController.ParentViewController.ChildViewControllers[1] as MenuController; menuController.UpdateAssignment (); }); }); } }; alertView.Show(); }
internal static void Show(string p, string p_2) { UIAlertView uiav = new UIAlertView("Status", p_2, null, "OK"); uiav.Show(); return; }
private async void SaveButton_Click(object sender, EventArgs ea) { var waitingOverlay = new WaitingOverlay(UIScreen.MainScreen.Bounds, "Saving..."); View.Add(waitingOverlay); Bindings.UpdateSourceForLastView(); this.Model.ApplyEdit(); try { //this.Model.GetBrokenRules(); this.Model = await this.Model.SaveAsync(); var alert = new UIAlertView(); alert.Message = "Saved..."; alert.AddButton("Close"); alert.DismissWithClickedButtonIndex(0, false); alert.Show(); } catch (Exception ex) { var alert = new UIAlertView(); alert.Message = string.Format("the following error has occurred: {0}", ex.Message); alert.AddButton("Close"); alert.DismissWithClickedButtonIndex(0, false); alert.Show(); } finally { InitializeBindings(this.Model); waitingOverlay.Hide(); } }
public override void ReceivedRemoteNotification (UIApplication application, NSDictionary userInfo) { var message = (NSString) userInfo.ObjectForKey (new NSString ("aps")).ValueForKey(new NSString("alert")); var alert = new UIAlertView("Notification", message, null, "Okay", null); alert.Show (); }
void ShowPopup(LoanViewModel vm) { if (null == vm) return; var popup = new UIAlertView(View.Frame); popup.Title = vm.DocumentTitle; popup.AddButton("Utvid lånetid"); popup.AddButton("Vis detaljer"); popup.AddButton("Avbryt"); popup.CancelButtonIndex = 2; popup.Dismissed += (sender, e) => { switch(e.ButtonIndex) { case 0 : ViewModel.ExpandLoan(vm.DocumentNumber); break; case 1: ViewModel.ShowDetailsCommand.Execute(vm); break; } }; popup.Show(); }
public void SendMessage(string message, string title = null) { Helpers.EnsureInvokedOnMainThread (() => { var alertView = new UIAlertView (title ?? string.Empty, message, null, "OK"); alertView.Show (); }); }
public void SendEmail () { UIView activeView = _viewController.TableView.FindFirstResponder (); if (activeView != null) { activeView.ResignFirstResponder (); } _context.Fetch (); /* var test2 = _viewController.TableView.FindRecursive<UITextField> (t => t.Placeholder.Contains ("Email")).FirstOrDefault (); if (test2.CanBecomeFirstResponder) { test2.BecomeFirstResponder (); } */ if (Validate ()) { //TODO: Send via WebService Util.PushNetworkActive (); NSTimer.CreateScheduledTimer (2, delegate { Util.PopNetworkActive (); var alert = new UIAlertView ("", Locale.GetText ("Vielen Dank für Ihre Nachricht."), null, "OK", null); alert.Show (); alert.Clicked += delegate { _navigation.PopToRootViewController (true); }; }); } }
public override void ViewDidLoad() { _btn.TouchUpInside += (object sender, EventArgs e) => { var alert = new UIAlertView("Clicked", "me", null, "OK"); alert.Show(); }; }
async Task<bool> SignIn() { var tcs = new TaskCompletionSource<bool> (); var alert = new UIAlertView ("Please sign in", "", null, "Cancel", "Ok"); alert.AlertViewStyle = UIAlertViewStyle.SecureTextInput; var tb = alert.GetTextField(0); tb.ShouldReturn = (t)=>{ alert.DismissWithClickedButtonIndex(1,true); signIn(tcs,tb.Text); return true; }; alert.Clicked += async (object sender, UIButtonEventArgs e) => { if(e.ButtonIndex == 0) { tcs.TrySetResult(false); alert.Dispose(); return; } var id = tb.Text; signIn(tcs,id); }; alert.Show (); return await tcs.Task; }
public override void ViewDidLoad () { base.ViewDidLoad (); tv.BecomeFirstResponder (); toolbar.Items[0].Clicked += (o, s) => { string text = tv.Text; NSData pdfData = CreatePDF (text, 500f, 700f); if (MFMailComposeViewController.CanSendMail) { _mail = new MFMailComposeViewController (); _mail.SetMessageBody (tv.Text, false); _mail.AddAttachmentData (pdfData, "text/x-pdf", "test.pdf"); _mail.Finished += HandleMailFinished; this.PresentModalViewController (_mail, true); } else { UIAlertView alert = new UIAlertView ("App", "Could not send mail.", null, "OK", null); alert.Show (); } }; toolbar.Items[1].Clicked += (o, s) => { _pdf = new PDFViewController (tv.Text); this.PresentModalViewController (_pdf, true); }; }
void ShowPopup(FavoriteViewModel vm) { if (null == vm) return; var popup = new UIAlertView(View.Frame); popup.Title = vm.Name; popup.AddButton("Fjern fra favoritter"); popup.AddButton("Vis detaljer"); popup.AddButton("Avbryt"); popup.CancelButtonIndex = 2; popup.Dismissed += (sender, e) => { switch(e.ButtonIndex) { case 0 : ViewModel.RemoveFavorite(vm.DocumentNumber, vm); break; case 1: ViewModel.ShowDetailsCommand.Execute(vm); break; } }; popup.Show(); }
void ShowPopup(ReservationViewModel vm) { if (null == vm) return; var popup = new UIAlertView(View.Frame); popup.Title = vm.DocumentTitle; popup.AddButton("Kanseller reservasjon"); popup.AddButton("Vis detaljer"); popup.AddButton("Avbryt"); popup.CancelButtonIndex = 2; popup.Dismissed += (sender, e) => { switch(e.ButtonIndex) { case 0 : ViewModel.RemoveReservation(vm); break; case 1: ViewModel.ShowDetailsCommand.Execute(vm); break; } }; popup.Show(); }
public override void ViewDidAppear(bool animated) { NavigationController.NavigationBar.BackgroundColor = UIColor.FromPatternImage(UIImage.FromFile("images/blue.png")); float border = 0; float gridHight = (View.Frame.Height - border) / elements.Count; float gridWidh = View.Frame.Width; float ypos = 0; float xpos = 0; for (int i = 0; i < elements.Count; i++) { elements[i].Frame = new RectangleF(xpos + border, ypos + border, gridWidh - 2 * border, gridHight - border); View.AddSubview(elements[i]); ypos += gridHight; } if (GymSettingsDataSource.UserName == null || GymSettingsDataSource.Password == null) { NavigationController.PushViewController(new GymSettingsViewController(), true); } else { TTTHttp.LogOn(); } if (TTTHttp.isError) { UIAlertView alert = new UIAlertView(); alert.Title = "Påloggingsfeil"; alert.Message = Text.getString(TTTHttp.ErrorMessage); alert.AddButton("OK"); alert.Show(); NavigationController.PushViewController(new GymSettingsViewController(), true); } }
private void FoundTransfer(object sender, EventArgs e) { if ((acccountmaskedEdit.Value == null || acccountmaskedEdit.Value.ToString() == string.Empty) || (descriptionmaskedEdit.Value == null || descriptionmaskedEdit.Value.ToString() == string.Empty) || (amountmaskedEdit.Value == null || amountmaskedEdit.Value.ToString() == string.Empty) || (emailIDmaskedEdit.Value == null || emailIDmaskedEdit.Value.ToString() == string.Empty) || (mobileNumbermaskedEdit.Value == null || mobileNumbermaskedEdit.Value.ToString() == string.Empty)) { UIAlertView v = new UIAlertView(); v.Title = "Results"; v.Message = "Please fill all the required data!"; v.AddButton("OK"); v.Show(); } else if (acccountmaskedEdit.HasError || descriptionmaskedEdit.HasError || amountmaskedEdit.HasError || emailIDmaskedEdit.HasError || mobileNumbermaskedEdit.HasError) { UIAlertView v = new UIAlertView(); v.Title = "Results"; v.Message = "Please enter valid details"; v.AddButton("OK"); v.Show(); } else { UIAlertView v1 = new UIAlertView(); v1.Title = "Results"; v1.AddButton("OK"); v1.Message = string.Format("Amount of {0} has been transferred successfully!", amountmaskedEdit.Text); v1.Show(); acccountmaskedEdit.Value = string.Empty; descriptionmaskedEdit.Value = string.Empty; amountmaskedEdit.Value = string.Empty; emailIDmaskedEdit.Value = string.Empty; mobileNumbermaskedEdit.Value = string.Empty; } this.BecomeFirstResponder(); }
public void ProcessNotification(NSDictionary options) { // Check to see if the dictionary has the aps key. This is the notification payload you would have sent if (null != options && options.ContainsKey(new NSString("aps"))) { //Get the aps dictionary var aps = options.ObjectForKey(new NSString("aps")) as NSDictionary; var alert = string.Empty; //Extract the alert text // NOTE: If you're using the simple alert by just specifying // " aps:{alert:"alert msg here"} ", this will work fine. // But if you're using a complex alert with Localization keys, etc., // your "alert" object from the aps dictionary will be another NSDictionary. // Basically the JSON gets dumped right into a NSDictionary, // so keep that in mind. if (aps.ContainsKey(new NSString("alert"))) { alert = (aps[new NSString("alert")] as NSString) ?? string.Empty; } //If this came from the ReceivedRemoteNotification while the app was running, // we of course need to manually process things like the sound, badge, and alert. //Manually show an alert if (!string.IsNullOrEmpty(alert)) { var avAlert = new UIAlertView("Notification", alert, null, "OK", null); avAlert.Show(); } var content = new ReceivedMessageEventArgs(alert, options); var message = OnMessageReceived; message?.Invoke(null, content); } }
private async Task <bool> EnsureLoggedInAsync() { bool loggedIn = false; try { // Create a challenge request for portal credentials (OAuth credential request for arcgis.com) CredentialRequestInfo challengeRequest = new CredentialRequestInfo(); // Use the OAuth implicit grant flow challengeRequest.GenerateTokenOptions = new GenerateTokenOptions { TokenAuthenticationType = TokenAuthenticationType.OAuthImplicit }; // Indicate the url (portal) to authenticate with (ArcGIS Online) challengeRequest.ServiceUri = new Uri(ServerUrl); // Call GetCredentialAsync on the AuthenticationManager to invoke the challenge handler var cred = await AuthenticationManager.Current.GetCredentialAsync(challengeRequest, false); loggedIn = cred != null; } catch (OperationCanceledException) { // Login was canceled // .. ignore, user can still search public maps without logging in } catch (Exception ex) { // Login failure var alert = new UIAlertView("Login Error", ex.Message, null, "OK", null); alert.Show(); } return(loggedIn); }
void ProcessNotification(NSDictionary options, bool fromFinishedLaunching) { // Check to see if the dictionary has the aps key. This is the notification payload you would have sent if (null != options && options.ContainsKey(new NSString("aps"))) { //Get the aps dictionary NSDictionary aps = options.ObjectForKey(new NSString("aps")) as NSDictionary; string alert = string.Empty; //Extract the alert text // NOTE: If you're using the simple alert by just specifying // " aps:{alert:"alert msg here"} ", this will work fine. // But if you're using a complex alert with Localization keys, etc., // your "alert" object from the aps dictionary will be another NSDictionary. // Basically the JSON gets dumped right into a NSDictionary, // so keep that in mind. if (aps.ContainsKey(new NSString("alert"))) { alert = (aps[new NSString("alert")] as NSString).ToString(); } //If this came from the ReceivedRemoteNotification while the app was running, // we of course need to manually process things like the sound, badge, and alert. if (!fromFinishedLaunching) { //Manually show an alert if (!string.IsNullOrEmpty(alert)) { string titlealert = string.Format("RCIDEMO CA Update"); UIAlertView avAlert = new UIAlertView(titlealert, alert, null, "OK", null); avAlert.Show(); } } } }
/* * https://developer.apple.com/library/mac/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/Chapters/ApplePushService.html * For Apple Push Notification Information and Keywords * From Windows Azure, We're sending: {"aps":{"alert":"Hello Vafied", "sound":"default", "badge": 1}} */ private void ProcessNotification(NSDictionary userInfo) { // Check to see if the dictionary has the aps key. This is the notification payload you would have sent if (userInfo == null) { return; } var apsString = new NSString("aps"); if (userInfo != null && userInfo.ContainsKey(apsString)) { var alertKey = new NSString("alert"); var aps = (NSDictionary)userInfo.ObjectForKey(apsString); if (aps.ContainsKey(alertKey)) { var alertMessage = (NSString)aps.ObjectForKey(alertKey); var alertView = new UIAlertView("Push Received", alertMessage, null, "OK", null); alertView.Show(); } } }
private void Share(ShareViewModel source) { var window = UIApplication.SharedApplication.KeyWindow; var subviews = window.Subviews; var view = subviews.Last(); var frame = view.Frame; var uidic = UIDocumentInteractionController.FromUrl(new NSUrl(source.FileName, true)); if (!uidic.PresentPreview(true)) { var rc = uidic.PresentOpenInMenu(frame, view, true); if (!rc) { UIAlertView alert = new UIAlertView() { Title = AppResources.FAILED_TO_OPEN_ATTACHMENT, Message = AppResources.ATTACHMENT_FILE_TYPE_NOT_SUPPORTED }; alert.AddButton(AppResources.OK); alert.Show(); } } }
partial void BarItemStorePressed(MonoTouch.Foundation.NSObject sender) { if (File.Exists(cart.Filename)) { // Delete cartridge and all files // Ask, if user wants to delete cartridge var alert = new UIAlertView(); alert.Title = Catalog.GetString("Delete"); alert.Message = Catalog.Format(Catalog.GetString("Would you delete the cartridge {0} and all log/save files?"), cart.Name); alert.AddButton(Catalog.GetString("Yes")); alert.AddButton(Catalog.GetString("No")); alert.Clicked += (s, e) => { if (e.ButtonIndex == 0) { if (File.Exists(cart.SaveFilename)) { File.Delete(cart.SaveFilename); } if (File.Exists(cart.LogFilename)) { File.Delete(cart.LogFilename); } if (File.Exists(cart.Filename)) { File.Delete(cart.Filename); } NavigationController.PopViewControllerAnimated(true); } }; alert.Show(); } else { // TODO: Save cartridge } }
public void SendEmail(EmailMessage message) { if (MFMailComposeViewController.CanSendMail) { var mailController = new MFMailComposeViewController(); mailController.SetToRecipients(new string[] { message.EmailAddress }); mailController.SetSubject(message.Subject); mailController.SetMessageBody(message.Message, false); mailController.Finished += (object s, MFComposeResultEventArgs args) => { Device.BeginInvokeOnMainThread(() => { args.Controller.DismissViewController(true, null); }); }; GetUIController().PresentViewController(mailController, true, null); } else { var alert = new UIAlertView("Mail not supported", "Can't send mail from this device", null, "OK"); alert.Show(); } }
async partial void UIButton249827_TouchUpInside(UIButton sender) { var bounds = UIScreen.MainScreen.Bounds; loadPop = new LoadingOverlay(bounds); View.Add(loadPop); string sEmail = txtForgotEmail.Text; bool bSuccess = await RestAPI.ForgotPassword(sEmail); if (bSuccess) { _msg = new UIAlertView(Lang.MESSAGE_HEADLINE, Lang.RESET_PASSWORD_LINK, null, Lang.BUTTON_OK, null); _msg.Show(); } else { _msg = new UIAlertView(Lang.MESSAGE_HEADLINE, Lang.NO_EMAIL_FOUND, null, Lang.BUTTON_OK, null); _msg.Show(); } loadPop.Hide(); }
public override void CommitEditingStyle(UITableView tableView, UITableViewCellEditingStyle editingStyle, MonoTouch.Foundation.NSIndexPath indexPath) { var section = Container.Root [indexPath.Section]; var element = section [indexPath.Row]; var item = element as ProjectElement; if (item == null) { return; } var count = Data.Database.Main.Table <ProjectImage>().Where(a => a.ProjectId == item.Project.Id).Count(); if (count > 0) { var alert = new UIAlertView { Title = "Confirm?", Message = "Are you sure you want to delete this project and all " + count + " images?" }; alert.CancelButtonIndex = alert.AddButton("No"); var ok = alert.AddButton("Yes"); alert.Clicked += (sender, e) => { if (e.ButtonIndex == ok) { _parent.Delete(item); } }; alert.Show(); } else { _parent.Delete(item); } }
void ProcessNotification(NSDictionary options, bool fromFinishedLaunching) { if (null != options && options.ContainsKey(new NSString("aps"))) { NSDictionary aps = options.ObjectForKey(new NSString("aps")) as NSDictionary; string alert = string.Empty; string type = string.Empty; string notification = string.Empty; if (aps.ContainsKey(new NSString("alert"))) { alert = (aps[new NSString("alert")] as NSString).ToString(); } //type = (aps[new NSString("Type")] as NSString).ToString(); if (!fromFinishedLaunching) { //notification = (aps[new NSString("Notification")] as NSString).ToString(); var avAlert = new UIAlertView("Tata App", alert, null, "Ok", null); avAlert.Show(); } } }
public override void AccessoryButtonTapped(UITableView tableView, NSIndexPath indexPath) { UIAlertView alert = new UIAlertView() { Title = tableItems[indexPath.Row].ToString(), Message = "¿Que desea hacer?" }; alert.AddButton("Editar"); alert.AddButton("Borrar"); alert.AddButton("Cancelar"); alert.Clicked += (s, o) => { if (o.ButtonIndex == 0) { editTaskView = new EditTaskView(); editTaskView.setTask(tableItems[indexPath.Row]); controller.NavigationController.PushViewController(editTaskView, true); } else if (o.ButtonIndex == 1) { delete(tableItems[indexPath.Row].idTarea); } }; alert.Show(); }
public void ShowPrompt(string title, string message, string affirmButton, string denyButton, Action <string> onAffirm, Action onDeny = null, string text = "", string placeholder = "", Func <string, bool> affirmEnableFunc = null, bool isPassword = false) { CancelAlert(); Utilities.Dispatch(() => { _Alert = new UIAlertView(title ?? string.Empty, message, null, denyButton, new string[] { affirmButton }) { AlertViewStyle = isPassword ? UIAlertViewStyle.SecureTextInput : UIAlertViewStyle.PlainTextInput }; var textField = _Alert.GetTextField(0); textField.Text = text; textField.SecureTextEntry = isPassword; textField.Placeholder = placeholder; _Alert.ShouldEnableFirstOtherButton = al => affirmEnableFunc?.Invoke(textField?.Text) ?? true; _Alert.Clicked += (s, e) => { if (_Alert.CancelButtonIndex == e.ButtonIndex) { onDeny?.Invoke(); } else { onAffirm?.Invoke(textField?.Text); } }; _Alert.Show(); }); }
// returns true if test run should still start bool ShowConnectionErrorAlert(string hostname, int port, Exception ex) { #if __TVOS__ || __WATCHOS__ return(true); #else // Don't show any alerts if we're running automated. if (AutoStart) { return(true); } // UIAlert is not available for extensions. if (NSBundle.MainBundle.BundlePath.EndsWith(".appex", StringComparison.Ordinal)) { return(true); } Console.WriteLine("Network error: Cannot connect to {0}:{1}: {2}.", hostname, port, ex); UIAlertView alert = new UIAlertView("Network Error", String.Format("Cannot connect to {0}:{1}: {2}. Continue on console ?", hostname, port, ex.Message), (IUIAlertViewDelegate)null, "Cancel", "Continue"); int button = -1; alert.Clicked += delegate(object sender, UIButtonEventArgs e) { button = (int)e.ButtonIndex; }; alert.Show(); while (button == -1) { NSRunLoop.Current.RunUntil(NSDate.FromTimeIntervalSinceNow(0.5)); } Console.WriteLine(button); Console.WriteLine("[Host unreachable: {0}]", button == 0 ? "Execution cancelled" : "Switching to console output"); return(button != 0); #endif }
void OnAuthenticationCompleted(object sender, AuthenticatorCompletedEventArgs e) { //App.SuccessfulLoginAction.Invoke(); UIAlertView alert = new UIAlertView() { Title = "確認" }; alert.AddButton("OK"); if (e.IsAuthenticated) { //App.Instance.SuccessfulLoginAction.Invoke(); // Use eventArgs.Account to do wonderful things //App.OAuth2Settings.SaveToken(e.Account.Properties["access_token"]); alert.Message = "認証成功"; alert.Show(); } else { // The user cancelled alert.Message = "認証キャンセル"; alert.Show(); } }
public void ShowPopup(EntryPopup popup) { var alert = new UIAlertView { Title = popup.Title, Message = popup.Text, AlertViewStyle = UIAlertViewStyle.PlainTextInput }; foreach (var b in popup.Buttons) { alert.AddButton(b); } alert.Clicked += (s, args) => { popup.OnPopupClosed(new EntryPopupClosedArgs { Button = popup.Buttons.ElementAt(Convert.ToInt32(args.ButtonIndex)), Text = alert.GetTextField(0).Text }); }; alert.Show(); }
protected void StartActivityAnimation(string title) { if (activityAlert != null) { StopActivityAnimation(); } activityAlert = new UIAlertView { Title = title }; var indicator = new UIActivityIndicatorView { ActivityIndicatorViewStyle = UIActivityIndicatorViewStyle.White, Center = new CGPoint(activityAlert.Bounds.GetMidX(), activityAlert.Bounds.GetMidY()), AutoresizingMask = UIViewAutoresizing.FlexibleMargins }; indicator.StartAnimating(); activityAlert.AddSubview(indicator); activityAlert.Show(); }
public TUM(IntPtr handle) : base(handle) { Title = NSBundle.MainBundle.LocalizedString("TUM", "TUM"); View.BackgroundColor = UIColor.White; webView = new UIWebView(View.Bounds); webView.ScrollView.ContentInset = new UIEdgeInsets(0, 0, 45, 0); View.AddSubview(webView); url = "http://ios.tum.pt/index.html"; webView.ScalesPageToFit = true; if (!Reachability.IsHostReachable("tum.pt")) { UIAlertView alert = new UIAlertView(); alert.Title = "Sem ligação à rede"; alert.AddButton("Continuar"); alert.Message = "Não conseguirá usar a aplicação sem conexão à rede."; alert.Show(); } else { webView.LoadRequest(new NSUrlRequest(new NSUrl(url))); } }
private static Nullable <int> ShowMessageBox( string title, string text, IEnumerable <string> buttons, int focusButton, MessageBoxIcon icon) { Nullable <int> result = null; if (!isMessageBoxShowing) { isMessageBoxShowing = true; UIAlertView alert = new UIAlertView(); alert.Title = title; foreach (string btn in buttons) { alert.AddButton(btn); } alert.Message = text; alert.Dismissed += delegate(object sender, UIButtonEventArgs e) { result = e.ButtonIndex; isMessageBoxShowing = false; }; alert.Clicked += delegate(object sender, UIButtonEventArgs e) { result = e.ButtonIndex; isMessageBoxShowing = false; }; UIApplication.SharedApplication.InvokeOnMainThread(delegate { alert.Show(); }); } isVisible = isMessageBoxShowing; return(result); }
public override void UpdatedTransactions(SKPaymentQueue queue, SKPaymentTransaction[] transactions) { foreach (SKPaymentTransaction transaction in transactions) { try { switch (transaction.TransactionState) { case SKPaymentTransactionState.Purchased: _inAppPurchases.CompleteTransaction(transaction); SKPaymentQueue.DefaultQueue.FinishTransaction(transaction); break; case SKPaymentTransactionState.Failed: _inAppPurchases.FailedTransaction(transaction); SKPaymentQueue.DefaultQueue.FinishTransaction(transaction); break; case SKPaymentTransactionState.Restored: _inAppPurchases.RestoreTransaction(transaction); SKPaymentQueue.DefaultQueue.FinishTransaction(transaction); break; default: break; } } catch (Exception e) { var alert = _alertView = new UIAlertView(); alert.Title = "Error"; alert.Message = "Unable to process transaction: " + e.Message; alert.Show(); } } }
private void SaveButtonClick(object sender, EventArgs e) { // Get the values entered in the text fields var clientId = _clientIdTextField.Text.Trim(); var redirectUrl = _redirectUrlTextField.Text.Trim(); // Make sure all required info was entered if (string.IsNullOrEmpty(clientId) || string.IsNullOrEmpty(redirectUrl)) { var alert = new UIAlertView("Error", "Please enter a client ID and redirect URL for OAuth authentication.", null, "OK", null); alert.Show(); return; } // Fire the OnOAuthPropsInfoEntered event and provide the map item values if (OnOAuthPropsInfoEntered != null) { // Create a new OAuthPropsSavedEventArgs to contain the user's values var oauthSaveEventArgs = new OAuthPropsSavedEventArgs(clientId, redirectUrl); // Raise the event OnOAuthPropsInfoEntered(sender, oauthSaveEventArgs); } }
public override void ViewDidLoad() { base.ViewDidLoad(); AppDelegate app = UIApplication.SharedApplication.Delegate as AppDelegate; //app.status this.NavigationController.NavigationBar.BarTintColor = COLOR_ACTIONBAR; this.NavigationController.NavigationBar.TintColor = UIColor.White; this.NavigationController.NavigationBar.BarStyle = UIBarStyle.Black; // this.NavigationController.NavigationBar.Translucent = true; //this.NavigationController.NavigationBar.SetBackgroundImage (new UIImage(), UIBarMetrics.Default); this.NavigationController.NavigationBar.BackgroundColor = COLOR_HIGHLIGHT; if (base.ViewModel is BaseViewModel) { ((BaseViewModel)base.ViewModel).ErrorHandler += (sender, e) => { ErrorEventArgs ee = (ErrorEventArgs)e; UIAlertView alert = new UIAlertView(ee.Title, ee.Message, null, ee.CloseTitle, null); alert.Show(); }; } }
public void PromtUserToEnableLocationService(Action callcack) { if (CLLocationManager.Status == CLAuthorizationStatus.Authorized) { return; } _onSuccessEnableLocationCallback = callcack; _locationManager.AuthorizationChanged += HandleAuthorizationChanged; if (CLLocationManager.Status == CLAuthorizationStatus.NotDetermined) { _locationManager.StartMonitoringSignificantLocationChanges(); _locationManager.StopMonitoringSignificantLocationChanges(); } else if ( CLLocationManager.Status == CLAuthorizationStatus.Restricted || CLLocationManager.Status == CLAuthorizationStatus.Denied ) { UIAlertView alert = new UIAlertView("Need to enable location service", "To use this feature you must enable location service in settings", null, "Ok"); alert.Show(); } }
public async Task <bool> Authenticate() { var success = false; var message = string.Empty; try { // Sign in with Facebook login using a server-managed flow. if (user == null) { user = await YodelManager.DefaultManager.CurrentClient .LoginAsync(UIApplication.SharedApplication.KeyWindow.RootViewController, MobileServiceAuthenticationProvider.Facebook); if (user != null) { Settings.AuthToken = user?.MobileServiceAuthenticationToken ?? string.Empty; Settings.UserId = user?.UserId ?? string.Empty; message = string.Format("You are now signed-in as {0}.", user.UserId); success = true; } } } catch (Exception ex) { message = ex.Message; } // Display the success or failure message. UIAlertView avAlert = new UIAlertView("Sign-in result", message, null, "OK", null); avAlert.Show(); return(success); }
private static Task <int?> PlatformShow(string title, string description, List <string> buttons) { tcs = new TaskCompletionSource <int?>(); UIApplication.SharedApplication.InvokeOnMainThread(delegate { alert = new UIAlertView(); alert.Title = title; alert.Message = description; foreach (string button in buttons) { alert.AddButton(button); } alert.Dismissed += (sender, e) => { if (!tcs.Task.IsCompleted) { tcs.SetResult((int)e.ButtonIndex); } }; alert.Show(); }); return(tcs.Task); }
/// <summary> /// Display a notification to the user with options. /// </summary> /// <param name="message"></param> /// <param name="title"></param> /// <param name="visualizerOptions"></param> /// <returns></returns> public async Task <IUICommand> ShowAsync(string message, string title, MessageVisualizerOptions visualizerOptions) { if (string.IsNullOrEmpty(message)) { message = string.Empty; } if (string.IsNullOrEmpty(title)) { title = string.Empty; } if (visualizerOptions == null) { visualizerOptions = new MessageVisualizerOptions(UICommand.Ok); } var alertDialog = new UIAlertView( title, message, null, visualizerOptions.Commands[0].Label, visualizerOptions.Commands.Skip(1).Select(c => c.Label).ToArray()); IUICommand selectedCommand = null; CancellationTokenSource cts = new CancellationTokenSource(); alertDialog.Dismissed += (sender, args) => { selectedCommand = visualizerOptions.Commands[(int)args.ButtonIndex]; cts.Cancel(); }; await Task.Delay(TimeSpan.MaxValue, cts.Token); return(selectedCommand); }
void ProcessNotification(NSDictionary userInfo) { if (userInfo == null) return; Console.WriteLine("Received Notification"); var apsKey = new NSString("aps"); if (userInfo.ContainsKey(apsKey)) { var alertKey = new NSString("alert"); var aps = (NSDictionary)userInfo.ObjectForKey(apsKey); if (aps.ContainsKey(alertKey)) { var alert = (NSString)aps.ObjectForKey(alertKey); try { var avAlert = new UIAlertView ("Evolve Update", alert, null, "OK", null); avAlert.Show (); } catch (Exception ex) { } Console.WriteLine("Notification: " + alert); } } }
public override void ViewDidLoad() { base.ViewDidLoad(); buttonAdd = new UIBarButtonItem(UIBarButtonSystemItem.Add); buttonAdd.Clicked += (sender, e) => { var arAdd = new UIAlertView("Load Url", "Enter a Wikitude World URL to Load:", null, "Cancel", "Load"); arAdd.AlertViewStyle = UIAlertViewStyle.PlainTextInput; arAdd.Clicked += (sender2, e2) => { var tf = arAdd.GetTextField(0); var url = tf.Text; var isOk = true; try { var uri = new Uri(url); } catch { isOk = false; } if (isOk) { AddUrl(url); Reload(); arController = new ARViewController(url, true); NavigationController.PushViewController(arController, true); } }; arAdd.Show(); }; NavigationItem.RightBarButtonItem = buttonAdd; Reload(); }
public static async Task <bool> AskToUseCloud() { var askCloudAlert = new UIAlertView( "iCloud", "Should documents be stored in iCloud and made available on all your devices?", null, "Local Only", "Use iCloud"); var tcs = new TaskCompletionSource <bool> (); askCloudAlert.Clicked += (s, e) => { try { var useCloud = e.ButtonIndex == 1; tcs.SetResult(useCloud); } catch (Exception ex) { Log.Error(ex); } }; askCloudAlert.Show(); return(await tcs.Task); }