Esempio n. 1
0
        void videoImg_MouseDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
        {
            var video     = sender as Image;
            var videoName = video.DataContext.ToString();

            WebDownloader.GetInstance().DownloadFile(videoName, VideoDownloadComplete, this);
        }
Esempio n. 2
0
        public void InitPictureView(ClassPictureDetailInfo pDetail)
        {
            m_strImageFolderName = pDetail.ClassType[0].Class_Img_Folder;
            stackPanel1.Children.Clear();

            for (int i = 0; i < pDetail.ClassType.Count; i++)
            {
                string filePath = string.Empty;
                if (pDetail.ClassType[i].Class_File_Type == 0)
                {
                    //filePath = "ImageFile/" + pDetail.ClassType[i].Class_File_Name;
                    filePath = pDetail.ClassType[i].Class_File_Name;
                    WebDownloader.GetInstance().DownloadFile(filePath, PictureDownloadComplete, this);
                }
                else if (pDetail.ClassType[i].Class_File_Type == 2)
                {
                    //filePath = "ImageFile/" + pDetail.ClassType[i].Class_Video_Title;
                    string[] strVideoTitles   = new string[] { "" };
                    string[] stringSeparators = new string[] { "||" };
                    strVideoTitles = pDetail.ClassType[i].Class_Video_Title.Split(stringSeparators, StringSplitOptions.RemoveEmptyEntries);

                    for (int j = 0; j < strVideoTitles.Length; j++)
                    {
                        //filePath = "VideoFile/" + strVideoTitles[j];
                        filePath = strVideoTitles[j];
                        WebDownloader.GetInstance().DownloadFile(filePath, PictureDownloadComplete, this);
                    }
                }

                //WebDownloader.GetInstance().DownloadFile(filePath, PictureDownloadComplete, this);
            }
        }
 private void Button_Click(object sender, RoutedEventArgs e)
 {
     if (bClickFlag == false)
     {
         if (fpFlag == true)
         {
             //Dispatcher.BeginInvoke(new System.Threading.ThreadStart(delegate
             //{
             //    if (Main.loadWnd == null)
             //    {
             //        Main.loadWnd = new LoadingWnd();
             //        Main.loadWnd.Owner = GetParentWindow(this);
             //        Main.loadWnd.ShowDialog();
             //    }
             //}));
             bClickFlag = true;
             //WebDownloader.GetInstance().DownloadFile("VideoFile/" + image2.DataContext.ToString(), VideoDownloadComplete, this);
             WebDownloader.GetInstance().DownloadFile(image2.DataContext.ToString(), VideoDownloadComplete, this);
             return;
         }
         else
         {
             for (int i = 0; i < Login._ClassTypeListInfo.ClassType.Count; i++)
             {
                 string folderName = Login._ClassTypeListInfo.ClassType[i].Class_Img_Folder;
                 if (folderName == image2.DataContext.ToString())
                 {
                     Login._ClassTypeInfo = Login._ClassTypeListInfo.ClassType[i];
                     Login._ClientEngine.Send(NotifyType.Request_ClassPictureDetail, Login._ClassTypeInfo);
                     break;
                 }
             }
         }
     }
 }
        private void novelGrid_MouseDown(object sender, MouseButtonEventArgs e)
        {
            var itemGrid = sender as Grid;

            WebDownloader.GetInstance().DownloadFile("NovelFile/" + itemGrid.DataContext.ToString(), NovelDownloadComplete, this);
            return;
        }
Esempio n. 5
0
        static public WebDownloader GetInstance()
        {
            if (_instance == null)
            {
                _instance = new WebDownloader();
            }

            return(_instance);
        }
