// Refresh the references in the current document private void btnRefresh_Click(object sender, EventArgs e) { try { ParameterizedThreadStart threadStart = new ParameterizedThreadStart(formatter.RefreshCitationsInThread); masterThread = new Thread(threadStart); masterThread.Name = "refreshingcitations"; masterThread.Start(this); progress = new ProgressForm(Lang.en_US.Progress_RefreshCitation_Title, Lang.en_US.Progress_RefreshCitation_Msg, true); progress.FormClosed += new FormClosedEventHandler(progress_FormClosed); progress.ShowDialog(); } catch(Exception ex) { log.WriteLine(LogType.Error, "MasterControl::btnRefList_Click", ex.ToString()); } }
private void btnOK_Click(object sender, EventArgs e) { try { if (listCitations.SelectedItems.Count == 0) { MessageBox.Show(Lang.en_US.StyleChooser_NoStyleSelected_Label); return; } Dictionary<string, string> style = (Dictionary<string, string>)listCitations.SelectedObject; int iUserID = (style["Type"] == "official") ? -1 : Globals.ThisAddIn.user.UserID; if (style["Type"] == "fav") { JavaScriptSerializer sr = new JavaScriptSerializer(); ListDictionary ld = null; try { ld = sr.Deserialize<ListDictionary>(Properties.Settings.Default.LAST_USED_CITATIONSTYLES); } catch { } iUserID = (int)ld[style["StyleName"]]; } StyleInformation styleInfo = new StyleInformation(iUserID, style["StyleName"]); addToFavList(style); this.Close(); Globals.ThisAddIn.Application.ActiveDocument.Activate(); ParameterizedThreadStart threadStart = new ParameterizedThreadStart(formatter.ReappyStyleInThread); curThread = new Thread(threadStart); Dictionary<string, object> data = new Dictionary<string, object>(); data["Control"] = this; data["Style"] = styleInfo; curThread.Start(data); progress = new ProgressForm(Lang.en_US.Progress_ChangeCitationStyle_Title, string.Format(Lang.en_US.Progress_ChangeCitationStyle_Msg, styleInfo.StyleName), true); progress.ShowDialog(); } catch(Exception ex) { this.log.WriteLine(LogType.Error, "CitationStyleForm::btnOK_Click", ex.ToString()); } }
// Cite the selected items private void btnCite_Click(object sender, EventArgs e) { try { ParameterizedThreadStart threadStart = new ParameterizedThreadStart(formatter.InsertCitationsInThread); masterThread = new Thread(threadStart); masterThread.Name = "insertingcitations"; List<ItemMasterRow> listSelectedItems = new List<ItemMasterRow>(); foreach (ItemMasterRow item in listItems.SelectedObjects) { listSelectedItems.Add(item); } Dictionary<string, object> data = new Dictionary<string, object>(); data["Control"] = this; data["ListItems"] = listSelectedItems; if (currentSearchOption != SearchOptions.Filter) data["FromSearch"] = 1; masterThread.Start(data); progress = new ProgressForm(Lang.en_US.Progress_InsertCitation_Title, Lang.en_US.Progress_InsertCitation_Msg, true); progress.FormClosed += new FormClosedEventHandler(this.progress_FormClosed); progress.ShowDialog(); } catch (Exception ex) { this.log.WriteLine(LogType.Error, "MasterControl::btnCite_Click", ex.ToString()); } }