Example #1
0
        static void Main()
        {
            try
            {
                #region Programm hochfahren
                //Console.BufferHeight = 1000; //Max. Zeilen in Console begrenzen
                Console.WriteLine("Progammstart. Beenden mit >Exit> - Für Hilfe: >Help<");
                Ini.ReadIni();
                Console.WriteLine($"Tägliche Abfrage um {HourOfDailyTasks} Uhr.");

                //Modem initialisieren
                Gsm.SmsSentEvent              += Gsm_SmsSentEvent;
                Gsm.SmsRecievedEvent          += Gsm_SmsRecievedEvent;
                Gsm.GsmStatusReceived         += Gsm_GsmStatusReceived;
                Gsm.SmsSentFaildEvent         += Gsm_SmsSentFaildEvent;
                Gsm.SerialPortDisposed        += Gsm_SerialPortDisposed;
                Gsm.StatusReportRecievedEvent += Gsm_StatusReportRecievedEvent;
                Gsm.ModemSetup();

                Tab_Log.Insert(Tab_Log.Topic.Startup, 3, "Programmstart");

#if DEBUG
                Gsm.Debug = 7;
                Console.WriteLine("Debug: Es wird keine Info-Email beim Programmstart versendet.");
#else
                Email.Send(new System.Net.Mail.MailAddressCollection()
                {
                    Email.Admin
                }, DateTime.Now.ToString("G") + " MelBox2 Programmstart", "Information von " + Environment.MachineName);
#endif
                Console.WriteLine("Prüfe Datenbank: " + (Sql.CheckDb() ? "ok" : "Fehler"));

                MelBoxWeb.Server.Start();
                SetHourTimer();

                #endregion

                bool run = true;

                while (run)
                {
                    string request = Console.ReadLine() ?? string.Empty;
                    run = ParseConsoleInput(request);
                }
            }
            finally
            {
                Console.WriteLine("Das Programm wird beendet.");
                Gsm.Ask_DeactivateCallForewarding();
                MelBoxWeb.Server.Stop();
                Gsm.DisConnect();
            }
        }