Example #1
0
        private void btnRun_Click(object sender, EventArgs e)
        {
            var crt_path = Path.Combine(Application.StartupPath, "Models\\CRT_1.1.1.exe");

            if (_ProjectService.Project == null)
            {
                return;
            }

            if (!File.Exists(crt_path))
            {
                MessageBox.Show("CRT_1.1.1.exe dose not exist. Please repair it", "Cascade", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            Cursor.Current = Cursors.WaitCursor;
            var dt = this.bindingSource1.DataSource as DataTable;

            _Cascade.OutflowID       = _Cascade.GetOutlets(dt);
            _Cascade.Property.HRUFLG = 0;
            _Cascade.Save(_ProjectService.Project.ProcessingDirectory);
            if (!_Cascade.Run(crt_path, _ProjectService.Project.ProcessingDirectory))
            {
                MessageBox.Show("Failed to calculate cascade.", "Cascade", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                _Cascade.UpdateParameter(_ProjectService.Project.ProcessingDirectory);
            }
            Cursor.Current = Cursors.Default;
        }