Пример #1
0
        /// <summary>
        ///移除[ModelInfoCollection中的物件
        /// </summary>
        public void RemoveItem(object o)
        {
            if (_modelSettingView.ModelListView.SelectedItem != null)
            {
                //選擇的ModelItem
                ModelSettingItem selectedModelItem = (ModelSettingItem)_modelSettingView.ModelListView.SelectedItem;

                //設定所選模型物件為"已移除",按下OK之後會刪除
                selectedModelItem.Bone.IsRemoved = true;
                selectedModelItem.Osp.IsRemoved  = true;

                int temp = _modelSettingView.ModelListView.SelectedIndex;

                ModelSettingCollection.Remove(selectedModelItem);

                //刪減之後數量若跟舊的索引值一樣,代表選項在最後一個
                if (ModelSettingCollection.Count == temp)
                {
                    _modelSettingView.ModelListView.SelectedIndex = ModelSettingCollection.Count - 1;
                }
                else//不是的話則維持原索引值
                {
                    _modelSettingView.ModelListView.SelectedIndex = temp;
                }

                ListViewItem item = _modelSettingView.ModelListView.ItemContainerGenerator.ContainerFromIndex(_modelSettingView.ModelListView.SelectedIndex) as ListViewItem;
                if (item != null)
                {
                    item.Focus();
                }
            }
        }
Пример #2
0
        /// <summary>
        /// 建構子,如果ModelInfoCollection是空的,則自製部分預設項目
        /// </summary>
        public ModelSettingViewModel(ModelSettingView modelSettingView)
        {
            this._modelSettingView = modelSettingView;

            AddItemCommand      = new RelayCommand(AddItem);
            RemoveItemCommand   = new RelayCommand(RemoveItem);
            ModelSettingCommand = new RelayCommand(LoadSettingModel);

            //如果ModelInfoCollection為空的
            if (ModelSettingCollection == null || ModelSettingCollection.Count == 0)
            {
                ModelSettingViewModel.ModelSettingCollection = new ObservableCollection <ModelSettingItem>();

                ModelSettingCollection = ModelSettingViewModel.ModelSettingCollection;


                ModelSettingCollection.Add(new ModelSettingItem
                {
                    MarkerId = "Head"
                    ,
                    BoneFilePath = "D:\\Desktop\\研究資料\\蔡慧君_15755388_20151231\\註冊\\skull_wo_maxilla_w_ramus_BVRO_4.stl"
                    ,
                    OspFilePath = "D:\\Desktop\\研究資料\\蔡慧君_15755388_20151231\\註冊\\max_OSP.stl"
                    ,
                    OspDiffuseColor = System.Windows.Media.Color.FromArgb(50, 255, 0, 0)
                    ,
                    BoneDiffuseColor = System.Windows.Media.Color.FromArgb(255, 40, 181, 187)
                });

                ModelSettingCollection.Add(new ModelSettingItem
                {
                    MarkerId = "C"
                    ,
                    BoneFilePath = "D:\\Desktop\\研究資料\\蔡慧君_15755388_20151231\\註冊\\mandible_digital_segment_BVRO_0.4.stl"
                                   //ModelFilePath = "D:\\Desktop\\c2lpk7avgum8-E-45-Aircraft\\E-45-Aircraft\\E 45 Aircraft_stl.stl"
                    ,
                    OspFilePath = "D:\\Desktop\\研究資料\\蔡慧君_15755388_20151231\\註冊\\man_OSP.stl"
                    ,
                    BoneDiffuseColor = System.Windows.Media.Color.FromArgb(255, 40, 181, 187)
                    ,
                    OspDiffuseColor = System.Windows.Media.Color.FromArgb(50, 0, 255, 0)
                });


                ModelSettingCollection.Add(new ModelSettingItem
                {
                    MarkerId = "A"
                    ,
                    BoneFilePath = "D:\\Desktop\\研究資料\\蔡慧君_15755388_20151231\\註冊\\maxilla_0.4.stl"
                                   // ModelFilePath = "D:\\Desktop\\c2lpk7avgum8-E-45-Aircraft\\E-45-Aircraft\\E 45 Aircraft_stl.stl"
                                   //                                                           ,
                                   //OSPFilePath = "D:\\Desktop\\研究資料\\蔡慧君_15755388_20151231\\註冊\\max_OSP.stl"
                    ,
                    BoneDiffuseColor = System.Windows.Media.Color.FromArgb(100, 40, 181, 187)
                });
            }
        }
Пример #3
0
        /// <summary>
        /// 新增ModelInfo進ModelInfoCollection
        /// </summary>
        public void AddItem(object o)
        {
            int temp = ModelSettingCollection.Count;

            ModelSettingCollection.Add(new ModelSettingItem());
            _modelSettingView.ModelListView.SelectedIndex = temp;
            ListViewItem item = _modelSettingView.ModelListView.ItemContainerGenerator.ContainerFromIndex(temp - 1) as ListViewItem;

            //設置成點選狀態
            if (item != null)
            {
                item.Focus();
            }
        }