Esempio n. 1
0
        //public PLSetting()
        //{
        //    this.OptionList = new List<OpenOption>();
        //}
        public static void SavePLSettingToFile(PLSetting plSetting, string filePath)
        {
            var serializer = new XmlSerializer(typeof(PLSetting));

            using (var writer = new StreamWriter(filePath))
            {
                serializer.Serialize(writer, plSetting);
            }
        }
Esempio n. 2
0
        private void btnSaveChart_Click(object sender, RoutedEventArgs e)
        {
            SaveFileDialog dlg = new SaveFileDialog();

            dlg.DefaultExt = ".pl";
            dlg.Filter = "PL File (.pl)|*.pl";
            bool? result = dlg.ShowDialog();

            if (result==true)
            {
                string filename = dlg.FileName;

                PLSetting plSetting = new PLSetting();

                //foreach (OpenOption openOpt in this._optionComb.Options)
                //{
                //    plSetting.OptionList.Add(openOpt);
                //}

                plSetting.OptionList = this._openOptions;
                plSetting.DrawDate = Convert.ToDateTime(this.txtDrawDate.Text);
                plSetting.StockPrice = Convert.ToDecimal(this.txtStockPrice.Text);
                plSetting.PriceRange = Convert.ToDecimal(this.txtPriceRange.Text);
                plSetting.Interest = Convert.ToDecimal(this.txtInterest.Text);
                plSetting.Volatility = Convert.ToDouble(this.txtVolatility.Text);

                PLSetting.SavePLSettingToFile(plSetting, filename);

            }
        }