当前位置: 首页>>代码示例>>C#>>正文


C# UIAlertView.DismissWithClickedButtonIndex方法代码示例

本文整理汇总了C#中UIAlertView.DismissWithClickedButtonIndex方法的典型用法代码示例。如果您正苦于以下问题:C# UIAlertView.DismissWithClickedButtonIndex方法的具体用法?C# UIAlertView.DismissWithClickedButtonIndex怎么用?C# UIAlertView.DismissWithClickedButtonIndex使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在UIAlertView的用法示例。


在下文中一共展示了UIAlertView.DismissWithClickedButtonIndex方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ShowProgressDialog

        public static void ShowProgressDialog(string title, string message, Action action) {
            UIAlertView dialog = new UIAlertView(title, message, null, null);
            dialog.Show();
			_indicatorViewLeftCorner.Hidden = false;
            action();
            dialog.DismissWithClickedButtonIndex(0, true);
        }
开发者ID:MBrekhof,项目名称:pleiobox-clients,代码行数:7,代码来源:DialogHelper.cs

示例2: SignIn

		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;
		}
开发者ID:nagyist,项目名称:iPadPos,代码行数:29,代码来源:PaymentViewController.cs

示例3: ViewDidLoad

        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            _client = new TwitterClient();

            var loading = new UIAlertView("Downloading Tweets", "Please wait...", null, null, null);
            loading.Show();

            var indicator = new UIActivityIndicatorView(UIActivityIndicatorViewStyle.WhiteLarge);
            indicator.Center = new System.Drawing.PointF(loading.Bounds.Width / 2, loading.Bounds.Size.Height - 40);
            indicator.StartAnimating();
            loading.AddSubview (indicator);

            _client.GetTweetsForUser ("OReillyMedia", tweets =>
            {
                InvokeOnMainThread(() =>
              	{
                    TableView.Source = new TwitterTableViewSource(tweets);
                    TableView.ReloadData();
                    loading.DismissWithClickedButtonIndex (0, true);
                });
            });

            _client.MentionReceived += (object sender, MentionEventArgs args) =>
            {
                InvokeOnMainThread(() =>
                    new UIAlertView("Mention Received", args.Tweet.Text,
                                    null, "Ok", null).Show());
            };
        }
开发者ID:jorik041,项目名称:MobileDevelopmentInCSharpBook,代码行数:31,代码来源:TwitterViewController.cs

示例4: DisplayToast

        public async override void DisplayToast(MessageDisplayParams messageParams, bool quick)
        {
            var alert = new UIAlertView(string.Empty, messageParams.Message, null, null, null);
            alert.Show();

            await Task.Delay(quick ? ShortToastDuration : LongToastDuration);
            alert.DismissWithClickedButtonIndex(0, true);
        }
开发者ID:sgmunn,项目名称:Mobile.Mvvm,代码行数:8,代码来源:AlertMessageDisplay.cs

示例5: Show

        public static void Show(string message, int timeout)
        {
            var timer = new System.Timers.Timer (timeout);
            var alert = new UIAlertView{ Message = message };

            timer.Elapsed += delegate {
                timer.Stop ();
                alert.InvokeOnMainThread (delegate {
                    alert.DismissWithClickedButtonIndex (0, animated:true);
                });
            };
            alert.Show ();
            timer.Start ();
        }
开发者ID:agzam,项目名称:bunk1-iphoneApp,代码行数:14,代码来源:MessageBox.cs

示例6: Confirm

 public void Confirm(string title, string text, Action<int> callback, string button1 = "Отмена", string button2 = "ОК")
 {
     UIAlertView alert = new UIAlertView(title, text, null,
         NSBundle.MainBundle.LocalizedString (button1, button1),
         NSBundle.MainBundle.LocalizedString (button2, button2));
     alert.Show ();
     alert.Clicked += (sender, buttonArgs) =>  {
         if(buttonArgs.ButtonIndex == 0)
         {
             alert.DismissWithClickedButtonIndex(0, false);
         }
         callback.Invoke((int)(buttonArgs.ButtonIndex));
     };
 }
