public void Init(params Type[] parts) { _calculatorExtensionsManager.InitializeContainer(parts); foreach (var extension in _calculatorExtensionsManager.GetExtensionInformation()) { var vm = new ExtensionViewModel(extension); vm.ActivatedExtensionChanged += OnActivatedExtensionChanged; Extensions.Add(vm); } }
private void OnActivatedExtensionChanged(ExtensionViewModel extension, ActivatedExtensionEventArgs e) { switch (e.ExtensionChange) { case ExtensionChange.Added: ActivatedExtensions.Add(extension); SelectedExtension = extension; break; case ExtensionChange.Removed: ActivatedExtensions.Remove(extension); SelectedExtension = ActivatedExtensions.FirstOrDefault(); break; } }
private void OnActivateExtension(ExtensionViewModel sender, EventArgs e) { ActivatedExtensions.Add(sender); SelectedExtension = sender; }