コード例 #1
0
        public void Execute(object parameter)
        {
            SelectedViewModel selectedViewModel = _RefViewModel.SelectedViewModel;
            ObservableCollection <SelectedViewModel> childrenSelectedViewModel = selectedViewModel.Parent.Children;
            OneElement        oneElement         = Database.Instance.SelectedElement;
            List <OneElement> childrenOneElement = oneElement.Parent.Children;
            int curIdx = childrenSelectedViewModel.IndexOf(selectedViewModel);

            switch ((string)parameter)
            {
            case "Up":
                if (curIdx > 0)
                {
                    childrenSelectedViewModel.Remove(selectedViewModel);
                    childrenSelectedViewModel.Insert(curIdx - 1, selectedViewModel);
                    childrenOneElement.Remove(oneElement);
                    childrenOneElement.Insert(curIdx - 1, oneElement);
                }
                break;

            case "Down":
                if (curIdx < (childrenSelectedViewModel.Count - 1))
                {
                    childrenSelectedViewModel.Remove(selectedViewModel);
                    childrenSelectedViewModel.Insert(curIdx + 1, selectedViewModel);
                    childrenOneElement.Remove(oneElement);
                    childrenOneElement.Insert(curIdx + 1, oneElement);
                }
                break;

            default:
                break;
            }
        }
コード例 #2
0
        public void Execute(object parameter)
        {
            if (_RefViewModel.SelectedViewModel != null)
            {
                OneElement        oneElement        = new OneElement(Database.Instance.SelectedElement, Database.Instance.ExecTypeList);
                SelectedViewModel selectedViewModel = new SelectedViewModel(_RefViewModel.SelectedViewModel, oneElement);

                Database.Instance.SelectedElement.Children.Add(oneElement);
                _RefViewModel.SelectedViewModel.Children.Add(selectedViewModel);
            }
        }
コード例 #3
0
ファイル: ViewModel.cs プロジェクト: EmVerif/EmVerifPC
        private void MakeTableViewFromDatabase(IReadOnlyList <OneElement> oneElementList, SelectedViewModel parentSelectedViewModel)
        {
            foreach (var oneElement in oneElementList)
            {
                SelectedViewModel selectedViewModel = new SelectedViewModel(parentSelectedViewModel, oneElement);

                parentSelectedViewModel.Children.Add(selectedViewModel);
                if (oneElement.Children.Count != 0)
                {
                    MakeTableViewFromDatabase(oneElement.Children, selectedViewModel);
                }
            }
        }
コード例 #4
0
 public SelectedViewModel(SelectedViewModel selectedViewModel, OneElement oneElement)
 {
     Parent   = selectedViewModel;
     RefModel = oneElement;
 }