开发者ID:welb-studio,项目名称:ClothesAndWeather,代码行数:14,代码来源:AppDelegate.cs

示例7: ViewDidLoad

        public async override void ViewDidLoad()
        {
            base.ViewDidLoad();

            if (Initialized) return;
            Initialized = true;

            this.View = new MainView();

            // create binding manager
            Bindings = new BindingManager(this.View);

            ((MainView)this.View).btnSave.TouchUpInside += SaveButton_Click;
            ((MainView)this.View).btnCancel.TouchUpInside += CancelButton_Click;
            ((MainView)this.View).btnMarkForDelete.TouchUpInside += DeleteButton_Click;

            ((MainView)this.View).txtName.ShouldReturn += (textField) =>
            {
              textField.ResignFirstResponder();
              return true;
            };

            var waitingOverlay = new WaitingOverlay(UIScreen.MainScreen.Bounds, "Loading...");
            View.Add(waitingOverlay);

            try
            {
                this.Model = await CustomerEdit.GetCustomerEditAsync(1);
                InitializeBindings(this.Model);
            }
            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
            {
                waitingOverlay.Hide();
            }
        }
开发者ID:BiYiTuan,项目名称:csla,代码行数:43,代码来源:MainViewController.cs

示例8: ViewDidAppear

        public override void ViewDidAppear(bool animated)
        {
            base.ViewDidAppear (animated);

            _client = new RemoteDataRepository (_baseUrl);

            var loading = new UIAlertView ("Downloading Session", "Please wait...", null, null, null);

            loading.Show ();

            var indicator = new UIActivityIndicatorView (UIActivityIndicatorViewStyle.WhiteLarge);
            indicator.Center = new System.Drawing.PointF (loading.Bounds.Width / 2, loading.Bounds.Size.Height - 40);
            indicator.StartAnimating ();
            loading.AddSubview (indicator);

            _client.GetSession ("CodeMash-2012", this.SessionSlug, session =>
            {
                InvokeOnMainThread (() =>
                {
                    //new UIAlertView ("Session", session.title, null, "Ok", null).Show ();
                    this.sessionTitleLabel.Text = session.title;
                    this.sessionEndLabel.Text = session.end.ToString ();
                    this.sessionStartLabel.Text = session.start.ToString();
                    this.sessionTwitterHashTagLabel.Text = session.twitterHashTag;
                    loading.DismissWithClickedButtonIndex (0, true);
                }
                );
            }
            );

            // Perform any additional setup after loading the view, typically from a nib.

            //this.TableView.Source = new DataSource (this);

            //			if (!UserInterfaceIdiomIsPhone) {
            //				this.TableView.SelectRow (
            //					NSIndexPath.FromRowSection (0, 0),
            //					false,
            //					UITableViewScrollPosition.Middle
            //				);
            //			}
        }
开发者ID:akeresztesgh,项目名称:tekconf,代码行数:42,代码来源:SessionDetailViewController.cs

示例9: PromptTextBox

 public Task<string> PromptTextBox(string title, string message, string defaultValue, string okTitle)
 {
     var tcs = new TaskCompletionSource<string>();
     var alert = new UIAlertView();
     alert.Title = title;
     alert.Message = message;
     alert.AlertViewStyle = UIAlertViewStyle.PlainTextInput;
     var cancelButton = alert.AddButton("Cancel".t());
     var okButton = alert.AddButton(okTitle);
     alert.CancelButtonIndex = cancelButton;
     alert.DismissWithClickedButtonIndex(cancelButton, true);
     alert.GetTextField(0).Text = defaultValue;
     alert.Clicked += (s, e) =>
     {
         if (e.ButtonIndex == okButton)
             tcs.SetResult(alert.GetTextField(0).Text);
         else
             tcs.SetCanceled();
     };
     alert.Show();
     return tcs.Task;
 }
