public TrayContext() { singleton = Singleton.Instance; this.MenuItems.Add(new MenuItem("Show main window", showMainWindow)); this.MenuItems.Add(new MenuItem("Start server", startServer)); this.MenuItems.Add(new MenuItem("Stop server", stopServer)); this.MenuItems.Add(new MenuItem("Exit", exitApp)); }
public Client(TcpClient client) { singleton = Singleton.Instance; singleton.stopSockets += closeSocket; formatter = new MessageFormatter(); this.client = client; logIt(); clientStream = client.GetStream(); adapter = new DbAdapter(); }
public Server(IPEndPoint ipEndPoint) : base(ipEndPoint) { singleton = Singleton.Instance; singleton.serverStop += closeEverything; singleton.log("Server started.\nServer ip: " + ipEndPoint.Address.ToString() + "\nServer port: " + ipEndPoint.Port.ToString()); threads = new List<Thread>(); this.Start(); listenThread = new Thread(new ThreadStart(listen)); listenThread.Start(); }
public DbAdapter() { singleton = Singleton.Instance; connString = "DRIVER={" + singleton.dbSettings.Driver + "};" + "SERVER=" + singleton.dbSettings.Host + ";" + "DATABASE=" + singleton.dbSettings.Schema + ";" + "UID=" + singleton.dbSettings.Username + ";" + "PASSWORD="******";" + "OPTION=" + singleton.dbSettings.Option + ";"; conn = new OdbcConnection(connString); conn.Open(); }
public MainWindow() { InitializeComponent(); this.Icon = new Icon("Icon1.ico"); singleton = Singleton.Instance; singleton.log += appendLog; singleton.serverStart += startServer; ServerSwitch.Click += switchServer; tray = new NotifyIcon(); tray.Icon = new Icon("Icon1.ico"); tray.Visible = true; tray.MouseClick += trayClicked; tray.ContextMenu = new TrayContext(); singleton.mainWindowVisibilityChanged += toggleMainWindow; Application.ApplicationExit += appExit; loadServerConfig(); loadDatabaseConfig(); singleton.serverStart(); }