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


C# UIViewController.PresentModalViewController方法代码示例

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


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

示例1: SelectPicture

		public static void SelectPicture (UIViewController parent, Action<NSDictionary> callback)
		{
			Init ();
			picker.SourceType = UIImagePickerControllerSourceType.PhotoLibrary;
			_callback = callback;
			parent.PresentModalViewController (picker, true);
		}
开发者ID:Securecom,项目名称:Securecom-Messaging-iOS,代码行数:7,代码来源:Camera.cs

示例2: PickContact

        public static void PickContact(UIViewController view, Action<ABPerson> picked)
        {
            /*
            ABAddressBook ab = new ABAddressBook();
            ABPerson p = new ABPerson();

            p.FirstName = "Brittani";
            p.LastName = "Clancey";

            ABMutableMultiValue<string> phones = new ABMutableStringMultiValue();
            phones.Add("9079470168", ABPersonPhoneLabel.Mobile);

            p.SetPhones(phones);

            ab.Add(p);
            ab.Save();
            */

            picker = new ABPeoplePickerNavigationController ();
            //picker.DismissModalViewControllerAnimated (true);
                //picker.Dispose();
            picker.SelectPerson += delegate(object sender, ABPeoplePickerSelectPersonEventArgs e) { picked (e.Person); };

            picker.PerformAction += delegate(object sender, ABPeoplePickerPerformActionEventArgs e) { };

            picker.Cancelled += delegate {
                picker.DismissModalViewControllerAnimated (true);
                picked (null);
                picker.Dispose ();
            };
            view.PresentModalViewController (picker, true);
        }
开发者ID:Clancey,项目名称:ClanceyLib,代码行数:32,代码来源:AddressBook.cs

示例3: SelectPicture

		public static void SelectPicture (UIViewController parent, Action<UIImage> callback, Action onCancel)
		{
			Init ();
			picker.SourceType = UIImagePickerControllerSourceType.PhotoLibrary;
			_callbackImg = callback;
			_oncancel = onCancel;
			if (parent != null)
				parent.PresentModalViewController (picker, true);
		}
开发者ID:21Off,项目名称:21Off,代码行数:9,代码来源:Camera.cs

示例4: ShowCredentialDetails

        public static void ShowCredentialDetails(Credential credential, UIViewController controller, UITableView tableView)
        {
            bool isNew = credential.Id == 0;

            var binding = new BindingContext(null, credential, isNew ? "Add Credential" : credential.Name);
            var dialogViewController = new DialogViewController(binding.Root);

            if ( controller is UINavigationController )
            {
                var navController = (controller as UINavigationController);

                navController.PushViewController(dialogViewController, true);
                navController.NavigationBarHidden = false;

                UIBarButtonItem addButton = new UIBarButtonItem (UIBarButtonSystemItem.Save);
                dialogViewController.NavigationItem.HidesBackButton = false;
                dialogViewController.NavigationItem.RightBarButtonItem = addButton;

                addButton.Clicked += (sender, e) =>
                {
                    binding.Fetch();
                    binding.Root.Caption = credential.Name;

                    if (ClientInterface.SaveCredential(credential)
                        && tableView != null)
                    {
                        tableView.ReloadData();
                    }

                    navController.PopViewControllerAnimated(true);
                };
            }
            else
            {
                controller.PresentModalViewController(dialogViewController, true);
            }
        }
开发者ID:MrPerphekt,项目名称:theVault,代码行数:37,代码来源:CredentialHelper.cs

示例5: ReportError

		public static void ReportError (UIViewController current, Exception e, string msg)
		{
			var root = new RootElement (Locale.GetText ("Error")) {
				new Section (Locale.GetText ("Error")) {
					new StyledStringElement (msg){
						Font = UIFont.BoldSystemFontOfSize (14),
					}
				}
			};
			
			if (e != null){
				root.Add (new Section (e.GetType ().ToString ()){
					new StyledStringElement (e.Message){
						Font = UIFont.SystemFontOfSize (14),
					}
				});
				root.Add (new Section ("Stacktrace"){
					new StyledStringElement (e.ToString ()){
						Font = UIFont.SystemFontOfSize (14),
					}
				});
			};
			
			// Delay one second, as UIKit does not like to present
			// views in the middle of an animation.
			NSTimer.CreateScheduledTimer (TimeSpan.FromSeconds (1), delegate {
				UINavigationController nav = null;
				DialogViewController dvc = new DialogViewController (root);
				dvc.NavigationItem.LeftBarButtonItem = new UIBarButtonItem (Locale.GetText ("Close"), UIBarButtonItemStyle.Plain, delegate {
					nav.DismissModalViewControllerAnimated (false);
				});
				
				nav = new UINavigationController (dvc);
				current.PresentModalViewController (nav, false);	
			});
		}
开发者ID:21Off,项目名称:21Off,代码行数:36,代码来源:Util.cs

示例6: AuthorizeUser

		public void AuthorizeUser (UIViewController parent, NSAction callback)
		{
			var authweb = new AuthorizationViewController (this, config.AuthorizeUrl + "?oauth_token=" + RequestToken, callback);
			
			parent.PresentModalViewController (authweb, true);
		}
开发者ID:21Off,项目名称:21Off,代码行数:6,代码来源:OAuthAuthorizer.cs

示例7: SignIn

            public override void SignIn(UIViewController container, Action<bool> callback)
            {
                signinController = new InstapaperSignInController (this, result => {
                    signinController.Dispose ();
                    signinController = null;
                    callback (result);
                });

                container.PresentModalViewController (signinController, true);
            }
开发者ID:sdether,项目名称:TweetStation,代码行数:10,代码来源:Instapaper.cs

