Exemple #1
0
        //save settings
        private void save_INI_Settings()
        {
            SetupIniIP ini = new SetupIniIP("DDESetting.ini");
            DataGridViewRowCollection     DR          = dgvDDESource.Rows;
            Dictionary <string, string[]> tmp_DGV_Dic = new Dictionary <string, string[]>();

            foreach (DataGridViewRow tr in DR)
            {
                string[] tmpArray = new string[9];
                for (int i = 0; i < 9; i++)
                {
                    if (tr.Cells[i].Value != null)
                    {
                        tmpArray[i] = tr.Cells[i].Value.ToString();
                    }
                    else
                    {
                        tmpArray[i] = "";
                    }
                }
                tmp_DGV_Dic.Add(tr.Cells[0].Value.ToString(), tmpArray);
            }
            //ini.exportINI(tmp_DGV_Dic);

            ini.Local_Server     = txtServer.Text;
            ini.Local_Topic      = txtTopic.Text;
            ini.Local_Separation = txtSeparation.Text;
            ini.Local_Trade      = txtTradePrice.Text;
            ini.Local_Vol        = txtTradeVolume.Text;
            ini.Local_Bid        = txtBidPrice.Text;
            ini.Local_BidSize    = txtBidVolume.Text;
            ini.Local_Ask        = txtAskPrice.Text;
            ini.Local_AskSize    = txtAskVolume.Text;
            if (cbLogin.Checked)
            {
                ini.checkLongin = "1";
            }
            else
            {
                ini.checkLongin = "0";
            }

            if (cbClose.Checked)
            {
                ini.checkClose = "1";
            }
            else
            {
                ini.checkClose = "0";
            }

            if (cbDataFilter.Checked)
            {
                ini.DataFilter = "1";
            }
            else
            {
                ini.DataFilter = "0";
            }

            ini.TimekLongin = dTimeLogin.Value.ToString("HH:mm:ss");
            ini.TimekClose  = dTimeClose.Value.ToString("HH:mm:ss");

            ini.exportINI(tmp_DGV_Dic);
        }
Exemple #2
0
        //Load settings
        private void load_INI_Settings()
        {
            try
            {
                SetupIniIP ini = new SetupIniIP("DDESetting.ini");
                ini.importINI();
                ddeList = ini.listSymbol;
                int i = 0;

                //load symbol and items
                foreach (KeyValuePair <string, string[]> kvp in ddeList)
                {
                    i += 1;
                    dgvDDESource.Rows.Add(kvp.Value);
                    dgvDDESource.Rows[dgvDDESource.Rows.Count - 1].HeaderCell.Value = i.ToString();
                }
                dgvDDESource.AutoResizeColumns();



                //load dde server
                txtServer.Text      = ini.Local_Server;
                txtTopic.Text       = ini.Local_Topic;
                txtSeparation.Text  = ini.Local_Separation;
                txtTradePrice.Text  = ini.Local_Trade;
                txtTradeVolume.Text = ini.Local_Vol;
                txtBidPrice.Text    = ini.Local_Bid;
                txtBidVolume.Text   = ini.Local_BidSize;
                txtAskPrice.Text    = ini.Local_Ask;
                txtAskVolume.Text   = ini.Local_AskSize;

                if (ini.checkLongin == "1")
                {
                    cbLogin.Checked = true;
                }
                else
                {
                    cbLogin.Checked = false;
                }

                if (ini.checkClose == "1")
                {
                    cbClose.Checked = true;
                }
                else
                {
                    cbClose.Checked = false;
                }

                if (ini.DataFilter == "1")
                {
                    cbDataFilter.Checked = true;
                }
                else
                {
                    cbDataFilter.Checked = false;
                }

                dTimeLogin.Text = ini.TimekLongin;
                dTimeClose.Text = ini.TimekClose;

                write2allTextbox();
            }
            catch (Exception ex)
            { this.Invoke((MethodInvoker)(() => lbMsg.Items.Add(DateTime.Now.ToString("HH:mm:ss") + "   Load INI:" + ex.Message))); }
        }