public void OnConnectToTradosServer() { if (model.SelectedServer != null) { if (!model.SelectedServer.IsServerUp) { MessagingHelpers.ShowInformation(this.form, string.Format(PluginResources.Information_ServerIsDown, model.SelectedServer)); } this.worker = new BackgroundWorker(); this.worker.DoWork += (obj, args) => { args.Result = model.SelectedServer.GetTranslationMemories(); }; this.worker.RunWorkerCompleted += (obj, args) => { model.TranslationMemories = args.Result as IList <ServerBasedTrados2007TranslationMemory>; form.TranslationMemories = model.TranslationMemories; form.StopInfiniteProgress(); }; form.StartInfiniteProgress(); this.worker.RunWorkerAsync(); } }
internal void OnDelete() { if (MessagingHelpers.AskYesNoQuestion(form, PluginResources.Trados2007_ServersDialog_Delete) == System.Windows.Forms.DialogResult.Yes) { var selectedServer = GetSelectedServer(); model.Servers.Remove(selectedServer); form.Servers = model.Servers; } }
/// <summary> /// Selects the server-based trados 2007 translation provider. /// </summary> /// <param name="translationMemory">The translation memory.</param> /// <returns> /// <c>true</c> if succeeded; otherwise - <c>false</c> /// </returns> public bool SelectServerBasedProvider(ServerBasedTrados2007TranslationMemory translationMemory) { try { var result = this.CheckServer(translationMemory); this.SelectedTrados2007TranslationProvider = translationMemory; return(result); } catch (Exception ex) { MessagingHelpers.ShowError(ex); return(false); } }
private void OnOkButtonClick(object sender, EventArgs e) { ServerAccount = this.windowsAuthRadioButton.Checked ? new Trados2007ServerAccount(this.addressTextBox.Text) : new Trados2007ServerAccount( this.addressTextBox.Text, this.loginTextBox.Text, this.passwordTextBox.Text); if (!ServerAccount.Valid) { MessagingHelpers.ShowError(PluginResources.Trados2007_AddEditServerDialog_WrongCredentials); return; } this.DialogResult = DialogResult.OK; this.Close(); }
/// <summary> /// Selects the file based provider. /// </summary> /// <param name="path">The local path.</param> /// <returns><c>true</c> if succeeded, otherwise - <c>false</c></returns> public bool SelectFileBasedProvider(string path) { try { var memory = new FileBasedTrados2007TranslationMemory(path); this.SelectedTrados2007TranslationProvider = memory; return(true); } catch (FileNotFoundException ex) { MessagingHelpers.ShowError(ex); return(false); } catch (ArgumentNullException ex) { MessagingHelpers.ShowError(ex, PluginResources.Exception_CouldNotOpen); return(false); } }