public static void SaveToConfig(EsPrice price)
        {
            string saved = JsonConvert.SerializeObject(price);

            Properties.Settings.Default.esPrice = saved;
            Properties.Settings.Default.Save();
        }
 private void LoadSavedConfig(EsPrice price)
 {
     radEsLong.Checked = price.IsLong;
     radEsShort.Checked = !price.IsLong;
     numEsStopLossSize.Value = Convert.ToDecimal(price.StopLossSize);
     numEsProfitTargetSize.Value = Convert.ToDecimal(price.ProfitTargetSize);
     numEsPriceMain.Value = Convert.ToDecimal(price.PriceMainPart);
     numEsPriceDecimals.Value = Convert.ToDecimal(price.PriceDecimalPart);
 }
        private void frmMain_Load(object sender, EventArgs e)
        {
            try
            {
                isInternalChange = true;
                m_ZbPrice = ZbPrice.LoadFromConfig();
                m_EsPrice = EsPrice.LoadFromConfig();

                LoadSavedConfig(m_ZbPrice);
                LoadSavedConfig(m_EsPrice);
            }
            finally
            {
                isInternalChange = false;
            }

            UpdateZbUi();
            UpdateEsUi();
        }
        public static EsPrice LoadFromConfig()
        {
            string saved = Properties.Settings.Default.esPrice;
            EsPrice value = new EsPrice();

            if (!string.IsNullOrWhiteSpace(saved))
            {
                try
                {
                    value = JsonConvert.DeserializeObject<EsPrice>(saved);
                }
                catch
                {

                }
            }

            return value;
            ;
        }
        public static EsPrice LoadFromConfig()
        {
            string  saved = Properties.Settings.Default.esPrice;
            EsPrice value = new EsPrice();

            if (!string.IsNullOrWhiteSpace(saved))
            {
                try
                {
                    value = JsonConvert.DeserializeObject <EsPrice>(saved);
                }
                catch
                {
                }
            }

            return(value);

            ;
        }
 public static void SaveToConfig(EsPrice price)
 {
     string saved = JsonConvert.SerializeObject(price);
     Properties.Settings.Default.esPrice = saved;
     Properties.Settings.Default.Save();
 }