/// <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) }); } }
/// <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(); } }