public static void StartMoniteringAtLocation(string location) { P99LogMonitor.StopMonitering(); P99LogMonitor.instance = new P99LogMonitor(); MonitorLocation(location); FileReadingThread(); P99LogMonitor.instance.logMonitorThread.Start(); }
private void settingsToolStripMenuItem_Click(object sender, EventArgs e) { SettingsForm settingDlg = new SettingsForm(); settingDlg.ShowDialog(); P99LogMonitor.StopMonitering(); logMonitorStatus.Text = "Moniter Status: Watching " + Properties.Settings.Default.LogFolder + "."; P99LogMonitor.StartMoniteringAtLocation(Properties.Settings.Default.LogFolder); }
// Clean up singleton instance. public static void StopMonitering() { // Don't buffer cleaning up if there isn't an instance. if (P99LogMonitor.instance == null) { return; } P99LogMonitor.instance.monitoring = false; P99LogMonitor.instance.stopWatching = true; P99LogMonitor.instance.mResetEvent.Set(); if (P99LogMonitor.instance.logMonitorThread != null) { P99LogMonitor.instance.logMonitorThread.Join(); } P99LogMonitor.instance = null; //OnNewLineCaptured = null; //OnNewFileCaptured = null; }
protected override void OnShown(EventArgs e) { base.OnShown(e); P99LogMonitor.OnNewFileCaptured += P99LogMonitor_OnNewFileCaptured; P99LogMonitor.OnNewLineCaptured += P99LogMonitor_OnNewLineCaptured; PlayerManagement.OnLocationChanged += PlayerManagement_OnLocationChanged; PlayerManagement.OnPlayerAadded += PlayerManagement_OnPlayerAadded; PlayerManagement.OnPlayerRemoved += PlayerManagement_OnPlayerRemoved; Map aMap = (Map)mapTabs.TabPages["youTab"].Controls["zoneMap"]; aMap.OnDraw += AMap_OnDraw; if ((Properties.Settings.Default.LogFolder == "c:\\") || (Properties.Settings.Default.LogFolder == "")) { logMonitorStatus.Text = "Moniter Status: Not running. Please set a log directory to monitor."; } else { logMonitorStatus.Text = "Moniter Status: Watching " + Properties.Settings.Default.LogFolder + "."; connectionInfo.Text = Properties.Settings.Default.DefaultConnection; P99LogMonitor.StartMoniteringAtLocation(Properties.Settings.Default.LogFolder); } }
protected override void OnClosing(CancelEventArgs e) { base.OnClosing(e); P99LogMonitor.StopMonitering(); }