当前位置: 首页>>代码示例>>C#>>正文


C# Config.SetValue方法代码示例

本文整理汇总了C#中Config.SetValue方法的典型用法代码示例。如果您正苦于以下问题:C# Config.SetValue方法的具体用法?C# Config.SetValue怎么用?C# Config.SetValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Config的用法示例。


在下文中一共展示了Config.SetValue方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: btnsaveMktwatch_Click

        //private void DGV1_KeyDown(object sender, KeyEventArgs e)
        //{
        //    if (e.Modifiers == Keys.Shift)
        //    {
        //        if (e.KeyCode == Keys.F2)
        //        {
        //            using (frmDiff _frmDIff = new frmDiff())
        //            {
        //              //_frmDIff._FOPairDiff.TokenNear = DGV1.SelectedRows[]
        //                _frmDIff._FOPairDiff.BFSNDIFF = Convert.ToDouble(Convert.IsDBNull(DGV1.SelectedRows[0].Cells["BFSNDIFF"].Value) ? 0 : DGV1.SelectedRows[0].Cells["BFSNDIFF"].Value);
        //                _frmDIff._FOPairDiff.BNSFDIFF = Convert.ToDouble(Convert.IsDBNull(DGV1.SelectedRows[0].Cells["BNSFDIFF"].Value) ? 0 : DGV1.SelectedRows[0].Cells["BNSFDIFF"].Value);
        //                _frmDIff._FOPairDiff.MINQTY = Convert.ToInt32(Convert.IsDBNull(DGV1.SelectedRows[0].Cells["MINQTY"].Value) ? 0 : DGV1.SelectedRows[0].Cells["MINQTY"].Value);
        //                _frmDIff._FOPairDiff.MAXQTY=  Convert.ToInt32( Convert.IsDBNull(DGV1.SelectedRows[0].Cells["MAXQTY"].Value)  ? 0 :DGV1.SelectedRows[0].Cells["MAXQTY"].Value);
        //                if (_frmDIff.ShowDialog() == DialogResult.OK)
        //                {
        //                    DGV1.SelectedRows[0].Cells["BFSNDIFF"].Value = _frmDIff._FOPairDiff.BFSNDIFF;
        //                    DGV1.SelectedRows[0].Cells["BNSFDIFF"].Value = _frmDIff._FOPairDiff.BNSFDIFF;
        //                    DGV1.SelectedRows[0].Cells["MINQTY"].Value = _frmDIff._FOPairDiff.MINQTY;
        //                    DGV1.SelectedRows[0].Cells["MAXQTY"].Value = _frmDIff._FOPairDiff.MAXQTY;
        //                    _frmDIff._FOPairDiff.PORTFOLIONAME =Convert.ToInt32( DGV1.SelectedRows[0].Cells["PF"].Value);
        //                    _frmDIff._FOPairDiff.TokenNear =Convert.ToInt32( DGV1.SelectedRows[0].Cells["Token1"].Value);
        //                    _frmDIff._FOPairDiff.TokenFar =Convert.ToInt32( DGV1.SelectedRows[0].Cells["Token2"].Value);
        //                    byte[] buffer = DataPacket.RawSerialize(_frmDIff._FOPairDiff);
        //                    NNFHandler.Instance.Publisher("FOPAIRDIFF", buffer);
        //                }
        //            }
        //        }
        //    }
        //}
        private void btnsaveMktwatch_Click(object sender, EventArgs e)
        {
            if (DGV1.Rows.Count == 0)
                return;
            SaveFileDialog savd = new SaveFileDialog();
            savd.AddExtension = true;
            savd.DefaultExt = "xml";
            savd.Filter = "*.xml|*.*";

            if(savd.ShowDialog() == DialogResult.OK)
            {
                SpreadTable = (DataTable)DGV1.DataSource;
                savd.DefaultExt = ".xml";
                SpreadTable.WriteXml(savd.FileName );
                var config = new Config { GroupName = null };
                config.SetValue("PF_Profile", Convert.ToString(0), savd.FileName);
                //var config = new Config { GroupName = null };
                //var iforms = config.GetValue("Fo_FO_Profile", Convert.ToString(0));

            }

            DataTable dt_save = new DataTable("lastvalue");
            dt_save.Columns.Add("BNSFDIFF", typeof(Double));
            dt_save.Columns.Add("BFSNDIFF", typeof(Double));
            dt_save.Columns.Add("BNSFMNQ", typeof(int));
            dt_save.Columns.Add("BFSNMNQ", typeof(int));
            dt_save.Columns.Add("BNSFMXQ", typeof(int));
            dt_save.Columns.Add("BFSNMXQ", typeof(int));
            dt_save.Columns.Add("TICKS", typeof(int));

            foreach (DataGridViewRow row in DGV1.Rows)
            {
                DataRow dRow = dt_save.NewRow();
                dRow["BNSFDIFF"] = row.Cells["BNSFDIFF"].Value == null || row.Cells["BNSFDIFF"].Value==DBNull.Value ? 0 : row.Cells["BNSFDIFF"].Value;
                dRow["BFSNDIFF"] = row.Cells["BFSNDIFF"].Value == null || row.Cells["BFSNDIFF"].Value == DBNull.Value ? 0 : row.Cells["BFSNDIFF"].Value;
                dRow["BNSFMNQ"] = row.Cells["BNSFMNQ"].Value == null || row.Cells["BNSFMNQ"].Value == DBNull.Value ? 0 : row.Cells["BNSFMNQ"].Value;
                dRow["BFSNMNQ"] = row.Cells["BFSNMNQ"].Value == null || row.Cells["BFSNMNQ"].Value == DBNull.Value ? 0 : row.Cells["BFSNMNQ"].Value;
                dRow["BNSFMXQ"] = row.Cells["BNSFMXQ"].Value == null || row.Cells["BNSFMXQ"].Value == DBNull.Value ? 0 : row.Cells["BNSFMXQ"].Value;
                dRow["BFSNMXQ"] = row.Cells["BFSNMXQ"].Value == null || row.Cells["BFSNMXQ"].Value == DBNull.Value ? 0 : row.Cells["BFSNMXQ"].Value;
                dRow["TICKS"] = row.Cells["TICKS"].Value == null || row.Cells["TICKS"].Value == DBNull.Value ? 0 : row.Cells["TICKS"].Value;
                dt_save.Rows.Add(dRow);
            }

             dt_save.WriteXml(Application.StartupPath+Path.DirectorySeparatorChar+"Lastvalue.xml");
        }
