Exemplo n.º 1
0
 public ReferenceCitationItem()
 {
     OldFormatString = string.Empty;
     FormatString = string.Empty;
     MasterURLList = new List<string>();
     MasterRefList = new List<ItemMasterRow>();
     TextCitations = new List<TextCitationItem>();
     UserList = new Dictionary<int, User>();
     MasterHashList = new List<string>();
     DocType = string.Empty;
     StyleInfo = null;
     FieldIndex = -1;
     URL = string.Empty;
 }
Exemplo n.º 2
0
 public void ReapplySytle(StyleInformation styleinfo)
 {
     try
     {
         Globals.ThisAddIn.Application.ScreenUpdating = false;
         if (styleinfo != null)
         {
             StyleOwner styleOwner = (styleinfo.UserID == -1) ? StyleOwner.Public : StyleOwner.User;
             citationstyle = Globals.ThisAddIn.user.LoadStyle(styleOwner, styleinfo.StyleName);
             citationstyle.OwnerUserID = styleinfo.UserID;
         }
         bForceReload = true;
         RefreshCitations(false);
         Globals.ThisAddIn.Application.ScreenRefresh();
         Globals.ThisAddIn.Application.ScreenUpdating = true;
     }
     catch (Exception ex)
     {
         log.WriteLine(LogType.Error, "DocumentFormatter::ReapplySytle", ex.ToString());
     }
 }
Exemplo n.º 3
0
 private List<StyleInformation> loadFavoriteStyleNames()
 {
     List<StyleInformation> favoriteStyles = new List<StyleInformation>();
     JavaScriptSerializer sr = new JavaScriptSerializer();
     ListDictionary ld = null;
     try
     {
         ld = sr.Deserialize<ListDictionary>(Properties.Settings.Default.LAST_USED_CITATIONSTYLES);
     }
     catch { }
     if (ld != null)
     {
         IDictionaryEnumerator myEnumerator = ld.GetEnumerator();
         while (myEnumerator.MoveNext())
         {
             StyleInformation styleInfo = new StyleInformation(int.Parse(myEnumerator.Value + ""), myEnumerator.Key + "");
             if (styleInfo.UserID == Globals.ThisAddIn.user.UserID || styleInfo.UserID == -1)
                 favoriteStyles.Add(styleInfo);
         }
     }
     return favoriteStyles;
 }
Exemplo n.º 4
0
 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());
     }
 }