示例#1
0
        public MainFormVm(MainForm mainForm, ApplicationWatcher applicationWatcher, Configuration configuration, Utilities.ConfigurationSerializer <Configuration> serializer)
        {
            _mainForm           = mainForm;
            _applicationWatcher = applicationWatcher;
            _configuration      = configuration;
            _serializer         = serializer;
            _selectedItem       = null;
            // todo load item
            _mainForm.listBoxMonitoredApplications.SelectedIndexChanged += this.ListBoxMonitoredApplicationsSelectedIndexChanged;

            _mainForm.buttonAddProcess.Click     += ButtonAddProcessClick;
            _mainForm.buttonDeleteProcess.Click  += ButtonDeleteProcessOnClick;
            _mainForm.buttonEditProcess.Click    += ButtonEditProcessClick;
            _mainForm.buttonRebootSettings.Click += ButtonRebootSettingsClick;

            foreach (var applicationHandlerConfig in configuration.ApplicationHandlers)
            {
                _mainForm.listBoxMonitoredApplications.Items.Add(applicationHandlerConfig.ApplicationName);
            }
            SelectMenuItemInList(0);
        }
示例#2
0
        static void Main(string[] args)
        {
            ///ApplicationWatcher initialization

            int monitoringInterval = 5000;

            try
            {
                monitoringInterval = Convert.ToInt32(ConfigurationManager.AppSettings["MonitoringInterval"]);

                if (monitoringInterval == 0)
                {
                    monitoringInterval = 5000;
                }
            }
            catch (Exception ex)
            {
                monitoringInterval = 5000;
                Debug.WriteLine("ApplicationWatcher Exception2: " + ex.StackTrace);
            }

            ApplicationWatcher applicationWatcher = new ApplicationWatcher("MonitoredApplication", "WatchDog", 5000);
        }
示例#3
0
 public WatchDogForm()
 {
     InitializeComponent();
     applicationWatcher = new ApplicationWatcher("FtpClient", "WatchDog", 5000);
 }
示例#4
0
 public WatchDogForm()
 {
     InitializeComponent();
     applicationWatcher = new ApplicationWatcher("MonitoredApplication", "WatchDog", 5000);
 }