Ejemplo n.º 1
0
        static FinancialCalculator CreateCalculatorFromText(string text)
        {
            using (var stream = new MemoryStream(text.Length))
            {
                using (var writer = new StreamWriter(stream))
                {
                    writer.Write(text);
                    writer.Flush();
                    stream.Position = 0;

                    var result = FinancialCalculator.Load(stream);
                    return(result);
                }
            }
        }
Ejemplo n.º 2
0
        void OnOpen(object sender, EventArgs e)
        {
            var result = this.m_openFileDialog.ShowDialog();

            if (result != DialogResult.OK)
            {
                return;
            }

            var path = this.m_openFileDialog.FileName;

            try
            {
                this.calculator = FinancialCalculator.Load(path);
                this.RefreshData();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString(), this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }