Esempio n. 1
0
 public NewsPageViewModel(IOpenLinkService linkService, INotifycationService notify)
 {
     _linkService        = linkService;
     _notify             = notify;
     ShowDocumentCommand = new ActionCommand(async() =>
     {
         try
         {
             await _linkService.OpenLinkAsync(Document?.url);
         }
         catch (Exception ex)
         {
             await _notify.ShowMessageAsync("Ошибка при открытии новости");
         }
     });
 }
Esempio n. 2
0
        public async Task OpenLinkAsync(string urlPath)
        {
            var path    = Path.Combine(_settings.BaseUrl, urlPath);
            var uri     = new Uri(path, UriKind.RelativeOrAbsolute);
            var success = await Launcher.LaunchUriAsync(uri,
                                                        new LauncherOptions()
            {
                DesiredRemainingView = Windows.UI.ViewManagement.ViewSizePreference.UseMore
            }
                                                        );

            if (!success)
            {
                await _notify.ShowMessageAsync("Ошибка открытия ссылки");
            }
        }