コード例 #1
0
ファイル: DeviceItem.cs プロジェクト: EdWeller/SoapboxSnap
 private void setItems()
 {
     var newCollection = new ObservableCollection<INodeWrapper>();
     foreach (var nDevice in Device.NodeDeviceChildren.Items)
     {
         var device = FindItemByNodeId(nDevice.ID) as DeviceItem;
         if (device == null)
         {
             device = new DeviceItem(this, nDevice);
             HookupHandlers(device);
         }
         newCollection.Add(device);
     }
     foreach (var nDiscreteInput in Device.NodeDiscreteInputChildren.Items)
     {
         var discreteInput = FindItemByNodeId(nDiscreteInput.ID) as DiscreteInputItem;
         if (discreteInput == null)
         {
             discreteInput = new DiscreteInputItem(this, nDiscreteInput);
             HookupHandlers(discreteInput);
         }
         newCollection.Add(discreteInput);
     }
     foreach (var nDiscreteOutput in Device.NodeDiscreteOutputChildren.Items)
     {
         var discreteOutput = FindItemByNodeId(nDiscreteOutput.ID) as DiscreteOutputItem;
         if (discreteOutput == null)
         {
             discreteOutput = new DiscreteOutputItem(this, nDiscreteOutput);
             HookupHandlers(discreteOutput);
         }
         newCollection.Add(discreteOutput);
     }
     foreach (var nAnalogInput in Device.NodeAnalogInputChildren.Items)
     {
         var analogInput = FindItemByNodeId(nAnalogInput.ID) as AnalogInputItem;
         if (analogInput == null)
         {
             analogInput = new AnalogInputItem(this, nAnalogInput);
             HookupHandlers(analogInput);
         }
         newCollection.Add(analogInput);
     }
     foreach (var nAnalogOutput in Device.NodeAnalogOutputChildren.Items)
     {
         var analogOutput = FindItemByNodeId(nAnalogOutput.ID) as AnalogOutputItem;
         if (analogOutput == null)
         {
             analogOutput = new AnalogOutputItem(this, nAnalogOutput);
             HookupHandlers(analogOutput);
         }
         newCollection.Add(analogOutput);
     }
     foreach (var nStringInput in Device.NodeStringInputChildren.Items)
     {
         var stringInput = FindItemByNodeId(nStringInput.ID) as StringInputItem;
         if (stringInput == null)
         {
             stringInput = new StringInputItem(this, nStringInput);
             HookupHandlers(stringInput);
         }
         newCollection.Add(stringInput);
     }
     foreach (var nStringOutput in Device.NodeStringOutputChildren.Items)
     {
         var stringOutput = FindItemByNodeId(nStringOutput.ID) as StringOutputItem;
         if (stringOutput == null)
         {
             stringOutput = new StringOutputItem(this, nStringOutput);
             HookupHandlers(stringOutput);
         }
         newCollection.Add(stringOutput);
     }
     Items = newCollection;
 }
コード例 #2
0
ファイル: DeviceItem.cs プロジェクト: EdWeller/SoapboxSnap
 void HookupHandlers(StringOutputItem stringOutput)
 {
     stringOutput.Parent = this;
     stringOutput.Edited += new EditedHandler(StringOutput_Edited);
     stringOutput.Deleted += new DeletedHandler(StringOutput_Deleted);
 }