Пример #1
0
        private void loadToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Engine.Stop();
            WaveSettings set = Engine.Settings;

            DialogResult res = openFileDialog.ShowDialog();

            if (res != System.Windows.Forms.DialogResult.Cancel)
            {
                bool result = set.LoadFromFile(openFileDialog.FileName);

                if (!result)
                {
                    MessageBox.Show("An error occured whilst loading the file!", "Load");
                    Engine.Start();
                    return;
                }

                //Resize windows
                int deltaWidth  = this.Width - pb_image.Width;
                int deltaHeight = this.Height - pb_image.Height;

                Size windowS = new Size(set.Width * _resDiv + deltaWidth, set.Height * _resDiv + deltaHeight);
                this.Size = windowS;

                Engine.Settings = set;
                MessageBox.Show("File loaded successfully!", "Load");
                Engine.Start();
            }
        }
Пример #2
0
        private void Form1_Load(object sender, EventArgs e)
        {
            Engine = new WaveEngine();
            Engine.OnNewSimulationFrame += new WaveEngine.NewSimulationFrameHandler(Engine_OnNewSimulationFrame);
            Engine.Init(pb_image.Width / _resDiv, pb_image.Height / _resDiv);

            dcv = new DynamicColorVisualizer();

            tsCbMouseAction.SelectedIndex   = 0;
            tsCbMouseValue.SelectedIndex    = 9;
            tsCbSimResolution.SelectedIndex = 3;

            if (_fileToLoad != "")
            {
                WaveSettings set = Engine.Settings;

                bool result = set.LoadFromFile(_fileToLoad);

                if (!result)
                {
                    MessageBox.Show("An error occured whilst loading the file!", "Load");
                    return;
                }

                //Resize window
                int deltaWidth  = this.Width - pb_image.Width;
                int deltaHeight = this.Height - pb_image.Height;

                Size windowS = new Size(set.Width * _resDiv + deltaWidth, set.Height * _resDiv + deltaHeight);
                this.Size = windowS;

                Engine.Settings = set;
                //MessageBox.Show("File loaded successfully!", "Load");
            }

            String PersonalFolder = Environment.GetFolderPath(Environment.SpecialFolder.Personal);

            saveFileDialog.InitialDirectory = PersonalFolder + "\\WaveSim";
            openFileDialog.InitialDirectory = PersonalFolder + "\\WaveSim";

            Engine.Start();
        }