Exemple #1
0
        public virtual async Task <int> Start()
        {
            settings.Load();
            foreach (var plugin in Plugins)
            {
                plugin.Attach(this);
            }
            peerCast.AddChannelMonitor(new ChannelCleaner(peerCast));
            peerCast.AddChannelMonitor(new ChannelNotifier(this));
            LoadConfigurations();
            LoadSettings();
            foreach (var plugin in Plugins)
            {
                plugin.Start();
            }
            var result = await stopTask.Task.ConfigureAwait(false);

            foreach (var plugin in Plugins.Reverse())
            {
                plugin.Stop();
            }
            SaveSettings();
            peerCast.Stop();
            foreach (var plugin in Plugins.Reverse())
            {
                plugin.Detach();
            }
            return(result);
        }
Exemple #2
0
 public void Run()
 {
     Console.CancelKeyPress += (sender, args) => {
         args.Cancel = true;
         Stop();
     };
     settings.Load();
     foreach (var plugin in Plugins)
     {
         plugin.Attach(this);
     }
     peerCast.AddChannelMonitor(new ChannelCleaner(peerCast));
     peerCast.AddChannelMonitor(new ChannelNotifier(this));
     LoadSettings();
     foreach (var plugin in Plugins)
     {
         plugin.Start();
     }
     WaitHandle.WaitAny(new WaitHandle[] { killWaitHandle, stoppedEvent });
     foreach (var plugin in Plugins)
     {
         plugin.Stop();
     }
     SaveSettings();
     peerCast.Stop();
     foreach (var plugin in Plugins)
     {
         plugin.Detach();
     }
     Logger.Close();
 }
        public void Run()
        {
            LoadSettings();
            var uis = userInterfaceFactories.Select(factory => factory.CreateUserInterface()).ToArray();

            foreach (var ui in uis)
            {
                ui.Start(this);
            }
            stoppedEvent.WaitOne();
            foreach (var ui in uis)
            {
                ui.Stop();
            }
            SaveSettings();

            peerCast.Stop();
        }