コード例 #1
0
        public void loadConfigOptions()
        {
            this.cbxDb.DataSource   = SAPGlobalSettings.GetDbConnectionList();
            cbxSAPClient.DataSource = SAPGlobalSettings.GetSAPClientList();
            cbxSAPServer.DataSource = SAPGlobalSettings.GetSAPServerList();



            //foreach (ConnectionStringSettings item in System.Configuration.ConfigurationManager.ConnectionStrings)
            //{
            //    this.cbxDb.Items.Add(item.Name);
            //}
            ////

            //ConfigFileTool.SapConfig.RfcDestinationCollection sapclient = SAPClientServerSetting.getClientSettings();
            //IEnumerator enumerator = sapclient.GetEnumerator();
            //while (enumerator.MoveNext())
            //{
            //    ConfigFileTool.SapConfig.RfcDestinationParameters current = (ConfigFileTool.SapConfig.RfcDestinationParameters)enumerator.Current;
            //    cbxSAPClient.Items.Add(current.Name);
            //}
            //ConfigFileTool.SapConfig.RfcServerCollection sapserver = SAPClientServerSetting.getServerSettings();
            //IEnumerator enumerator1 = sapserver.GetEnumerator();
            //while (enumerator1.MoveNext())
            //{
            //    ConfigFileTool.SapConfig.RfcServerParameters current = (ConfigFileTool.SapConfig.RfcServerParameters)enumerator1.Current;
            //    cbxSAPServer.Items.Add(current.Name);
            //}
        }
コード例 #2
0
        private void readConfig()
        {
            // SapDefaultSettingSection defaultSettingSection = (SapDefaultSettingSection)ConfigurationManager.GetSection("SAPDefaultSetting");
            SAPGlobalSettings.reload();
            this.cbxDb.DataSource   = SAPGlobalSettings.GetDbConnectionList();
            cbxSAPClient.DataSource = SAPGlobalSettings.GetSAPClientList();
            cbxSAPServer.DataSource = SAPGlobalSettings.GetSAPServerList();

            SapDefaultSettingSection defaultSettingSection = (SapDefaultSettingSection)SAPGlobalSettings.config.GetSection("SAPDefaultSetting");

            this.cbxSAPClient.Text = defaultSettingSection.DefaultSapClient;
            this.cbxDb.Text        = defaultSettingSection.DefaultDb;
            this.cbxSAPServer.Text = defaultSettingSection.DefaultSapServer;


            XmlKeyValueSection globalSettingSection = (XmlKeyValueSection)SAPGlobalSettings.config.GetSection("GlobalSetting");

            // XmlKeyValueSection globalSettingSection = (XmlKeyValueSection)System.Configuration.ConfigurationManager.GetSection("GlobalSetting");
            txtKeyValues.Text = string.Join("\r\n",
                                            (from kv in globalSettingSection.KeyValues.Cast <XmlKeyValueSetting>()
                                             let s = string.Format("{0}={1}", kv.Key, kv.Value)
                                                     select s).ToArray());
        }