Esempio n. 6
0
        public void InitPictureView(ClassPictureDetailInfo pDetail)
        {
            stackPanel1.Children.Clear();
            WebDownloader.GetInstance().CancelDownload(this);

            for (int i = 0; i < pDetail.ClassType.Count; i++)
            {
                string filePath = "ImageFile/" + pDetail.ClassType[i].Class_File_Name;

                WebDownloader.GetInstance().DownloadFile(filePath, PictureDownloadComplete, this);
            }
        }
        public void selPictureList(UserDetailInfo user)
        {
            try
            {
                wrapPanel1.Children.Clear();

                nTotalCount = user.Faces.Count;

                if (user.Faces.Count == 0)
                {
                    this.titleName.Visibility = Visibility.Visible;
                    return;
                }

                for (int i = 0; i < user.Faces.Count; i++)
                {
                    //string video = user.Faces[i].Icon;
                    //char[] delimiterChars = { ':', '\\' };
                    //string[] words = video.Split(delimiterChars);
                    //int count = words.Length;

                    //if (words[count - 2].ToString() == "Face")
                    {
                        user.Faces[i].Icon = user.Faces[i].Icon.Replace("\\", "/");
                        WebDownloader.GetInstance().ctrlSelectAlbum = this;
                        progressUpdate.Visibility = Visibility.Visible;
                        WebDownloader.GetInstance().DownloadFile(user.Faces[i].Icon, TitleDownloadComplete, this);

                        //var faceGrid = new Grid();
                        //faceGrid.Width = 82;
                        //faceGrid.Height = 81;
                        //faceGrid.Margin = new Thickness(0);

                        //Image finalImage = new Image();
                        //finalImage.Cursor = Cursors.Hand;
                        //finalImage.Margin = new Thickness(2, 1, 2, 1);
                        //finalImage.DataContext = user.Faces[i].Icon;
                        //finalImage.Source = ImageDownloader.GetInstance().GetImage(user.Faces[i].Icon);
                        //finalImage.MouseLeftButtonUp += new MouseButtonEventHandler(finalImage_MouseLeftButtonUp);
                        //faceGrid.Children.Add(finalImage);
                        //wrapPanel1.Children.Add(faceGrid);
                    }
                }
            }
            catch (Exception ex)
            {
                string strError = ex.ToString();
                ErrorCollection.GetInstance().SetErrorInfo(strError);
            }
        }
Esempio n. 8
0
        public void pictureList(List <IconInfo> iconInfoList)
        {
            wrapPanel1.Children.Clear();

            nTotalCount = iconInfoList.Count;
            if (iconInfoList.Count == 0)
            {
                this.titleName.Visibility = Visibility.Visible;
                return;
            }

            for (int i = 0; i < iconInfoList.Count; i++)
            {
                //string video = iconInfoList[i].Icon;
                //char[] delimiterChars = { ':', '\\' };
                //string[] words = video.Split(delimiterChars);
                //int count = words.Length;

                //if (words[count - 2].ToString() == "Face")
                //{
                //    var faceGrid = new Grid();
                //    faceGrid.Width = 80;
                //    faceGrid.Height = 80;
                //    faceGrid.Margin = new Thickness(0);

                //    Image finalImage = new Image();
                //    finalImage.Cursor = Cursors.Hand;
                //    finalImage.Margin = new Thickness(1, 1, 1, 1);

                //    finalImage.DataContext = iconInfoList[i].Icon;
                //    finalImage.Source = ImageDownloader.GetInstance().GetImage(iconInfoList[i].Icon);
                //    finalImage.MouseRightButtonUp += new MouseButtonEventHandler(imgMenu_MouseRightUp);
                //    finalImage.MouseLeftButtonUp += new MouseButtonEventHandler(finalImage_MouseLeftButtonUp);
                //    faceGrid.Children.Add(finalImage);
                //    wrapPanel1.Children.Add(faceGrid);
                //}

                // 2013-12-30: GreenRose
                if (!iconInfoList[i].Icon.Contains(".avi"))
                {
                    iconInfoList[i].Icon = iconInfoList[i].Icon.Replace("\\", "/");

                    WebDownloader.GetInstance().ctrlAlbum = this;
                    progressUpdate.Visibility = Visibility.Visible;
                    WebDownloader.GetInstance().DownloadFile(iconInfoList[i].Icon, TitleDownloadComplete, this);
                }
            }
        }
