private void Item_DeleteMediaEvent(object sender, Code.Media.MediaData e)
 {
     if (e != null)
     {
         MessageBoxResult messageBoxResult = MessageBox.Show("Bạn có muốn xoá file video này không?", "Xoá video", System.Windows.MessageBoxButton.YesNo);
         if (messageBoxResult == MessageBoxResult.Yes)
         {
             alta_class_ftp.deleteFile(e.Url, App.setting.ftp_user, App.setting.ftp_password);
             MediaData.Delete(e);
             UIMedia m = this.list_Box_Item.SelectedItem as UIMedia;
             m.Animation_Opacity_View_Frame(false, () =>
             {
                 this.list_Box_Item.Items.Remove(m);
                 this.Datas.Remove(e);
                 this.totalMedia -= 1;
                 if (this.to < this.totalMedia)
                 {
                     if (this.User == null)
                     {
                         this.Datas = App.curUser.LoadMedias(this.from, this.to, out this.totalMedia, this.TypeMedia);
                     }
                     else
                     {
                         this.Datas = this.User.LoadMedias(this.from, this.to, out this.totalMedia, this.TypeMedia, true);
                     }
                     this.LoadGUI();
                 }
             }, 600);
             this.list_Box_Item.SelectedIndex = -1;
         }
     }
 }
        public void LoadGUI()
        {
            this.list_Box_Item.Items.Clear();
            if (to < this.totalMedia)
            {
                this.UIRightBtn.Foreground = Brushes.DarkOrange;
            }
            else
            {
                this.UIRightBtn.Foreground = Brushes.Gray;
            }
            if (this.from > 0)
            {
                this.UILeftBtn.Foreground = Brushes.DarkOrange;
            }
            else
            {
                this.UILeftBtn.Foreground = Brushes.Gray;
            }

            if (this.Datas != null)
            {
                foreach (Code.Media.MediaData m in this.Datas)
                {
                    if (m.TypeMedia.Code.ToUpper() == "FILE")
                    {
                        UIMedia item = new UIMedia();
                        item.Media               = m;
                        item.Height              = 240;
                        item.Width               = 170;
                        item.ViewInfoMediaEvent += Item_ViewInfoMediaEvent;
                        item.DeleteMediaEvent   += Item_DeleteMediaEvent;
                        item.PlayMediaEvent     += Item_PlayMediaEvent;
                        this.list_Box_Item.Items.Add(item);
                    }
                    else
                    {
                        UIcamera item = new UIcamera();
                        item.Media               = m;
                        item.Height              = 240;
                        item.Width               = 170;
                        item.ViewInfoMediaEvent += Item_ViewInfoMediaEvent;
                        item.DeleteMediaEvent   += Item_DeleteCameraEvent;
                        item.PlayMediaEvent     += Item_PlayMediaEvent;
                        this.list_Box_Item.Items.Add(item);
                    }
                }
            }
        }
        public void LoadGUI()
        {
            this.list_Box_Item.Items.Clear();
            if (to < this.totalMedia)
            {
                this.UIRightBtn.Foreground = Brushes.DarkOrange;
            }
            else
            {
                this.UIRightBtn.Foreground = Brushes.Gray;
            }
            if (this.from > 0)
            {
                this.UILeftBtn.Foreground = Brushes.DarkOrange;
            }
            else
            {
                this.UILeftBtn.Foreground = Brushes.Gray;
            }
           
            if (this.Datas != null)
            {
                foreach (Code.Media.MediaData m in this.Datas)
                {
                    if (m.TypeMedia.Code.ToUpper() == "FILE")
                    {
                        UIMedia item = new UIMedia();
                        item.Media = m;
                        item.Height = 240;
                        item.Width = 170;
                        item.ViewInfoMediaEvent += Item_ViewInfoMediaEvent;
                        item.DeleteMediaEvent += Item_DeleteMediaEvent;
                        item.PlayMediaEvent += Item_PlayMediaEvent;
                        this.list_Box_Item.Items.Add(item);
                    }
                    else
                    {
                        UIcamera item = new UIcamera();
                        item.Media = m;
                        item.Height = 240;
                        item.Width = 170;
                        item.ViewInfoMediaEvent += Item_ViewInfoMediaEvent;
                        item.DeleteMediaEvent += Item_DeleteCameraEvent;
                        item.PlayMediaEvent += Item_PlayMediaEvent;
                        this.list_Box_Item.Items.Add(item);
                    }

                }
            }
        }