private void AddPortfolioItem_Completed(DownloadClient <XDocument> sender, DownloadCompletedEventArgs <XDocument> e)
        {
            AddPfItemAsyncArgs args = (AddPfItemAsyncArgs)e.UserArgs;
            Portfolio          pf   = new PortfolioDownload().ConvertHtmlDoc(e.Response.Result);

            if (this.AsyncAddPortfolioItemCompleted != null)
            {
                this.AsyncAddPortfolioItemCompleted(this, ((DefaultDownloadCompletedEventArgs <XDocument>)e).CreateNew(pf));
            }
        }
        private void DeletePortfolioView_DownloadCompleted(WebFormUpload sender, DefaultDownloadCompletedEventArgs <XDocument> e)
        {
            sender.AsyncUploadCompleted -= this.DeletePortfolioView_DownloadCompleted;
            Portfolio pf = new PortfolioDownload().ConvertHtmlDoc(e.Response.Result);

            if (this.AsyncDeletePortfolioViewCompleted != null)
            {
                this.AsyncDeletePortfolioViewCompleted(this, e.CreateNew <Portfolio>(pf));
            }
        }
 public Response <Portfolio> DownloadPortfolio(string portfolioID, int viewIndex)
 {
     if (this.IsLoggedIn)
     {
         PortfolioDownload dl = new PortfolioDownload();
         dl.Settings.Account     = this;
         dl.Settings.ViewIndex   = viewIndex;
         dl.Settings.PortfolioID = portfolioID;
         return(dl.Download());
     }
     else
     {
         throw new NotSupportedException("The user is not logged in.");
     }
 }
 public void DownloadPortfolioAsync(PortfolioInfo portfolio, int viewIndex, bool dlRealTime, bool dlFundamentals, object userArgs)
 {
     if (this.IsLoggedIn)
     {
         PortfolioDownload dl = new PortfolioDownload();
         dl.Settings.Account     = this;
         dl.Settings.ViewIndex   = viewIndex;
         dl.Settings.PortfolioID = portfolio.ID;
         dl.Settings.DownloadFundamentalsView = dlFundamentals;
         dl.Settings.DownloadRealTimeView     = dlRealTime;
         dl.AsyncDownloadCompleted           += this.PortfolioDownload_DownloadCompleted;
         dl.DownloadAsync(userArgs);
     }
     else
     {
         throw new NotSupportedException("The user is not logged in.");
     }
 }