public NetworkingServer(MainWindow mainWindowClass, encryption encryptionClass) { sendCommandsServerClass = new sendCommandsServer(this, mainWindowClass); this.mainWindowClass = mainWindowClass; this.encryptionClass = encryptionClass; }
public NetworkingClient(MainWindow mainWindowClass, encryption encryptionClass) { receiveCommandsClientClass = new receiveCommandsClient(this, mainWindowClass); this.mainWindowClass = mainWindowClass; this.encryptionClass = encryptionClass; }
public MainWindow() { InitializeComponent(); try { ((Control)this.taskManagerTab).IsEnabled = false; ((Control)this.commandsTab).IsEnabled = false; encryptionClass = new encryption(this); networkingClientClass = new NetworkingClient(this, encryptionClass); networkingServerClass = new NetworkingServer(this, encryptionClass); string[] settings = System.IO.File.ReadAllLines(System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "computerMonitorSettings.txt")); foreach (string line in settings) { string stringSave = line.Substring(0, line.IndexOf("=")); switch (stringSave) { case "home_ip": homeIp = line.Substring(line.IndexOf("=") + 1); break; case "home_port": homePort = line.Substring(line.IndexOf("=") + 1); break; case "home_password": homePassword = line.Substring(line.IndexOf("=") + 1); break; case "home_set": homeSet = line.Substring(line.IndexOf("=") + 1); break; case "last_ip": ipToConnect = line.Substring(line.IndexOf("=") + 1); break; case "last_port": portToConnect = Int32.Parse(line.Substring(line.IndexOf("=") + 1)); break; case "last_password": passwordToConnect = line.Substring(line.IndexOf("=") + 1); break; case "saveFolder": saveFolder = line.Substring(line.IndexOf("=") + 1); break; case "serverPort": serverPort = Int32.Parse(line.Substring(line.IndexOf("=") + 1)); break; case "serverPassword": serverPassword = line.Substring(line.IndexOf("=") + 1); break; case "startup": { string aux = line.Substring(line.IndexOf("=") + 1); if (aux == "True") { serverBootUp = true; } else { serverBootUp = false; } }; break; } } } catch (Exception) { Thread newUserMessage = new Thread(newUser); newUserMessage.Start(); } if (serverBootUp == true) { keepServerOnAfterClient = true; startServer(); } connectPage1Class = new connectPage1(this, false, false); connectWindow.Navigate(connectPage1Class); }