本文整理汇总了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);
}
示例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);
}
示例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);
}
示例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);
}
}
示例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);
});
}
示例6: AuthorizeUser
public void AuthorizeUser (UIViewController parent, NSAction callback)
{
var authweb = new AuthorizationViewController (this, config.AuthorizeUrl + "?oauth_token=" + RequestToken, callback);
parent.PresentModalViewController (authweb, true);
}
示例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);
}
示例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);
}
});
}
示例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);
}
}
示例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;
}
}
示例11: NewComment
public void NewComment (UIViewController parent, Action action)
{
_navItem.Title = Title;
ReturnAction = action;
_previousController = parent;
_composerView.textView.BecomeFirstResponder ();
parent.PresentModalViewController (this, true);
}
示例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 ();
}
示例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 ();
}