public static void writeConfig() { string jsonFilepath = @"c:\temp\netcheck.json"; string databaseFilepath = SelectDatabaseFile(); string logFilepath = SelectLogFile(); if (databaseFilepath == "MISSING" || logFilepath == "MISSING") { MessageBox.Show("Error 9: Invalid file path provided."); return; } //string filepath = @"c:\temp\netcheck.json"; ConfigurationValues cv = new ConfigurationValues(); cv.TemperatureCelsius = 69; cv.DatabaseFilepath = databaseFilepath; cv.RefreshDurationinHours = 1; cv.LoggerFilepath = logFilepath; DateTime sourceTime = DateTime.Now; cv.ConfigurationDate = new DateTime(sourceTime.Year, sourceTime.Month, sourceTime.Day, sourceTime.Hour, sourceTime.Minute, 0); var options = new JsonSerializerOptions { WriteIndented = true, }; //outputs the JSON file with user friendly indentation string jsonString = JsonSerializer.Serialize(cv, options); File.WriteAllText(jsonFilepath, jsonString); JLogger.WriteGenericLogFile(System.Security.Principal.WindowsIdentity.GetCurrent().Name + "\twrote new config file"); }
public void PingButton_Click(object sender, EventArgs e) { JLogger.WriteGenericLogFile(System.Security.Principal.WindowsIdentity.GetCurrent().Name + "\tcalled ping task"); //calls the pinger() and then uppdates the table with refreshTable() Thread t = new Thread(() => pinger()); t.Start(); refreshTable(); }
private void Button_Click_4(object sender, RoutedEventArgs e) { try { Process.Start("mstsc", "/v:" + hosts[dgSimple.SelectedIndex].hostname); JLogger.WriteGenericLogFile(System.Security.Principal.WindowsIdentity.GetCurrent().Name + "\tlaunched mstsc onto " + hosts[dgSimple.SelectedIndex].hostname); //opens a new MSTSC window going to the server row selected } catch { MessageBox.Show("Error 5: No host selected in the table."); } }
public JNetcheckerWindow() { InitializeComponent(); refreshTable(); JLogger.WriteGenericLogFile(System.Security.Principal.WindowsIdentity.GetCurrent().Name + "\tlaunched application"); }
private void InitilizeDatabaseButtonClick(object sender, RoutedEventArgs e) { JLogger.WriteGenericLogFile(System.Security.Principal.WindowsIdentity.GetCurrent().Name + "\tdeleted and reinitilized database"); DataAccess.InitializeDatabase(this); //delete. recreate database refreshTable(); }