private void Bind() { IdpeKey key = new Manager().GetKey(IdpeKeyTypes.GlobalEventsOnComplete); if (key != null) { s.GlobalEventsOnCompletes gecs = new s.GlobalEventsOnCompletes(key.Value); listView.Columns.Clear(); listView.Columns.Add("Events"); listView.Columns[0].Width = listView.Width - 10; listView.Items.Clear(); foreach (s.GlobalEventsOnComplete gec in gecs) { ListViewItem item = new ListViewItem(gec.Name); item.Tag = gec; listView.Items.Add(item); } } if (listView.Items.Count > 0) { BindOne(listView.Items[0].Tag); } }
public void RefreshGlobalEvents() { IdpeKey key = new Manager().GetKey(IdpeKeyTypes.GlobalEventsOnComplete); if (key != null) { GlobalEventsOnCompletes = new GlobalEventsOnCompletes(key.Value); } else { GlobalEventsOnCompletes = new GlobalEventsOnCompletes(string.Empty); } GlobalEventsOnCompletes.StartWatching(); }
private void Timer_Interval(object source, ElapsedEventArgs e) { if (this.LocalFileWatcher == null) { ExtensionMethods.TraceInformation("Local file watcher died. Restarting it"); new Idpe().StartPullers(); } if ((this.Pullers != null) && (this.Pullers._LocalFileSystemWatcher != null)) { this.Pullers._LocalFileSystemWatcher.HandleExistingFiles(); } ExecuteFtpWatchers(); if (this.LocalFileWatcher.EnableRaisingEvents == false) { this.LocalFileWatcher.EnableRaisingEvents = true; } ExtensionMethods.TraceInformation("T [{0}]", this.LocalFileWatcher.EnableRaisingEvents); Trace.Flush(); MidnightSwiffer(); if (_Entries.Count == 0) { return; } List <string> removeEntries = new List <string>(); foreach (string processId in this._Entries.Keys) { Job thisJob = this._Entries[processId] as Job; if (thisJob != null) { if ((thisJob.IsFinished != true) && (thisJob.StartedAt.AddMinutes(IdpeConfigurationSection.CurrentConfig.TimeOut) < DateTime.Now)) { ExtensionMethods.TraceInformation("Job '{0}' is timed out / expired, sending abort signal to the job. Time out was set to {1} minutes.", processId, IdpeConfigurationSection.CurrentConfig.TimeOut); lock (_lock) { thisJob.AbortRequested = true; thisJob.AbortReason = Job.AbortReasons.TimedOut; } //removeEntries.Add(processId); } else if ((thisJob.IsFinished == true) && (thisJob.KeepInMemoryUntilTimeOut)) { ExtensionMethods.TraceInformation("Job '{0}' is finished, but waiting for caller to retreive result.", processId); } } } if (removeEntries.Count > 0) { ExtensionMethods.TraceInformation(string.Format("Removing {0} expired jobs from Registry.", removeEntries.Count)); } lock (_lock) { foreach (string processId in removeEntries) { ExtensionMethods.TraceInformation(string.Format("Removing '{0}'.", processId)); Job theJob = this._Entries[processId] as Job; this._Entries.Remove(processId); theJob.Dispose(); theJob = null; } } GlobalEventsOnCompletes.Tick(); Trace.Flush(); }