开发者ID:spsinghdocument1,项目名称:C-,代码行数:74,代码来源:Fo_Fo_mktwatch.cs

示例2: btnprofile_Click

        private void btnprofile_Click(object sender, EventArgs e)
        {
            var frmprf = new frmProfile();
            foreach (DataGridViewColumn dc in DGV1.Columns)
            {

                if (!frmprf.lbxSecondary.Items.Contains(dc.HeaderText))
                {
                    frmprf.lbxPrimary.Items.Add(dc.HeaderText);

                }

            }

            if (frmprf.ShowDialog() == DialogResult.OK)
            {
                var config = new Config { GroupName = null };
                foreach (DataGridViewColumn dc in DGV1.Columns)
                {
                    this.DGV1.Columns[dc.HeaderText.Replace(" ", "")].Visible = true;
                }
                String GetProfileName = frmprf.GetProfileName();

                DataSet ds = new DataSet();
                ds.ReadXml(Application.StartupPath + Path.DirectorySeparatorChar + "Profiles" + Path.DirectorySeparatorChar + GetProfileName + ".xml");
                if(ds.Tables.Count ==  0)
                {
                    return;
                }
                for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                {
                     string st = ds.Tables[0].Rows[i]["Input"].ToString();
                     if (st==null||st==DBNull.Value.ToString())
                         continue;
                    this.DGV1.Columns[ds.Tables[0].Rows[i]["Input"].ToString().Replace(" ","")].Visible = false;
                }
                config.SetValue("Fo_FO_Profile", Convert.ToString(0),GetProfileName);

            }
            else
            {
                //String GetProfileName = frmprf.GetProfileName();
                //DataSet ds = new DataSet();
                //ds.ReadXml(Application.StartupPath + Path.DirectorySeparatorChar + "Profiles" + Path.DirectorySeparatorChar + "MarketCol.xml");
                //for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                //{
                //    string st = ds.Tables[0].Rows[i]["Input"].ToString();
                //    this.DGV1.Columns[ds.Tables[0].Rows[i]["Input"].ToString().Replace(" ", "")].Visible = true;
                //}
            }
        }
