private void CleanCacheHandler(object obj) { var appsFolder = $@"C:\Users\{Environment.UserName}\AppData\Local\Apps\2.0"; var buildInfo = new[] { new InfoData( "Clean cache", $@"You are going to clean local applications cache. Be sure that no deployed programs running now. Cache folder location: ""{ appsFolder}"". By the way cleaning can be done manually:{Environment.NewLine }1. By cmd.exe command: ""rundll32 dfshim CleanOnlineAppCache""] {Environment.NewLine }2. Or just remove [{appsFolder}] folder content.") }; var buildModel = new BuildInfoViewModel(buildInfo); var buildView = new BuildInfoView(buildModel) { Owner = Application.Current.MainWindow }; if (buildView.ShowDialog().GetValueOrDefault()) { string errorString, messageText; if (FlowUtils.CleanCache(out errorString)) { messageText = "Operation completed!"; } else { messageText = $"Unable complete cleaning cause of error:{Environment.NewLine}{errorString}"; } MessageBox.Show(messageText, "Information", MessageBoxButton.OK, MessageBoxImage.Information); } }
private void BuildHandler(object obj) { if (SelectedAction == UserActions.Resigning) { if (!IsTemporaryCertificate && string.IsNullOrEmpty(SelectedCetificatePath)) { MessageBox.Show( "No certificates was selected", "Information", MessageBoxButton.OK, MessageBoxImage.Warning); return; } if (!string.IsNullOrEmpty(TimestampUrl)) { try { var uri = new Uri(TimestampUrl); if (string.IsNullOrEmpty(uri.Host)) { throw new Exception("No host name in Uri"); } } catch (Exception exception) { string text = $"Unable to create Uri from timestamp {TimestampUrl}. Error text below:{Environment.NewLine + Environment.NewLine}{exception.Message}"; MessageBox.Show(text, "Error", MessageBoxButton.OK, MessageBoxImage.Error); return; } } } X509Certificate2 certificate = null; if (SelectedAction == UserActions.Resigning) { try { certificate = GetCertificate(); } catch (Exception exception) { MessageBox.Show( exception.Message, "Certificate error", MessageBoxButton.OK, MessageBoxImage.Warning); return; } } var container = new Container { TimestampUrl = TimestampUrl, FullPath = SelectedFolder.FullPath, Application = ApplicationManifest?.Manifest ?? SelectedFolder.ApplicationManifest, Deploy = DeployManifest?.Manifest ?? SelectedFolder.DeployManifest, Certificate = certificate, Version = _version, EntrypointPath = !string.IsNullOrEmpty(SelectedEntrypoint) ? Path.Combine(SelectedFolder.FullPath, SelectedEntrypoint) : null }; container.ApplicationName = !string.IsNullOrEmpty(ApplicationName) ? ApplicationName : Path.GetFileName(container.EntrypointPath); var buildInfo = _flowsContainer[SelectedAction].GetBuildInformation(container).ToArray(); if (buildInfo.Any()) { var buildModel = new BuildInfoViewModel(buildInfo); var buildView = new BuildInfoView(buildModel) { Owner = Application.Current.MainWindow }; if (!buildView.ShowDialog().GetValueOrDefault()) { return; } } string errorString; if (!_flowsContainer[SelectedAction].Execute(container, out errorString)) { MessageBox.Show(errorString, "Error", MessageBoxButton.OK, MessageBoxImage.Error); } else { MessageBox.Show( "Operation completed successfully!", "Information", MessageBoxButton.OK, MessageBoxImage.Information); _selectedFolder.Update(true); FolderUpdated(_selectedFolder); } BrowseCommand.RaiseCanExecuteChanged(); }