Esempio n. 1
0
 public OnInfoClickEventArgs(Info info)
 {
     this.Info = info;
 }
Esempio n. 2
0
 private void initIndexImage(Info info, int index)
 {
     InfoIndexItem item = new InfoIndexItem();
     if (info.ImageSource != null)
     {
         Image s = new Image();
         s.Margin = new Thickness(2.0, 1.0, 2.0, 1.0);
         s.Height = 45.0;
         s.Width = 57.0;
         s.Stretch = Stretch.Fill;
         s.Source = info.ImageSource;
         s.Tag = index;
         s.MouseLeftButtonDown += (objects, arts) =>
         {
             Image source = objects as Image;
             int Index = (int)source.Tag;
             Content.DataContext = InfoList[Index];
             _currentIndex = Index;
         };
         s.MouseEnter += new MouseEventHandler(Content_MouseEnter);
         s.MouseLeave += new MouseEventHandler(Content_MouseLeave);
     }
 }
Esempio n. 3
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();

            }
        }