Exemplo n.º 1
0
        private void createECUFileToolStripMenuItem_Click(object sender, EventArgs e)
        {
            OpenFileDialog ofd = new OpenFileDialog();

            ofd.InitialDirectory = System.IO.Path.Combine(Program.ME7LoggerDirectory, "images");
            ofd.Title            = "Select ECU Image File";
            ofd.Filter           = "ECU Images (*.bin)|*.bin";
            if (ofd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                try
                {
                    ECUFile ecuFile = ECUFile.Create(Program.ME7LoggerDirectory, ofd.FileName);
                    if (DialogResult.Yes == MessageBox.Show(string.Format("ECU File Created at:{1}{1}{0}{1}{1}Would you like to load this ECU File now?", ecuFile.FilePath, Environment.NewLine),
                                                            "ECU File created successfully", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1))
                    {
                        ecuFile.Open();
                        if (!ecuFile.Measurements.Values.Any())
                        {
                            MessageBox.Show(this, "ECU File loaded without error but no measurements were read.");
                        }
                        this.CurrentProfile.ECUFile = ecuFile;
                        this.LoadECUFile();
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.ToString());
                }
            }
        }
Exemplo n.º 2
0
        private void loadECUFileToolStripMenuItem_Click(object sender, EventArgs e)
        {
            OpenFileDialog ofd = new OpenFileDialog();

            ofd.InitialDirectory =
                string.IsNullOrWhiteSpace(this.txtECUFile.Text) ?
                System.IO.Path.Combine(Program.ME7LoggerDirectory, "ecus") :
                System.IO.Path.GetDirectoryName(this.txtECUFile.Text);
            ofd.FileName = System.IO.Path.GetFileName(this.txtECUFile.Text);
            ofd.Title    = "Select ECU File";
            ofd.Filter   = "ECU Files (*.ecu)|*.ecu";
            if (ofd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                this.CurrentProfile.ECUFile = null;
                ECUFile file = new ECUFile(ofd.FileName);
                file.Open();
                if (!file.Measurements.Values.Any())
                {
                    MessageBox.Show(this, "ECU File loaded without error but no measurements were read.");
                }
                this.CurrentProfile.ECUFile = file;
                this.LoadECUFile();
            }
        }