private void ListEvents() { // make sure we have the right event list DisplayProduct product = listViewProducts.SelectedItem as DisplayProduct; if (product != null) { if (product.SynchronizeEnabled) { ClientLogic clientLogic = this.DataContext as ClientLogic; Debug.Assert(clientLogic != null); clientLogic.PopulateEventPackages(product, null, clientLogic.LastEventsSort, 1, UserSettings.Settings.EventPageSize, UserSettings.Settings.GetDisplayHitThreshold(product.Id), ClientLogicView.EventList, PageIntention.First, UserSettings.Settings.ShowEventsWithoutCabs); } else { StackHashMessageBox.Show(Window.GetWindow(this), string.Format(CultureInfo.CurrentCulture, Properties.Resources.MainProductList_ProductDisabledMBMessage, product.NameAndVersion), Properties.Resources.MainProductList_ProductDisabledMBTitle, StackHashMessageBoxType.Ok, StackHashMessageBoxIcon.Information); } } }
private void ClientLogic_ClientLogicSetupWizardPrompt(object sender, ClientLogicSetupWizardPromptEventArgs e) { if (this.Dispatcher.CheckAccess()) { if (e.Prompt == ClientLogicSetupWizardPromptOperation.ProductListUpdated) { listViewProducts.ItemsSource = this.ClientLogic.Products; if (!e.Succeeded) { Mouse.OverrideCursor = null; StackHashMessageBox.Show(Window.GetWindow(this), Properties.Resources.SetupWizard_UpdateProductListFailedMBMessage, Properties.Resources.SetupWizard_UpdateProductListFailedMBTitle, StackHashMessageBoxType.Ok, StackHashMessageBoxIcon.Error, e.LastException, e.LastServiceError); } } } else { this.Dispatcher.BeginInvoke(new Action <object, ClientLogicSetupWizardPromptEventArgs>(ClientLogic_ClientLogicSetupWizardPrompt), sender, e); } }
public override void TryNext() { UpdateState(); if (this.NextEnabled) { // try to save the client WinDbg paths from the cdb paths (if present) string path32WinDbg = string.Empty; string path64WinDbg = string.Empty; if (!string.IsNullOrEmpty(_path32)) { try { path32WinDbg = System.IO.Path.GetDirectoryName(_path32); path32WinDbg = System.IO.Path.Combine(path32WinDbg, "WinDbg.exe"); if (File.Exists(path32WinDbg)) { UserSettings.Settings.DebuggerPathX86 = path32WinDbg; } } catch { } } if (!string.IsNullOrEmpty(_path64)) { try { path64WinDbg = System.IO.Path.GetDirectoryName(_path64); path64WinDbg = System.IO.Path.Combine(path64WinDbg, "WinDbg.exe"); if (File.Exists(path64WinDbg)) { UserSettings.Settings.DebuggerPathAmd64 = path64WinDbg; } } catch { } } if (Directory.Exists(_pathLocalStore)) { // add or update the context this.ClientLogic.AdminCreateFirstContext(_contextDatabaseName, _username, _password, _path32, _path64, _pathLocalStore, _connectionString, _profileName, _isDatabaseInCabFolder); } else { StackHashMessageBox.Show(Window.GetWindow(this), Properties.Resources.SetupWizard_IndexFolderMisingMBMessage, Properties.Resources.SetupWizard_IndexFolderMissingMBTitle, StackHashMessageBoxType.Ok, StackHashMessageBoxIcon.Error); } } }
private void buttonDelete_Click(object sender, RoutedEventArgs e) { StackHashContextSettings settings = listBoxProfiles.SelectedItem as StackHashContextSettings; if (settings != null) { if (StackHashMessageBox.Show(this, string.Format(CultureInfo.CurrentCulture, Properties.Resources.ProfileManager_DeleteProfileMBMessage, settings.WinQualSettings.CompanyName, settings.ErrorIndexSettings.Folder), Properties.Resources.ProfileManager_DeleteProfileMBTitle, StackHashMessageBoxType.YesNo, StackHashMessageBoxIcon.Question) == StackHashDialogResult.Yes) { // if the current context is deleted then go back to the invalid state if (UserSettings.Settings.CurrentContextId == settings.Id) { UserSettings.Settings.CurrentContextId = UserSettings.InvalidContextId; } // remove the context _clientLogic.AdminRemoveContext(settings.Id); } } }
void ClientLogic_ClientLogicSetupWizardPrompt(object sender, ClientLogicSetupWizardPromptEventArgs e) { if (this.Dispatcher.CheckAccess()) { if (e.Prompt == ClientLogicSetupWizardPromptOperation.ReportingUpdated) { if (e.Succeeded) { DoRaiseExitWizard(true); } else { Mouse.OverrideCursor = null; StackHashMessageBox.Show(Window.GetWindow(this), Properties.Resources.SetupWizard_UpdateReportingStateFailedMBMessage, Properties.Resources.SetupWizard_UpdateReportingStateFailedMBTitle, StackHashMessageBoxType.Ok, StackHashMessageBoxIcon.Error, e.LastException, e.LastServiceError); } } } else { this.Dispatcher.BeginInvoke(new Action <object, ClientLogicSetupWizardPromptEventArgs>(ClientLogic_ClientLogicSetupWizardPrompt), sender, e); } }
private void buttonSelectDatabse_Click(object sender, RoutedEventArgs e) { try { // save settings (to pass to the config tool) DBConfigSettings.Settings.ResetSettings(); DBConfigSettings.Settings.IsNewProfile = true; DBConfigSettings.Settings.ServiceHost = ServiceProxy.Services.ServiceHost; DBConfigSettings.Settings.ServicePort = ServiceProxy.Services.ServicePort; DBConfigSettings.Settings.ServiceUsername = UserSettings.Settings.ServiceUsername; DBConfigSettings.Settings.ServicePassword = UserSettings.Settings.ServicePassword; DBConfigSettings.Settings.ServiceDomain = UserSettings.Settings.ServiceDomain; if (this.ClientLogic.ContextCollection != null) { foreach (DisplayContext settings in this.ClientLogic.ContextCollection) { DBConfigSettings.Settings.ExistingProfileFolders.Add(settings.StackHashContextSettings.ErrorIndexSettings.Folder); DBConfigSettings.Settings.ExistingProfileNames.Add(settings.StackHashContextSettings.ErrorIndexSettings.Name); } } DBConfigSettings.Settings.IsDatabaseInCabFolder = _isDatabaseInCabFolder; DBConfigSettings.Settings.ProfileFolder = _pathLocalStore; DBConfigSettings.Settings.ConnectionString = _connectionString; DBConfigSettings.Settings.Save(); Mouse.OverrideCursor = Cursors.Wait; _dbConfigProcess = Process.Start("StackHashDBConfig.exe"); _dbConfigProcess.EnableRaisingEvents = true; _dbConfigProcess.Exited += new EventHandler(_dbConfigProcess_Exited); } catch (Exception ex) { Mouse.OverrideCursor = null; bool userCancel = false; Win32Exception win32ex = ex as Win32Exception; if (win32ex != null) { userCancel = (win32ex.NativeErrorCode == 1223); } if (!userCancel) { DiagnosticsHelper.LogException(DiagSeverity.ComponentFatal, "Failed to launch StackHashDBConfig.exe", ex); StackHashMessageBox.Show(Window.GetWindow(this), Properties.Resources.DBConfigLaunchFailedMBMessage, Properties.Resources.DBConfigLaunchFailedMBTitle, StackHashMessageBoxType.Ok, StackHashMessageBoxIcon.Error, ex, StackHashMessageBox.ParseServiceErrorFromException(ex)); } } }
private void _worker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { // do nothing if the window has closed if (_windowClosed) { return; } this.IsEnabled = true; if (e.Error == null) { _reselectContextId = UserSettings.Settings.CurrentContextId; // update the datacontext with the new StackHashStatus object this.DataContext = e.Result; // try to select the current profile //if (!_initialContextSelected) //{ // if (UserSettings.Settings.CurrentContextId != UserSettings.InvalidContextId) // { // StackHashStatus status = e.Result as StackHashStatus; // if ((status != null) && (status.ContextStatusCollection != null)) // { // foreach (StackHashContextStatus contextStatus in status.ContextStatusCollection) // { // if (contextStatus.ContextId == UserSettings.Settings.CurrentContextId) // { // listViewContexts.SelectedItem = contextStatus; // _reselectContextId = contextStatus.ContextId; // _reselectContextIdIsActive = contextStatus.IsActive; // break; // } // } // } // } // _initialContextSelected = true; //} } else { StackHashServiceErrorCode errorCode = StackHashMessageBox.ParseServiceErrorFromException(e.Error); if (errorCode != StackHashServiceErrorCode.Aborted) { // show error StackHashMessageBox.Show(this, Properties.Resources.Error_ServiceCallFailedMBMessage, Properties.Resources.Error_ServiceCallFailedMBTitle, StackHashMessageBoxType.Ok, StackHashMessageBoxIcon.Error, e.Error, errorCode); } } }
private void buttonClose_Click(object sender, RoutedEventArgs e) { if (StackHashMessageBox.Show(this, Properties.Resources.UpgradeFromXml_CloseMBMessage, Properties.Resources.UpgradeFromXml_CloseMBTitle, StackHashMessageBoxType.YesNo, StackHashMessageBoxIcon.Question) == StackHashDialogResult.Yes) { DialogResult = false; Close(); } }
private static void DisplayUnhandledExceptionAndDie(Exception ex) { DiagnosticsHelper.LogException(DiagSeverity.ApplicationFatal, "Unhandled Exception", ex); try { Window owner = null; if (Application.Current != null) { owner = Application.Current.MainWindow; } StackHashMessageBox.Show(owner, UnhandledExceptionMessage, UnhandledExceptionTitle, StackHashMessageBoxType.Ok, StackHashMessageBoxIcon.Error, ex, StackHashService.StackHashServiceErrorCode.NoError); } catch (XamlParseException xex) { DiagnosticsHelper.LogException(DiagSeverity.ApplicationFatal, "XamlParseException displaying fatal error message", xex); try { // this will happen if the XAML window can't be created for some reason - // try showing a regular message box in this case MessageBox.Show(UnhandledExceptionMessage, UnhandledExceptionTitle, MessageBoxButton.OK, MessageBoxImage.Hand); } catch { } } catch { } finally { try { if (App.Current != null) { App.Current.Shutdown(1); } } catch { } } }
private void CompleteAdd() { Debug.Assert(_currentAddSettings != null); if (_currentAddSettings != null) { ProfileAddEdit profileAdd = new ProfileAddEdit(_currentAddSettings, _allContexts, true, _clientLogic); profileAdd.Owner = this; if (profileAdd.ShowDialog() == true) { // ask the user if they want to activate this profile if (StackHashMessageBox.Show(this, string.Format(CultureInfo.CurrentCulture, Properties.Resources.ProfileManager_ActivateProfileMBMessage, _currentAddSettings.WinQualSettings.CompanyName), Properties.Resources.ProfileManager_ActivateProfileMBTitle, StackHashMessageBoxType.YesNo, StackHashMessageBoxIcon.Question) == StackHashDialogResult.Yes) { _activateRequired = true; _activateContextId = _currentAddSettings.Id; // if no contexts or no current context then also make this Id the current client context if ((!_haveContexts) || (UserSettings.Settings.CurrentContextId == UserSettings.InvalidContextId)) { UserSettings.Settings.CurrentContextId = _currentAddSettings.Id; } } _clientLogic.SaveContextSettings(_currentAddSettings.Id, _currentAddSettings, profileAdd.CollectionPolicies, profileAdd.Plugins, profileAdd.WorkFlowMappings, _currentAddSettings.IsActive); } else { DeleteContextCore(_currentAddSettings.Id); } _currentAddSettings = null; } }
private void buttonDelete_Click(object sender, RoutedEventArgs e) { DisplayContext context = listViewProfiles.SelectedItem as DisplayContext; Debug.Assert(context != null); if (StackHashMessageBox.Show(this, string.Format(CultureInfo.CurrentCulture, Properties.Resources.ProfileManager_DeleteProfileMBMessage, context.StackHashContextSettings.WinQualSettings.CompanyName, context.StackHashContextSettings.ErrorIndexSettings.Folder), Properties.Resources.ProfileManager_DeleteProfileMBTitle, StackHashMessageBoxType.YesNo, StackHashMessageBoxIcon.Question) == StackHashDialogResult.Yes) { DeleteContextCore(context.Id); } }
private void DoDelete() { Debug.Assert(_clientLogic.CurrentScript != null); if (_clientLogic.CurrentScript != null) { if (StackHashMessageBox.Show(this, string.Format(CultureInfo.CurrentCulture, Properties.Resources.ScriptManager_DeleteScriptMBMessage, _clientLogic.CurrentScript.Name), Properties.Resources.ScriptManager_DeleteScriptMBTitle, StackHashMessageBoxType.YesNo, StackHashMessageBoxIcon.Question) == StackHashDialogResult.Yes) { _clientLogic.AdminRemoveScript(_clientLogic.CurrentScript.Name); _actionOnScriptReady = ActionOnScriptReady.None; } } }
private void hyperlinkServiceOptions_Click(object sender, RoutedEventArgs e) { if (this.ClientLogic.ServiceIsLocal) { ProfileManager profileManager = new ProfileManager(this.ClientLogic); profileManager.Owner = Window.GetWindow(this); profileManager.ShowDialog(); } else { StackHashMessageBox.Show(Window.GetWindow(this), string.Format(CultureInfo.CurrentCulture, Properties.Resources.ServiceOptionsUnavailable_MBMessage, this.ClientLogic.ServiceHost), Properties.Resources.ServiceOptionsUnavailable_MBTitle, StackHashMessageBoxType.Ok, StackHashMessageBoxIcon.Information); } }
private void buttonManageProfiles_Click(object sender, RoutedEventArgs e) { if (_clientLogic.ServiceIsLocal) { // enable validation on OK _contextValidation.ValidationEnabled = true; if (BindingValidator.IsValid(tabItemServiceConnection)) { // need to update in case the user has changed the service details ServiceProxy.Services.UpdateServiceEndpointAndAccount(_contextValidation.ServiceHost, _contextValidation.ServicePort, UserSettings.Settings.ServiceUsername, UserSettings.Settings.ServicePassword, UserSettings.Settings.ServiceDomain); ProfileManager profileManager = new ProfileManager(_clientLogic); profileManager.Owner = this; profileManager.ShowDialog(); UpdateActiveContexts(); } else { // select and revalidate the service connection tab if necessary if (tabControl.SelectedItem != tabItemServiceConnection) { tabControl.SelectedItem = tabItemServiceConnection; BindingValidator.IsValid(tabItemServiceConnection); } } } else { StackHashMessageBox.Show(this, string.Format(CultureInfo.CurrentCulture, Properties.Resources.ServiceOptionsUnavailable_MBMessage, _clientLogic.ServiceHost), Properties.Resources.ServiceOptionsUnavailable_MBTitle, StackHashMessageBoxType.Ok, StackHashMessageBoxIcon.Information); } }
private void buttonErrorDetails_Click(object sender, RoutedEventArgs e) { DisplayContext context = listViewProfiles.SelectedItem as DisplayContext; if (context != null) { StackHashMessageBox.Show(this, string.Format(CultureInfo.CurrentCulture, Properties.Resources.ProfileManager_ErrorDetailsMBMessage, context.ProfileName, context.CurrentErrorText, context.LastContextException), Properties.Resources.ProfileManager_ErrorDetailsMBTitle, StackHashMessageBoxType.Ok, StackHashMessageBoxIcon.Information, new AdminReportException(context.LastContextException), context.CurrentError); } }
private void menuDeleteScriptRun_Click(object sender, RoutedEventArgs e) { DisplayScriptResult resultFile = listViewResultFiles.SelectedItem as DisplayScriptResult; if (resultFile != null) { bool deleteScriptRun = true; if (!UserSettings.Settings.IsMessageSuppressed(UserSettings.SuppressCabDetailsDeleteScriptRun)) { bool suppress = false; if (StackHashMessageBox.Show(Window.GetWindow(this), string.Format(CultureInfo.CurrentCulture, Properties.Resources.CabDetails_DeleteScriptRunMBMessage, resultFile.ScriptName, _clientLogic.CurrentCab.Id), Properties.Resources.CabDetails_DeleteScriptRunMBTitle, StackHashMessageBoxType.YesNo, StackHashMessageBoxIcon.Question, true, out suppress) != StackHashDialogResult.Yes) { deleteScriptRun = false; } if (suppress) { UserSettings.Settings.SuppressMessage(UserSettings.SuppressCabDetailsDeleteScriptRun); } } if (deleteScriptRun) { _clientLogic.AdminRemoveResult(resultFile.ScriptName); } } }
private void buttonOK_Click(object sender, RoutedEventArgs e) { // enable validation on OK _contextValidation.ValidationEnabled = true; bool valid = true; // check the proxy settings control if (valid) { if (!proxySettingsControl.IsValid) { valid = false; if (tabControl.SelectedItem != tabItemProxyServer) { tabControl.SelectedItem = tabItemProxyServer; // validate again to highlight error valid = proxySettingsControl.IsValid; } } } // check the display policy control if (valid) { if (!displayPolicyControl.IsValid) { valid = false; if (tabControl.SelectedItem != tabItemDefaultDisplayFilter) { tabControl.SelectedItem = tabItemDefaultDisplayFilter; // validate again to highlight error valid = displayPolicyControl.IsValid; } } } // check other tabs if (valid) { foreach (TabItem tab in tabControl.Items) { if (!BindingValidator.IsValid(tab)) { valid = false; // activate the bad tab if it's not the current one if (tabControl.SelectedItem != tab) { tabControl.SelectedItem = tab; // need to validate again to highlight errors BindingValidator.IsValid(tab); } break; } } } // prompt the user if a profile has not been selected if (valid) { if (!(comboBoxProfiles.SelectedItem is DisplayContext)) { if (StackHashMessageBox.Show(this, Properties.Resources.OptionsWindow_SelectProfileMBMessage, Properties.Resources.OptionsWindow_SelectProfileMBTitle, StackHashMessageBoxType.YesNo, StackHashMessageBoxIcon.Question) != StackHashDialogResult.Yes) { valid = false; tabControl.SelectedItem = tabItemServiceConnection; } else { UserSettings.Settings.CurrentContextId = -1; } } } if (valid) { UserSettings.Settings.DebuggerPathX86 = _contextValidation.DebuggerPathX86; UserSettings.Settings.DebuggerPathAmd64 = _contextValidation.DebuggerPathAmd64; UserSettings.Settings.DebuggerPathVisualStudio = _contextValidation.DebuggerPathVisualStudio; UserSettings.Settings.DefaultDebugTool = _contextValidation.DefaultDebugger; UserSettings.Settings.DiagnosticLogEnabled = _contextValidation.DiagnosticLogEnabled; UserSettings.Settings.ServiceHost = _contextValidation.ServiceHost; UserSettings.Settings.ServicePort = _contextValidation.ServicePort; UserSettings.Settings.EventPageSize = _contextValidation.EventsPerPage; // save proxy server settings UserSettings.Settings.UseProxyServer = proxySettingsControl.ProxySettings.UseProxy; UserSettings.Settings.UseProxyServerAuthentication = proxySettingsControl.ProxySettings.UseProxyAuthentication; UserSettings.Settings.ProxyHost = proxySettingsControl.ProxySettings.ProxyHost; UserSettings.Settings.ProxyPort = proxySettingsControl.ProxySettings.ProxyPort; UserSettings.Settings.ProxyUsername = proxySettingsControl.ProxySettings.ProxyUsername; UserSettings.Settings.ProxyPassword = proxySettingsControl.ProxySettings.ProxyPassword; UserSettings.Settings.ProxyDomain = proxySettingsControl.ProxySettings.ProxyDomain; // save default display policy UserSettings.Settings.SetDisplayHitThreshold(UserSettings.DefaultDisplayFilterProductId, displayPolicyControl.GetHitThreshold()); DialogResult = true; } }
private void ClientLogic_ClientLogicSetupWizardPrompt(object sender, ClientLogicSetupWizardPromptEventArgs e) { if (this.Dispatcher.CheckAccess()) { switch (e.Prompt) { case ClientLogicSetupWizardPromptOperation.FirstContextCreated: if (e.Succeeded) { // test the provided WinQual Credentials this.ClientLogic.AdminTestWinQualLogOn(UserSettings.Settings.CurrentContextId, _username, _password); } else { Mouse.OverrideCursor = null; StackHashMessageBox.Show(Window.GetWindow(this), Properties.Resources.SetupWizard_AddContextFailedMBMessage, Properties.Resources.SetupWizard_AddContextFailedMBTitle, StackHashMessageBoxType.Ok, StackHashMessageBoxIcon.Error, e.LastException, e.LastServiceError); } break; case ClientLogicSetupWizardPromptOperation.LogOnTestComplete: if (e.Succeeded) { // sync with WinQual to get the product list this.DisableWizard = true; // force diable as the client won't stay busy during the sync this.ClientLogic.AdminStartSync(false, true, true, null); } else { Mouse.OverrideCursor = null; StackHashMessageBox.Show(Window.GetWindow(this), Properties.Resources.SetupWizard_LogOnTestFailedMBMessage, Properties.Resources.SetupWizard_LogOnTestFailedMBTitle, StackHashMessageBoxType.Ok, StackHashMessageBoxIcon.Error, e.LastException, e.LastServiceError); } break; case ClientLogicSetupWizardPromptOperation.ProductListUpdated: // always enable the wizard again when the sync completes this.DisableWizard = false; if (e.Succeeded) { // we have the product list, can go to the next page this.DoRaiseShowNextPage(); } else { Mouse.OverrideCursor = null; StackHashMessageBox.Show(Window.GetWindow(this), Properties.Resources.SetupWizard_GetProductListFailedMBMessage, Properties.Resources.SetupWizard_GetProductListFailedMBTitle, StackHashMessageBoxType.Ok, StackHashMessageBoxIcon.Error, e.LastException, e.LastServiceError); } break; case ClientLogicSetupWizardPromptOperation.SyncFailed: // always enable the wizard again when the sync fails this.DisableWizard = false; // report the error Mouse.OverrideCursor = null; StackHashMessageBox.Show(Window.GetWindow(this), Properties.Resources.Error_SyncFailedMBMessage, Properties.Resources.Error_SyncFailedMBTitle, StackHashMessageBoxType.Ok, StackHashMessageBoxIcon.Error, e.LastException, e.LastServiceError); break; } } else { this.Dispatcher.BeginInvoke(new Action <object, ClientLogicSetupWizardPromptEventArgs>(ClientLogic_ClientLogicSetupWizardPrompt), sender, e); } }
private void RunDBConfigForAdd() { _currentAddSettings = _clientLogic.AdminCollectNewContext(); Debug.Assert(_currentAddSettings != null); if (_currentAddSettings != null) { try { Mouse.OverrideCursor = Cursors.Wait; DBConfigSettings.Settings.ResetSettings(); DBConfigSettings.Settings.IsNewProfile = true; DBConfigSettings.Settings.IsUpgrade = false; DBConfigSettings.Settings.ServiceHost = ServiceProxy.Services.ServiceHost; DBConfigSettings.Settings.ServicePort = ServiceProxy.Services.ServicePort; DBConfigSettings.Settings.ServiceUsername = UserSettings.Settings.ServiceUsername; DBConfigSettings.Settings.ServicePassword = UserSettings.Settings.ServicePassword; DBConfigSettings.Settings.ServiceDomain = UserSettings.Settings.ServiceDomain; if (_clientLogic.ContextCollection != null) { foreach (DisplayContext existingSettings in _clientLogic.ContextCollection) { DBConfigSettings.Settings.ExistingProfileFolders.Add(existingSettings.StackHashContextSettings.ErrorIndexSettings.Folder); DBConfigSettings.Settings.ExistingProfileNames.Add(existingSettings.StackHashContextSettings.ErrorIndexSettings.Name); } } DBConfigSettings.Settings.Save(); _dbConfigProcess = Process.Start("StackHashDBConfig.exe"); _dbConfigProcess.EnableRaisingEvents = true; _dbConfigProcess.Exited += new EventHandler(_dbConfigProcess_Exited); } catch (Exception ex) { Mouse.OverrideCursor = null; bool userCancel = false; Win32Exception win32ex = ex as Win32Exception; if (win32ex != null) { userCancel = (win32ex.NativeErrorCode == 1223); } if (userCancel) { // user cancelled DB config DeleteContextCore(_currentAddSettings.Id); _currentAddSettings = null; } else { DiagnosticsHelper.LogException(DiagSeverity.ComponentFatal, "Failed to launch StackHashDBConfig.exe", ex); StackHashMessageBox.Show(this, Properties.Resources.DBConfigLaunchFailedMBMessage, Properties.Resources.DBConfigLaunchFailedMBTitle, StackHashMessageBoxType.Ok, StackHashMessageBoxIcon.Error, ex, StackHashMessageBox.ParseServiceErrorFromException(ex)); } } } }
private void ClientLogic_ClientLogicSetupWizardPrompt(object sender, ClientLogicSetupWizardPromptEventArgs e) { if (this.Dispatcher.CheckAccess()) { switch (e.Prompt) { case ClientLogicSetupWizardPromptOperation.AdminServiceConnect: if (e.Succeeded) { // save service proxy settings UpdatateServiceProxySettings(); } else { Mouse.OverrideCursor = null; StackHashMessageBox.Show(Window.GetWindow(this), Properties.Resources.SetupWizard_ServiceConnectFailedMBMessage, Properties.Resources.SetupWizard_ServiceConnectFailedMBTitle, StackHashMessageBoxType.Ok, StackHashMessageBoxIcon.Error, e.LastException, e.LastServiceError); } break; case ClientLogicSetupWizardPromptOperation.ProxySettingsUpdated: if (e.Succeeded) { UserSettings.Settings.ServiceHost = _host; UserSettings.Settings.ServicePort = _port; // go to the next page if (((this.ClientLogic.ContextCollection != null) && (this.ClientLogic.ContextCollection.Count > 0)) || (!this.ClientLogic.ServiceIsLocal)) { // profiles exist or we're not on the service computer so the wizard should just select a profile DoRaiseConfigureForProfileOnly(); DoRaiseShowNextPage(); } else { // we're on the service computer and there are no profiles so continue with normal setup DoRaiseConfigureForInitialSetup(); DoRaiseShowNextPage(); } } else { Mouse.OverrideCursor = null; StackHashMessageBox.Show(Window.GetWindow(this), Properties.Resources.SetupWizard_ProxyUpdateFailedMBMessage, Properties.Resources.SetupWizard_ProxyUpdateFailedMBTitle, StackHashMessageBoxType.Ok, StackHashMessageBoxIcon.Error, e.LastException, e.LastServiceError); } break; } } else { this.Dispatcher.BeginInvoke(new Action <object, ClientLogicSetupWizardPromptEventArgs>(ClientLogic_ClientLogicSetupWizardPrompt), sender, e); } }
private void buttonUpgrade_Click(object sender, RoutedEventArgs e) { StackHashContextSettings settings = listBoxProfiles.SelectedItem as StackHashContextSettings; if (settings != null) { try { Mouse.OverrideCursor = Cursors.Wait; DBConfigSettings.Settings.ResetSettings(); DBConfigSettings.Settings.IsNewProfile = true; DBConfigSettings.Settings.IsUpgrade = true; DBConfigSettings.Settings.ServiceHost = ServiceProxy.Services.ServiceHost; DBConfigSettings.Settings.ServicePort = ServiceProxy.Services.ServicePort; DBConfigSettings.Settings.ServiceUsername = UserSettings.Settings.ServiceUsername; DBConfigSettings.Settings.ServicePassword = UserSettings.Settings.ServicePassword; DBConfigSettings.Settings.ServiceDomain = UserSettings.Settings.ServiceDomain; if (_clientLogic.ContextCollection != null) { foreach (DisplayContext existingSettings in _clientLogic.ContextCollection) { DBConfigSettings.Settings.ExistingProfileFolders.Add(existingSettings.StackHashContextSettings.ErrorIndexSettings.Folder); DBConfigSettings.Settings.ExistingProfileNames.Add(existingSettings.StackHashContextSettings.ErrorIndexSettings.Name); } } DBConfigSettings.Settings.ProfileName = settings.ErrorIndexSettings.Name; DBConfigSettings.Settings.ProfileFolder = null; // not populated as user is required to change this DBConfigSettings.Settings.ConnectionString = null; DBConfigSettings.Settings.Save(); _copyContextId = settings.Id; _copyContextIsActive = settings.IsActive; _dbConfigProcess = Process.Start("StackHashDBConfig.exe"); _dbConfigProcess.EnableRaisingEvents = true; _dbConfigProcess.Exited += new EventHandler(_dbConfigProcess_Exited); } catch (Exception ex) { Mouse.OverrideCursor = null; bool userCancel = false; Win32Exception win32ex = ex as Win32Exception; if (win32ex != null) { userCancel = (win32ex.NativeErrorCode == 1223); } if (!userCancel) { DiagnosticsHelper.LogException(DiagSeverity.ComponentFatal, "Failed to launch StackHashDBConfig.exe", ex); StackHashMessageBox.Show(this, Properties.Resources.DBConfigLaunchFailedMBMessage, Properties.Resources.DBConfigLaunchFailedMBTitle, StackHashMessageBoxType.Ok, StackHashMessageBoxIcon.Error, ex, StackHashMessageBox.ParseServiceErrorFromException(ex)); } } } }