예제 #1
0
 public ServerService()
 {
     service = new UploadServiceClient();
     service.PublishDocumentCompleted += new EventHandler <PublishDocumentCompletedEventArgs>(service_PublishDocumentCompleted);
     progressBar = new ProgressBarDlg();
     progressBar.SetMax(100);
 }
예제 #2
0
 public LogOn()
 {
     InitializeComponent();
     progressBarLogon.Visible = false;
     timerProgress.Tick      += timerProgress_Tick;
     _client = ServicePool.Instance.GetService <ServerService>().Client;
     _client.SignInCompleted += client_SignInCompleted;
 }
예제 #3
0
        static void Main(string[] args)
        {
            var client = new UploadServiceClient();
            var bytesProcessed = client.Upload(new byte[] {1, 2, 3, 4});
            Console.WriteLine("Bytes processed: " + bytesProcessed);

            var windowsIdentity = client.GetCurrentWindowsIdentityName();
            Console.WriteLine("Current Windows Identity as detected by server: " + windowsIdentity);
            Console.ReadLine();
        }
예제 #4
0
        private void DownLoadNews(T_PF_NEWS newsmodel)
        {
            try
            {
                //FileUploadManagerClient fileUpload = new FileUploadManagerClient();
                WebClient wc = new WebClient();
                SMT.Saas.Tools.NewFileUploadWS.UploadServiceClient bb = new UploadServiceClient();
                bb.GetFileListByOnlyApplicationIDCompleted += (obj, args) =>
                {
                    try
                    {
                        var result = args.Result.FileList;
                        if (result != null && result.Count > 0)
                        {
                            string path     = result[0].FILEURL;
                            string filename = path.Substring(path.LastIndexOf('\\') + 1);
                            //string filepath = HttpUtility.UrlEncode(result[0].THUMBNAILURL + "\\" + result[0].FILENAME);
                            //var url = args.Result.DownloadUrl + "?filename=" + filepath;//文件地址
                            string filepath = HttpUtility.UrlEncode(result[0].THUMBNAILURL + "\\" + result[0].FILENAME);
                            string url      = args.Result.DownloadUrl + "?flag=1&filename=" + filepath;

                            wc.OpenReadAsync(new Uri(url, UriKind.Absolute));
                            wc.OpenReadCompleted += (r, c) =>
                            {
                                try
                                {
                                    Info info = new Info();
                                    info.DataContext = newsmodel;
                                    info.InfoID      = newsmodel.NEWSID;
                                    info.Titel       = "◇" + newsmodel.NEWSTITEL;
                                    info.Uri         = "";
                                    BitmapImage            imgsource = new BitmapImage();
                                    System.IO.MemoryStream stream    = new System.IO.MemoryStream(StreamToBytes(c.Result));
                                    imgsource.SetSource(stream);
                                    stream.Close();
                                    info.ImageSource = imgsource;
                                    infoPanel.InfoList.Add(info);
                                }
                                catch (Exception ex)
                                {
                                    Main.CurrentContext.AppContext.SystemMessage("webpart RollImageNews err:"
                                                                                 + ex.ToString() + " url=" + url);
                                }finally
                                {
                                    if (listIndex < ImageNews.Count - 1)
                                    {
                                        listIndex++;
                                        DownLoadNews(ImageNews[listIndex]);
                                    }
                                    else
                                    {
                                        if (infoPanel.InfoList.Count > 0)
                                        {
                                            infoPanel.Start();
                                        }
                                    }
                                }
                            };
                        }
                    }
                    catch (Exception ex)
                    {
                        SMT.SAAS.Main.CurrentContext.AppContext.logAndShow(ex.ToString());
                        if (infoPanel.InfoList.Count > 0)
                        {
                            infoPanel.Start();
                        }
                    }
                };
                bb.GetFileListByOnlyApplicationIDAsync(newsmodel.NEWSID);
            }
            catch (Exception ex)
            {
                SMT.SAAS.Main.CurrentContext.AppContext.logAndShow(ex.ToString());
                if (infoPanel.InfoList.Count > 0)
                {
                    infoPanel.Start();
                }
            }
        }
예제 #5
0
        private void DownLoadNews(T_PF_NEWS newsmodel)
        {
            try
            {
                //FileUploadManagerClient fileUpload = new FileUploadManagerClient();
                WebClient wc = new WebClient();
                SMT.Saas.Tools.NewFileUploadWS.UploadServiceClient bb = new UploadServiceClient();
                bb.GetFileListByOnlyApplicationIDCompleted += (obj, args) =>
                {
                    try
                    {
                        var result = args.Result.FileList;
                        if (result != null && result.Count > 0)
                        {
                            string path = result[0].FILEURL;
                            string filename = path.Substring(path.LastIndexOf('\\') + 1);
                            //string filepath = HttpUtility.UrlEncode(result[0].THUMBNAILURL + "\\" + result[0].FILENAME);
                            //var url = args.Result.DownloadUrl + "?filename=" + filepath;//文件地址
                            string filepath = HttpUtility.UrlEncode(result[0].THUMBNAILURL + "\\" + result[0].FILENAME);
                            string url = args.Result.DownloadUrl + "?flag=1&filename=" + filepath;

                            wc.OpenReadAsync(new Uri(url, UriKind.Absolute));
                            wc.OpenReadCompleted += (r, c) =>
                            {
                                try
                                {
                                    Info info = new Info();
                                    info.DataContext = newsmodel;
                                    info.InfoID = newsmodel.NEWSID;
                                    info.Titel = "◇" + newsmodel.NEWSTITEL;
                                    info.Uri = "";
                                    BitmapImage imgsource = new BitmapImage();
                                    System.IO.MemoryStream stream = new System.IO.MemoryStream(StreamToBytes(c.Result));
                                    imgsource.SetSource(stream);
                                    stream.Close();
                                    info.ImageSource = imgsource;
                                    infoPanel.InfoList.Add(info);
                                }
                                catch (Exception ex)
                                {
                                    Main.CurrentContext.AppContext.SystemMessage("webpart RollImageNews err:"
                                        + ex.ToString() + " url=" + url);
                                }finally
                                {
                                    if (listIndex < ImageNews.Count - 1)
                                    {
                                        listIndex++;
                                        DownLoadNews(ImageNews[listIndex]);

                                    }
                                    else
                                    {
                                        if (infoPanel.InfoList.Count > 0)
                                            infoPanel.Start();
                                    }
                                }
                            };
                        }
                    }
                    catch (Exception ex)
                    {
                        SMT.SAAS.Main.CurrentContext.AppContext.logAndShow(ex.ToString());
                        if (infoPanel.InfoList.Count > 0) infoPanel.Start();

                    }

                };
                bb.GetFileListByOnlyApplicationIDAsync(newsmodel.NEWSID);
            }
            catch (Exception ex)
            {
                SMT.SAAS.Main.CurrentContext.AppContext.logAndShow(ex.ToString());
                if (infoPanel.InfoList.Count > 0) infoPanel.Start();

            }
        }