Пример #1
0
 public static ViewModelBase CreateAppropriateRecordViewModel(NetworkElement networkElement)
 {
     if (networkElement.Element is Network)
     {
         return(new NetworkDetailViewModel(networkElement.Element));
     }
     else if (networkElement.Element is NetworkModel)
     {
         return(new NetworkModelDetailViewModel(networkElement.Element));
     }
     else if (networkElement.Element is Company)
     {
         return(new CompanyDetailViewModel(networkElement.Element));
     }
     else if (networkElement.Element is Division)
     {
         return(new DivisionDetailViewModel(networkElement.Element));
     }
     else if (networkElement.Element is Substation)
     {
         return(new SubstationDetailViewModel(networkElement.Element));
     }
     else if (networkElement.Element is TransmissionLine)
     {
         return(new TransmissionLineDetailViewModel(networkElement.Element));
     }
     else if (networkElement.Element is Node)
     {
         return(new NodeDetailViewModel(networkElement.Element));
     }
     else if (networkElement.Element is Transformer)
     {
         return(new TransformerDetailViewModel(networkElement.Element));
     }
     else if (networkElement.Element is ShuntCompensator)
     {
         return(new ShuntDetailViewModel(networkElement.Element));
     }
     else if (networkElement.Element is SeriesCompensator)
     {
         return(new SeriesCompensatorDetailViewModel(networkElement.Element));
     }
     else if (networkElement.Element is LineSegment)
     {
         return(new LineSegmentDetailViewModel(networkElement.Element));
     }
     else if (networkElement.Element is CircuitBreaker)
     {
         return(new CircuitBreakerDetailViewModel(networkElement.Element));
     }
     else if (networkElement.Element is Switch)
     {
         return(new SwitchDetailViewModel(networkElement.Element));
     }
     else if (networkElement.Element is VoltageLevel)
     {
         return(new VoltageLevelDetailViewModel(networkElement.Element));
     }
     else if (networkElement.Element is StatusWord)
     {
         return(new StatusWordDetailViewModel(networkElement.Element));
     }
     else if (networkElement.Element is BreakerStatus)
     {
         return(new BreakerStatusDetailViewModel(networkElement.Element));
     }
     else if (networkElement.Element is TapConfiguration)
     {
         return(new TapConfigurationDetailViewModel(networkElement.Element));
     }
     else if (networkElement.Element is VoltagePhasorGroup)
     {
         return(new VoltagePhasorGroupDetailViewModel(networkElement.Element));
     }
     else if (networkElement.Element is CurrentFlowPhasorGroup)
     {
         return(new CurrentPhasorGroupDetailViewModel(networkElement.Element));
     }
     else if (networkElement.Element is CurrentInjectionPhasorGroup)
     {
         return(new CurrentInjectionPhasorGroupDetailViewModel(networkElement.Element));
     }
     else
     {
         return(null);
     }
 }
