コード例 #1
0
 public SignalChooser(INodeWrapper nodeItem, NodeSignalIn initialSignalIn, double maxWidth, TextAlignment textAlignment)
 {
     NodeItem      = nodeItem;
     SignalIn      = initialSignalIn;
     MaxWidth      = maxWidth;
     TextAlignment = textAlignment;
 }
コード例 #2
0
        protected bool TraceBackForPath(INodeWrapper <T> startingNode)
        {
            result.Clear();
            NodeWrapperEx <T> nodeWrapper = startingNode as NodeWrapperEx <T>;

            if (nodeWrapper == null || nodeWrapper.g == float.PositiveInfinity)
            {
                return(false);
            }

            while (!nodeWrapper.node.Equals(endingNode))
            {
                NodeWrapperEx <T> previous = default;
                foreach (var nei in context.GetGraphData().CollectNeighbor(nodeWrapper.node).Select(n => context.GetOrCreateNode(n)))
                {
                    if (previous == null || nei.g < previous.g)
                    {
                        previous = nei;
                    }
                }

                result.Add(nodeWrapper.node);
                nodeWrapper = previous;
            }
            result.Add(nodeWrapper.node);

            return(true);
        }
コード例 #3
0
ファイル: RuntimeService.cs プロジェクト: mainr/Soapbox_SNAP
 public bool DisconnectDialog(INodeWrapper requester)
 {
     if (!Connected(requester))
     {
         return(true);
     }
     else
     {
         if (messagingService.ShowDialog(Resources.Strings.RuntimeService_Disconnect_Message, Resources.Strings.RuntimeService_Disconnect_Title,
                                         System.Windows.Forms.MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.Yes)
         {
             var runtimeApplicationItem = FindParentRuntimeApplicationItem(requester);
             if (runtimeApplicationItem != null)
             {
                 runtimeApplicationItem.Disconnect();
                 return(true);
             }
             else
             {
                 // we're not inside a runtime app?
                 return(false);
             }
         }
         else
         {
             return(false);
         }
     }
 }
コード例 #4
0
ファイル: SignalChooser.cs プロジェクト: EdWeller/SoapboxSnap
 public SignalChooser(INodeWrapper nodeItem, NodeSignalIn initialSignalIn, double maxWidth, TextAlignment textAlignment)
 {
     NodeItem = nodeItem;
     SignalIn = initialSignalIn;
     MaxWidth = maxWidth;
     TextAlignment = textAlignment;
 }
コード例 #5
0
ファイル: RuntimeService.cs プロジェクト: mainr/Soapbox_SNAP
        public void RegisterValueWatcher(INodeWrapper nodeItem, NodeSignal signal)
        {
            if (nodeItem == null)
            {
                throw new ArgumentNullException("nodeItem");
            }
            if (signal == null)
            {
                throw new ArgumentNullException("signal");
            }
            var rta = FindParentRuntimeApplicationItem(nodeItem);

            if (rta != null)
            {
                lock (m_valueWatchers_Lock)
                {
                    if (!m_valueWatchers.ContainsKey(rta))
                    {
                        m_valueWatchers.Add(rta, new Dictionary <NodeSignal, int>());
                    }
                    if (!m_valueWatchers[rta].ContainsKey(signal))
                    {
                        m_valueWatchers[rta].Add(signal, 1);
                        m_rtaLookup[nodeItem] = rta;
                    }
                    else
                    {
                        m_valueWatchers[rta][signal] += 1;
                    }
                }
            }
        }
コード例 #6
0
 void EditorRoot_Edited(INodeWrapper sender, NodeBase oldNode, NodeBase newNode)
 {
     // If we want to cache the page edits at the page level before saving, then
     // use IsDirty = true.  Otherwise, set m_pageItem.Page = EditorRoot.WorkingCopy
     //IsDirty = true;
     m_pageItem.Page = EditorRoot.WorkingCopy;
 }
コード例 #7
0
ファイル: SignalValue.cs プロジェクト: EdWeller/SoapboxSnap
 public SignalValue(INodeWrapper nodeItem, NodeSignal initialSignal, double maxWidth, TextAlignment textAlignment, string formatString)
 {
     Signal = initialSignal;
     NodeItem = nodeItem;
     MaxWidth = maxWidth;
     TextAlignment = textAlignment;
     FormatString = formatString;
 }
コード例 #8
0
 public SignalValue(INodeWrapper nodeItem, NodeSignal initialSignal, double maxWidth, TextAlignment textAlignment, string formatString)
 {
     Signal        = initialSignal;
     NodeItem      = nodeItem;
     MaxWidth      = maxWidth;
     TextAlignment = textAlignment;
     FormatString  = formatString;
 }
コード例 #9
0
 protected void FireEditedEvent(INodeWrapper sender, NodeBase oldNode, NodeBase newNode)
 {
     if (!disableEditedDeletedEvents)
     {
         logger.Info("Firing Edited Event in item " + this.GetType().ToString());
         Edited(this, oldNode, newNode);
     }
 }
コード例 #10
0
        private void DeviceConfiguration_Edited(INodeWrapper sender, NodeBase oldNode, NodeBase newNode)
        {
            var newDC = newNode as NodeDeviceConfiguration;

            if (newDC != null)
            {
                RuntimeApplication = RuntimeApplication.SetDeviceConfiguration(newDC);
            }
        }
コード例 #11
0
 private void saveNodeState(INodeWrapper nodeWrapper, IUndoMemento memento)
 {
     if (nodeWrapper != null && memento != null)
     {
         var saveNodeWrapper = nodeWrapper;
         var saveNode        = saveNodeWrapper.Node;
         memento.RedoActions.Add(() => saveNodeWrapper.StealthSetNode(saveNode));
     }
 }
コード例 #12
0
 private void saveNodeState(INodeWrapper nodeWrapper, List <Action> actions)
 {
     if (nodeWrapper != null && actions != null)
     {
         var saveNodeWrapper = nodeWrapper;
         var saveNode        = saveNodeWrapper.Node;
         actions.Add(() => saveNodeWrapper.StealthSetNode(saveNode));
     }
 }
コード例 #13
0
        void Logic_Edited(INodeWrapper sender, NodeBase oldNode, NodeBase newNode)
        {
            var newLogic = newNode as NodePageCollection;

            if (newLogic != null)
            {
                RuntimeApplication = RuntimeApplication.SetLogic(newLogic);
            }
        }
コード例 #14
0
ファイル: DeviceItem.cs プロジェクト: mainr/Soapbox_SNAP
        void Device_Edited(INodeWrapper sender, NodeBase oldNode, NodeBase newNode)
        {
            var oldDevice = oldNode as NodeDevice;
            var newDevice = newNode as NodeDevice;

            if (oldDevice != null && newDevice != null)
            {
                Device = Device.NodeDeviceChildren.Replace(oldDevice, newDevice);
            }
        }
コード例 #15
0
ファイル: DeviceItem.cs プロジェクト: mainr/Soapbox_SNAP
        void AnalogInput_Edited(INodeWrapper sender, NodeBase oldNode, NodeBase newNode)
        {
            var oldAnalogInput = oldNode as NodeAnalogInput;
            var newAnalogInput = newNode as NodeAnalogInput;

            if (oldAnalogInput != null && newAnalogInput != null)
            {
                Device = Device.NodeAnalogInputChildren.Replace(oldAnalogInput, newAnalogInput);
            }
        }
コード例 #16
0
        public void ChildInstruction_Edited(INodeWrapper sender, NodeBase oldNode, NodeBase newNode)
        {
            var oldInstruction = oldNode as NodeInstruction;
            var newInstruction = newNode as NodeInstruction;

            if (oldInstruction != null && newInstruction != null)
            {
                Instruction = Instruction.NodeInstructionChildren.Replace(oldInstruction, newInstruction);
            }
        }
コード例 #17
0
            void InstructionGroupItem_Edited(INodeWrapper sender, NodeBase oldNode, NodeBase newNode)
            {
                var oldInstructionGroup = oldNode as NodeInstructionGroup;
                var newInstructionGroup = newNode as NodeInstructionGroup;

                if (oldInstructionGroup != null && newInstructionGroup != null)
                {
                    WorkingCopy = WorkingCopy.NodeInstructionGroupChildren.Replace(oldInstructionGroup, newInstructionGroup);
                }
            }
コード例 #18
0
        void Page_Edited(INodeWrapper sender, NodeBase oldNode, NodeBase newNode)
        {
            var oldPage = oldNode as NodePage;
            var newPage = newNode as NodePage;

            if (oldPage != null && newPage != null)
            {
                PageCollection = PageCollection.NodePageChildren.Replace(oldPage, newPage);
            }
        }
コード例 #19
0
ファイル: DeviceItem.cs プロジェクト: mainr/Soapbox_SNAP
        void StringOutput_Edited(INodeWrapper sender, NodeBase oldNode, NodeBase newNode)
        {
            var oldStringOutput = oldNode as NodeStringOutput;
            var newStringOutput = newNode as NodeStringOutput;

            if (oldStringOutput != null && newStringOutput != null)
            {
                Device = Device.NodeStringOutputChildren.Replace(oldStringOutput, newStringOutput);
            }
        }
コード例 #20
0
        void Driver_Edited(INodeWrapper sender, NodeBase oldNode, NodeBase newNode)
        {
            var oldDriver = oldNode as NodeDriver;
            var newDriver = newNode as NodeDriver;

            if (oldDriver != null && newDriver != null)
            {
                DeviceConfiguration = DeviceConfiguration.NodeDriverChildren.Replace(oldDriver, newDriver);
            }
        }
コード例 #21
0
        void SignalIn_Edited(INodeWrapper sender, NodeBase oldNode, NodeBase newNode)
        {
            var oldSignalIn = oldNode as NodeSignalIn;
            var newSignalIn = newNode as NodeSignalIn;

            if (oldSignalIn != null && newSignalIn != null)
            {
                AnalogOutput = AnalogOutput.SetSignalIn(newSignalIn);
            }
        }
コード例 #22
0
        void RuntimeApplication_Edited(INodeWrapper sender, NodeBase oldNode, NodeBase newNode)
        {
            var oldRTA = oldNode as NodeRuntimeApplication;
            var newRTA = newNode as NodeRuntimeApplication;

            if (oldRTA != null && newRTA != null)
            {
                Solution = Solution.NodeRuntimeApplicationChildren.Replace(oldRTA, newRTA);
            }
        }
コード例 #23
0
ファイル: RuntimeService.cs プロジェクト: mainr/Soapbox_SNAP
 public NodeSignalIn SignalDialog(INodeWrapper requester, NodeSignalIn defaultSignalIn)
 {
     if (DisconnectDialog(requester))
     {
         return(signalChooserDialog.ShowDialog(requester, defaultSignalIn));
     }
     else
     {
         return(defaultSignalIn);
     }
 }
コード例 #24
0
        public INodeWrapper FindAncestorByNodeId(FieldGuid nodeId)
        {
            INodeWrapper parent = Parent;

            while (parent != null)
            {
                if (parent.Node.ID == nodeId)
                {
                    break;
                }
                parent = parent.Parent;
            }
            return(parent);
        }
コード例 #25
0
        public INodeWrapper FindAncestorOfType(Type findType)
        {
            INodeWrapper parent = Parent;

            while (parent != null)
            {
                if (parent.GetType() == findType)
                {
                    break;
                }
                parent = parent.Parent;
            }
            return(parent);
        }
コード例 #26
0
        /// <summary>
        /// Finds the item (if it exists) in the Items collection
        /// matching the given nodeId.  It is *not* recursive.
        /// </summary>
        public INodeWrapper FindItemByNodeId(FieldGuid nodeId)
        {
            INodeWrapper retVal = null;

            foreach (var item in Items)
            {
                if (item.Node != null && item.Node.ID == nodeId)
                {
                    retVal = item;
                    break;
                }
            }
            return(retVal);
        }
コード例 #27
0
        public void ChildInstruction_Deleted(INodeWrapper sender, NodeBase deletedNode)
        {
            var deletedInstruction = deletedNode as NodeInstruction;
            var instructionItem    = sender as IInstructionItem;

            if (deletedInstruction != null && instructionItem != null)
            {
                if (instructionItem.Parent == this)
                {
                    instructionItem.Parent = null;
                }
                Instruction              = Instruction.NodeInstructionChildren.Remove(deletedInstruction);
                instructionItem.Edited  -= new EditedHandler(ChildInstruction_Edited);
                instructionItem.Deleted -= new DeletedHandler(ChildInstruction_Deleted);
                Items.Remove(instructionItem);
            }
        }
コード例 #28
0
        void RuntimeApplication_Deleted(INodeWrapper sender, NodeBase deletedNode)
        {
            var deletedRTA   = deletedNode as NodeRuntimeApplication;
            var solutionItem = sender as RuntimeApplicationItem;

            if (deletedRTA != null && solutionItem != null)
            {
                if (solutionItem.Parent == this)
                {
                    solutionItem.Parent = null;
                }
                Solution              = Solution.NodeRuntimeApplicationChildren.Remove(deletedRTA);
                solutionItem.Edited  -= new EditedHandler(RuntimeApplication_Edited);
                solutionItem.Deleted -= new DeletedHandler(RuntimeApplication_Deleted);
                m_Items.Remove(solutionItem);
            }
        }
コード例 #29
0
ファイル: DeviceItem.cs プロジェクト: mainr/Soapbox_SNAP
        void Device_Deleted(INodeWrapper sender, NodeBase deletedNode)
        {
            var deletedDevice = deletedNode as NodeDevice;
            var solutionItem  = sender as DriverItem;

            if (deletedDevice != null && solutionItem != null)
            {
                if (solutionItem.Parent == this)
                {
                    solutionItem.Parent = null;
                }
                Device = Device.NodeDeviceChildren.Remove(deletedDevice);
                solutionItem.Edited  -= new EditedHandler(Device_Edited);
                solutionItem.Deleted -= new DeletedHandler(Device_Deleted);
                Items.Remove(solutionItem);
            }
        }
コード例 #30
0
            void InstructionGroupItem_Deleted(INodeWrapper sender, NodeBase deletedNode)
            {
                var deletedInstructionGroup = deletedNode as NodeInstructionGroup;
                var editorItem = sender as IEditorItem;

                if (deletedInstructionGroup != null && editorItem != null)
                {
                    if (editorItem.Parent == this)
                    {
                        editorItem.Parent = null;
                    }
                    WorkingCopy         = WorkingCopy.NodeInstructionGroupChildren.Remove(deletedInstructionGroup);
                    editorItem.Edited  -= new EditedHandler(InstructionGroupItem_Edited);
                    editorItem.Deleted -= new DeletedHandler(InstructionGroupItem_Deleted);
                    Items.Remove(editorItem);
                }
            }
コード例 #31
0
        void Driver_Deleted(INodeWrapper sender, NodeBase deletedNode)
        {
            var deletedDriver = deletedNode as NodeDriver;
            var solutionItem  = sender as DriverItem;

            if (deletedDriver != null && solutionItem != null)
            {
                if (solutionItem.Parent == this)
                {
                    solutionItem.Parent = null;
                }
                DeviceConfiguration   = DeviceConfiguration.NodeDriverChildren.Remove(deletedDriver);
                solutionItem.Edited  -= new EditedHandler(Driver_Edited);
                solutionItem.Deleted -= new DeletedHandler(Driver_Deleted);
                Items.Remove(solutionItem);
            }
        }
コード例 #32
0
ファイル: DeviceItem.cs プロジェクト: mainr/Soapbox_SNAP
        void StringOutput_Deleted(INodeWrapper sender, NodeBase deletedNode)
        {
            var deletedStringOutput = deletedNode as NodeStringOutput;
            var solutionItem        = sender as DriverItem;

            if (deletedStringOutput != null && solutionItem != null)
            {
                if (solutionItem.Parent == this)
                {
                    solutionItem.Parent = null;
                }
                Device = Device.NodeStringOutputChildren.Remove(deletedStringOutput);
                solutionItem.Edited  -= new EditedHandler(StringOutput_Edited);
                solutionItem.Deleted -= new DeletedHandler(StringOutput_Deleted);
                Items.Remove(solutionItem);
            }
        }
コード例 #33
0
 void RuntimeApplication_Deleted(INodeWrapper sender, NodeBase deletedNode)
 {
     var deletedRTA = deletedNode as NodeRuntimeApplication;
     var solutionItem = sender as RuntimeApplicationItem;
     if (deletedRTA != null && solutionItem != null)
     {
         if (solutionItem.Parent == this)
         {
             solutionItem.Parent = null;
         }
         Solution = Solution.NodeRuntimeApplicationChildren.Remove(deletedRTA);
         solutionItem.Edited -= new EditedHandler(RuntimeApplication_Edited);
         solutionItem.Deleted -= new DeletedHandler(RuntimeApplication_Deleted);
         m_Items.Remove(solutionItem);
     }
 }
コード例 #34
0
 void Driver_Deleted(INodeWrapper sender, NodeBase deletedNode)
 {
     var deletedDriver = deletedNode as NodeDriver;
     var solutionItem = sender as DriverItem;
     if (deletedDriver != null && solutionItem != null)
     {
         if (solutionItem.Parent == this)
         {
             solutionItem.Parent = null;
         }
         DeviceConfiguration = DeviceConfiguration.NodeDriverChildren.Remove(deletedDriver);
         solutionItem.Edited -= new EditedHandler(Driver_Edited);
         solutionItem.Deleted -= new DeletedHandler(Driver_Deleted);
         Items.Remove(solutionItem);
     }
 }
コード例 #35
0
 private void saveNodeState(INodeWrapper nodeWrapper, IUndoMemento memento)
 {
     if (nodeWrapper != null && memento != null)
     {
         var saveNodeWrapper = nodeWrapper;
         var saveNode = saveNodeWrapper.Node;
         memento.RedoActions.Add(() => saveNodeWrapper.StealthSetNode(saveNode));
     }
 }
コード例 #36
0
 public void DeregisterValueWatcher(INodeWrapper nodeItem, NodeSignal signal)
 {
     if (nodeItem == null)
     {
         throw new ArgumentNullException("nodeItem");
     }
     if (signal == null)
     {
         throw new ArgumentNullException("signal");
     }
     var rta = FindParentRuntimeApplicationItem(nodeItem);
     if (rta == null)
     {
         lock (m_valueWatchers_Lock)
         {
             if (m_rtaLookup.ContainsKey(nodeItem))
             {
                 rta = m_rtaLookup[nodeItem];
             }
         }
     }
     if (rta != null)
     {
         lock (m_valueWatchers_Lock)
         {
             if (m_valueWatchers.ContainsKey(rta))
             {
                 if (m_valueWatchers[rta].ContainsKey(signal))
                 {
                     m_valueWatchers[rta][signal] -= 1;
                     if (m_valueWatchers[rta][signal] <= 0)
                     {
                         m_rtaLookup.Remove(nodeItem);
                         m_valueWatchers[rta].Remove(signal);
                         if (m_valueWatchers[rta].Count == 0)
                         {
                             m_valueWatchers.Remove(rta);
                         }
                     }
                 }
             }
         }
     }
 }
コード例 #37
0
 public Tuple<NodePage, NodeRuntimeApplication> FindParentPageAndRuntimeApp(INodeWrapper requester)
 {
     var tpl = FindParentPageEditorItemPageItemAndRuntimeAppItem(requester);
     PageEditor.PageEditorItem pageEditorItem = tpl.Item1;
     PageItem pageItem = tpl.Item2;
     RuntimeApplicationItem runtimeAppItem = tpl.Item3;
     NodePage pg = null;
     NodeRuntimeApplication rta = null;
     if (pageEditorItem != null)
     {
         pg = pageEditorItem.WorkingCopy;
     }
     else if (pageItem != null)
     {
         pg = pageItem.Page;
     }
     if (runtimeAppItem != null)
     {
         rta = runtimeAppItem.RuntimeApplication;
     }
     return new Tuple<NodePage, NodeRuntimeApplication>(pg, rta);
 }
コード例 #38
0
 public void RegisterValueWatcher(INodeWrapper nodeItem, NodeSignal signal)
 {
     if (nodeItem == null)
     {
         throw new ArgumentNullException("nodeItem");
     }
     if (signal == null)
     {
         throw new ArgumentNullException("signal");
     }
     var rta = FindParentRuntimeApplicationItem(nodeItem);
     if (rta != null)
     {
         lock (m_valueWatchers_Lock)
         {
             if (!m_valueWatchers.ContainsKey(rta))
             {
                 m_valueWatchers.Add(rta, new Dictionary<NodeSignal, int>());
             }
             if (!m_valueWatchers[rta].ContainsKey(signal))
             {
                 m_valueWatchers[rta].Add(signal,1);
                 m_rtaLookup[nodeItem] = rta;
             }
             else
             {
                 m_valueWatchers[rta][signal] += 1;
             }
         }
     }
 }
コード例 #39
0
 /// <summary>
 /// Displays the Dialog as modal
 /// </summary>
 /// <returns>Signal ID</returns>
 public NodeSignalIn ShowDialog(INodeWrapper requester, NodeSignalIn originalSignalIn)
 {
     m_dataTypefilter = originalSignalIn.CompatibleTypes.DataType;
     OriginalSignalIn = originalSignalIn;
     setDefaultValues();
     NodeItem = requester;
     Window dlg = new SignalChooserDialogView();
     dlg.Owner = mainWindowExport.Value;
     dlg.DataContext = this;
     dlg.ShowDialog();
     if (SignalSelected)
     {
         return NodeSignalIn.BuildWith(OriginalSignalIn.DataType, OriginalSignalIn.CompatibleTypes, SignalId);
     }
     else
     {
         return NodeSignalIn.BuildWith(OriginalSignalIn.DataType, OriginalSignalIn.CompatibleTypes, Literal);
     }
 }
コード例 #40
0
 private Tuple<PageEditor.PageEditorItem, PageItem, RuntimeApplicationItem> FindParentPageEditorItemPageItemAndRuntimeAppItem(INodeWrapper requester)
 {
     PageEditor.PageEditorItem pageEditorItem;
     if (requester is PageEditor.PageEditorItem)
     {
         pageEditorItem = requester as PageEditor.PageEditorItem;
     }
     else
     {
         pageEditorItem = requester.FindAncestorOfType(typeof(PageEditor.PageEditorItem)) as PageEditor.PageEditorItem;
     }
     PageItem pageItem;
     if (requester is PageItem)
     {
         pageItem = requester as PageItem;
     }
     else
     {
         pageItem = requester.FindAncestorOfType(typeof(PageItem)) as PageItem;
     }
     RuntimeApplicationItem runtimeAppItem;
     if (pageEditorItem == null)
     {
         // we're outside of a page editor
         runtimeAppItem = requester.FindAncestorOfType(typeof(RuntimeApplicationItem)) as RuntimeApplicationItem;
     }
     else
     {
         // inside a page editor, we have to do some fancy footwork
         var pageEditor = pageEditorItem.PageEditorParent;
         if (pageEditor.PageItemParent != null)
         {
             pageItem = pageEditor.PageItemParent;
             runtimeAppItem = pageItem.FindAncestorOfType(typeof(RuntimeApplicationItem)) as RuntimeApplicationItem;
         }
         else
         {
             runtimeAppItem = null;
         }
     }
     return new Tuple<PageEditor.PageEditorItem, PageItem, RuntimeApplicationItem>(pageEditorItem, pageItem, runtimeAppItem);
 }
コード例 #41
0
 private void saveNodeState(INodeWrapper nodeWrapper, List<Action> actions)
 {
     if (nodeWrapper != null && actions != null)
     {
         var saveNodeWrapper = nodeWrapper;
         var saveNode = saveNodeWrapper.Node;
         actions.Add(() => saveNodeWrapper.StealthSetNode(saveNode));
     }
 }
コード例 #42
0
ファイル: DeviceItem.cs プロジェクト: EdWeller/SoapboxSnap
 void DiscreteInput_Edited(INodeWrapper sender, NodeBase oldNode, NodeBase newNode)
 {
     var oldDiscreteInput = oldNode as NodeDiscreteInput;
     var newDiscreteInput = newNode as NodeDiscreteInput;
     if (oldDiscreteInput != null && newDiscreteInput != null)
     {
         Device = Device.NodeDiscreteInputChildren.Replace(oldDiscreteInput, newDiscreteInput);
     }
 }
コード例 #43
0
ファイル: DeviceItem.cs プロジェクト: EdWeller/SoapboxSnap
 void StringOutput_Deleted(INodeWrapper sender, NodeBase deletedNode)
 {
     var deletedStringOutput = deletedNode as NodeStringOutput;
     var solutionItem = sender as DriverItem;
     if (deletedStringOutput != null && solutionItem != null)
     {
         if (solutionItem.Parent == this)
         {
             solutionItem.Parent = null;
         }
         Device = Device.NodeStringOutputChildren.Remove(deletedStringOutput);
         solutionItem.Edited -= new EditedHandler(StringOutput_Edited);
         solutionItem.Deleted -= new DeletedHandler(StringOutput_Deleted);
         Items.Remove(solutionItem);
     }
 }
コード例 #44
0
ファイル: DeviceItem.cs プロジェクト: EdWeller/SoapboxSnap
 void StringOutput_Edited(INodeWrapper sender, NodeBase oldNode, NodeBase newNode)
 {
     var oldStringOutput = oldNode as NodeStringOutput;
     var newStringOutput = newNode as NodeStringOutput;
     if (oldStringOutput != null && newStringOutput != null)
     {
         Device = Device.NodeStringOutputChildren.Replace(oldStringOutput, newStringOutput);
     }
 }
コード例 #45
0
 public static void SetNodeItem(DependencyObject target, INodeWrapper value)
 {
     target.SetValue(SignalValueBehavior.NodeItemProperty, value);
 }
コード例 #46
0
 private RuntimeApplicationItem FindParentRuntimeApplicationItem(INodeWrapper requester)
 {
     return FindParentPageEditorItemPageItemAndRuntimeAppItem(requester).Item3;
 }
コード例 #47
0
 void Instruction_Edited(INodeWrapper sender, NodeBase oldNode, NodeBase newNode)
 {
     var oldInstruction = oldNode as NodeInstruction;
     var newInstruction = newNode as NodeInstruction;
     if (oldInstruction != null && newInstruction != null)
     {
         if (newInstruction.InstructionType != InstructionLDSeries.StaticInstructionType)
         {
             throw new InvalidOperationException("The first and only instruction in an " +
                 Extensions.Workbench.Documents.PageEditor_.InstructionGroupItems.LD +
                 " instruction group must be a " +
                 InstructionLDSeries.StaticInstructionType.ToString() +
                 " instruction.");
         }
         InstructionGroup = InstructionGroup.NodeInstructionChildren.Replace(oldInstruction, newInstruction);
     }
 }
コード例 #48
0
 public void ChildInstruction_Edited(INodeWrapper sender, NodeBase oldNode, NodeBase newNode)
 {
     var oldInstruction = oldNode as NodeInstruction;
     var newInstruction = newNode as NodeInstruction;
     if (oldInstruction != null && newInstruction != null)
     {
         Instruction = Instruction.NodeInstructionChildren.Replace(oldInstruction, newInstruction);
     }
 }
コード例 #49
0
 /// <summary>
 /// Returns a dictionary of signal names, and those signals, in a depth
 /// first search of the runtime application.  For those signals within
 /// the same page, it has no prefix, but for those in other pages or
 /// in the device configuration, it adds a directory-like prefix.
 /// </summary>
 public Dictionary<string, NodeSignal> SignalList(INodeWrapper requester, FieldDataType.DataTypeEnum dataTypeFilter)
 {
     var dict = new Dictionary<string, NodeSignal>();
     var tpl = FindParentPageAndRuntimeApp(requester);
     NodePage pg = tpl.Item1;
     NodeRuntimeApplication rta = tpl.Item2;
     if (rta != null)
     {
         if (pg != null)
         {
             // Search the local page first
             SignalsDepthFirst(pg, string.Empty, dict, pg, dataTypeFilter);
         }
         SignalsDepthFirst(rta, string.Empty, dict, pg, dataTypeFilter);
     }
     return dict;
 }
コード例 #50
0
ファイル: DeviceItem.cs プロジェクト: EdWeller/SoapboxSnap
 void Device_Edited(INodeWrapper sender, NodeBase oldNode, NodeBase newNode)
 {
     var oldDevice = oldNode as NodeDevice;
     var newDevice = newNode as NodeDevice;
     if (oldDevice != null && newDevice != null)
     {
         Device = Device.NodeDeviceChildren.Replace(oldDevice, newDevice);
     }
 }
コード例 #51
0
 public NodeSignalIn SignalDialog(INodeWrapper requester, NodeSignalIn defaultSignalIn)
 {
     if (DisconnectDialog(requester))
     {
         return signalChooserDialog.ShowDialog(requester, defaultSignalIn);
     }
     else
     {
         return defaultSignalIn;
     }
 }
コード例 #52
0
ファイル: DeviceItem.cs プロジェクト: EdWeller/SoapboxSnap
 void Device_Deleted(INodeWrapper sender, NodeBase deletedNode)
 {
     var deletedDevice = deletedNode as NodeDevice;
     var solutionItem = sender as DriverItem;
     if (deletedDevice != null && solutionItem != null)
     {
         if (solutionItem.Parent == this)
         {
             solutionItem.Parent = null;
         }
         Device = Device.NodeDeviceChildren.Remove(deletedDevice);
         solutionItem.Edited -= new EditedHandler(Device_Edited);
         solutionItem.Deleted -= new DeletedHandler(Device_Deleted);
         Items.Remove(solutionItem);
     }
 }
コード例 #53
0
        /// <summary>
        /// Searches the runtime application for a signal matching the given signalId
        /// </summary>
        public Tuple<string, NodeSignal> FindSignal(INodeWrapper requester, FieldGuid signalId)
        {
            var tpl = FindParentPageAndRuntimeApp(requester);
            NodePage pg = tpl.Item1;
            NodeRuntimeApplication rta = tpl.Item2;
            if (rta != null)
            {
                var edits = new Dictionary<NodePage,NodePage>();

                if (pg != null)
                {
                    // Searches the local page first
                    var tryLocal = FindSignalAndName(pg, string.Empty, pg, signalId, edits);
                    if (tryLocal != null)
                    {
                        return tryLocal;
                    }
                }

                // Make a list of edited page copies
                foreach (var d in layoutManager.Documents)
                {
                    var pageEditor = d as PageEditor;
                    if (pageEditor != null)
                    {
                        edits.Add(pageEditor.PageItemParent.Page, pageEditor.EditorRoot.WorkingCopy);
                    }
                }

                return FindSignalAndName(rta, string.Empty, pg, signalId, edits);
            }
            else
            {
                return null;
            }
        }
コード例 #54
0
 void Logic_Edited(INodeWrapper sender, NodeBase oldNode, NodeBase newNode)
 {
     var newLogic = newNode as NodePageCollection;
     if (newLogic != null)
     {
         RuntimeApplication = RuntimeApplication.SetLogic(newLogic);
     }
 }
コード例 #55
0
 public bool DisconnectDialog(INodeWrapper requester)
 {
     if (!Connected(requester))
     {
         return true;
     }
     else
     {
         if (messagingService.ShowDialog(Resources.Strings.RuntimeService_Disconnect_Message, Resources.Strings.RuntimeService_Disconnect_Title,
             System.Windows.Forms.MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.Yes)
         {
             var runtimeApplicationItem = FindParentRuntimeApplicationItem(requester);
             if (runtimeApplicationItem != null)
             {
                 runtimeApplicationItem.Disconnect();
                 return true;
             }
             else
             {
                 // we're not inside a runtime app?
                 return false;
             }
         }
         else
         {
             return false;
         }
     }
 }
コード例 #56
0
 private void DeviceConfiguration_Edited(INodeWrapper sender, NodeBase oldNode, NodeBase newNode)
 {
     var newDC = newNode as NodeDeviceConfiguration;
     if (newDC != null)
     {
         RuntimeApplication = RuntimeApplication.SetDeviceConfiguration(newDC);
     }
 }
コード例 #57
0
 public bool Connected(INodeWrapper requester)
 {
     if(requester == null)
     {
         return false;
     }
     var runtimeApplicationItem = FindParentRuntimeApplicationItem(requester);
     if (runtimeApplicationItem != null)
     {
         return runtimeApplicationItem.Connected;
     }
     else
     {
         // we're not inside a runtime app?
         return false;
     }
 }
コード例 #58
0
 void RuntimeApplication_Edited(INodeWrapper sender, NodeBase oldNode, NodeBase newNode)
 {
     var oldRTA = oldNode as NodeRuntimeApplication;
     var newRTA = newNode as NodeRuntimeApplication;
     if (oldRTA != null && newRTA != null)
     {
         Solution = Solution.NodeRuntimeApplicationChildren.Replace(oldRTA, newRTA);
     }
 }
コード例 #59
0
 void Driver_Edited(INodeWrapper sender, NodeBase oldNode, NodeBase newNode)
 {
     var oldDriver = oldNode as NodeDriver;
     var newDriver = newNode as NodeDriver;
     if (oldDriver != null && newDriver != null)
     {
         DeviceConfiguration = DeviceConfiguration.NodeDriverChildren.Replace(oldDriver, newDriver);
     }
 }
コード例 #60
0
 void SignalIn_Edited(INodeWrapper sender, NodeBase oldNode, NodeBase newNode)
 {
     var oldSignalIn = oldNode as NodeSignalIn;
     var newSignalIn = newNode as NodeSignalIn;
     if (oldSignalIn != null && newSignalIn != null)
     {
         AnalogOutput = AnalogOutput.SetSignalIn(newSignalIn);
     }
 }