Exemplo n.º 1
0
 public void Remove(PackageInfo info)
 {
     if (Exists(info))
     {
         MasterList.Remove(info);
         IsDirty = true;
     }
 }
Exemplo n.º 2
0
        public void RemoveBy(int fid)
        {
            var pi = SelectBy(fid);

            if (pi != null)
            {
                MasterList.Remove(pi);
                IsDirty = true;
            }
        }
Exemplo n.º 3
0
 void MasterExecRemove()
 {
     //_dataService.DeleteLightElement(MasterSelectedItem, (data, error) =>
     //    {
     //        if (error != null) { return; } // Report error here
     //        int updateCount = data;
     //    });
     MasterList.Remove(MasterSelectedItem);
     MasterSelectedItem = null;
 }
Exemplo n.º 4
0
        private void SlaveList_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
        {
            switch (e.Action)
            {
            case NotifyCollectionChangedAction.Add:
                foreach (var item in e.NewItems)
                {
                    MasterList.Add((T)item);
                }

                break;

            case NotifyCollectionChangedAction.Move:
                // We don't care if an item is moved.
                break;

            case NotifyCollectionChangedAction.Remove:
                foreach (var item in e.NewItems)
                {
                    MasterList.Remove((T)item);
                }

                break;

            case NotifyCollectionChangedAction.Replace:
                T   oldItem = (T)e.OldItems[0];
                T   newItem = (T)e.NewItems[0];
                int index   = MasterList.IndexOf(oldItem);

                MasterList[index] = newItem;

                break;

            case NotifyCollectionChangedAction.Reset:
                foreach (var item in e.NewItems)
                {
                    MasterList.Remove((T)item);
                }

                break;

            default:
                break;
            }
        }
Exemplo n.º 5
0
        //AttentionVM attentionVM;

        void MasterExecSave()
        {
            int  i = -1;
            bool partitionChanged = false;

            //int dsi = -1;
            if (MasterEditMode)
            {
                if (MasterCurrentObject.Partition.Id != MasterSelectedItem.Partition.Id)
                {
                    partitionChanged = true;
                    foreach (ControlChannel ch in MasterCurrentObject.ControlChannels)
                    {
                        ch.Partition = MasterCurrentObject.Partition;
                    }
                }
            }
            _dataService.UpdateControlDevice(MasterCurrentObject, (updatedCount, error) =>
            {
                if (error != null)
                {
                    return;
                }                              // Report error here
                i = updatedCount;
            });

            MasterObjectButtonsVisibility = Visibility.Collapsed;
            MasterListCurtainVisibility   = Visibility.Collapsed;
            DetailListCurtainVisibility   = Visibility.Collapsed;


            if (MasterAddMode)
            {
                MasterSelectorSelectedItem = null;

                MasterList.Add(MasterCurrentObject);
                MasterSelectedItem   = MasterCurrentObject;
                MasterListVisibility = Visibility.Visible;
            }
            if (MasterEditMode) //in EditMode MasterSelectedItem always not null
            {
                if (!partitionChanged)
                {
                    MasterList[msix]   = MasterCurrentObject;
                    MasterSelectedItem = MasterCurrentObject;
                    if (savedDsix != -1)
                    {
                        DetailSelectedItem = DetailList[savedDsix];
                    }
                }
                else
                {
                    MasterList.Remove(MasterSelectedItem);
                    DetailContentVisibility = Visibility.Hidden;
                    partitionChanged        = false;
                }
            }

            MasterAddMode  = false;
            MasterEditMode = false;
            MasterCurrentObject.IsEditMode = false;
            MasterRemoveCmd.RaiseCanExecuteChanged();
            MasterAddCmd.RaiseCanExecuteChanged();

            MessengerInstance.Send("", AppContext.UnBlockUIMsg);
        }