示例#1
0
 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));
 }
示例#2
0
 public Client(TcpClient client)
 {
     singleton = Singleton.Instance;
     singleton.stopSockets += closeSocket;
     formatter = new MessageFormatter();
     this.client = client;
     logIt();
     clientStream = client.GetStream();
     adapter = new DbAdapter();
 }
示例#3
0
 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();
 }
示例#4
0
 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();
 }
示例#5
0
 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();
 }