private static void OnBindingTypeChanged(DependencyObject d, DependencyPropertyChangedEventArgs args) { BindingsPanel p = d as BindingsPanel; p.LoadBindings(); p.LoadSources(); }
private static void Delete_CanExecute(object target, CanExecuteRoutedEventArgs e) { BindingsPanel editor = target as BindingsPanel; HeliosBinding binding = e.Parameter as HeliosBinding; if (editor != null) { e.Handled = true; e.CanExecute = binding != null || editor.SelectedBinding != null; } }
private static void LoadSources(BindingsPanel p) { ProfileExplorerTreeItemType triggerTypes = ProfileExplorerTreeItemType.Interface | ProfileExplorerTreeItemType.Monitor | ProfileExplorerTreeItemType.Panel | ProfileExplorerTreeItemType.Visual | ProfileExplorerTreeItemType.Trigger; ProfileExplorerTreeItemType actionTypes = ProfileExplorerTreeItemType.Interface | ProfileExplorerTreeItemType.Monitor | ProfileExplorerTreeItemType.Panel | ProfileExplorerTreeItemType.Visual | ProfileExplorerTreeItemType.Action; if (p.BindingObject != null) { if (p.BindingObject.Profile != p._actionTriggerProfile) { HeliosProfile newProfile = p.BindingObject.Profile; if (p._actionsList != null) { p._actionsList.Disconnect(); } if (p._triggerList != null) { p._triggerList.Disconnect(); } p._actionsList = new ProfileExplorerTreeItem(newProfile, actionTypes); p._triggerList = new ProfileExplorerTreeItem(newProfile, triggerTypes); p._actionTriggerProfile = newProfile; } } if (p.BindingType == BindingPanelType.Input) { if (p._triggerList == null) { p.ProfileExplorerItems = null; } else { p.ProfileExplorerItems = p._triggerList.Children; } } else if (p.BindingType == BindingPanelType.Output) { if (p._actionsList == null) { p.ProfileExplorerItems = null; } else { p.ProfileExplorerItems = p._actionsList.Children; } } }
private static void Delete_Executed(object target, ExecutedRoutedEventArgs e) { BindingsPanel editor = target as BindingsPanel; HeliosBinding binding = e.Parameter as HeliosBinding; if (editor != null) { BindingDeleteUndoEvent undo; if (binding != null) { undo = new BindingDeleteUndoEvent(binding); } else { undo = new BindingDeleteUndoEvent(editor.SelectedBinding); } undo.Do(); ConfigManager.UndoManager.AddUndoItem(undo); e.Handled = true; } }
private static void LoadBindings(BindingsPanel p) { if (p.BindingObject != null) { if (p.BindingItems != null) { p.BindingItems.Disconnect(); } p.BindingItems = new ProfileExplorerTreeItemCollection(); if (p.BindingType == BindingPanelType.Input) { ProfileExplorerTreeItem inputBindings = new ProfileExplorerTreeItem(p.BindingObject, ProfileExplorerTreeItemType.Action | ProfileExplorerTreeItemType.Binding); if (inputBindings.HasChildren) { foreach (ProfileExplorerTreeItem item in inputBindings.Children) { p.BindingItems.Add(item); } } } else if (p.BindingType == BindingPanelType.Output) { ProfileExplorerTreeItem outputBindings = new ProfileExplorerTreeItem(p.BindingObject, ProfileExplorerTreeItemType.Trigger | ProfileExplorerTreeItemType.Binding); if (outputBindings.HasChildren) { foreach (ProfileExplorerTreeItem item in outputBindings.Children) { p.BindingItems.Add(item); } } } } else { p.BindingItems = null; } }