public Result ExecuteCommand(DynamoRevitCommandData commandData) { HandleDebug(commandData); InitializeCore(commandData); try { extCommandData = commandData; shouldShowUi = CheckJournalForUiDisplay(extCommandData); isAutomationMode = CheckJournalForAutomationMode(extCommandData); UpdateSystemPathForProcess(); // create core data models revitDynamoModel = InitializeCoreModel(extCommandData); dynamoViewModel = InitializeCoreViewModel(revitDynamoModel); revitDynamoModel.Logger.Log("SYSTEM", string.Format("Environment Path:{0}", Environment.GetEnvironmentVariable("PATH"))); // handle initialization steps after RevitDynamoModel is created. revitDynamoModel.HandlePostInitialization(); // show the window if (shouldShowUi) { InitializeCoreView().Show(); } TryOpenAndExecuteWorkspace(extCommandData); // Disable the Dynamo button to prevent a re-run DynamoRevitApp.DynamoButtonEnabled = false; } catch (Exception ex) { // notify instrumentation InstrumentationLogger.LogException(ex); StabilityTracking.GetInstance().NotifyCrash(); MessageBox.Show(ex.ToString()); DynamoRevitApp.DynamoButtonEnabled = true; return(Result.Failed); } return(Result.Succeeded); }
/// <summary> /// Vérifie le contenu du message. /// </summary> /// <param name="_message">Message</param> /// <returns>Boolean : True -> Message non null. False -> Message null.</returns> private static bool IsCreateMessage(_MailItem _message) { _MailItem message = _message; bool isCorrectCreateMessage = (message != null); // Vérifie le contenu du message. if (isCorrectCreateMessage) { return(true); } // Affichage d'un message d'erreur. MessageBox.Show(Results_Val.Default.IsNullMessage, Results_Err.Default.ErrorTitle, MessageBoxButtons.OK, MessageBoxIcon.Error); return(false); }
protected void DoCloseCheck(Action <bool> callback) { var result = MessageBox.Show("Document is not saved and you will loose all changes.\r\n\r\nDo you want to close?", @"Document is not saved.", MessageBoxButtons.YesNo, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1); var close = result == DialogResult.Yes; callback(close); if (!close) { CloseCheckHelper(close); } }
public void SetLastDownloadedUid(string emailAddress, string uid) { try { _writer.Write(MessageDictionary.SetLastDownloadedUid); _writer.Write(emailAddress); _writer.Write(uid); } catch (Exception ex) { MessageBox.Show(ex.Message + Environment.NewLine + ex.StackTrace); ErrorHelper.LogError(ex); Logout(); } }
private void LaunchEditor() { try { if (dgHours.SelectedItem != null) { Entry item = dgHours.SelectedItems[0] as Entry; (new TimesheetEntry_Edit(item, this)).Show(); } } catch (Exception exception) { MessageBox.Show(exception.ToString()); } }
private void DoUFLDemo() { var LApp = (IAppTaxApplicationService)_appInstance; var LUFL = LApp.UFL; var LCurrentReturn = LApp.GetCurrentDocReturn(); if (LCurrentReturn == null) { MessageBox.Show("Please Open a Client File first"); } else { WKCA.Sample.UFLDemo.ShowUFL(LUFL, LCurrentReturn); } }
public void HandleMessage(string emailAddress, string messageUId) { try { _writer.Write(MessageDictionary.HandleMessage); _writer.Write(emailAddress); _writer.Write(messageUId); } catch (Exception ex) { MessageBox.Show(ex.Message + Environment.NewLine + ex.StackTrace); ErrorHelper.LogError(ex); Logout(); } }
/// <summary> /// Essaye d'ouvrir le fichier avec le programme par défaut. /// </summary> /// <param name="_filePath">Chemin du fichier</param> internal static void TryOpenFile(string _filePath) { string filePath = _filePath; try { Process.Start(filePath); } catch { // Affiche un message d'erreur. MessageBox.Show(Profile_Err.Default.TryOpenFile, Profile_Err.Default.ErrorTitle, MessageBoxButtons.OK, MessageBoxIcon.Error); return; } }
private void AppUnandledExceptionEventHandler(object sender, UnhandledExceptionEventArgs ea) { var e = (Exception)ea.ExceptionObject; MessageBox.Show(e.Message); /*ErrorWindow errorWindow = new ErrorWindow(); * * Messenger.Default.Send<ShowErrorMessage>(new ShowErrorMessage() { ErrorMessage = e.Message }); * * errorWindow.Owner = this.MainWindow; * errorWindow.ShowDialog(); * * ViewModelLocator.ConverterVMStatic.IsBusy = false;*/ }
public List <EmailModel> GetUserEmailAddresses() { try { List <EmailModel> emailAddresses = new List <EmailModel>(); _writer.Write(MessageDictionary.GetEmailAddresses); if (_reader.Read() == MessageDictionary.OK) { int emailCount = _reader.ReadInt32(); for (int i = 0; i < emailCount; i++) { string id = _reader.ReadString(); string address = _reader.ReadString(); string login = _reader.ReadString(); string imapHost = _reader.ReadString(); int imapPort = _reader.ReadInt32(); bool imapUsessl = _reader.ReadBoolean(); string smtpHost = _reader.ReadString(); int smtpPort = _reader.ReadInt32(); bool smtpUsessl = _reader.ReadBoolean(); string lastUid = _reader.ReadString(); int unhandledMessagesCount = _reader.ReadInt32(); List <string> unhandledMessages = new List <string>(); for (int j = 0; j < unhandledMessagesCount; j++) { unhandledMessages.Add(_reader.ReadString()); } EmailModel email = new EmailModel(id, address, login, imapHost, imapPort, imapUsessl, smtpHost, smtpPort, smtpUsessl, unhandledMessages, lastUid); emailAddresses.Add(email); } return(_reader.Read() == MessageDictionary.EndOfMessage ? emailAddresses : null); } throw new Exception("Connection unsynced"); } catch (Exception ex) { MessageBox.Show(ex.Message + Environment.NewLine + ex.StackTrace); ErrorHelper.LogError(ex); Logout(); return(null); } }
public static void RunRTSS() { if (RTSSInstance == null && !IsRTSSRunning() && File.Exists(RTSSPath)) { try { RTSSInstance = Process.Start(RTSSPath); Thread.Sleep(2000); // For what? Idk. If it works, don't touch it } catch (Exception exc) { MessageBox.Show(exc.Message, "Could not start the RTSS", MessageBoxButton.OK, MessageBoxImage.Error); } RunOSD(); } }
private void Loginworker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { try { ReadOnlyCollection <IWebElement> bluebarNodeelement = ChromeWebDriver.FindElements(By.Id("blueBarDOMInspector")); if (bluebarNodeelement.Count > 0) { MessageBox.Show("Login Successfully..!"); ChromeWebDriver.Manage().Window.Maximize(); } } catch (Exception) { // ignored } }
public void CreateDatabaseExecute() { if (string.IsNullOrWhiteSpace(NewDatabaseName)) { MessageBox.Show("Du må angi navn på stevnet"); return; } if (NewDatabaseStartTime == DateTime.MinValue) { NewDatabaseStartTime = DateTime.Now; } DatabaseApi.CreateNewCompetition(SelectedAvailableTemplate, NewDatabaseName, NewDatabaseStartTime); this.InitExistingDatabase(); }
private static void FatalAlert() { lock (fatal_locker) { //skip if it's in design mode if (IsInDesignMode) { return; } Process.Start(Log.LogFilePath); MessageBox.Show("Wbooru遇到了无法解决的错误,程序即将关闭。请查看日志文件.", "Wbooru", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Stop); Environment.Exit(0); } }
private void DoClientLettersDemo() { var LApp = (IAppTaxApplicationService)_appInstance; var LCLManager = LApp.ClientLetterManager; var LUFL = LApp.UFL; var LCurrentReturn = LApp.GetCurrentDocReturn(); if (LCurrentReturn == null) { MessageBox.Show("Please Open a Client File first"); } else { WKCA.Sample.ClientLettersDemo.ShowDemo(LCLManager, LCurrentReturn, LUFL); } }
/// <summary> /// Vérifie l'envoi de la proposition de mission. /// </summary> /// <param name="_message">Message</param> /// <returns>Boolean : True -> Réussite de l'envoi de l'email. False -> Echec de l'envoi de l'email</returns> private static bool IsSentEmail(_MailItem _message) { try { _MailItem message = _message; message.Send(); return(true); } catch { // Affichage d'un message d'erreur. MessageBox.Show(Results_Err.Default.IsSendEmail, Results_Err.Default.ErrorTitle, MessageBoxButtons.OK, MessageBoxIcon.Error); return(false); } }
private static void WriteLangIni(string language) { var configPath = Path.Combine(GameRootDirectory, @"BepInEx/Config/AutoTranslatorConfig.ini"); if (!File.Exists(configPath)) { return; } if (System.Windows.MessageBox.Show("Do you want the ingame language to reflect this language choice?", "Question", MessageBoxButton.YesNo, MessageBoxImage.Question) != MessageBoxResult.Yes) { return; } try { var contents = File.ReadAllLines(configPath).ToList(); // Fix VMD for darkness var setToLanguage = contents.FindIndex(s => s.ToLower().Contains("[General]".ToLower())); if (setToLanguage >= 0) { var i = contents.FindIndex(setToLanguage, s => s.StartsWith("Language")); if (i > setToLanguage) { contents[i] = $"Language={language}"; } else { contents.Insert(setToLanguage + 1, $"Language={language}"); } } else { contents.Add(""); contents.Add("[General]"); contents.Add($"Language={language}"); } File.WriteAllLines(configPath, contents.ToArray()); } catch (Exception e) { MessageBox.Show("Something went wrong: " + e); } }
/// <summary> /// Obtient le numéro de téléphone de l'intérimaire. /// </summary> /// <remarks> /// Obtient le numéro de téléphone de l'intérimaire. /// </remarks> /// <param name="_temporaryID">ID de l'intérimaire</param> /// <returns>String : Réussite -> Numéro de téléphone de l'intérimaire. Echec -> Valeur vide.</returns> /// <exception cref="SqlConnection, SqlCommand, SqlDataReader"> /// Exception levée par l'objet SqlConnection, SqlCommand ou SqlDataReader. /// </exception> public static string GetTemporaryPhoneNumber(string _temporaryID) { try { using (SqlConnection connectionSQL = new SqlConnection(Interim_Code.Default.InterimDatabaseConnectionString)) { connectionSQL.Open(); using (SqlCommand commandSQL = new SqlCommand(Interim_Proc.Default.Proc_GetTemporaryPhoneNumber, connectionSQL)) { string temporaryID = _temporaryID; // Ajoute une valeur à l'endroit spécifié dans la commande SQL. commandSQL.CommandType = CommandType.StoredProcedure; // Ajoute une valeur à l'endroit spécifié dans la commande SQL. commandSQL.Parameters.AddWithValue(Interim_Fields.Default.IDTemporary, temporaryID); using (SqlDataReader dataReader = commandSQL.ExecuteReader()) { // Vérifie si la commande SQL retourne au moins une ligne et lit tant qu'il existe des lignes. if (dataReader.HasRows && dataReader.Read()) { // Obtient le numéro de téléphone de l'intérimaire. string phoneNumber = dataReader[Interim_Fields.Default.Temporary_PhoneNumber].ToString(); for (int index = 2; index <= phoneNumber.Length; index += 7) { phoneNumber = phoneNumber.Insert(index, " "); phoneNumber = phoneNumber.Insert(index + 3, " "); } return(phoneNumber); } return(string.Empty); } } } } catch { // Affiche un message d'erreur. MessageBox.Show(Interim_Err.Default.GetTemporaryPhoneNumber, Interim_Err.Default.ErrorTitle, MessageBoxButtons.OK, MessageBoxIcon.Error); return(string.Empty); } }
/// <summary> /// Obtient les ID des disponibilités annulées. /// </summary> /// <remarks> /// Obtient les ID des disponibilités annulées. /// </remarks> /// <returns>List : Réussite -> Liste des ID des disponibilités annulées. Echec -> Valeur null.</returns> /// <exception cref="SqlConnection, SqlCommand, SqlDataReader"> /// Exception levée par l'objet SqlConnection, SqlCommand ou SqlDataReader. /// </exception> public static List <string> GetAbortAvibilityID(string _avaibilityIDRef) { try { using (SqlConnection connectionSQL = new SqlConnection(Interim_Code.Default.InterimDatabaseConnectionString)) { connectionSQL.Open(); using (SqlCommand commandSQL = new SqlCommand(Interim_Proc.Default.Proc_GetAbortAvaibilityID, connectionSQL)) { string avaibilityIDRef = _avaibilityIDRef; // Assigne le type procédure stockée à la commande. commandSQL.CommandType = CommandType.StoredProcedure; // Ajoute une valeur à l'endroit spécifié dans la commande SQL. commandSQL.Parameters.AddWithValue(Interim_Fields.Default.IDAvaibility, avaibilityIDRef); using (SqlDataReader dataReader = commandSQL.ExecuteReader()) { // Vérifie si la commande SQL retourne au moins une ligne. if (dataReader.HasRows) { List <string> abortAvaibilityID = new List <string>(); // Lit tant qu'il existe des lignes. while (dataReader.Read()) { // Obtient les ID des disponibilités annulées. abortAvaibilityID.Add(dataReader[Interim_Fields.Default.IDAvaibility].ToString()); } return(abortAvaibilityID); } return(null); } } } } catch { // Affiche un message d'erreur. MessageBox.Show(Interim_Err.Default.GetAbortAvibilityID, Interim_Err.Default.ErrorTitle, MessageBoxButtons.OK, MessageBoxIcon.Error); return(null); } }
//public event Action<string> Check; /// <summary> /// Handles the Closing event of the duplicatesWindow control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.ComponentModel.CancelEventArgs"/> instance containing the event data.</param> private void duplicatesWindow_Closing(object sender, System.ComponentModel.CancelEventArgs e) { if (selectionmade == false) { if (MessageBox.Show("Are you sure you wish to close without adding one of these options?", "Close Confirmation", System.Windows.Forms.MessageBoxButtons.YesNo, System.Windows.Forms.MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.Yes) { e.Cancel = false; } else { e.Cancel = true; } } callback(choiceStr); //Check("apple"); }
private void Shuffle_Songs() { try { //Playlist randPL = plHolder.getRandomPlaylist(); Song randSong = selectedHeader.getRandomSong(); //selectedHeader = randPL; SongView.SelectedItem = null; paused = false; currentlyPlaying = null; Play(selectedHeader, randSong); } catch (Exception ex) { MessageBox.Show(ex.ToString(), "Error"); } }
private static void CheckPlugin() { var conflict_plugin_group = Container.Default.GetExportedValues <PluginInfo>().GroupBy(x => x.PluginName).Where(x => x.Count() > 1); foreach (var p in conflict_plugin_group) { var message = $"There contains plugin conflict that plugin name is same:\"{p.Key}\" : {Environment.NewLine} {string.Join(Environment.NewLine, p.Select(x => x.GetType().Assembly.Location).Select(x => $" -- {x}"))}"; Log.Error(message); MessageBox.Show(message, "Wbooru.CheckPlugin()"); } if (conflict_plugin_group.Any()) { UnusualSafeExit(); } }
/// <summary> /// Enregistre le contenu HTML dans un fichier PDF. /// </summary> /// <param name="_workReportInformations">Informations du rapport de travail</param> /// <returns>Boolean : True -> Fichier créé. False -> Fichier non créé.</returns> internal static bool SaveWorkReport(List <string> _workReportInformations) { List <string> workReportInformations = _workReportInformations; try { byte[] pdfBytes = (new NReco.PdfGenerator.HtmlToPdfConverter()).GeneratePdf(workReportInformations[17]); File.WriteAllBytes(workReportInformations[16], pdfBytes); return(true); } catch { // Affiche un message d'erreur. MessageBox.Show(Profile_Err.Default.SaveWorkReport, Profile_Err.Default.ErrorTitle, MessageBoxButtons.OK, MessageBoxIcon.Error); return(false); } }
private void DoQueryComplexData() { var LApplication = (IAppTaxApplicationService)_appInstance; if (LApplication.GetCurrentTaxData() == null) { MessageBox.Show("Please Open a Client File first"); } else { using (var form = new WKCA.Sample.QueryComplexDataForm()) { form.LoadData(LApplication.GetCurrentTaxData()); form.ShowDialog(); } } }
private void BtnPreviewJSON_Click(object sender, RibbonControlEventArgs e) { if (isPresentationChanged() == true) { MessageBox.Show("Presentation updated! Extarcting first to get updated output"); extractSlide(); } if (File.Exists(currentPPTPath + "\\Json.JSON") && currentPPTPath != "") { Process.Start(currentPPTPath + "\\Json.JSON"); } else { System.Windows.Forms.MessageBox.Show("No JSON file exists. Please first click on extract to generate JSON"); } }
public static void KillRTSS() { if (RTSSInstance != null) { try { RTSSInstance.Kill(); RTSSInstance = null; Process[] proc = Process.GetProcessesByName("RTSSHooksLoader64"); proc[0].Kill(); } catch (Exception exc) { MessageBox.Show(exc.Message, "Failed to close RTSS", MessageBoxButton.OK, MessageBoxImage.Error); } } }
private void btnSaveLocationForm_Click(object sender, RoutedEventArgs e) { if (txtLocation.Text == null || txtLocation.Text == "") { MessageBox.Show("Please enter shop location before proceeding"); } else if (txtLocation.Text != null || txtLocation.Text != "") { //set environment variable so pernament location can be set for this particular install System.Windows.Forms.DialogResult answer = MessageBox.Show("Are these details correct?", "", System.Windows.Forms.MessageBoxButtons.YesNo); if (answer == System.Windows.Forms.DialogResult.Yes) { Environment.SetEnvironmentVariable("Location", txtLocation.Text, EnvironmentVariableTarget.User); Switcher.Switch(new MainWindow()); } } }
private void BuildCompound() { if (!_compoundSelected || !_groupSelected) { return; } _multipliedAtoms.Clear(); MainViewport.Children.Clear(); _atomCell = _compound.CrystalCell; try { _compoundVisual = new CompoundVisual(_compound, _selectedSpaceGroup, _selectableModels, _multipliedAtoms); } catch (EvaluateException) { MessageBox.Show("Ошибка в записях пространственной группы! Ячейка построена неправильно!"); return; } MainViewport.Children.Add(_compoundVisual); MoveFromCenter(_compoundVisual); ModelBuilder.BuildDiscreteAxis(out _discreteYAxis, out _discreteXAxis, out _discreteZAxis, _atomCell); _discreteAxisGroup.Children.Clear(); _discreteAxisGroup.Children.Add(_discreteXAxis); _discreteAxisGroup.Children.Add(_discreteYAxis); _discreteAxisGroup.Children.Add(_discreteZAxis); ModelVisual3D axisModelVisual = new ModelVisual3D(); AmbientLight ambientLight = new AmbientLight(Colors.Gray); DirectionalLight directionalLight = new DirectionalLight(Colors.Gray, new Vector3D(-1.0, -3.0, -2.0)); _discreteAxisGroup.Children.Add(ambientLight); _discreteAxisGroup.Children.Add(directionalLight); axisModelVisual.Content = _discreteAxisGroup; AxisViewport.Children.Add(axisModelVisual); }
private void ExecuteSaveFlightProcessViewCommand(object obj) { try { if (SelectedFlightProcess != null && Employee != null) { SelectedFlightProcess.DateLastModified = DateTime.Now; Employee.FlightProcess = SelectedFlightProcess; _employeeService.InsertOrUpdate(Employee); } CloseWindow(obj); } catch { MessageBox.Show("Problem Saving On Flight Data!!!"); } }
/// <summary> /// This function is the callback used to execute the command when the menu item is clicked. /// See the constructor to see how the menu item is associated with this function using /// OleMenuCommandService service and MenuCommand class. /// </summary> /// <param name="sender">Event sender.</param> /// <param name="e">Event args.</param> private async void Execute(object sender, EventArgs e) { await this.package.JoinableTaskFactory.SwitchToMainThreadAsync(); DTE2 dte = await this.ServiceProvider.GetServiceAsync(typeof(DTE)) as DTE2; ToolWindowPane pane = this.package.FindToolWindow(typeof(WDotykCmd), 0, true); WDotykCmdControl wDotyk = pane.Content as WDotykCmdControl; if (dte.Solution.Count != 0) if (dte.Solution.Projects.Count != 0) { if (!string.IsNullOrEmpty(wDotyk.PushPackage.Text)) { PushOption pushOption = new PushOption() { Register = true, ServerUrl = wDotyk.PushServer.Text, LogVerbosity = (LogLevel)Enum.Parse(typeof(LogLevel), wDotyk.PushVerb.SelectedValue.ToString()), PackagePath = wDotyk.PushPackage.Text,//packagePath, Feed = /*Store.Model.*/PackageFeed.Test, DotykMeToken = wDotyk.PushToken.Text, UseDotykMe = true }; try { OutputsWindow.outputPane.Activate(); await pushOption.ExecuteAsync(); } catch (Exception ex) { Debug.Write(ex.Message); } } else MessageBox.Show("field \"ProjectPath\" is required"); } else { MessageBox.Show("No Project"); } else { MessageBox.Show("No Solution"); } }