Beispiel #1
0
        static async Task Main()
        {
            MainApp.log_info("Start...");

            // Load setting
            MainApp.log_info("Load setting...");
            Load_setting();
            g_setting.Save();

            // Calculate the time differences between Local and Australia
            var      cst_tz    = TimeZoneInfo.FindSystemTimeZoneById("AUS Eastern Standard Time");
            var      local_tz  = TimeZoneInfo.Local;
            var      now       = DateTimeOffset.UtcNow;
            TimeSpan cst_off   = cst_tz.GetUtcOffset(now);
            TimeSpan local_off = local_tz.GetUtcOffset(now);

            g_time_diff = local_off - cst_off;

            // Global exception
            AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
            Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException);
            Application.ThreadException += Application_ThreadException;

            MainApp.log_info("Log in...");
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            g_api       = new API_Con(MainApp.g_setting.api_endpoint);
            g_api_login = await connect_db();

            m_main_frm = new MainFrm();
            Application.Run(m_main_frm);
        }
Beispiel #2
0
        public MainFrm()
        {
            skinman = MaterialSkinManager.Instance;
            skinman.AddFormToManage(this);
            skinman.Theme       = MaterialSkinManager.Themes.DARK;
            skinman.ColorScheme = new ColorScheme(Primary.BlueGrey800, Primary.BlueGrey900, Primary.Blue200, Accent.Teal200, TextShade.WHITE);

            InitializeComponent();

            m_media_player.Open(new Uri(Directory.GetCurrentDirectory() + "\\Resources\\alert.wav"));

            m_timer_alert.Elapsed  += M_timer_Elapsed;
            m_timer_alert.AutoReset = false;

            m_timer_ui_refresh.Elapsed  += M_timer_ui_refresh_Elapsed;
            m_timer_ui_refresh.AutoReset = true;
            m_timer_ui_refresh.Interval  = 1000;
            m_timer_ui_refresh.Start();

            m_timer_track_result.Elapsed  += M_timer_track_result_Elapsed;
            m_timer_track_result.AutoReset = false;
            m_timer_track_result.Start();

            m_api = MainApp.g_api;
        }