示例8: Activate

        void Activate(UIViewController parent)
        {
            previousController = parent;
            composerView.textView.BecomeFirstResponder ();
            parent.PresentModalViewController (this, true);

            if (Util.Defaults.IntForKey ("disableMusic") != 0)
                return;

            // Give some room to breathe on old systems
            NSTimer.CreateScheduledTimer (1, delegate {
                try {
                    if (player == null)
                        player = new AudioPlay ("Audio/composeaudio.mp3");
                    player.Play ();
                } catch (Exception e){
                    Console.WriteLine (e);
                }
            });
        }
开发者ID:nagyist,项目名称:TweetStation,代码行数:20,代码来源:Composer.cs

示例9: Activate

        void Activate(UIViewController parent)
        {
            previousController = parent;
            composerView.textView.BecomeFirstResponder ();
            parent.PresentModalViewController (this, true);

            if (Util.Defaults.IntForKey ("disableMusic") != 0)
                return;

            try {
                if (player == null)
                    player = new AudioPlay ("Audio/composeaudio.mp3");
                player.Play ();
            } catch (Exception e){
                Console.WriteLine (e);
            }
        }
开发者ID:kangaroo,项目名称:TweetStation,代码行数:17,代码来源:Composer.cs

示例10: Login

		/// <summary>
		/// Starts the login process.
		/// </summary>
		public void Login(UIViewController parent, bool animate)
		{
			switch (Config.Network)
			{
				case SocialNetwork.Facebook:
					{
						var config = (FacebookConfig)Config;
						var authorizor = new FacebookAuthorizationViewController(config.AppID,
#if true // fel
							config.Permissions, FbDisplayType.Popup);
#else
							config.Permissions, FbDisplayType.Touch);
#endif
				
						authorizor.AccessToken += delegate(string accessToken, DateTime expires) {
							try
							{
								var wc = new System.Net.WebClient();
								var result = wc.DownloadData("https://graph.facebook.com/me?access_token="+accessToken);
								var stream = new MemoryStream(result);						
								var jsonArray = (System.Json.JsonObject)System.Json.JsonObject.Load(stream);
								string username = jsonArray["name"].ToString().Replace("\"", "");
								this.UserId = jsonArray["id"].ToString().Replace("\"", "");
								this.AccessToken = accessToken;
								this.Username = username;
#if true // fel
								this.ExpirationDate = expires;
#endif
								parent.BeginInvokeOnMainThread(delegate{
									parent.DismissModalViewControllerAnimated(animate);
									OnSuccess();
								});
							}
							catch (Exception ex)
							{
								OnFailure();
							}
						};
				
						authorizor.Canceled += delegate {
							OnFailure();
						};
				
						authorizor.AuthorizationFailed += delegate {
							OnFailure();
						};
				
						parent.BeginInvokeOnMainThread(delegate{
							parent.PresentModalViewController(authorizor,animate);
						});
					}
					break;
				case SocialNetwork.Twitter:
					{
						var config = (TwitterConfig)Config;
						var authorizor = new TweetStation.OAuthAuthorizer(new TweetStation.OAuthConfig(){
							ConsumerKey = config.ConsumerKey,
							ConsumerSecret = config.ConsumerSecret,
							Callback = config.Callback,
							RequestTokenUrl = "https://api.twitter.com/oauth/request_token",
							AccessTokenUrl = "https://api.twitter.com/oauth/access_token",
							AuthorizeUrl = "https://api.twitter.com/oauth/authorize"
						});
						parent.BeginInvokeOnMainThread(delegate {
							authorizor.AcquireRequestToken();
							authorizor.AuthorizeUser(parent,delegate(){
								if (authorizor.AccessScreenname != "")
								{
									this.Username = authorizor.AccessScreenname;
									this.AccessToken = authorizor.AccessToken;
									this.AccessTokenSecret = authorizor.AccessTokenSecret;
									OnSuccess();
								}
								else
								{
									OnFailure();
								}
							});
						});
					}
					break;
			}
		}
开发者ID:21Off,项目名称:21Off,代码行数:86,代码来源:SocialLogin.cs

示例11: NewComment

		public void NewComment (UIViewController parent, Action action)
		{
            _navItem.Title = Title;
            ReturnAction = action;
            _previousController = parent;
            _composerView.textView.BecomeFirstResponder ();
            parent.PresentModalViewController (this, true);
		}
开发者ID:envy4s,项目名称:Gistacular,代码行数:8,代码来源:Composer.cs

示例12: OpenHtmlString

		public static void OpenHtmlString (UIViewController parent, string htmlString, NSUrl baseUrl)
		{
			UIView.BeginAnimations ("foo");
			Main.HidesBottomBarWhenPushed = true;
			Main.SetupWeb ("");
			
			Main.WebView.LoadHtmlString (htmlString, baseUrl);
			//parent.ActivateController (Main);
			parent.PresentModalViewController(Main, false);
			UIView.CommitAnimations ();
		}
开发者ID:21Off,项目名称:21Off,代码行数:11,代码来源:WebUI.cs

示例13: OpenUrl

		public static void OpenUrl (UIViewController parent, string url)
		{
			UIView.BeginAnimations ("foo");
			Main.HidesBottomBarWhenPushed = true;
			Main.SetupWeb (url);
			
			if (url.StartsWith ("http://")){
				string host;
				int last = url.IndexOf ('/', 7);
				if (last == -1)
					host = url.Substring (7);
				else 
					host = url.Substring (7, last-7);
				url = "http://" + EncodeIdna (host) + (last == -1 ? "" : url.Substring (last));
			}
			Main.WebView.LoadRequest (new NSUrlRequest (new NSUrl (url)));
			
			parent.PresentModalViewController (Main, true);

			UIView.CommitAnimations ();
		}
开发者ID:21Off,项目名称:21Off,代码行数:21,代码来源:WebUI.cs


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