开发者ID:rcaratchuk,项目名称:CodeFramework,代码行数:22,代码来源:AlertDialogService.cs

示例10: ViewWillAppear

		public override void ViewWillAppear (bool animated)
		{
			base.ViewWillAppear (animated);
			Title = PlayerOption == PlayerOption.Stream ? "Stream " : "Stream & Save";
			playPauseButton.TitleLabel.Text = "Pause";
			timeLabel.Text = string.Empty;

			// Create a shared intance session & check
			var session = AVAudioSession.SharedInstance ();
			if (session == null) {
				var alert = new UIAlertView ("Playback error", "Unable to playback stream", null, "Cancel");
				alert.Show ();
				alert.Clicked += (object sender, UIButtonEventArgs e) => alert.DismissWithClickedButtonIndex (0, true);
			} else {
				StartPlayback ();
				IsPlaying = true;

				// Set up the session for playback category
				NSError error;
				session.SetCategory (AVAudioSessionCategory.Playback, AVAudioSessionCategoryOptions.DefaultToSpeaker);
				session.OverrideOutputAudioPort (AVAudioSessionPortOverride.Speaker, out error);
			}
		}
开发者ID:CBrauer,项目名称:monotouch-samples,代码行数:23,代码来源:PlayerViewController.cs

示例11: PlayAudio

        public void PlayAudio(byte[] audioRecording, string fileExtension)
        {
            if (_player != null)
            {
                _player.Dispose();
                _player = null;
            }
            var session = AVAudioSession.SharedInstance();
            if (session == null || audioRecording == null)
            {
                var alert = new UIAlertView("Playback error", "Unable to playback stream", null, "Cancel");
                alert.Show();
                alert.Clicked += (object senderObj, UIButtonEventArgs arg) => alert.DismissWithClickedButtonIndex(0, true);
            }
            else
            {
                NSError error;
                ObjCRuntime.Class.ThrowOnInitFailure = false;
                session.SetCategory(AVAudioSessionCategory.Playback);
                session.SetActive(true, out error);
                var documents = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
                var temp = Path.Combine(documents, "..", "tmp");
                _tempAudioFile = Path.Combine(temp, Guid.NewGuid() + fileExtension);
                File.WriteAllBytes(_tempAudioFile, audioRecording);
                using (var url = new NSUrl(_tempAudioFile))
                {
                    _player = AVAudioPlayer.FromUrl(url, out error);
                }

                _player.Volume = 1.0f;
                _player.NumberOfLoops = 0;
                _player.FinishedPlaying += player_FinishedPlaying;
                _player.PrepareToPlay();
                _player.Play();
            }
        }
开发者ID:Magenic,项目名称:WhitepaperPerformance,代码行数:36,代码来源:MediaService.cs

示例12: AttachSocketEvents

		private void AttachSocketEvents (UIAlertView alert)
		{
			// Whenever the server emits "login", log the login message
			socket.On ("login", data => {
				if (alert != null) {
					InvokeOnMainThread (() => alert.DismissWithClickedButtonIndex (0, true));
					alert = null;
				}

				var d = Data.FromData (data);
				connected = true;
				// Display the welcome message
				AddMessage ("Welcome to Socket.IO Chat – ", true);
				AddParticipantsMessage (d.numUsers);
			});
			// Whenever the server emits "new message", update the chat body
			socket.On ("new message", data => {
				var d = Data.FromData (data);
				AddMessage (d.message, username: d.username);
			});
			// Whenever the server emits "user joined", log it in the chat body
			socket.On ("user joined", data => {
				var d = Data.FromData (data);
				AddMessage (d.username + " joined");
				AddParticipantsMessage (d.numUsers);
			});
			// Whenever the server emits "user left", log it in the chat body
			socket.On ("user left", data => {
				var d = Data.FromData (data);
				AddMessage (d.username + " left");
				AddParticipantsMessage (d.numUsers);
				UpdateChatTyping (d.username, true);
			});
			// Whenever the server emits "typing", show the typing message
			socket.On ("typing", data => {
				var d = Data.FromData (data);
				UpdateChatTyping (d.username, false);
			});
			// Whenever the server emits "stop typing", kill the typing message
			socket.On ("stop typing", data => {
				var d = Data.FromData (data);
				UpdateChatTyping (d.username, true);
			});
		}
