static void Main(string[] args) { SetupContainer(); EnsureResourcesExists(); var consumerFactory = new ConsumerFactory(ConnectionString, DependencyResolver); var consumerProperties1 = ConsumerProperties.ForMultipleConsumers(TopicPath, SubscName, 2); var consumer1 = consumerFactory.CreateConsumer <CustomService1, CustomMessage>(consumerProperties1); consumer1.Start(); Console.WriteLine("Press any key to stop the app..."); Console.Read(); consumer1.Stop(); }
private void PlaceConsumer(Consumer consumer, double offset, int y, double cellWidth) { ConsumerUserControl consumerControl = new ConsumerUserControl(); double var = 80 * cellWidth / 100; if (var > startHeight) { currentHeight = startHeight; } else { currentHeight = var; } if (properties.TryGetValue(consumer.ElementGID, out ElementProperties elementProperties)) { ConsumerProperties consumerProperties = elementProperties as ConsumerProperties; consumerControl.DataContext = consumerProperties; consumerProperties.ScadaCornerRadius = 2 * currentHeight / 6; consumerProperties.ScadaSize = 2 * currentHeight / 3; consumerProperties.FontSize = 90 * consumerProperties.ScadaSize / 100; consumerProperties.ScadaTop = -(2 * currentHeight / 3 / 3); consumerProperties.ScadaLeft = -(2 * currentHeight / 3 / 3); } consumerControl.Button.Width = currentHeight; consumerControl.Button.Height = currentHeight; Canvas.SetLeft(consumerControl, offset + cellWidth / 2 - currentHeight / 2); Canvas.SetTop(consumerControl, y * cellHeight - cellHeight / 5 - currentHeight / 2); Panel.SetZIndex(consumerControl, 5); consumerControl.Button.Command = NetworkViewViewModel.OpenPropertiesCommand; consumerControl.Button.CommandParameter = consumer.ElementGID; consumerControl.ToolTip = consumer.MRID; result.Add(consumerControl); }
public override IBuilder UseConsumerProperties(ConsumerProperties properties) { ApplyParameters(properties); return(this); }
public abstract IBuilder UseConsumerProperties(ConsumerProperties properties);
public override IBuilder UseConsumerProperties(ConsumerProperties properties) { return(this); }
public Dictionary <long, ElementProperties> InitElementProperties(List <Element> elements) { if (elements != null) { foreach (Element element in elements) { if (element is Switch) { Switch @switch = (Switch)element; SwitchProperties switchProperties = new SwitchProperties() { GID = @switch.ElementGID, IsEnergized = @switch.IsEnergized, IsUnderScada = @switch.UnderSCADA, Incident = @switch.Incident, CanCommand = @switch.CanCommand, ParentGid = @switch.End1 }; properties.Add(switchProperties.GID, switchProperties); } else if (element is Consumer) { Consumer consumer = (Consumer)element; ConsumerProperties consumerProperties = new ConsumerProperties() { GID = consumer.ElementGID, IsEnergized = consumer.IsEnergized, IsUnderScada = consumer.UnderSCADA, Call = false }; properties.Add(consumerProperties.GID, consumerProperties); } else if (element is Source) { Source source = (Source)element; SourceProperties sourceProperties = new SourceProperties() { GID = source.ElementGID, IsEnergized = source.IsEnergized, IsUnderScada = source.UnderSCADA }; properties.Add(sourceProperties.GID, sourceProperties); } else if (element is ACLine) { ACLine acLine = (ACLine)element; ACLineProperties acLineProperties = new ACLineProperties() { GID = acLine.ElementGID, IsEnergized = acLine.IsEnergized, IsUnderScada = acLine.UnderSCADA }; properties.Add(acLineProperties.GID, acLineProperties); } else if (element is Node) { Node node = (Node)element; NodeProperties nodeProperties = new NodeProperties() { GID = node.ElementGID, IsEnergized = node.IsEnergized }; properties.Add(nodeProperties.GID, nodeProperties); } } } foreach (Model.Properties.DMSProperties.ElementProperties property in properties.Values) { if (property is SwitchProperties) { properties.TryGetValue(((SwitchProperties)property).ParentGid, out ElementProperties elementProperties); if (elementProperties != null) { ((SwitchProperties)property).Parent = elementProperties; } } } return(properties); }