Пример #1
0
        private void btnNcf_Click(object sender, EventArgs e)
        {
            OpenFileDialog openFileDialog1 = new OpenFileDialog();

            openFileDialog1.Filter           = "ncf Files(*.ncf)|*.ncf|All Files (*.*)|*.*";
            openFileDialog1.InitialDirectory = string.Format("{0}\\{1}", System.Environment.CurrentDirectory, "NCFData");

            DialogResult res = openFileDialog1.ShowDialog(this);

            if (res == DialogResult.OK)
            {
                try
                {
                    string fileName = openFileDialog1.FileName;
                    dbOp = DBOperate.CreateDBOperator(fileName);
                    if (dbOp.Connect(false))
                    {
                        ReadSampleConfig();
                    }
                    if (dbOp != null && dbOp.IsOpen)
                    {
                        dbOp.Close(false);
                    }
                }
                catch (Exception ex)
                {
                    LogHelper.GetLogger <SimulatorForm>().Error(ex.Message);
                    LogHelper.GetLogger <SimulatorForm>().Error(ex.StackTrace);
                }
            }
        }