Exemplo n.º 1
0
        public void Test()
        {
            var hub = new NotificationHub();
            hub.Initialise(new AgentInfo());

            Messenger.Publish(NotificationRequest.For("FailureOnly",
                                                      HealthCheckData.For(new PluginDescriptor
                                                                              {
                                                                                  Name = "Test"
                                                                              }, "Test").Failed()));
        }
Exemplo n.º 2
0
        public void Test()
        {
            var hub = new NotificationHub();

            hub.Initialise(new AgentInfo());

            Messenger.Publish(NotificationRequest.For("FailureOnly",
                                                      HealthCheckData.For(new PluginDescriptor
            {
                Name = "Test"
            }, "Test").Failed()));
        }
Exemplo n.º 3
0
        public IRolePlugin Start()
        {
            var agentConfig = new AgentConfiguration
            {
                AgentId = "TestAgent"
            };

            Container.Initialise();
            Messenger.Initialise(new MagnumMessenger());
            Messenger.InterceptBefore <NotificationEvent>(msg => NotificationEvents.Add(msg));
            Messenger.InterceptBefore <NotificationRequest>(msg => NotificationRequests.Add(msg));
            NotificationHub.Initialise(new DefaultNotificationHub(agentConfig, _notificationFilters));

            RunStartupPlugins();

            _customPluginActions.ForEach(a => a(this));

            _role = new Agent.Roles.Agent(agentConfig,
                                          _publisherLoader,
                                          _checkLoader,
                                          _activityLoader);
            _role.Start();
            return(_role);
        }
Exemplo n.º 4
0
        public MainWindow()
        {
            InitializeComponent();

            AppDomain.CurrentDomain.UnhandledException += (s, e) =>
            {
                string msg = null;
                try
                {
                    msg = e.ExceptionObject.ToString();
                }
                catch (Exception ex)
                {
                    msg = "Couldn't get exception details: " + ex.Message;
                }

                try
                {
                    MessageBox.Show(msg);
                }
                catch
                {
                    Debugger.Launch();
                    Debugger.Break();
                }
            };
            App.Current.DispatcherUnhandledException += (s, e) =>
            {
                string msg = null;
                try
                {
                    msg = e.Exception.ToString();
                }
                catch (Exception ex)
                {
                    msg = "Couldn't get exception details: " + ex.Message;
                }

                try
                {
                    MessageBox.Show(msg);
                }
                catch
                {
                    Debugger.Launch();
                    Debugger.Break();
                }
            };

            Services             = new ObservableCollection <Role>();
            CollectionViewSource = new ListCollectionViewEx(Services);


            foreach (var h in App.Configuration.Roles)
            {
                var r = new Role(h);
                Services.Add(r);
                r.RolePanic       += OnRolePanicking;
                r.PropertyChanged += (s, e) =>
                {
                    if (e.PropertyName == "Status")
                    {
                        CollectionViewSource.Refresh();
                    }
                };
            }

            CollectionViewSource.Filter += CollectionViewSource_Filter;

            DataContext = this;

            var autos = Services.Where(x => x.Status == RoleStatus.Sequenced).ToArray();

            BeginAutoStart(autos);

            Loaded += (s, a) =>
            {
                NotificationHub.Initialise(this);
            };
        }