private void Item_DeleteCameraEvent(object sender, MediaData e)
 {
     if (e != null)
     {
         MessageBoxResult messageBoxResult = MessageBox.Show("Bạn có muốn xoá camera này không?", "Xoá camera", System.Windows.MessageBoxButton.YesNo);
         if (messageBoxResult == MessageBoxResult.Yes)
         {
             Code.Media.MediaData.Delete(e);
             UIcamera m = this.list_Box_Item.SelectedItem as UIcamera;
             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);
                    }

                }
            }
        }