コード例 #1
0
        private void OnModAddedToPreset(ModViewModel modViewModel, Preset preset)
        {
            var presetViewModel = modItemsInternal.OfType<PresetViewModel>().SingleOrDefault(x => x.Preset.Equals(preset));

            if (presetViewModel == null)
            {
                var newModel = MakePresetViewModel(preset);
                modItemsInternal.Add(newModel);
                presetViewModel = newModel;
            }

            presetViewModel.AddMod(modViewModel.Mod);
            modItemsInternal.Remove(modViewModel);
        }
コード例 #2
0
 private void OnModDeleted(ModViewModel viewModel)
 {
     modItemsInternal.Remove(viewModel);
 }
コード例 #3
0
 private ModViewModel MakeModViewModel(Mod mod)
 {
     var viewModel = new ModViewModel(mod, initialization.ModManager, initialization.PresetManager);
     viewModel.OnDeleted += () => OnModDeleted(viewModel);
     viewModel.OnAddedToPreset += x => OnModAddedToPreset(viewModel, x);
     return viewModel;
 }