public void EditPortfolio(string portfolioID, string name, CurrencyInfo currency, bool symbolSorting, bool symbolCollapsing, IEnumerable<YID> items = null, IEnumerable<YIndexID> indices = null)
 {
     if (this.IsLoggedIn)
     {
         WebFormUpload upl = new WebFormUpload();
         upl.Upload(this.GetEditPortfolioDownloadSettings(portfolioID, name, currency, symbolSorting, symbolCollapsing, items, indices));
     }
     else { throw new NotSupportedException("The user is not logged in."); }
 }
 public Response<Portfolio> CreatePortfolio(string name, CurrencyInfo currency, bool symbolSorting, bool symbolCollapsing, IEnumerable<YID> items, IEnumerable<YIndexID> indices)
 {
     if (this.IsLoggedIn)
     {
         WebFormUpload upl = new WebFormUpload();
         Response<XDocument> resp = upl.Upload(this.GetCreatePortfolioDownloadSettings(name, currency, symbolSorting, symbolCollapsing, items, indices));
         return ((DefaultResponse<XDocument>)resp).CreateNew(new PortfolioDownload().ConvertHtmlDoc(resp.Result));
     }
     else { throw new NotSupportedException("The user is not logged in."); }
 }
 public Response<PortfolioInfoResult> DeletePortfolio(string portfolioID)
 {
     if (this.IsLoggedIn)
     {
         WebFormUpload upl = new WebFormUpload();
         DefaultResponse<XDocument> resp = (DefaultResponse<XDocument>)upl.Upload(this.GetDeletePortfolioDownloadSettings(portfolioID));
         return resp.CreateNew(new PortfolioInfoDownload().ConvertHtml(resp.Result));
     }
     else { throw new NotSupportedException("The user is not logged in."); }
 }
 public bool LogIn(System.Net.NetworkCredential user)
 {
     if (!this.IsLoggedIn)
     {
         if (user == null) throw new ArgumentNullException("User credential is null.");
         mCookies = new CookieContainer();
         WebFormUpload upl = new WebFormUpload();
         upl.Upload(this.GetLoginDownloadSettings(user));
         if (!this.IsLoggedIn) mCookies = null; 
     }
     return this.IsLoggedIn;
 }
 private void logInDl_Completed(WebFormUpload sender, DownloadCompletedEventArgs<XDocument> e)
 {
     sender.AsyncUploadCompleted -= this.logInDl_Completed;
     if (this.IsLoggedInFunc(mCookies)) { if (this.LoggedStatusChanged != null) this.LoggedStatusChanged(this, new LoginStateEventArgs(this.IsLoggedIn, e.UserArgs)); }
     else { mCookies = null; }
     if (this.PropertyChanged != null) this.PropertyChanged(this, new System.ComponentModel.PropertyChangedEventArgs("IsLoggedIn"));
 }
 public void LogInAsync(System.Net.NetworkCredential user, object userArgs)
 {
     if (!this.IsLoggedIn)
     {
         if (user == null) throw new ArgumentNullException("User credential is null.");
         mCookies = new CookieContainer();
         WebFormUpload upl = new WebFormUpload();
         upl.AsyncUploadCompleted += this.logInDl_Completed;
         upl.UploadAsync(this.GetLoginDownloadSettings(user), userArgs);
     }
 }
 public void DeletePortfolioItem(string portfolioID, string itemID, int idIndex)
 {
     if (this.IsLoggedIn)
     {
         WebFormUpload upl = new WebFormUpload();
         upl.Upload(this.GetDeletePortfolioItemDownloadSettings(portfolioID, itemID, idIndex));
     }
     else { throw new NotSupportedException("The user is not logged in."); }
 }
 public void EditHoldings(string portfolioID, Holding[] holdings)
 {
     if (this.IsLoggedIn)
     {
         WebFormUpload upl = new WebFormUpload();
         upl.Upload(this.GetEditHoldingsDownloadSettings(portfolioID, holdings));
     }
     else { throw new NotSupportedException("The user is not logged in."); }
 }
 private void EditPortfolio_DownloadCompleted(WebFormUpload sender, DefaultDownloadCompletedEventArgs<XDocument> e)
 {
     sender.AsyncUploadCompleted -= this.EditPortfolio_DownloadCompleted;
     if (this.AsyncEditPortfolioCompleted != null) this.AsyncEditPortfolioCompleted(this, new DownloadEventArgs(e.UserArgs));
 }
        private void EditPortfolioView_DownloadCompleted(WebFormUpload sender, DefaultDownloadCompletedEventArgs<XDocument> e)
        {
            sender.AsyncUploadCompleted -= this.EditPortfolioView_DownloadCompleted;

            Portfolio pf = new PortfolioDownload().ConvertHtmlDoc(e.Response.Result);

            if (this.AsyncEditPortfolioViewCompleted != null) this.AsyncEditPortfolioViewCompleted(this, e.CreateNew<Portfolio>(pf));
        }
 private void EditHoldings_DownloadCompleted(WebFormUpload sender, DefaultDownloadCompletedEventArgs<XDocument> e)
 {
     sender.AsyncUploadCompleted -= this.EditHoldings_DownloadCompleted;
     EditHoldingsAyncArgs args = (EditHoldingsAyncArgs)e.UserArgs;
     if (this.AsyncEditHoldingsCompleted != null) AsyncEditHoldingsCompleted(this, ((DefaultDownloadCompletedEventArgs<XDocument>)e).CreateNew(new PortfolioDownload().ConvertHtmlDoc(e.Response.Result), args.UserArgs));
 }
 private void DeletePortfolio_DownloadCompleted(WebFormUpload sender, DefaultDownloadCompletedEventArgs<XDocument> e)
 {
     sender.AsyncUploadCompleted -= this.DeletePortfolio_DownloadCompleted;
     if (this.AsyncDeletePortfolioCompleted != null) this.AsyncDeletePortfolioCompleted(this, e.CreateNew(new PortfolioInfoDownload().ConvertHtml(e.Response.Result)));
 }
 public void EditPortfolioViewAsync(string portfolioID, int viewIndex, string name, IEnumerable<PortfolioColumnType> viewFields, object userArgs)
 {
     if (this.IsLoggedIn)
     {
         WebFormUpload upl = new WebFormUpload();
         upl.AsyncUploadCompleted += this.EditPortfolioView_DownloadCompleted;
         upl.UploadAsync(this.GetEditPortfolioViewDownloadSettings(portfolioID, viewIndex, name, viewFields), userArgs);
     }
     else { throw new NotSupportedException("The user is not logged in."); }
 }
 public void EditPortfolioAsync(string portfolioID, string name, CurrencyInfo currency, bool symbolSorting, bool symbolCollapsing, IEnumerable<YID> items, IEnumerable<YIndexID> indices, object userArgs)
 {
     if (this.IsLoggedIn)
     {
         WebFormUpload upl = new WebFormUpload();
         upl.AsyncUploadCompleted += this.EditPortfolio_DownloadCompleted;
         upl.UploadAsync(this.GetEditPortfolioDownloadSettings(portfolioID, name, currency, symbolSorting, symbolCollapsing, items, indices), userArgs);
     }
     else { throw new NotSupportedException("The user is not logged in."); }
 }
 public void EditHoldingsAsync(string portfolioID, Holding[] holdings, object userArgs)
 {
     if (this.IsLoggedIn)
     {
         WebFormUpload upl = new WebFormUpload();
         upl.AsyncUploadCompleted += this.EditHoldings_DownloadCompleted;
         upl.UploadAsync(this.GetEditHoldingsDownloadSettings(portfolioID, holdings), new EditHoldingsAyncArgs(userArgs) { Info = portfolioID });
     }
     else { throw new NotSupportedException("The user is not logged in."); }
 }
 public void DeletePortfolioViewAsync(string portfolioID, int viewIndex, object userArgs)
 {
     if (this.IsLoggedIn)
     {
         WebFormUpload upl = new WebFormUpload();
         upl.AsyncUploadCompleted += this.DeletePortfolioView_DownloadCompleted;
         upl.UploadAsync(this.GetDeletePortfolioViewDownloadSettings(portfolioID, viewIndex), userArgs);
     }
     else { throw new NotSupportedException("The user is not logged in."); }
 }