private void Btn_AddNote_Click(object sender, RoutedEventArgs e) { if (TxtBx_Name.Text == "") { MissingValue("Bitte tragen Sie einen Titel ein"); } else { if (ListView_Projects.SelectedIndex != -1) { //RunSQL($"INSERT INTO Notes (title) VALUES ('{TxtBx_Name.Name}')"); Objects.MyTreeViewItem art = new Objects.MyTreeViewItem(); art.Header = TxtBx_Name.Text; art.Index = 1; Objects.MyTreeViewItem prt = new Objects.MyTreeViewItem(); prt.Header = TxtBx_Name.Text; prt.Index = 2; TreeView_Note.Items.Add(art); } else { CstmMsgBx.Error("Es wurde kein Projekt ausgewählt"); } } }
public static void RunSQL(string sql) { try { db_connect.Open(); connectionIsOpen = true; command = new SQLiteCommand(sql, db_connect); command.ExecuteNonQuery(); db_connect.Close(); } catch (SQLiteException a) { if (a.ErrorCode == 2067) { CstmMsgBx.Error("Name ist bereits vergeben"); CheckConnectionStatus(); } } catch (Exception exc) { CstmMsgBx.Error(exc.ToString()); Log.Error(Log.GetMethodName(), exc.ToString()); CheckConnectionStatus(); } }
public static void TestConnection() { try { db_connect.Open(); db_connect.Close(); CstmMsgBx.Show("Database connect successfully"); } catch (Exception exc) { CstmMsgBx.Error(exc.ToString(), 4000); } }
private void RunSQL(string SQL) { try { Database.RunSQL(SQL); TxtBx_Name.Background = Brushes.White; TxtBx_Name.Text = ""; } catch (Exception exc) { CstmMsgBx.Error(exc.ToString()); Log.Error(Log.GetMethodName(), exc.ToString()); } }
private static void OnTimeEvent(object source, EventArgs e) { try { foreach (Window window in Application.Current.Windows) { if (window.GetType() == typeof(MainWindow)) { (window as MainWindow).Snackbar_MessageBox.IsActive = false; } } Timer.Stop(); } catch (Exception exc) { CstmMsgBx.Error("A error occurred in CstmMsgBx.OnTimeEvent()"); Log.Error(Log.GetMethodName(), exc.ToString()); } }
public static void Error(string Function = "", string Message = "") { try { string filename = "log.err"; string path = GetPath(filename); string timestamp = DateTime.UtcNow.ToString("dd:MM:yyyy HH:mm:ss.fff", CultureInfo.InvariantCulture); string log = $"{Function} - {Message}\n---------------------------------------------------------------------------------------"; using (StreamWriter sw = File.AppendText(path)) Write(timestamp, log, sw); } catch { CstmMsgBx.Error("Couldn´t write to log file"); System.Threading.Thread.Sleep(5000); Application.Current.Shutdown(); } }
private void Btn_AddMeeting_Click(object sender, RoutedEventArgs e) { if (TxtBx_Name.Text == "") { MissingValue("Bitte tragen Sie einen Titel ein"); } else { if (ListView_Projects.SelectedIndex != -1) { //RunSQL($"INSERT INTO Notes (title) VALUES ('{TxtBx_Name.Name}')"); TreeView_Meetings.Items.Add(TxtBx_Name.Text); } else { CstmMsgBx.Error("Es wurde kein Projekt ausgewählt"); } } }
private void MissingValue(string message) { CstmMsgBx.Error(message); TxtBx_Name.Background = (SolidColorBrush) new BrushConverter().ConvertFromString("#ff3232"); }