示例#1
0
        void infoPanel_OnInfoClick(object sender, OnInfoClickEventArgs e)
        {
            if (e.Info == null)
            {
                return;
            }
            try
            {
                T_PF_NEWS news = e.Info.DataContext as T_PF_NEWS;

                NewsShow newsview = new NewsShow();
                newsview.LoadNewsDetails(news.NEWSID);
                string titel = "";
                switch (news.NEWSTYPEID)
                {
                case "0": titel = "新    闻"; break;

                case "1": titel = "动    态"; break;

                case "2": titel = "公    告"; break;

                case "3": titel = "通    知"; break;

                default:
                    break;
                }
                System.Windows.Controls.Window.Show(titel, "", news.NEWSID, true, true, newsview, null);
            }catch (Exception ex)
            {
                SMT.SAAS.Main.CurrentContext.AppContext.SystemMessage(ex.ToString());
                SMT.SAAS.Main.CurrentContext.AppContext.ShowSystemMessageText();
            }
        }
示例#2
0
        void client_GetNewsModelByIDCompleted(object sender, GetNewsModelByIDCompletedEventArgs e)
        {
            if (e.Error == null)
            {
                if (e.Result != null)
                {
                    publicWS.GetContentAsync(e.Result.NEWSID);

                    CacheNews = e.Result;
                    // CacheList.Add(e.Result.NEWSID, e.Result);
                }
            }
        }
示例#3
0
        void client_GetNewsModelByIDCompleted(object sender, GetNewsModelByIDCompletedEventArgs e)
        {
            if (e.Error == null)
            {
                if (e.Result != null)
                {
                    publicWS.GetContentAsync(e.Result.NEWSID);

                    CacheNews = e.Result;
                    // CacheList.Add(e.Result.NEWSID, e.Result);
                }
            }
        }
示例#4
0
        void tblRollnews_MouseLeftButtonUp(object sender, System.Windows.Input.MouseButtonEventArgs e)
        {
            T_PF_NEWS news = ((sender as TextBlock).DataContext as NewsModel).DataContent as T_PF_NEWS;

            NewsShow newsview = new NewsShow();

            newsview.LoadNewsDetails(news.NEWSID);
            string titel = "";

            switch (news.NEWSTYPEID)
            {
            case "0": titel = "新    闻"; break;

            case "1": titel = "动    态"; break;

            case "2": titel = "公    告"; break;

            case "3": titel = "通    知"; break;

            default:
                break;
            }
            System.Windows.Controls.Window.Show(titel, "", news.NEWSID, true, true, newsview, null);
        }
示例#5
0
        void infoPanel_OnInfoClick(object sender, OnInfoClickEventArgs e)
        {
            T_PF_NEWS news = e.Info.DataContext as T_PF_NEWS;

            NewsShow newsview = new NewsShow();

            newsview.LoadNewsDetails(news.NEWSID);
            string titel = "";

            switch (news.NEWSTYPEID)
            {
            case "0": titel = "新    闻"; break;

            case "1": titel = "动    态"; break;

            case "2": titel = "公    告"; break;

            case "3": titel = "通    知"; break;

            default:
                break;
            }
            System.Windows.Controls.Window.Show(titel, "", news.NEWSID, true, true, newsview, null);
        }
示例#6
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();
                }
            }
        }
示例#7
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();

            }
        }