public void NewLog(string info, NetworkNodeWindow tmp) { Dispatcher.Invoke(new Action(() => { string timeNow = DateTime.Now.ToString("h:mm:ss") + "." + DateTime.Now.Millisecond.ToString(); string restLog = info; string fullLog = timeNow + " " + restLog; tmp.logBox.Document.Blocks.Add(new Paragraph(new Run(fullLog))); tmp.logBox.ScrollToEnd(); })); }
public void NewLog(string info, NetworkNodeWindow tmp2, string color) { Dispatcher.Invoke(new Action(() => { NetworkNodeWindow tmp = tmp2; string timeNow = DateTime.Now.ToString("h:mm:ss") + "." + DateTime.Now.Millisecond.ToString(); string restLog = info; string fullLog = timeNow + " " + restLog; tmp.logBox.AppendText(Environment.NewLine); ColorLog(tmp.logBox, fullLog, color); tmp.logBox.ScrollToEnd(); })); }
public MainWindow() { InitializeComponent(); this.Hide(); for (int i = 1; i <= 8; i++) { Dispatcher.Invoke(new Action(() => { NodeWindow = new NetworkNodeWindow(i); NodeWindow.Title = "Router " + i; NodeWindow.Show(); })); } }
public MyPacket RoutePacket(MyPacket packet, TablesInNode getTables, NetworkNodeWindow window) { Window = window; RoutingTables = getTables; MyPacket routedPacket = null; int tableCount = getTables.SlTable.Records.Count; int portIn = packet.Port; int modType = packet.Performance; int startingSlot = packet.Frequency; int slotNr = packet.Bandwith; int endFor = slotNr + startingSlot; for (int i = 0; i < tableCount; i++) { NewLog($"count {portIn} ::::{getTables.SlTable.Records[i].PortIn}", Window); if (portIn == getTables.SlTable.Records[i].PortIn) { NewLog($"wszedl {portIn} ::::{getTables.SlTable.Records[i].PortIn}", Window); //for (int z = startingSlot; z < endFor; z++) //{ // getTables.SlTable.SlotsTable[z] = startingSlot; //} //getTables.SlTable.Records[i].IsUsed = true; //getTables.SlTable.Records[i].ModNumber = modType; //getTables.SlTable.Records[i].FirstSlotID = startingSlot; packet.Port = getTables.SlTable.Records[i].PortOut; NewLog($"wszedl csoic ::::{getTables.SlTable.Records[i].PortOut}", Window); routedPacket = packet; break; } } NewLog($"countfsdjsj ::::{routedPacket.Port}", Window); if (routedPacket == null) { NewLog("Pakiet odrzucony, brak odpowiedniego rekordu", Window); return(null); } return(routedPacket); }
public void NewLog(string info, NetworkNodeWindow tmp) { Window.Dispatcher.Invoke(() => Window.NewLog(info, tmp)); }
public BehaviourOfPacket(NetworkNodeWindow window) { Window = window; }
public TablesInNode(NetworkNodeWindow myWindow) { Window = myWindow; SlTable = new SNPP(); }
public NetworkNode(NetworkNodeWindow myWindow) { Window = myWindow; PacketLogic = new BehaviourOfPacket(myWindow); RoutingTables = new TablesInNode(myWindow); }