public ExtensibilityManager(SceneViewModel viewModel) { this.viewModel = viewModel; this.viewModel.EarlySceneUpdatePhase += new SceneUpdatePhaseEventHandler(this.OnViewModelEarlySceneUpdatePhase); this.viewModel.LateSceneUpdatePhase += new SceneUpdatePhaseEventHandler(this.OnViewModelLateSceneUpdatePhase); this.viewModel.ProjectContext.TypesChanged += new EventHandler <TypesChangedEventArgs>(this.OnProjectContextTypesChanged); this.editingContext = new EditingContext(); this.featureManager = new FeatureManager(this.editingContext); this.featureManager.MetadataProvider = (MetadataProviderCallback)((type, attributeType) => { List <object> list = new List <object>(); foreach (Attribute attribute in TypeUtilities.GetAttributes((MemberInfo)type, attributeType, true)) { list.Add((object)attribute); } return((IEnumerable <object>)list); }); this.modelService = new SceneNodeModelService(viewModel); this.featureManager.Context.Services.Publish(typeof(ModelService), (object)this.modelService); this.viewService = new SceneNodeViewService(viewModel); this.featureManager.Context.Services.Publish(typeof(ViewService), (object)this.viewService); SelectionOperations.Subscribe(this.editingContext, new SubscribeContextCallback <Microsoft.Windows.Design.Interaction.Selection>(this.OnUserSelectionChanged)); this.UpdateSelection(); this.featureManager.Context.Items.SetValue((ContextItem) new SelectionTool()); this.valueProviderService = new DesignModeValueProviderService(this.viewModel.ProjectContext.Platform, this.featureManager); if (this.viewModel.RootNode != null) { this.ProcessSubtree(this.viewModel.RootNode.DocumentNode); } this.viewModel.Closing += new EventHandler(this.OnViewModelClosing); }
public void RemoveFromSelection() { if (!this.IsSelected) { return; } SelectionOperations.Toggle(this._view.Context, this._item); this.RaiseAutomationEvent(AutomationEvents.SelectionItemPatternOnElementRemovedFromSelection); this.RaiseAutomationEvent(AutomationEvents.AutomationFocusChanged); }
private void Dispose(bool isDispoing) { if (!isDispoing) { return; } SelectionOperations.Unsubscribe(this.editingContext, new SubscribeContextCallback <Microsoft.Windows.Design.Interaction.Selection>(this.OnUserSelectionChanged)); this.viewModel.Closing -= new EventHandler(this.OnViewModelClosing); this.viewModel.ProjectContext.TypesChanged -= new EventHandler <TypesChangedEventArgs>(this.OnProjectContextTypesChanged); this.viewModel.EarlySceneUpdatePhase -= new SceneUpdatePhaseEventHandler(this.OnViewModelEarlySceneUpdatePhase); this.viewModel.LateSceneUpdatePhase -= new SceneUpdatePhaseEventHandler(this.OnViewModelLateSceneUpdatePhase); this.viewModel = (SceneViewModel)null; this.valueProviderService.Dispose(); this.featureManager.Dispose(); this.editingContext.Dispose(); }
private void OnPreviewMouseLeftButtonDown(object sender, System.Windows.Input.MouseButtonEventArgs e) { if (View.RootView == null) { return; } var hitTestObject = GetHitTestObject(e.GetPosition(View)); if (hitTestObject != null) { var service = Context.Services.GetRequiredService <ModelService>(); var items = service.Find(CurrentItem.Root, typeof(BarItem)); var modelItem = items.FirstOrDefault(x => x.GetCurrentValue() == hitTestObject); if (modelItem == null) { return; } SelectionOperations.SelectOnly(Context, modelItem); e.Handled = true; } }
public void ChangeSelectingStateToSphere() { userEditingState = EditingState.Selecting; userSelectionState = SelectionOperations.Sphere; }
public void ChangeSelectingStateToCube() { userEditingState = EditingState.Selecting; userSelectionState = SelectionOperations.Cube; }
public void Select() { SelectionOperations.SelectOnly(this._view.Context, this._item); this.RaiseAutomationEvent(AutomationEvents.SelectionItemPatternOnElementSelected); this.RaiseAutomationEvent(AutomationEvents.AutomationFocusChanged); }
public void AddToSelection() { SelectionOperations.Union(this._view.Context, this._item); this.RaiseAutomationEvent(AutomationEvents.SelectionItemPatternOnElementAddedToSelection); this.RaiseAutomationEvent(AutomationEvents.AutomationFocusChanged); }
protected override void SetFocusCore() { SelectionOperations.SelectOnly(this._view.Context, this._item); }
public void ChangeSelectingStateToSphere () { userEditingState = EditingState.Selecting; userSelectionState = SelectionOperations.Sphere; }
public void ChangeSelectingStateToCube () { userEditingState = EditingState.Selecting; userSelectionState = SelectionOperations.Cube; }