void f_FileOk(object sender, CancelEventArgs e) { OpenFileDialog f = (OpenFileDialog)sender; DB_Path = f.FileName; StatusForm ef = new StatusForm(); ef.label1.Text = "Bitte warte, die Datenbank wird geladen."; ef.Show(); ef.Refresh(); try { DataContext db = new DataContext(DB_Path); db.SubmitChanges(); txtPfad.Text = DB_Path; txtPfad.Enabled = false; button1.Enabled = false; btnStartReciever.Enabled = true; btnStartWebservice.Enabled = true; RefreshTrackerList(); ef.Close(); LogManager.AddLog(DB_Path, 4, "ControllCenter.cs:f_FileOk", "DB_Path Set"); } catch (Exception ex) { ef.Close(); MessageBox.Show("Fehler beim öffnen der DB, bitte DB überprüfen " + ex.ToString() ); } }
private void ControllCenter_FormClosing(object sender, FormClosingEventArgs e) { StatusForm ef = new StatusForm(); try { LogManager.AddLog(DB_Path, 4, "ControllCenter.cs:ControllCenter_FormClosing", "Start"); ef.label1.Text = "Beenden, Bitte Warten"; ef.Show(); ef.Refresh(); try { if (GPS_Service_running) { ef.label1.Text = "Bitte Warten, Reciever-Service wird beendet"; ef.Refresh(); Service_test.Stop(); } } catch { } try { if (Service_Host_running) { ef.label1.Text = "Bitte Warten, Web-Service wird beendet"; ef.Refresh(); host.Close(); } } catch { } LogManager.AddLog(DB_Path, 4, "ControllCenter.cs:ControllCenter_FormClosing", "Successfull"); } catch (Exception ex) { LogManager.AddLog(DB_Path, 0, "ControllCenter.cs:ControllCenter_FormClosing", "Error while Closing, end remaining Threads" + ex.InnerException); MessageBox.Show("Error while Closing, end remaining Threads" + ex.InnerException); } ef.Close(); }
void fp_FileOk(object sender, CancelEventArgs e) { LogManager.AddLog(DB_Path, 4, "ControllCenter.cs:fp_FileOk", "Start"); OpenFileDialog f = (OpenFileDialog)sender; String DxfFilePath = f.FileName; StatusForm ef = new StatusForm(); ef.label1.Text = "Bitte warte, Penaltyzonen werden geladen."; ef.Show(); ef.Refresh(); try { ImportPenaltyZones.importFromDxf(DxfFilePath, DB_Path); DatabaseDataContext dataContext = new DatabaseDataContext(DB_Path); int count = dataContext.t_Polygons.Count(); lblPenaltyZonenLoaded.Text = count.ToString() + " Penalty Zonen geladen"; ef.Close(); LogManager.AddLog(DB_Path, 4, "ControllCenter.cs:fp_FileOk", "Ende"); } catch (Exception ex) { LogManager.AddLog(DB_Path,0, "ControllCenter.cs:fp_FileOk:Error", ex.ToString()); ef.Close(); MessageBox.Show("Fehler beim laden der Penalty-Zonen"); } }
private void btnStartWebservice_Click(object sender, EventArgs e) { StatusForm ef = new StatusForm(); try { LogManager.AddLog(DB_Path, 4, "ControllCenter.cs:btnStartWebservice_Click", "Start"); ef.label1.Text = "Bitte Warten, der Webservice wird gestartet"; ef.Show(); ef.Refresh(); ANRLDataService ds = new ANRLDataService(DB_Path); host = new ServiceHost(ds, new Uri("http://92.51.137.17:5555")); host.Open(); lblStatusWebservice.Text = "Started"; Service_Host_running = true; btnStartWebservice.Enabled = false; LogManager.AddLog(DB_Path, 4, "ControllCenter.cs:btnStartWebservice_Click", "Successfull"); } catch (Exception ex) { LogManager.AddLog(DB_Path, 0, "ControllCenter.cs:btnStartWebservice_Click", "Fehler beim Starten des Webservices " + ex.ToString()); MessageBox.Show("Fehler beim Starten des Webservices "+ ex.ToString()); } ef.Close(); }