Example #1
0
 private void DeleteItemFromSource(object obj)
 {
     if (obj is ConditionGroupsEditorData source)
     {
         SourceItems.Remove(source);
     }
     else if (obj is ConditionGroupsEditorDataNode node)
     {
         node.Owner !.Members.Remove(node);
         node.Owner = null;
     }
 }
        private async void Delete()
        {
            if (HIOStaticValues.CheckSyncingData())
            {
                return;
            }

            if (TMessageBox.Show("Are you sure you want to delete these accounts?", "Confirm", MessageBoxButton.YesNo) == MessageBoxResult.Yes)
            {
                Commands cmd = new Backend.Commands();
                while (true)
                {
                    var res = cmd.AmISync();
                    if (res == SyncronizingStateEnum.Synced)
                    {
                        break;
                    }
                    else
                    {
                        HIOStaticValues.SyncOpration();
                    }
                }


                await UIService.Execute(async() =>
                {
                    DataBase db = new DataBase();
                    foreach (var item in SourceItems.Where(t => t.IsChecked).ToArray())
                    {
                        Commands ic = new Commands();
                        if (ic.Delete(item.UserID))
                        {
                            App.Current.Dispatcher.BeginInvoke((Action)(() =>
                            {
                                SourceItems.Remove(SourceItems.FirstOrDefault(i => i.UserID == item.UserID));
                                OnPropertyChanged(nameof(Items));
                            }));
                        }
                    }
                    await LoadData();
                });

                OnPropertyChanged(nameof(IsAllChecked));
            }
        }
Example #3
0
 private void RemoveInstanceFromCache(Instance ins)
 {
     // remove from parent
     ins.Source.Instances.Remove(ins);
     // remove from instances
     Instances.Remove(ins.ID);
     // cleanup groups
     Groups.Edit(innerCache =>
     {
         foreach (var g in innerCache.Items)
         {
             g.Instances.Remove(ins);
         }
     });
     // cleanup sources
     SourceItems.Remove(ins.ID);
     // claenup metrics
     Metrics.Remove(Metrics.Items.Where(m => m.Instance == ins));
 }
Example #4
0
 public bool Remove(ApplicationJumpItem item)
 {
     SourceItems.Remove(item);
     return(implementation.RemoveItem(ApplicationJumpItem.GetItemInfo(item)));
 }