public override void SetBindingFocus(HeliosObject bindingFoucsObject) { HeliosVisual visual = bindingFoucsObject as HeliosVisual; if (visual != null && Panel.Children.Contains(visual)) { PanelEditor.SelectedItems.Clear(); HeliosVisualView view = PanelEditor.GetViewerForVisual(visual); if (view != null) { PanelEditor.UpdateLayout(); PanelEditor.SelectedItems.Add((HeliosVisual)bindingFoucsObject); Dispatcher.BeginInvoke(new Action(view.BringIntoView)); } } }
void LayoutSerializer_LayoutSerializationCallback(object sender, LayoutSerializationCallbackEventArgs e) { if (Profile != null && e.Model is LayoutDocument) { HeliosObject profileObject = HeliosSerializer.ResolveReferenceName(Profile, e.Model.ContentId); if (profileObject != null) { HeliosEditorDocument editor = CreateDocumentEditor(profileObject); profileObject.PropertyChanged += DocumentObject_PropertyChanged; e.Content = CreateDocumentContent(editor); //DocumentPane.Children.Add((LayoutDocument)e.Model); e.Model.Closed += Document_Closed; AddDocumentMeta(profileObject, (LayoutDocument)e.Model, editor); } else { ConfigManager.LogManager.LogDebug("Layout Serializer: Unable to resolve Layout Document " + e.Model.ContentId); } } }
private void AddChild(HeliosObject hobj, ProfileExplorerTreeItemType includeTypes) { hobj.PropertyChanged += new System.ComponentModel.PropertyChangedEventHandler(hobj_PropertyChanged); if (includeTypes.HasFlag(ProfileExplorerTreeItemType.Trigger)) { foreach (IBindingTrigger trigger in hobj.Triggers) { AddTrigger(trigger, includeTypes); } hobj.Triggers.CollectionChanged += new System.Collections.Specialized.NotifyCollectionChangedEventHandler(Triggers_CollectionChanged); } if (includeTypes.HasFlag(ProfileExplorerTreeItemType.Action)) { foreach (IBindingAction action in hobj.Actions) { AddAction(action, includeTypes); } hobj.Actions.CollectionChanged += new System.Collections.Specialized.NotifyCollectionChangedEventHandler(Actions_CollectionChanged); } }
public void TraceTriggerFired(HeliosBinding heliosBinding) { // NOTE: deliberately crash if any of these are null HeliosObject target = heliosBinding.Action.Target; // IsTracing indicates a soft loop, IsExecuting indicates a hard loop if (IsTracing(target) || heliosBinding.IsExecuting) { if (!_tracesReported.Contains(heliosBinding.Description)) { string loopType = heliosBinding.IsExecuting ? "Hard" : "Soft"; Logger.Warn($"{loopType} binding loop detected; Object {target.Name} may have triggered itself"); _traceLoop = true; _tracesReported.Add(heliosBinding.Description); } _tracingSource = target; } HeliosObject source = (heliosBinding.Trigger).Source; SetTracing(source); }
private DocumentMeta AddNewDocument(HeliosObject profileObject) { DocumentMeta meta = FindDocumentMeta(profileObject); if (meta != null) { meta.document.IsSelected = true; return(meta); } HeliosEditorDocument editor = CreateDocumentEditor(profileObject); if (editor != null) { LayoutDocument document = new LayoutDocument(); document.Title = editor.Title; document.IsSelected = true; document.ContentId = HeliosSerializer.GetReferenceName(profileObject); document.Content = CreateDocumentContent(editor); // Since a new LayoutRoot object is created upon de-serialization, the Child LayoutDocumentPane no longer belongs to the LayoutRoot // therefore the LayoutDocumentPane 'DocumentPane' must be referred to dynamically // change added by yzfanimal LayoutDocumentPane DocumentPane = this.DockManager.Layout.Descendents().OfType <LayoutDocumentPane>().FirstOrDefault(); if (DocumentPane != null) { DocumentPane.Children.Add(document); } document.Closed += Document_Closed; meta = AddDocumentMeta(profileObject, document, editor); profileObject.PropertyChanged += DocumentObject_PropertyChanged; } return(meta); }
public void EndTraceTriggerFired(HeliosBinding heliosBinding) { if (_traceLoop) { // log every node traversed while returning back through the sources // after detecting a loop // NOTE: LongDescription is extremely expensive, but that's ok because we trace every loop only once Logger.Warn($" binding loop includes {heliosBinding.Description} ({heliosBinding.LongDescription})"); } HeliosObject source = heliosBinding.Trigger.Source; if (!IsTracing(source)) { // not part of a loop being traced return; } // returning back through the sources ClearTracing(source); if (_tracingSource != source) { // not the source currently being traced return; } if (_traceLoop) { // found source of loop, finish trace _traceLoop = false; Logger.Warn(" binding loop trace complete"); } // not tracing any more _tracingSource = null; }
public ProfileExplorerTreeItem(HeliosObject hobj, ProfileExplorerTreeItemType includeTypes) : this(hobj.Name, "", null, includeTypes) { _item = hobj; _itemType = ProfileExplorerTreeItemType.Visual; AddChild(hobj, includeTypes); }
public ItemDeleteEventArgs(HeliosObject item) { _deletedItem = item; }
public virtual void SetBindingFocus(HeliosObject bindingFoucsObject) { }
private DocumentMeta AddDocumentMeta(HeliosObject profileObject, LayoutDocument document, HeliosEditorDocument editor) { DocumentMeta meta = new DocumentMeta(); meta.editor = editor; meta.document = document; meta.hobj = profileObject; _documents.Add(meta); return meta; }
private static bool IsTracing(HeliosObject heliosObject) { return(heliosObject.OpaqueHandles.ContainsKey(typeof(SoftLoopTracer))); }
private static void ClearTracing(HeliosObject heliosObject) { heliosObject.OpaqueHandles.Remove(typeof(SoftLoopTracer)); }
private static void SetTracing(HeliosObject heliosObject) { heliosObject.OpaqueHandles[typeof(SoftLoopTracer)] = 1; }
private bool HasChildObject(HeliosObject childObject) { return GetChildObject(childObject) != null; }
private DocumentMeta FindDocumentMeta(HeliosObject profileObject) { foreach(DocumentMeta meta in _documents) { if (meta.hobj == profileObject) { return meta; } } return null; }
private DocumentMeta AddNewDocument(HeliosObject profileObject) { DocumentMeta meta = FindDocumentMeta(profileObject); if (meta != null) { meta.document.IsSelected = true; return meta; } HeliosEditorDocument editor = CreateDocumentEditor(profileObject); if (editor != null) { LayoutDocument document = new LayoutDocument(); document.Title = editor.Title; document.IsSelected = true; document.ContentId = HeliosSerializer.GetReferenceName(profileObject); document.Content = CreateDocumentContent(editor); DocumentPane.Children.Add(document); document.Closed += Document_Closed; meta = AddDocumentMeta(profileObject, document, editor); profileObject.PropertyChanged += DocumentObject_PropertyChanged; } return meta; }
private HeliosEditorDocument CreateDocumentEditor(HeliosObject profileObject) { HeliosEditorDocument editor = null; if (profileObject is Monitor) { editor = new MonitorDocument((Monitor)profileObject); } else if (profileObject is HeliosPanel) { editor = new PanelDocument((HeliosPanel)profileObject); } else if (profileObject is HeliosInterface) { editor = ConfigManager.ModuleManager.CreateInterfaceEditor((HeliosInterface)profileObject, Profile); if (editor != null) { editor.Style = App.Current.Resources["InterfaceEditor"] as Style; } } else { throw new ArgumentException("Can not create a editor document for profileobject requested.", "profileObject"); } return editor; }
private bool HasChildObject(HeliosObject childObject) { return(GetChildObject(childObject) != null); }
public void OnDeleting(HeliosObject item) { EventHandler<ItemDeleteEventArgs> handler = ItemDeleting; if (handler != null) { handler.Invoke(this, new ItemDeleteEventArgs(item)); } }