public void Setup()
        {
            Mapper.Initialize(MapperInitializer.InitializeMapper);

            _networkInfoRetriever = new NetworkInfoRetriever();

            _network = new Network();

            var nodes = new[]
            {
                new Node
                {
                    Id                   = 0,
                    LinkedNodesId        = new SortedSet <uint>(new uint[] { 1 }),
                    MessageQueueHandlers = new List <MessageQueueHandler>()
                },
                new Node
                {
                    Id                   = 1,
                    LinkedNodesId        = new SortedSet <uint>(new uint[] { 0 }),
                    MessageQueueHandlers = new List <MessageQueueHandler>()
                }
            };

            foreach (var node in nodes)
            {
                _network.AddNode(node);
            }

            var channels = new[]
            {
                new Channel
                {
                    Id             = Guid.Empty,
                    ConnectionType = ConnectionType.Duplex,
                    ChannelType    = ChannelType.Ground,
                    ErrorChance    = 0.5,
                    SecondNodeId   = 0,
                    FirstNodeId    = 1,
                    Price          = 20,
                    Capacity       = 20,
                }
            };

            foreach (var channel in channels)
            {
                _network.AddChannel(channel);
            }
        }
Exemplo n.º 2
0
        public MainWindow(INetworkHandler network, INetworkInfoRetriever networkInfoRetriever,
                          INetworkLocationMapRetriever networkLocationMapRetriever)
        {
            InitializeComponent();

            InitializeFiltrationModeComboBox();

            _network = network;
            _networkInfoRetriever        = networkInfoRetriever;
            _networkLocationMapRetriever = networkLocationMapRetriever;

            InitializeDrawers();
            _channelAddWindow = new ChannelAddWindow(OnChannelAddEventHandler);

            Loaded += OnWindowLoaded;
        }