예제 #1
0
        private void aPIKeyToolStripMenuItem_Click(object sender, EventArgs e)
        {
            AppSettings appSettings = new AppSettings();
            FormAPIKey  dlg         = new FormAPIKey(appSettings.ApiKey, appSettings.UseChinaServer);

            if (DialogResult.OK == dlg.ShowDialog())
            {
                appSettings.ApiKey         = dlg.APIKey;
                appSettings.UseChinaServer = dlg.UseChinaServer;
                appSettings.Save();

                // need to setup the api again since we'd changed the settings
                InitBomeansAPI();
            }
        }
예제 #2
0
        private void FormMain_Shown(object sender, EventArgs e)
        {
            Boolean bHasApiKey = false;

            AppSettings appSettings = new AppSettings();

            if (appSettings.ApiKey.Length == 0)
            {
                if (DialogResult.Yes == Program.ShowQuestion(Resources.Q_SETUP_API))
                {
                    FormAPIKey dlg = new FormAPIKey(appSettings.ApiKey, appSettings.UseChinaServer);
                    if (DialogResult.OK == dlg.ShowDialog())
                    {
                        if (dlg.APIKey.Length > 0)
                        {
                            bHasApiKey = true;
                        }
                    }
                }
            }
            else
            {
                bHasApiKey = true;
            }

            // do initial download
            if (bHasApiKey)
            {
                FormInitLoading form = new FormInitLoading();
                form.ShowDialog();
            }

            if (null != mMyIrEasy)
            {
                if (Settings.Default.UART_COM_PORT.Length > 0)
                {
                    mMyIrEasy.Initialize(Settings.Default.UART_COM_PORT);
                }
            }

            UpdateTitleText();
        }