private void DeleteButton_Click(object sender, RoutedEventArgs e)
        {
            if (this.eventLogsGrid.SelectedItem == null)
            {
                return;
            }

            if (MessageBox.Show("Do you want to delete selected filter?", "Delete filter", MessageBoxButton.YesNo, MessageBoxImage.Question, MessageBoxResult.No) == MessageBoxResult.Yes)
            {
                EventLogDescription c = (EventLogDescription)this.eventLogsGrid.SelectedItem;
                this.Logs.Remove(c);
                this.eventLogsGrid.SelectedItem = this.Logs.FirstOrDefault();
            }
        }
        private void AddButton_Click(object sender, RoutedEventArgs e)
        {
            EventLogEditor      w = new EventLogEditor();
            EventLogEditorModel m = new EventLogEditorModel();

            w.ViewModel = m;

            if (w.ShowDialog() == true)
            {
                EventLogDescription nel = w.ViewModel.GetEventLog();
                this.Logs.Add(nel);
                this.eventLogsGrid.SelectedItem = nel;
            }
        }
Esempio n. 3
0
        public EventLogDescription GetEventLog()
        {
            EventLogDescription ed = new EventLogDescription();

            ed.EventLogName = this.SelectedLog;
            ed.LogSources   = this.SelectedLogSources;
            ed.Keywords     = this.Keywords;
            ed.EventIds     = this.EventIds;

            ed.IsCritical    = this.IsCritical;
            ed.IsError       = this.IsError;
            ed.IsWarning     = this.IsWarning;
            ed.IsInformation = this.IsInformation;
            ed.IsVerbose     = this.IsVerbose;

            ed.NagiosServiceName        = this.NagiosServiceName;
            ed.MessageLevel             = this.Level;
            ed.NagiosServiceDescription = this.NagiosServiceDescription;
            ed.MessageLevel             = this.IsLevelCritical ? Nagios.Net.Client.Nsca.Level.Critical : (this.IsLevelWarning ? Nagios.Net.Client.Nsca.Level.Warning : Nagios.Net.Client.Nsca.Level.OK);
            return(ed);
        }
Esempio n. 4
0
        public void SetEventLog(EventLogDescription val)
        {
            SelectedLog = val.EventLogName;

            this.SelectedLogSources = val.LogSources;
            this.Keywords           = val.Keywords;
            this.EventIds           = val.EventIds;

            this.IsCritical    = val.IsCritical;
            this.IsError       = val.IsError;
            this.IsWarning     = val.IsWarning;
            this.IsInformation = val.IsInformation;
            this.IsVerbose     = val.IsVerbose;

            this.NagiosServiceName        = val.NagiosServiceName;
            this.Level                    = val.MessageLevel;
            this.NagiosServiceDescription = val.NagiosServiceDescription;

            this.IsLevelCritical = val.MessageLevel == Nagios.Net.Client.Nsca.Level.Critical;
            this.IsLevelWarning  = val.MessageLevel == Nagios.Net.Client.Nsca.Level.Warning;
            this.IsLevelOk       = val.MessageLevel == Nagios.Net.Client.Nsca.Level.OK;
        }
        private void EditButton_Click(object sender, RoutedEventArgs e)
        {
            if (this.eventLogsGrid.SelectedItem == null)
            {
                return;
            }

            EventLogEditor      w = new EventLogEditor();
            EventLogEditorModel m = new EventLogEditorModel();

            w.ViewModel = m;

            EventLogDescription c = (EventLogDescription)this.eventLogsGrid.SelectedItem;

            w.ViewModel.SetEventLog(c);

            if (w.ShowDialog() == true)
            {
                EventLogDescription nc = w.ViewModel.GetEventLog();
                this.Logs.Remove(c);
                this.Logs.Add(nc);
                this.eventLogsGrid.SelectedItem = nc;
            }
        }