Example #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();
                 }
             });
         }
     }
 }