public void LoadStyle(StyleOwner owner, string strStyleName)
 {
     if (bgLoadStyle != null && bgLoadStyle.IsBusy)
     {
         bgLoadStyle.RunWorkerCompleted -= new RunWorkerCompletedEventHandler(this.bgLoadStyle_RunWorkerCompleted);
         bgLoadStyle.CancelAsync();
     }
     this.lblPremiumServices.Visible = false;
     this.btnUpgradeAccount.Visible = false;
     this.lblTitle.Text = strStyleName;
     this.owner = owner;
     preparePreview(true);
     bgLoadStyle = new BackgroundWorker();
     bgLoadStyle.WorkerSupportsCancellation = true;
     bgLoadStyle.DoWork += new DoWorkEventHandler(this.bgLoadStyle_DoWork);
     bgLoadStyle.RunWorkerCompleted += new RunWorkerCompletedEventHandler(this.bgLoadStyle_RunWorkerCompleted);
     Dictionary<string, object> data = new Dictionary<string, object>();
     data["Owner"] = owner;
     data["StyleName"] = strStyleName;
     bgLoadStyle.RunWorkerAsync(data);
 }
Exemple #2
0
 public CitationStyle LoadStyle(StyleOwner owner, string name)
 {
     string type = (owner == StyleOwner.Public) ? "official" : "user";
     CitationStyle style = new CitationStyle();
     string strRequestURL = ServerAddress + Properties.Settings.Default.URI_LOCALDATASERVICE + "?op=style&from=" + DeviceTypes.MSWordWin.ToString() + "&authentication=" + Authentication + "&type=" + type + "&name=" + name;
     CustomHttpRequest req = new CustomHttpRequest(strRequestURL);
     JavaScriptSerializer js = new JavaScriptSerializer();
     style = js.Deserialize<CitationStyle>(req.GetResponse());
     return style;
 }