Esempio n. 1
0
 void StartServer()
 {
     System.Diagnostics.Process.GetCurrentProcess().PriorityClass = System.Diagnostics.ProcessPriorityClass.High;
     Console.WriteLine("[FORM] Starting Server");
     _newServer.OnMessageReceived += HandleOnMessageReceived;
     _newServer.StartServer();
 }
Esempio n. 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);
            };
        }