private async void MessageControl_OnImageMessageClick(WtMessage.Message message) { var data = new ImageViewerData { SelectedItem = UtilityTool.GetS3FileUrl(message.Body.Attachment.Id), ItemSource = ViewModel.Messages .Where(m => m.Type == WtMessage.MessageType.Image) .Select(m => UtilityTool.GetS3FileUrl(m.Body.Attachment.Id)) .ToList() }; CoreApplicationView newView = CoreApplication.CreateNewView(); int newViewId = 0; await newView.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => { Frame frame = new Frame(); frame.Navigate(typeof(ImageViewerPage), data); Window.Current.Content = frame; Window.Current.Activate(); newViewId = ApplicationView.GetForCurrentView().Id; }); await ApplicationViewSwitcher.TryShowAsStandaloneAsync(newViewId); }
private async void Download_Click(object sender, RoutedEventArgs e) { var allDownloads = await BackgroundDownloader.GetCurrentDownloadsAsync(); foreach (var item in FilesListView.SelectedItems) { var entity = item as Entity; Uri uri = new Uri(UtilityTool.GetS3FileUrl(entity.Id)); if (!allDownloads.Any(d => d.RequestedUri.ToString() == uri.ToString())) { var file = await DownloadsFolder.CreateFileAsync(entity.Addition.Title, CreationCollisionOption.GenerateUniqueName); var downloader = new BackgroundDownloader(); await Task.Run(async() => await DispatcherHelper.ExecuteOnUIThreadAsync(async() => { var download = downloader.CreateDownload(uri, file); await download.StartAsync(); })); } } }