public MainWindow()
        {
            InitializeComponent();
            DataContext = this;

            sql = new Sql();
            gsm = new Gsm();

            Log.Write(Log.Type.General, "Programm gestartet.");

            //Tab Tabellen
            Tab_ComboBoxTables.ItemsSource = sql.GetAllTableNames(new string[] { "sqlite_sequence" });

            //Tab Personen
            Mast_ComboBox_Company.ItemsSource = sql.GetListOfCompanies();
            GetUnknownPersons();

            // Tab GSM-Modem
            Gsm_AvailableComPorts.ItemsSource = System.IO.Ports.SerialPort.GetPortNames().ToList();
            if (Gsm_AvailableComPorts.Items.Contains(Gsm.PortName))
            {
                Gsm_AvailableComPorts.SelectedValue = Gsm.PortName;
            }
            else if (Gsm_AvailableComPorts.Items.Count > 0)
            {
                Gsm_AvailableComPorts.SelectedValue = Gsm_AvailableComPorts.Items[0];
            }

            Gsm_AvailableBaudRate.SelectedIndex = Gsm_AvailableBaudRate.Items.Count - 1;

            //Gesperrte Nachrichten
            BlockedMessages = sql.GetBlockedMessages();

            // Tab Timer
            StartTimer();
            CountDownEvent += HandleCountdownEvent;
            CountDownEvent += DatabaseBackupTrigger;
            CountDownEvent += MelBox2HeartBeat;

            Timer_CurrentShifts = sql.GetCurrentShifts();
            Timer_LastMessages  = sql.GetLastMessagesForShow();
        }
Exemple #2
0
        private void Gsm_Button_RecieveDummySms_Click(object sender, RoutedEventArgs e)
        {
            ulong celphone = HelperClass.ConvertStringToPhonenumber(Gsm_TextBox_DummySmsCellphone.Text);

            if (celphone == 0)
            {
                MessageBox.Show(Gsm_TextBox_DummySmsCellphone.Text + "\r\nDie angegebene Telefonnummer ist ungültig.");
                return;
            }

            if (Gsm_TextBox_DummySmsContent.Text.Length < 3)
            {
                MessageBox.Show(Gsm_TextBox_DummySmsContent.Text + "\r\nDer Inhalt der Nachricht muss mehr als drei Zeichen haben.");
                return;
            }

            string MessageContent = Gsm_TextBox_DummySmsContent.Text;

            Message message = new Message();

            message.Cellphone       = celphone;
            message.Content         = MessageContent;
            message.Status          = "REC UNREAD";
            message.SentTime        = Sql.ConvertToUnixTime(DateTime.Now);
            message.Type            = (ushort)MessageType.RecievedFromUnknown;
            message.CustomerKeyWord = Gsm.GetKeyWords(MessageContent);

            MessageCollection mc = new MessageCollection();

            mc.Add(message);

            ProcessRecievedMessages(mc);
            GetUnknownPersons();
            Timer_LastMessages = sql.GetLastMessagesForShow();

            MessageBox.Show("Dummy-Nachricht erzeugt:\r\nvon +" + message.Cellphone + "\r\n" + message.Content);
        }