Пример #1
0
 public InputDialog(DesignerItemViewModelBase component, string titleText)
 {
     Title = titleText;
     _component = component;
     InitializeComponent();
 }
 private FullyCreatedConnectorInfo GetFullConnectorInfo(int connectorId, DesignerItemViewModelBase dataItem, ConnectorOrientation connectorOrientation)
 {
     switch(connectorOrientation)
     {
         case ConnectorOrientation.Top:
             return dataItem.TopConnector;
         case ConnectorOrientation.Left:
             return dataItem.LeftConnector;
         case ConnectorOrientation.Right:
             return dataItem.RightConnector;
         case ConnectorOrientation.Bottom:
             return dataItem.BottomConnector;
         default:
             throw new InvalidOperationException($"Found invalid persisted Connector Orientation for Connector Id: {connectorId}");
     }
 }
        private Type GetTypeOfDiagramItem(DesignerItemViewModelBase vmType)
        {
            if (vmType is BatteryViewModel)
                return typeof(BatteryDesignerItem);
            if (vmType is ResistorViewModel)
                return typeof(ResistorDesignerItem);
            if (vmType is LightBulbViewModel)
                return typeof(LightBulbDesignerItem);
            if (vmType is SwitchViewModel)
                return typeof(SwitchDesignerItem);
            if (vmType is VoltmeterViewModel)
                return typeof(VoltmeterDesignerItem);
            if (vmType is AmmeterViewModel)
                return typeof(AmmeterDesignerItem);

            throw new InvalidOperationException("Unknown diagram type.");
        }
 public FullyCreatedConnectorInfo(DesignerItemViewModelBase dataItem, ConnectorOrientation orientation)
     : base(orientation)
 {
     DataItem = dataItem;
 }