コード例 #1
0
        protected override void OnRemove(object obj)
        {
            var dialogFactory = ParentViewModel as IDialogFactory;

            if (dialogFactory != null)
            {
                IDialogService         dialogService;
                INotifyPropertyChanged vmodel;
                INotifyPropertyChanged parent;
                if (dialogFactory.GetDialog("OnRemove", obj, out dialogService, out vmodel, out parent))
                {
                    bool?res = dialogService.ShowDialog(parent, vmodel);
                    if (!res.HasValue || !res.Value)
                    {
                        return;
                    }
                }
            }

            var item = obj as T;

            if (item != null)
            {
                this.Remove(item);
                if (this.Count > 0)
                {
                    Current = this.First();
                }
                else
                {
                    Current = null;
                }
            }
        }
コード例 #2
0
        protected override void OnAdd(object obj)
        {
            var item = new T();

            this.Add(item);
            Current = item;
        }