开发者ID:spsinghdocument1,项目名称:C-,代码行数:51,代码来源:Fo_Fo_mktwatch.cs

示例3: toolStripButton1_Click

        private void toolStripButton1_Click(object sender, EventArgs e)
        {
            try
            {
            Profile_forOrderBook pfltrade_book = new Profile_forOrderBook();
            var config = new Config { GroupName = null };
            if (pfltrade_book.ShowDialog() == DialogResult.OK)
            {
                foreach (DataGridViewColumn dc in DGV.Columns)
                {

                    this.DGV.Columns[dc.HeaderText.Replace(" ", "")].Visible = true;
                    this.DGV2.Columns[dc.HeaderText.Replace(" ", "")].Visible = true;
                }
                String GetProfileName = pfltrade_book.GetProfileName();

                DataSet ds = new DataSet();
                ds.ReadXml(Application.StartupPath + Path.DirectorySeparatorChar + "Order_Profiles" + Path.DirectorySeparatorChar + GetProfileName + ".xml");
                for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                {
                    string st = ds.Tables[0].Rows[i]["Input"].ToString();
                    this.DGV.Columns[ds.Tables[0].Rows[i]["Input"].ToString().Replace(" ", "")].Visible = false;
                    this.DGV2.Columns[ds.Tables[0].Rows[i]["Input"].ToString().Replace(" ", "")].Visible = false;
                }
                config.SetValue("GenOrderBook", Convert.ToString(0), GetProfileName);
            }
            }
            catch (Exception ex)
            {
            //    MessageBox.Show("Order Book -  Funtion Name-  toolStripButton1_Click  " + ex.Message);
            }
        }
开发者ID:spsinghdocument1,项目名称:C-,代码行数:32,代码来源:frmGenOrderBook.cs

示例4: savechildform

 void savechildform()
 {
     int iforms = 0;
     var config = new Config { GroupName = null };
     foreach (Form childForm in MdiChildren)
     {
       //MessageBox.Show(childForm.Text);
         config.SetValue("FORMS",iforms.ToString(),childForm.Text);
         childForm.Close();
         iforms++;
     }
     config.SetValue("FORMS", "MAX", iforms);
 }
开发者ID:spsinghdocument1,项目名称:C-,代码行数:13,代码来源:MDIParent1.cs

示例5: OpraterConfig

        private void OpraterConfig(bool isset)
        {
            try
            {
                string assemblyFilePath = Assembly.GetExecutingAssembly().Location;
                string assemblyDirPath = Path.GetDirectoryName(assemblyFilePath);
                string configFilePath = assemblyDirPath + "\\AppConfig.config";

                Config config = new Config(configFilePath);
                if(isset)
                {
                    config.SetValue("RemoteSQLServerUri",txtServerIP.Text,true);
                    config.SetValue("RemoteSQLServerUser",txtAccount.Text,true);
                    config.SetValue("RemoteSQLServerPWD",txtAcctPwd.Text,true);
                    config.SetValue("RemoteSQLServerDB",txtDBName.Text,true);
                    MessageBox.Show("���óɹ�");
                    btnOK.Enabled = false;
                }
                else
                {
                    txtServerIP.Text = config.GetValue("RemoteSQLServerUri");
                    txtAccount.Text = config.GetValue("RemoteSQLServerUser");
                    txtAcctPwd.Text = config.GetValue("RemoteSQLServerPWD");
                    txtDBName.Text = config.GetValue("RemoteSQLServerDB");
                }
            }
            catch
            {
                btnOK.Enabled = true;
            }
        }
开发者ID:vanzheng,项目名称:CShareCodeSample,代码行数:31,代码来源:ConfigDB.cs


注:本文中的Config.SetValue方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。