示例#1
0
        public Form1()
        {
            InitializeComponent();
            _newServer = new ConnectivityServer(false);
            _newServer.OnClientAskForConnection += _newServer_OnClientAskForConnection;
            _newServer.ClientConnected          += _newServer_ClientConnected;
            _newServer.ClientDisconnected       += _newServer_ClientDisconnected;
            StartServer();
            statusLbl.Text       = "Server Started";
            _numClientsConn.Text = "0";
            _secondsTimer        = new System.Windows.Forms.Timer();
            _inputemulated       = new InputSimulator();

            _input = new Input();

            // Be sure to set your keyboard filter to be able to capture key presses and simulate key presses
            // KeyboardFilterMode.All captures all events; 'Down' only captures presses for non-special keys; 'Up' only captures releases for non-special keys; 'E0' and 'E1' capture presses/releases for special keys
            _input.KeyboardFilterMode = KeyboardFilterMode.All;
            // You can set a MouseFilterMode as well, but you don't need to set a MouseFilterMode to simulate mouse clicks

            // Finally, load the driver
            _input.Load();
        }
示例#2
0
        // Call to load from the XIB/NIB file
        public MainWindowController() : base("MainWindow")
        {
            Initialize();

            _newServer = new ConnectivityServer(true);
            _newServer.OnClientAskForConnection += _newServer_OnClientAskForConnection;
            _newServer.ClientConnected          += _newServer_ClientConnected;
            _newServer.ClientDisconnected       += _newServer_ClientDisconnected;
            _newServer.OnMessageReceived        += HandleOnMessageReceived;
            _newServer.StartServer();

            NSStatusItem sItem = NSStatusBar.SystemStatusBar.CreateStatusItem(25);

            NSStatusBarButton statBtn = sItem.Button;

            statBtn.Image = NSImage.ImageNamed("tbar_BarIcon");

            statBtn.Activated += (sender, e) => {
                NSApplication app = NSApplication.SharedApplication;
                app.ActivateIgnoringOtherApps(true);

                this.Window.MakeKeyAndOrderFront(null);
            };
        }