本文整理汇总了C#中INavigationService.GoBack方法的典型用法代码示例。如果您正苦于以下问题:C# INavigationService.GoBack方法的具体用法?C# INavigationService.GoBack怎么用?C# INavigationService.GoBack使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类INavigationService
的用法示例。
在下文中一共展示了INavigationService.GoBack方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ThirdViewModel
public ThirdViewModel(INavigationService navigationService)
{
if (navigationService == null) throw new ArgumentNullException("navigationService");
_navigationService = navigationService;
NavigateCommand = new RelayCommand(() => { _navigationService.GoBack(); });
}
示例2: AddServicePageViewModel
public AddServicePageViewModel(
IServicesManager servicesManager,
INavigationService navigator)
{
_servicesManager = servicesManager;
_navigator = navigator;
Submit = new LambdaCommand(
_ =>
{
_servicesManager.AddServiceAsync(
new ServiceInformation(
string.IsNullOrEmpty(ServiceName) ? DefaultServiceName : ServiceName,
new PasswordRestriction(
CollectSymbolTypes(),
PasswordMinLength,
PasswordMaxLength)));
_navigator.GoBack();
});
ServiceName = DefaultServiceName;
PasswordMinLength = PasswordRestriction.DefaultMinLength;
PasswordMaxLength = PasswordRestriction.DefaultMaxLength;
AllowLowLatin = true;
AllowUpperLatin = true;
}
示例3: HubPageViewModel
public HubPageViewModel(INavigationService navigationService, IPasswordRepository passwordRepository)
{
_navigationService = navigationService;
_passwordRepository = passwordRepository;
_passwordGroups = new ObservableCollection<PasswordGroup>();
if (Windows.ApplicationModel.DesignMode.DesignModeEnabled)
{
PasswordGroups.Add(new PasswordGroup()
{
GroupKey = "A"
});
PasswordGroups.Add(new PasswordGroup()
{
GroupKey = "C"
});
PasswordGroups.Add(new PasswordGroup()
{
GroupKey = "D"
});
}
else
{
GetData();
}
AddNewPasswordCommand = new DelegateCommand(() => AddNewPassword());
DeleteCommand = new DelegateCommand(() => Delete());
CopyToClipboardCommand = new DelegateCommand(() => CopyToClipboard());
GoBackCommand = new DelegateCommand(() => _navigationService.GoBack(), () => _navigationService.CanGoBack());
}
示例4: Page1ViewModel
public Page1ViewModel(INavigationService navigationService)
{
_navigationService = navigationService;
HelloWorld = IsInDesignMode
? "Runs in design mode"
: "Runs in runtime mode";
GoBackCommand = new RelayCommand(() => _navigationService.GoBack());
}
示例5: SetupNavigationService
public void SetupNavigationService(Frame frame)
{
_navigationService = _container.RegisterNavigationService(frame);
var navigationManager = SystemNavigationManager.GetForCurrentView();
navigationManager.BackRequested += (a, b) => { if (_navigationService.CanGoBack) _navigationService.GoBack(); };
_navigationService.Navigated += _navigationService_Navigated;
_navigationService.For<GraphsViewModel>().Navigate();
}
示例6: PersonDetailPageViewModel
public PersonDetailPageViewModel(IPersonRepository personRepository, INavigationService navService, IEventAggregator eventAggregator) {
_personRepository = personRepository;
_navService = navService;
_eventAggregator = eventAggregator;
GoBackCommand = new DelegateCommand(
() => _navService.GoBack(),
() => _navService.CanGoBack());
NewPersonCommand = new DelegateCommand(OnNewPerson, CanNewPerson);
UpdatePersonCommand = new DelegateCommand(OnUpdatePerson, CanUpdatePerson);
DeletePersonCommand = new DelegateCommand(OnDeletePerson, CanDeletePerson);
TextBoxLostFocusAction = OnTextBoxLostFocusAction;
}
示例7: StateDetailPageViewModel
public StateDetailPageViewModel(IStateRepository stateRepository, INavigationService navService, IEventAggregator eventAggregator) {
_stateRepository = stateRepository;
_navService = navService;
_eventAggregator = eventAggregator;
GoBackCommand = new DelegateCommand(
() => _navService.GoBack(),
() => _navService.CanGoBack());
NewStateCommand = new DelegateCommand(OnNewState, CanNewState);
UpdateStateCommand = new DelegateCommand(OnUpdateState, CanUpdateState);
DeleteStateCommand = new DelegateCommand(OnDeleteState, CanDeleteState);
TextBoxLostFocusAction = OnTextBoxLostFocusAction;
}
示例8: EntityDetailPageViewModel
public EntityDetailPageViewModel(IEntityRepository entityRepository, INavigationService navService, IEventAggregator eventAggregator) {
_entityRepository = entityRepository;
_navService = navService;
_eventAggregator = eventAggregator;
GoBackCommand = new DelegateCommand(
() => _navService.GoBack(),
() => _navService.CanGoBack());
NewEntityCommand = new DelegateCommand(OnNewEntity, CanNewEntity);
UpdateEntityCommand = new DelegateCommand(OnUpdateEntity, CanUpdateEntity);
DeleteEntityCommand = new DelegateCommand(OnDeleteEntity, CanDeleteEntity);
TextBoxLostFocusAction = OnTextBoxLostFocusAction;
}
示例9: AddPageViewModel
public AddPageViewModel(INavigationService navigationService, IEventAggregator eventAggregator)
{
_navigationService = navigationService;
_eventAggregator = eventAggregator;
SaveCommand = new DelegateCommand(() =>
{
Person person = new Person
{
Name = this.Name,
Surname = this.Surname
};
_eventAggregator.GetEvent<AddPersonEvent>().Publish(person);
_navigationService.GoBack();
});
}
示例10: GeneratePasswordPageViewModel
public GeneratePasswordPageViewModel(
IServicesManager servicesManager,
ISessionStateService sessionStateService,
INavigationService navigationService)
{
Contract.Assert(sessionStateService != null);
_sessionStateService = sessionStateService;
_service = null;
_servicePassword = null;
GenerateServicePassword = new LambdaCommand(
parameter =>
{
var password = parameter as string;
if (password?.Length > 0)
{
ServicePassword = ServicePasswordGenerator.GeneratePassword(
Service,
password);
}
},
_ => Service != null);
CopyServicePassword = new LambdaCommand(
_ =>
{
_dataPackage.SetText(ServicePassword);
Clipboard.SetContent(_dataPackage);
},
_ => ServicePassword?.Length > 0);
RemoveService = new LambdaCommand(
_ =>
{
servicesManager.RemoveServiceAsync(Service.UniqueToken);
navigationService.GoBack();
});
}
示例11: CancelSeries
public static async Task<bool> CancelSeries(string seriesId, INavigationService navigationService, IApiClient apiClient, ILog log, bool goBack)
{
try
{
await apiClient.CancelLiveTvSeriesTimerAsync(seriesId);
Messenger.Default.Send(new NotificationMessage(seriesId, Constants.Messages.LiveTvSeriesDeletedMsg));
if (navigationService.CanGoBack && goBack)
{
navigationService.GoBack();
}
return true;
}
catch (HttpException ex)
{
Utils.HandleHttpException(ex, "CancelSeriesRecording", navigationService, log);
MessageBox.Show(AppResources.ErrorDeletingSeriesRecording, AppResources.ErrorTitle, MessageBoxButton.OK);
}
return false;
}
示例12: AddEditPasswordViewModel
public AddEditPasswordViewModel(INavigationService navigationService, IPasswordRepository passwordRepository)
{
_navigationService = navigationService;
_passwordRepository = passwordRepository;
SaveCommand = new DelegateCommand(() => Save(), () => CanSave);
CopyToClipboardCommand = new DelegateCommand(() => CopyToClipboard());
GoBackCommand = new DelegateCommand(() => navigationService.GoBack(), () => navigationService.CanGoBack());
KeyPressAction = (eventArgs) =>
{
switch (eventArgs.Key)
{
case VirtualKey.Enter:
{
if(CanSave)
SaveCommand.Execute();
}
break;
default:
break;
}
};
}
示例13: AddAccountViewModel
public AddAccountViewModel(ConnectionService connectionService, AccountService accountService, INavigationService navigationService) {
_connectionService = connectionService;
_accountService = accountService;
_navigationService = navigationService;
AnonymousAccess = false;
IsHostValid = false;
CheckHostCommand = new RelayCommand(async () => {
// TODO: check if really changed
IsHostValid = false;
var host = Host;
if (!host.EndsWith("/")) host = host + "/";
_connectionInfo = await _connectionService.GetConnectionInfo(host);
if (_connectionInfo != null) {
var auth = await _connectionService.GetAuthenticationInfo(_connectionInfo);
if (auth != AuthenticationMethod.Unknown)
IsHostValid = true;
AnonymousAccess = auth == AuthenticationMethod.None;
}
});
AddAccountCommand = new RelayCommand(async () => {
var newAccount = new Account {
IsAnonymous = AnonymousAccess,
Protocol = _connectionInfo.WebDAVUrl.Scheme,
ServerDomain = _connectionInfo.WebDAVUrl.Host,
WebDAVPath = _connectionInfo.WebDAVUrl.LocalPath
};
if (!AnonymousAccess) {
newAccount.UsernamePlain = UserName;
newAccount.PasswordPlain = Password;
await _accountService.UpdateCredentials(newAccount);
}
_accountService.AddAccount(newAccount);
await _accountService.SaveAccounts();
if (_navigationService.CanGoBack)
_navigationService.GoBack();
else
_navigationService.Navigate(typeof(MainPage));
}, () => IsHostValid &&
(AnonymousAccess ||
(!string.IsNullOrWhiteSpace(UserName) &&
!string.IsNullOrEmpty(Password))));
}
示例14: SettingsViewModel
/// <summary>
/// Initializes a new instance of the <see cref="SettingsViewModel"/> class.
/// </summary>
/// <param name="dialogService">Dialog service instance.</param>
/// <param name="navigationService">Navigation service instance.</param>
/// <param name="msHealthClient">Microsoft Health service instance.</param>
/// <param name="nikePlusClient">Nike+ service instance.</param>
public SettingsViewModel(IDialogService dialogService, INavigationService navigationService, IMSHealthClient msHealthClient, INikePlusClient nikePlusClient)
{
// Initialize services
moDialogService = dialogService;
moNavigationService = navigationService;
moMSHealthClient = msHealthClient;
moNikePlusClient = nikePlusClient;
// Initialize commands
SignInMSHealthCommand = new RelayCommand(SignInMSHealth, () => true);
SignOutMSHealthCommand = new RelayCommand(SignOutMSHealth, () => true);
NavigationCompletedCommand = new RelayCommand<object>(NavigationCompleted, (args) => true);
ValidateNikePlusCredentialCommand = new RelayCommand(ValidateNikePlusCredential,
() => !string.IsNullOrEmpty(NikePlusUser) && !string.IsNullOrEmpty(NikePlusPassword));
ClearNikePlusCredentialCommand = new RelayCommand(ClearNikePlusCredential,
() => !string.IsNullOrEmpty(NikePlusUser) && !string.IsNullOrEmpty(NikePlusPassword));
// Get AppVersion
Package loPackage = Package.Current;
PackageId loPackageId = loPackage.Id;
PackageVersion loPackageVersion = loPackageId.Version;
AppVersion = string.Format("v{0}.{1}.{2}.{3}",
loPackageVersion.Major,
loPackageVersion.Minor,
loPackageVersion.Build,
loPackageVersion.Revision);
// Handle Back button requests
SystemNavigationManager.GetForCurrentView().BackRequested += (s, e) =>
{
e.Handled = true;
IsRunningRequest = false;
IsMSHealthRunning = false;
if (ShowSignIn)
{
ShowSignIn = false;
}
else
{
moNavigationService.GoBack();
}
};
}
示例15: PlaylistViewModel
public PlaylistViewModel()
{
navigationService = SimpleIoc.Default.GetInstance<INavigationService>();
//PalyerMediaOpenedCommand = new RelayCommand(() =>
//{
// int i = 5;
//});
BackButtonCommand = new RelayCommand(() =>
{
AniTubeData.SetSeekPosition(SelectedFilm, PlayerPosition, FilmList);
AniTubeData.SaveFilmList(PlSelected, FilmList);
navigationService.GoBack();
});
PositionChangedCommand = new RelayCommand(() =>
{
FilmList[FilmList.IndexOf(SelectedFilm)].ProgressPercent = Math.Round((PlayerPosition.TotalSeconds)
/ Convert.ToSingle(PlayerEndTime.TotalSeconds) * 100, 2);
});
IsFullScreenCommand = new RelayCommand(() =>
{
if (PlayerFullScren)
{
PlayerFullScren = false;
}
else
{
PlayerFullScren = true;
}
SetPlayerFullScreen();
});
ButtonSetFavorite = new RelayCommand(() =>
{
AniTubeData.SetFavorites(PlSelected);
ButtonFavoritesVisibility(PlSelected.isFavorite);
});
Messenger.Default.Register<bool>(this, "videoQuality", (message) =>
{
IsHD = message;
});
Messenger.Default.Register<Playlist>(this, "plToken", (message) =>
{
PlSelected = message;
LoadPageData();
});
ItemSelectedCommand = new RelayCommand<Film>((film) =>
{
AniTubeData.SetSeekPosition(SelectedFilm, PlayerPosition, FilmList);
SelectedFilm = film;
SetVidoSource();
AniTubeData.SetLastPlayed(SelectedFilm, FilmList);
});
}