Esempio n. 9
0
        void videoImg_MouseDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
        {
            var    video     = sender as Image;
            string videoName = video.DataContext.ToString();

            //WebDownloader.GetInstance().DownloadFile(videoName, VideoDownloadComplete, this);
            int nIndex = videoName.LastIndexOf("\\");

            videoName = videoName.Substring(nIndex + 1);
            videoName = videoName.Replace(".jpg", ".mp4");
            //SelectVideoView selectVideoView = new SelectVideoView();
            //selectVideoView._strMediaFile = Login._ServerPath + "Images/Face/" + videoName;
            //selectVideoView.Show();

            WebDownloader.GetInstance().DownloadFile("Images/Face/" + videoName, VideoDownloadComplete, this);
        }
Esempio n. 10
0
        public void InitFilmView(ClassTypeInfo classTypeInfo)
        {
            string strFilePath = string.Empty;

            if (classTypeInfo.Class_File_Type == 2)
            {
                strFilePath        = "VideoFile/" + classTypeInfo.Class_Video_Title;
                image2.DataContext = classTypeInfo.Class_File_Name;
            }
            else
            {
                strFilePath        = "ImageFile/" + classTypeInfo.Class_File_Name;
                image2.DataContext = classTypeInfo.Class_Img_Folder;
            }

            WebDownloader.GetInstance().DownloadFile(strFilePath, TitleDownloadComplete, this);

            dateLabel.Content = classTypeInfo.Class_File_Date.ToString("yyyy-MM-dd");

            char[]   delimiterChars = { '.' };
            string[] words          = classTypeInfo.Class_Video_Title.Split(delimiterChars);
            int      count          = words.Length;

            if (classTypeInfo.Class_File_Type == 2)
            {
                fpFlag             = true;
                titleLabel.Content = words[0].ToString();
            }
            else
            {
                fpFlag             = false;
                titleLabel.Content = classTypeInfo.Class_Img_Folder + "(" + classTypeInfo.Class_File_Count + ")";
            }

            for (int i = 0; i < Window1._ClassListInfo.Classes.Count; i++)
            {
                if (Window1._ClassListInfo.Classes[i].Class_Type_Id == classTypeInfo.Class_File_Area)
                {
                    positionLabel.Content = Window1._ClassListInfo.Classes[i].Class_Type_Name;
                    break;
                }
            }
        }
        public void TitleDownloadComplete(string filePath)
        {
            try
            {
                string      strImagePath = filePath;
                BitmapImage bi           = new BitmapImage();

                bi.BeginInit();
                bi.UriSource = new Uri(strImagePath, UriKind.RelativeOrAbsolute);
                bi.EndInit();

                var faceGrid = new Grid();
                faceGrid.Width  = 82;
                faceGrid.Height = 81;
                faceGrid.Margin = new Thickness(0);

                Image finalImage = new Image();
                finalImage.Cursor             = Cursors.Hand;
                finalImage.Margin             = new Thickness(2, 1, 2, 1);
                finalImage.DataContext        = filePath;
                finalImage.Source             = bi;
                finalImage.MouseLeftButtonUp += new MouseButtonEventHandler(finalImage_MouseLeftButtonUp);
                faceGrid.Children.Add(finalImage);
                wrapPanel1.Children.Add(faceGrid);


                nStep++;

                if (nStep == nTotalCount)
                {
                    progressUpdate.Visibility = Visibility.Hidden;
                    WebDownloader.GetInstance().ctrlSelectAlbum = null;

                    nStep = 0;
                }
            }
            catch (Exception ex)
            {
                string strError = ex.ToString();
                ErrorCollection.GetInstance().SetErrorInfo(strError);
            }
        }