开发者ID:rong77,项目名称:SocketIoClientDotNet,代码行数:44,代码来源:ChatViewController.cs

示例13: SaveButton_Click

        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();
            }
        }
开发者ID:BiYiTuan,项目名称:csla,代码行数:32,代码来源:MainViewController.cs

示例14: ViewDidLoad

        public override void ViewDidLoad()
        {
            base.ViewDidLoad ();

            var backgroundImage = UIImage.FromBundle(@"images/appview/bg");
            //this.View.BackgroundColor = UIColor.FromPatternImage(backgroundImage);

            _client = new RemoteDataRepository (_baseUrl);

            var loading = new UIAlertView (" Downloading Sessions", "Please wait...", null, null, null);

            loading.Show ();

            var indicator = new UIActivityIndicatorView (UIActivityIndicatorViewStyle.WhiteLarge);
            indicator.Center = new System.Drawing.PointF (loading.Bounds.Width / 2, loading.Bounds.Size.Height - 40);
            indicator.StartAnimating ();
            loading.AddSubview (indicator);

            //			_client.GetFullConference("CodeMash-2012", conference => {
            //				var connectionString = Path.Combine (Environment.GetFolderPath (Environment.SpecialFolder.MyDocuments), "conferences.db");
            //				var localDatabase = new LocalDatabase(connectionString);
            //				localDatabase.CreateDatabase();
            //
            //				var conferenceMapper = new ConferenceDtoToConferenceEntityMapper();
            //				var conferenceEntity = conferenceMapper.Map(conference);
            //
            //				var sessionMapper = new SessionDtoToSessionEntityMapper();
            //				var sessions = sessionMapper.MapAll(conferenceEntity.Id, conference.sessions.AsEnumerable());
            //				//localDatabase.SaveSessions(sessions);
            //
            //				var speakersMapper = new SessionDtoToSessionEntityMapper();
            //				var speakerEntities = speakersMapper.MapAll(conferenceEntity.Id, conference.speakers.AsEnumerable());
            //				localDatabase.SaveConference(conferenceEntity, sessions, speakers);
            //
            //			});
            _client.GetSessions ("CodeMash-2012", sessions =>
            {
                InvokeOnMainThread (() =>
                {
                    TableView.Source = new SessionsTableViewSource (this, sessions);
                    TableView.ReloadData ();
                    loading.DismissWithClickedButtonIndex (0, true);
                });
            }
            );

            // Perform any additional setup after loading the view, typically from a nib.

            //this.TableView.Source = new DataSource (this);

            if (!UserInterfaceIdiomIsPhone)
                this.TableView.SelectRow (
                    NSIndexPath.FromRowSection (0, 0),
                    false,
                    UITableViewScrollPosition.Middle
                );
        }
开发者ID:akeresztesgh,项目名称:tekconf,代码行数:57,代码来源:SessionsListRootViewController.cs

示例15: DeleteButton_Click

        private async void DeleteButton_Click(object sender, EventArgs ea)
        {
            var waitingOverlay = new WaitingOverlay(UIScreen.MainScreen.Bounds, "Deleting...");
            View.Add(waitingOverlay);

            try
            {
                this.Model.Delete();
                this.Model.ApplyEdit();
                var returnModel = await this.Model.SaveAsync();
                InitializeBindings(returnModel);
            }
            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
            {
                waitingOverlay.Hide();
            }
        }
开发者ID:BiYiTuan,项目名称:csla,代码行数:25,代码来源:MainViewController.cs


注:本文中的UIAlertView.DismissWithClickedButtonIndex方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。