public TransferWindow(DownloadMotionStoreRequest request, string motionTitle) { InitializeComponent(); StoreRequest = request; StoreRequest.ProcessError += Request_ProcessError; StoreRequest.ProcessSuccessfully += StoreRequest_ProcessSuccessfully; StoreRequest.ProgressReport += Request_ProgressReport; StoreRequest.ProcessCancel += StoreRequest_ProcessCancel; ProgressBar.Maximum = 100; var viewModel = new TransferWindowViewModel(); DataContext = viewModel; ViewModel = (TransferWindowViewModel)DataContext; ViewModel.Title = motionTitle; ViewModel.TransferText = (string)TryFindResource("DownloadingText"); }
private void Request_ProcessError(DownloadMotionStoreRequest.DownloadMotionErrorCode errorcode, string errorMessage) { Dispatcher.BeginInvoke((Action)delegate { DialogResult = false; DebugHelper.WriteLine(errorMessage); Close(); var title = (string)TryFindResource("DownloadErrorText"); WPFMessageBox.Show(StaticMainWindow.Window, "", title, MessageBoxButton.OK, MessageBoxImage.Information, MessageBoxResult.OK); }); }
private void DownloadButton_Click(object sender, RoutedEventArgs e) { if (!GlobalVariables.UserOnline) { var signinWindow = new LoginWindow(); if (signinWindow.ShowDialog(StaticMainWindow.Window) == false) return; } StaticMainWindow.Window.UpdateLoginSuccessfully(); var request = new DownloadMotionStoreRequest(MotionID); var transferWindow = new TransferWindow(request, Info.title); if (transferWindow.ShowDialog(StaticMainWindow.Window) == true) { ViewModel.DownloadButtonContent = "Installed"; GlobalFunction.SaveIconImage(ViewModel.CoverImage, MotionID); } }