示例#1
0
 private void Item_DeleteEvent(object sender, DeviceData e)
 {
     if (e != null)
     {
         MessageBoxResult messageBoxResult = MessageBox.Show("Bạn có muốn xoá thiết bị này không?", "Xoá thiết bị", System.Windows.MessageBoxButton.YesNo);
         if (messageBoxResult == MessageBoxResult.Yes)
         {
             UIDevice uid = (this.list_Box_Item.SelectedItem as UIDevice);
             if (this.list_Box_Item.SelectedIndex != 0)
             {
                 this.list_Box_Item.SelectedIndex = 0;
             }
             else if (this.list_Box_Item.Items.Count > 1)
             {
                 this.list_Box_Item.SelectedIndex = 1;
             }
             uid.Animation_Opacity_View_Frame(false, () =>
             {
                 this.Datas.Remove(uid.Device);
                 this.list_Box_Item.Items.Remove(uid);
                 if (this.to < this.total)
                 {
                     this.Datas = App.curUser.LoadDevices(this.from, ref this.to, out this.total);
                     this.LoadGUI();
                 }
             });
         }
     }
 }
示例#2
0
 private void LoadGUI()
 {
     this.list_Box_Item.Items.Clear();
     if (to < this.total)
     {
         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 (DeviceData d in this.Datas)
         {
             UIDevice item = new UIDevice();
             item.Width           = 170;
             item.Height          = 240;
             item.Device          = d;
             item.ViewInfoEvent  += Item_ViewInfoEvent;
             item.DeleteEvent    += Item_DeleteEvent;
             item.PlayMediaEvent += item_PlayMediaEvent;
             this.list_Box_Item.Items.Add(item);
         }
     }
 }
 private void LoadGUI()
 {
     this.list_Box_Item.Items.Clear();
     if (to < this.total)
     {
         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 (DeviceData d in this.Datas)
         {
             UIDevice item = new UIDevice();
             item.Width = 170;
             item.Height = 240;
             item.Device = d;
             item.ViewInfoEvent += Item_ViewInfoEvent;
             item.DeleteEvent += Item_DeleteEvent;
             item.PlayMediaEvent += item_PlayMediaEvent;
             this.list_Box_Item.Items.Add(item);
         }
     }
 }