Esempio n. 12
0
        public void InitVideoList(List <IconInfo> videoLsit)
        {
            if (videoLsit != null)
            {
                for (int i = 0; i < videoLsit.Count; i++)
                {
                    if (videoLsit[i].Icon.Contains(".mp4") == true)
                    {
                        try
                        {
                            //char[] delimiterChars = { '\\', '.' };
                            //string[] imgwords = videoLsit[i].Icon.Split(delimiterChars);
                            //int imgcount = imgwords.Length;
                            //string imgName = imgwords[imgcount - 2].ToString();

                            //Image videoImg = new Image();
                            //videoImg.Width = 85;
                            //videoImg.Height = 63;
                            //videoImg.Cursor = System.Windows.Input.Cursors.Hand;
                            //videoImg.Margin = new Thickness(2, 2, 2, 2);
                            //string fileName = "\\Videos\\" + imgName + ".gif";
                            //videoImg.Source = ImageDownloader.GetInstance().GetImage(fileName);
                            //videoImg.DataContext = videoLsit[i].Icon;
                            //videoImg.MouseLeftButtonDown += new System.Windows.Input.MouseButtonEventHandler(videoImg_MouseDown);
                            //videoImg.MouseRightButtonDown += new System.Windows.Input.MouseButtonEventHandler(videoImg_MouseRightButtonDown);
                            //wrapPanel1.Children.Add(videoImg);

                            // 2013-12-30: GreenRose
                            videoLsit[i].Icon = videoLsit[i].Icon.Replace("\\", "/");
                            videoLsit[i].Icon = videoLsit[i].Icon.Replace(".mp4", ".jpg");
                            WebDownloader.GetInstance().DownloadFile(videoLsit[i].Icon, TitleDownloadComplete, this);
                            videoLsit[i].Icon = videoLsit[i].Icon.Replace(".jpg", ".mp4");
                        }
                        catch (Exception ex)
                        {
                            string strError = ex.ToString();
                            ErrorCollection.GetInstance().SetErrorInfo(strError);
                        }
                    }
                }
            }
        }
Esempio n. 13
0
 private void image2_MouseDown(object sender, MouseButtonEventArgs e)
 {
     if (fpFlag == true)
     {
         WebDownloader.GetInstance().DownloadFile("VideoFile/" + image2.DataContext.ToString(), VideoDownloadComplete, this);
         return;
     }
     else
     {
         for (int i = 0; i < Window1._ClassTypeListInfo.ClassType.Count; i++)
         {
             string folderName = Window1._ClassTypeListInfo.ClassType[i].Class_Img_Folder;
             if (folderName == image2.DataContext.ToString())
             {
                 Window1._ClassTypeInfo = Window1._ClassTypeListInfo.ClassType[i];
                 Window1._ClientEngine.Send(NotifyType.Request_ClassPictureDetail, Window1._ClassTypeInfo);
                 break;
             }
         }
     }
 }
Esempio n. 14
0
        private void FileUploadComplete(string strFileName)
        {
            byte[] bit = new byte[0];

            VideoInfo videoInfo = new VideoInfo();

            videoInfo.Data    = bit;
            videoInfo.UserId  = Login._UserInfo.Id;
            videoInfo.ImgData = bit;
            int nIndex = strFileName.LastIndexOf("\\");

            videoInfo.ImgName = strFileName.Substring(nIndex + 1);
            Login._ClientEngine.Send(NotifyType.Request_IconUpload, videoInfo);

            nUploadStep++;
            if (nUploadStep == nTotalCount)
            {
                progressUpdate.Visibility = Visibility.Hidden;
                WebDownloader.GetInstance().ctrlSelectAlbum = null;

                nUploadStep = 0;
            }
        }