Пример #2
0
 private List <NetworkElement> GetNetworkElementChildren()
 {
     if (m_element is Network)
     {
         NetworkElement networkModel      = new NetworkElement((m_element as Network).Model);
         NetworkElement voltageLevels     = new NetworkElement((m_element as Network).Model.VoltageLevels);
         NetworkElement statusWords       = new NetworkElement((m_element as Network).Model.StatusWords);
         NetworkElement breakerStatuses   = new NetworkElement((m_element as Network).Model.BreakerStatuses);
         NetworkElement tapConfigurations = new NetworkElement((m_element as Network).Model.TapConfigurations);
         return(new List <NetworkElement>(new NetworkElement[] { networkModel, voltageLevels, statusWords, breakerStatuses, tapConfigurations }));
     }
     else if (m_element is NetworkModel)
     {
         return((from child in (m_element as NetworkModel).Companies select new NetworkElement(child)).ToList <NetworkElement>());
     }
     else if (m_element is Company)
     {
         return((from child in (m_element as Company).Divisions select new NetworkElement(child)).ToList <NetworkElement>());
     }
     else if (m_element is Division)
     {
         NetworkElement substations       = new NetworkElement((m_element as Division).Substations);
         NetworkElement transmissionLines = new NetworkElement((m_element as Division).TransmissionLines);
         return(new List <NetworkElement>(new NetworkElement[] { substations, transmissionLines }));
     }
     else if (m_element is List <Substation> )
     {
         return(new List <NetworkElement>((from child in (m_element as List <Substation>)select new NetworkElement(child)).ToList <NetworkElement>()));
     }
     else if (m_element is Substation)
     {
         NetworkElement nodes           = new NetworkElement((m_element as Substation).Nodes);
         NetworkElement shunts          = new NetworkElement((m_element as Substation).Shunts);
         NetworkElement circuitBreakers = new NetworkElement((m_element as Substation).CircuitBreakers);
         NetworkElement switches        = new NetworkElement((m_element as Substation).Switches);
         NetworkElement transformers    = new NetworkElement((m_element as Substation).Transformers);
         return(new List <NetworkElement>(new NetworkElement[] { nodes, shunts, circuitBreakers, switches, transformers }));
     }
     else if (m_element is List <TransmissionLine> )
     {
         return(new List <NetworkElement>((from child in (m_element as List <TransmissionLine>)select new NetworkElement(child)).ToList <NetworkElement>()));
     }
     else if (m_element is TransmissionLine)
     {
         NetworkElement nodes                 = new NetworkElement((m_element as TransmissionLine).Nodes);
         NetworkElement lineSegments          = new NetworkElement((m_element as TransmissionLine).LineSegments);
         NetworkElement seriesCompensators    = new NetworkElement((m_element as TransmissionLine).SeriesCompensators);
         NetworkElement switches              = new NetworkElement((m_element as TransmissionLine).Switches);
         NetworkElement fromSubstationCurrent = new NetworkElement((m_element as TransmissionLine).FromSubstationCurrent);
         NetworkElement toSubstationCurrent   = new NetworkElement((m_element as TransmissionLine).ToSubstationCurrent);
         return(new List <NetworkElement>(new NetworkElement[] { nodes, lineSegments, seriesCompensators, switches, fromSubstationCurrent, toSubstationCurrent }));
     }
     else if (m_element is List <Node> )
     {
         return(new List <NetworkElement>((from child in (m_element as List <Node>)select new NetworkElement(child)).ToList <NetworkElement>()));
     }
     else if (m_element is Node)
     {
         NetworkElement voltage = new NetworkElement((m_element as Node).Voltage);
         return(new List <NetworkElement>(new NetworkElement[] { voltage }));
     }
     else if (m_element is List <Transformer> )
     {
         return(new List <NetworkElement>((from child in (m_element as List <Transformer>)select new NetworkElement(child)).ToList <NetworkElement>()));
     }
     else if (m_element is Transformer)
     {
         NetworkElement fromNodeCurrent = new NetworkElement((m_element as Transformer).FromNodeCurrent);
         NetworkElement toNodeCurrent   = new NetworkElement((m_element as Transformer).ToNodeCurrent);
         return(new List <NetworkElement>(new NetworkElement[] { fromNodeCurrent, toNodeCurrent }));
     }
     else if (m_element is List <ShuntCompensator> )
     {
         return(new List <NetworkElement>((from child in (m_element as List <ShuntCompensator>)select new NetworkElement(child)).ToList <NetworkElement>()));
     }
     else if (m_element is ShuntCompensator)
     {
         NetworkElement current = new NetworkElement((m_element as ShuntCompensator).Current);
         return(new List <NetworkElement>(new NetworkElement[] { current }));
     }
     else if (m_element is List <Switch> )
     {
         return(new List <NetworkElement>((from child in (m_element as List <Switch>)select new NetworkElement(child)).ToList <NetworkElement>()));
     }
     else if (m_element is List <Transformer> )
     {
         return(new List <NetworkElement>((from child in (m_element as List <Transformer>)select new NetworkElement(child)).ToList <NetworkElement>()));
     }
     else if (m_element is List <SeriesCompensator> )
     {
         return(new List <NetworkElement>((from child in (m_element as List <SeriesCompensator>)select new NetworkElement(child)).ToList <NetworkElement>()));
     }
     else if (m_element is List <LineSegment> )
     {
         return(new List <NetworkElement>((from child in (m_element as List <LineSegment>)select new NetworkElement(child)).ToList <NetworkElement>()));
     }
     else if (m_element is List <CircuitBreaker> )
     {
         return(new List <NetworkElement>((from child in (m_element as List <CircuitBreaker>)select new NetworkElement(child)).ToList <NetworkElement>()));
     }
     else if (m_element is List <VoltageLevel> )
     {
         return(new List <NetworkElement>((from child in (m_element as List <VoltageLevel>)select new NetworkElement(child)).ToList <NetworkElement>()));
     }
     else if (m_element is List <StatusWord> )
     {
         return(new List <NetworkElement>((from child in (m_element as List <StatusWord>)select new NetworkElement(child)).ToList <NetworkElement>()));
     }
     else if (m_element is List <BreakerStatus> )
     {
         return(new List <NetworkElement>((from child in (m_element as List <BreakerStatus>)select new NetworkElement(child)).ToList <NetworkElement>()));
     }
     else if (m_element is List <TapConfiguration> )
     {
         return(new List <NetworkElement>((from child in (m_element as List <TapConfiguration>)select new NetworkElement(child)).ToList <NetworkElement>()));
     }
     else
     {
         return(null);
     }
 }