コード例 #1
0
        public MergeVoxelViewModel(BaseViewModel parentViewModel, MergeVoxelModel dataModel)
            : base(parentViewModel)
        {
            _dataModel = dataModel;

            // Will bubble property change events from the Model to the ViewModel.
            _dataModel.PropertyChanged += (sender, e) => OnPropertyChanged(e.PropertyName);

            MergeFileName = "merge";
        }
コード例 #2
0
        public void VoxelMergeExecuted()
        {
            var model = new MergeVoxelModel();
            var item1 = Selections[0];
            var item2 = Selections[1];
            model.Load(item1.DataModel, item2.DataModel);
            var loadVm = new MergeVoxelViewModel(this, model);
            var result = _dialogService.ShowDialog<WindowVoxelMerge>(this, loadVm);
            if (result == true)
            {
                IsBusy = true;
                var newEntity = loadVm.BuildEntity();
                var structure = _dataModel.AddEntity(newEntity);
                ((StructureVoxelModel)structure).SourceVoxelFilepath = loadVm.SourceFile; // Set the temporary file location of the Source Voxel, as it hasn't been written yet.
                if (_preSelectedStructure != null)
                    SelectedStructure = _preSelectedStructure;

                if (loadVm.RemoveOriginalAsteroids)
                {
                    DeleteModel(item1, item2);
                }

                IsBusy = false;
            }
        }