Пример #1
0
        private string DownloadPaperDocs(IPaperModel model, IPaperView view, IMainPresenter presenter)
        {
            string errorMessage    = string.Empty;
            string outputFolder    = view.OutputFolder;
            string fileAccessToken = ApplicationResource.DefaultAccessToken;

            IMemberServices service = new MemberServices(ApplicationResource.BaseUrl, ApplicationResource.ApiVersion);

            service.DownloadPaperDocUrl = ApplicationResource.ActionDownloadPaperDocs;
            service.UserAgentVersion    = ApplicationResource.UserAgent;
            IServiceResponse response = null;

            foreach (PaperListViewItemModel item in model.Paper)
            {
                if (item.IsChecked)
                {
                    response = service.DownloadPaperDoc(item.MemberId, item.PaperId, outputFolder, item.PaperName, fileAccessToken);

                    if (SyncContext != null)
                    {
                        SyncContext.Post(delegate
                        {
                            presenter.UpdateProgressInfo(string.Format("Downloaded Paper doc [" + item.PaperName + "]"));
                        }, null);
                    }
                }
            }
            return(errorMessage);
        }