Example #1
0
        private void ExitFreya()
        {
            if (radioServer != null)
            {
                radioServer.Stop();
            }
            if (radioServer1 != null)
            {
                radioServer1.Stop();
            }

            if (m_DMSCancellationSource != null)
            {
                m_DMSCancellationSource.Cancel();
                m_DMSCancellationSource = null;
            }

            if (this != null)
            {
                this.InvokeIfRequired(() =>
                {
                    this.WindowState         = FormWindowState.Minimized;
                    this.notifyIcon1.Visible = false;
                    this.notifyIcon1.Dispose();
                    Close();
                });
            }

            //Environment.Exit(Environment.ExitCode);
            Application.Exit();
        }
Example #2
0
        /// <summary>
        /// Handle the service stop event by stopping all proxies.
        /// </summary>
        protected override void OnStop()
        {
            try
            {
                StopProxies();

                for (int n = 0; n < Workers.Length; n++)
                {
                    if (Workers[n] != null)
                    {
                        try
                        {
                            Workers[n].Enable = false;
                            Workers[n].Stop();
                            Workers[n] = null;
                        }
                        catch (Exception) { }
                    }
                }

                if (radioServer != null)
                {
                    radioServer.Stop();
                }

                logger.WriteLine("[Service] OnStop() finished. Service Stopped.");
            }
            catch (Exception ex) { logger.WriteLine("[Service] OnStop() - Stop Service Excpetion:" + ex.Message); }
        }
Example #3
0
        public override void WillTerminate(NSNotification notification)
        {
            _ipcServer?.Stop();
            _ipcServer?.Dispose();

            // Insert code here to tear down your application
            NSEvent.RemoveMonitor(_eventMonitor);
        }
Example #4
0
 public static void Stop()
 {
     if (server != null)
     {
         server.Stop();
         server = null;
     }
 }
Example #5
0
        static void Main()
        {
            Console.SetWindowSize(60, 10);
            //Settings for single instance app start
            const string appName = "admy_server";
            bool         createdNew;

            mutex = new Mutex(true, appName, out createdNew);
            if (!createdNew)
            {
                //app is already running! Exiting the application
                return;
            }
            //Settings for single instance app end

            var s = new IpcServer();

            s.Start(12345); // Passing no port selects a free port automatically.

            Console.WriteLine("Started server on port {0}, input \"quit\" to exit", s.Port);

            s.ReceivedRequest += (sender, args) =>
            {
                args.Response = args.Request;
                Console.WriteLine("I've got: " + args.Response);
                try
                {
                    Process.Start(args.Response);
                }
                catch (Exception e)
                {
                    Console.WriteLine(e.Message);
                }
                args.Handled = true;
            };

            bool   stay = true;
            string command;

            while (stay)
            {
                command = Console.ReadLine();
                if (command == "quit")
                {
                    stay = false;
                }
            }
            s.Stop();
        }
Example #6
0
        protected override void OnExit(ExitEventArgs e)
        {
            _ipcServer?.Stop();
            _ipcServer?.Dispose();

            _hotkey.Unregister();

            _explorerUpdateTimer.Change(Timeout.Infinite, Timeout.Infinite);

            var explorerHandler = TinyIoCContainer.Current.Resolve <WindowsExplorerHandler>();

            explorerHandler.CleanTitles();

            _notifyIcon.Dispose();

            base.OnExit(e);
        }
Example #7
0
        private static void Main()
        {
            var s = new IpcServer();

            s.Start(12345);

            Console.WriteLine("Started server.");

            s.ReceivedRequest += (sender, args) =>
            {
                Console.WriteLine("Received: " + args.Request);
                args.Response = "Super: " + args.Request;
                args.Handled  = true;
            };

            while (true)
            {
                Thread.Sleep(1000);
            }

            s.Stop();
        }
Example #8
0
        public static void Main(string[] args)
        {
            var server = new IpcServer("ExamplePipeName");

            server.Connected    += id => Console.WriteLine($"Connected {id}");
            server.Disconnected += id => Console.WriteLine($"Disconnected ({id})");
            server.Message      += (id, message) => Console.WriteLine($"Message Received ({id}): {message}");

            server.Connect();

            Thread.Sleep(5000);

            Console.WriteLine("Sending tests to clients");

            Thread.Sleep(1000);

            server.Send("Server 1");

            Thread.Sleep(1000);

            server.Send("Server 2");

            Thread.Sleep(1000);

            server.Send("Server 3");

            Thread.Sleep(1000);

            server.Send("Server 4");

            Thread.Sleep(1000);

            server.Stop();

            Console.WriteLine("End");
        }
Example #9
0
 private void button3_Click(object sender, EventArgs e)
 {
     s.Stop();
 }
Example #10
0
 private void StopServerBtn_OnClick(object sender, RoutedEventArgs e)
 {
     _server.Stop();
 }
Example #11
0
 void StopServer(IpcServer s)
 {
     s.Stop();
 }