本文整理汇总了C#中INavigation.PopAsync方法的典型用法代码示例。如果您正苦于以下问题:C# INavigation.PopAsync方法的具体用法?C# INavigation.PopAsync怎么用?C# INavigation.PopAsync使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类INavigation
的用法示例。
在下文中一共展示了INavigation.PopAsync方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FundsTransferViewModel
public FundsTransferViewModel (INavigation navigation, Page currentPage)
{
Navigation = navigation;
CancelCommand = new Command(async () => await Navigation.PopAsync());
TransferCommand = new Command(async () => await currentPage.DisplayAlert("Transfer", "Success", "Ok"));
}
示例2: NewUserViewModel
public NewUserViewModel(INavigation nav)
{
SendEmail = new Command (async () => {
if(String.IsNullOrEmpty(Email)) return;
//send email
await nav.PopAsync();
});
}
示例3: ContentPageXaml
public ContentPageXaml(Document selecteDocument, string parentName,INavigation navigation)
{
InitializeComponent();
try
{
if (Device.OS == TargetPlatform.iOS)
{
// move layout under the status bar
this.pageButton.HeightRequest = 30;
this.pageButton.BackgroundColor = Color.Gray;
this.Padding = new Thickness(0, Device.OnPlatform(20,0,0), 0, 0);
}
(Application.Current.MainPage as MasterDetailPage).IsGestureEnabled = false;
_navigation = navigation;
NavigationPage.SetHasNavigationBar(this,false);
BindingContext = new ViewModels.TransformImageViewModel(selecteDocument);
this.backButton.Clicked += async(sender, e) =>
{
(Application.Current.MainPage as MasterDetailPage).IsGestureEnabled = true;
_navigation.PopAsync();
};
this.pageButton.Clicked+= async(sender, e) =>
{
var str = new List<string>();
for (int i = 1; i <= ViewModel.TotalPage; i++)
{
str.Add("Page " + i.ToString());
}
var action = await DisplayActionSheet ("Go To Page", "Cancel", null, str.ToArray());
if(action != null)
{
if(action.ToUpper().Contains("PAGE"))
{
int page = Convert.ToInt32(action.ToUpper().Replace("PAGE ",""));
if(ViewModel.CurrentPage != page)
{
ViewModel.CurrentPage = page;
ViewModel.CurrentPickerPage = ViewModel.CurrentPage.ToString();
ViewModel.ImageSource = null;
Task.Run(() => ViewModel.RefreshImage(page, ViewModel.FolderName, "", false));
}
}
}
};
}
catch (Exception ex)
{
DisplayAlert("Error", "An exception occurred.", "OK");
}
}
示例4: NavigateToSample
public async Task NavigateToSample(INavigation navigation){
SampleCoordinator.RaiseSampleSelected (this);
if (_justNotifyNavigateIntent) {
return;
}
if (_customNavigation != null) {
_customNavigation (navigation);
return;
}
int popCount = 0;
int firstPageToPopIndex = 0;
for (int i = navigation.NavigationStack.Count - 1; i >= 0; i--) {
if (navigation.NavigationStack [i].GetType () == _pageType) {
firstPageToPopIndex = i + 1;
popCount = navigation.NavigationStack.Count - 1 - i;
break;
}
}
if (popCount > 0) {
for (int i = 1; i < popCount; i++) {
navigation.RemovePage(navigation.NavigationStack[firstPageToPopIndex]);
}
await navigation.PopAsync ();
return;
}
var page = CreateContentPage ();
if (_modal) {
await navigation.PushModalAsync (new NavigationPage(page));
} else {
await navigation.PushAsync (page);
}
}
示例5: AddMonkeyPageViewModel
public AddMonkeyPageViewModel(INavigation navigation)
{
Photo = DefaultPhoto;
var dataManager = App.MonkeyDataManager;
PickPhotoCommand = new Command(async () => {
image = await Plugin.Media.CrossMedia.Current.PickPhotoAsync();
if(image!=null)
Photo = ImageSource.FromFile(image.Path);
});
UploadPhotoCommand = new Command(async ()=> {
if (!string.IsNullOrEmpty(Status) && image != null)
{
var monkey = new Models.Monkey { Status = this.Status, UserName= App.UserName };
await dataManager.SaveMonkeyAsync(monkey);
await dataManager.AddImage(monkey, image.Path);
if (navigation != null)
await navigation.PopAsync();
}
});
}
示例6: DoPop
protected static Task<Page> DoPop(INavigation navigation, bool useModalNavigation, bool animated)
{
if (useModalNavigation)
return navigation.PopModalAsync(animated);
else
return navigation.PopAsync(animated);
}