Esempio n. 15
0
        public void InitFilmView(ClassTypeInfo classTypeInfo)
        {
            string strFilePath = string.Empty;

            if (classTypeInfo.Class_File_Type == 2)
            {
                string[] strVideoTitles   = new string[] { "" };
                string[] stringSeparators = new string[] { "||" };
                strVideoTitles = classTypeInfo.Class_Video_Title.Split(stringSeparators, StringSplitOptions.RemoveEmptyEntries);

                //strFilePath = "VideoFile/" + classTypeInfo.Class_Video_Title;
                //strFilePath = "VideoFile/" + strVideoTitles[0];
                strFilePath        = strVideoTitles[0];
                strFilePath        = classTypeInfo.Class_File_Name.Substring(0, classTypeInfo.Class_File_Name.LastIndexOf("/")) + "/" + strFilePath;
                image2.DataContext = classTypeInfo.Class_File_Name;

                _nVideoTitleCount = strVideoTitles.Length;
            }
            else
            {
                //strFilePath = "ImageFile/" + classTypeInfo.Class_File_Name;
                strFilePath        = classTypeInfo.Class_File_Name;
                image2.DataContext = classTypeInfo.Class_Img_Folder;
            }

            WebDownloader.GetInstance().DownloadFile(strFilePath, TitleDownloadComplete, this);

            dateLabel.Content = classTypeInfo.Class_File_Date.ToString("yyyy-MM-dd");

            char[]   delimiterChars = { '.' };
            string[] words          = classTypeInfo.Class_File_Name.Split(delimiterChars);
            int      count          = words.Length;

            // 2014-01-05: GreenRose
            int nDelimiterIndex = classTypeInfo.Class_File_Name.LastIndexOf(".");
            //string strVideoFileName = classTypeInfo.Class_File_Name.Substring(0, nDelimiterIndex);
            string strVideoFileName = classTypeInfo.Class_Img_Folder;

            if (classTypeInfo.Class_File_Type == 2)
            {
                fpFlag = true;

                // 2013-12-13: GreenRose
                // 제목의 길이가 5문자이상이라면 ToolTip에 제목을 현시하여 준다.
                //if (words[0].ToString().Length > 8)
                if (strVideoFileName.Length > 8)
                {
                    //string strTitle = words[0].ToString().Substring(0, 8) + "...";
                    string strTitle = strVideoFileName.Substring(0, 8) + "...";
                    titleLabel.Content = strTitle;
                    titleLabel.ToolTip = strVideoFileName;
                    //titleLabel.ToolTip = words[0].ToString();
                }
                else
                {
                    titleLabel.Content = strVideoFileName;
                    //titleLabel.Content = words[0].ToString();
                }

                //lblCountOfImage.Content = string.Empty;
                lblCountOfImage.Content = _nVideoTitleCount.ToString() + "张";

                // 2013-12-13: GreenRose
                // 비디오보기에서 비디오이미지를 클릭하였을때의 사건처리.
                m_classTypeInfo             = classTypeInfo;
                image1.Cursor               = Cursors.Hand;
                image1.MouseLeftButtonDown += new MouseButtonEventHandler(image1_LButtonClick);
            }
            else
            {
                fpFlag = false;

                // 2013-12-13: GreenRose
                // 제목의 길이가 5문자이상이라면 ToolTip에 제목을 현시하여 준다.
                if (classTypeInfo.Class_Img_Folder.Length > 8)
                {
                    string strTitle = classTypeInfo.Class_Img_Folder.Substring(0, 8) + "...";
                    titleLabel.Content = strTitle;
                    titleLabel.ToolTip = classTypeInfo.Class_Img_Folder;
                }
                else
                {
                    titleLabel.Content = classTypeInfo.Class_Img_Folder;
                }

                lblCountOfImage.Content = classTypeInfo.Class_File_Count + "张";


                m_classTypeInfo             = classTypeInfo;
                image1.Cursor               = Cursors.Hand;
                image1.MouseLeftButtonDown += new MouseButtonEventHandler(image1_LButtonClick1);
            }



            for (int i = 0; i < Login._ClassListInfo.Classes.Count; i++)
            {
                if (Login._ClassListInfo.Classes[i].Class_Type_Id == classTypeInfo.Class_File_Area)
                {
                    positionLabel.Content = Login._ClassListInfo.Classes[i].Class_Type_Name;
                    break;
                }
            }
        }