private void TopGlassLabel_PointerExited(object sender, PointerRoutedEventArgs e) { if (e.Pointer.PointerDeviceType == Windows.Devices.Input.PointerDeviceType.Mouse) { HideGlassLabel.Begin(); } }
private async void FolderButton_Click(object sender, RoutedEventArgs e) { try { var folder = await StorageManager.TryGetFolderAsync(downloader.Message.FolderToken); StorageManager.LaunchFolderAsync(folder); } catch (Exception) { Toasts.ToastManager.ShowSimpleToast(Strings.AppResources.GetString("SomethingWrong"), Strings.AppResources.GetString("FolderNotExist")); } HideGlassLabel.Begin(); }
private async void FileButton_Click(object sender, RoutedEventArgs e) { try { string path = Path.Combine((await StorageManager.TryGetFolderAsync(downloader.Message.FolderToken)).Path, downloader.Message.FileName + downloader.Message.Extention); var file = await StorageFile.GetFileFromPathAsync(path); StorageTools.StorageManager.LaunchFileAsync(file); } catch (Exception) { Toasts.ToastManager.ShowSimpleToast(Strings.AppResources.GetString("SomethingWrong"), Strings.AppResources.GetString("FileNotExist")); } HideGlassLabel.Begin(); }
private void TopGlassLabel_PointerReleased(object sender, PointerRoutedEventArgs e) { if (e.Pointer.PointerDeviceType == Windows.Devices.Input.PointerDeviceType.Mouse) { return; } if (TopGlassLabel.Opacity == 0) { ShowGlassLabel_Begin(); } else if (TopGlassLabel.Opacity == 1) { HideGlassLabel.Begin(); } else { return; } }
private void RefreshButton_Click(object sender, RoutedEventArgs e) { downloader.Refresh(); HideGlassLabel.Begin(); }
private async void PauseButton_Click(object sender, RoutedEventArgs e) { await Task.Run(() => downloader.Pause()); HideGlassLabel.Begin(); }
private void PlayButton_Click(object sender, RoutedEventArgs e) { downloader.Start(); HideGlassLabel.Begin(); }
private async void DownloaderStateChanged(Enums.DownloadState state) { //在后台运行(挂起或最小化)不更新UI if (((App)App.Current).InBackground) { return; } await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () => { if (state == Enums.DownloadState.Pause) { PauseButton.IsEnabled = false; PlayButton.IsEnabled = true; DeleteButton.IsEnabled = true; RefreshButton.IsEnabled = true; Bar.ShowPaused = true; } else if (state == Enums.DownloadState.Error) { PauseButton.IsEnabled = false; PlayButton.IsEnabled = false; DeleteButton.IsEnabled = true; RefreshButton.IsEnabled = true; Bar.ShowPaused = true; } else if (state == Enums.DownloadState.Downloading) { PauseButton.IsEnabled = true; PlayButton.IsEnabled = false; DeleteButton.IsEnabled = true; RefreshButton.IsEnabled = true; Bar.ShowPaused = false; } else if (state == Enums.DownloadState.Done) { Bar.Value = 100; ProgressBlock.Text = "100%"; PlayButton.IsEnabled = false; PauseButton.IsEnabled = false; DeleteButton.IsEnabled = false; RefreshButton.IsEnabled = false; } else if (state == Enums.DownloadState.Prepared) { HideGlassLabel.Begin(); Models.DownloaderMessage message = downloader.Message; NameBlock.Text = message.FileName + message.Extention; PauseButton.IsEnabled = false; PlayButton.IsEnabled = true; DeleteButton.IsEnabled = true; RefreshButton.IsEnabled = false; int per = (int)((message.FileSize == null) ? 0 : (100f * message.DownloadSize / message.FileSize)); ProgressBlock.Text = (message.FileSize == null) ? "-%" : (per + "%"); Bar.Value = per; SizeBlock.Text = StringConverter.GetPrintSize(message.DownloadSize) + " / " + (message.FileSize == null ? "--" : StringConverter.GetPrintSize((long)message.FileSize)); SpeedBlock.Text = "-/s "; } }); }