Ejemplo n.º 1
0
        public void Run(string name)
        {
            _name       = name;
            _dispatcher = Dispatcher.CurrentDispatcher;

            using (_log = CreateLog())
            {
                try
                {
                    _log.Info("PluginHost running at " + IntPtr.Size * 8 + " bit, CLR version " + Environment.Version);
                    new AssemblyResolver().Setup();
                    AppDomain.CurrentDomain.UnhandledException += OnUnhandledException;
                    IpcServices.RegisterChannel(name);
                    RegisterObject();
                    SignalReady();
                    Dispatcher.Run();
                }
                catch (Exception ex)
                {
                    ReportFatalError(ex);
                }

                Thread.Sleep(100); // allow any pending remoting operations to finish
                _log.Debug("Shutdown complete");
            }
        }
Ejemplo n.º 2
0
        public IRemotePlugin LoadPlugin(IWpfHost host, PluginStartupInfo startupInfo)
        {
            _host = host;

            _log.Info(String.Format("LoadPlugin('{0}','{1}')", startupInfo.AssemblyName, startupInfo.MainClass));

            new ProcessMonitor(Dispose).Start(_host.HostProcessId);

            Func <PluginStartupInfo, object> createOnUiThread = LoadPluginOnUiThread;
            var result = _dispatcher.Invoke(createOnUiThread, startupInfo);

            _log.Debug("Returning plugin object to host");

            if (result is Exception)
            {
                _log.Error("Error loading plugin", (Exception)result);
                throw new TargetInvocationException((Exception)result);
            }
            return((IRemotePlugin)result);
        }
        protected override void OnStop()
        {
            try
            {
                LocalLog.Info("Stopping RantaLogService。");

                host.Close();

                LocalLog.Info("RantaLogService stopped.");
            }
            catch (Exception ex)
            {
                LocalLog.Error(ex.ToString());
            }
        }
Ejemplo n.º 4
0
        protected override void OnStop()
        {
            try
            {
                LocalLog.Info("Stopping MessageProcessor.");

                processor.Stop();

                LocalLog.Info("MessageProcessor stopped.");
            }
            catch (Exception ex)
            {
                LocalLog.Error(ex.ToString());
            }
        }
        protected override void OnStart(string[] args)
        {
            try
            {
                LocalLog.Info("Starting RantaLogService.");

                host = new ServiceHost(typeof(LogService));

                host.Open();

                LocalLog.Info("RantaLogService Started.");
            }
            catch (Exception ex)
            {
                LocalLog.Error(ex.ToString());
            }
        }
Ejemplo n.º 6
0
        protected override void OnStart(string[] args)
        {
            try
            {
                LocalLog.Info("Starting MessageProcessor.");

                processor = new MessageProcessor();

                processor.Start();

                LocalLog.Info("MessageProcessor started.");
            }
            catch (Exception ex)
            {
                LocalLog.Error(ex.ToString());
            }
        }