Ejemplo n.º 1
0
        private void btnRefreshAdmissibleSet_Click(object sender, EventArgs e)
        {
            // Получим граничные точки, которые ввел пользователь
            Dictionary <TId, int> boundaryPoints = new Dictionary <TId, int>();
            bool gotAllPoints = true;

            foreach (DataGridViewRow row in this.dgvBoundaryPoints.Rows)
            {
                TId critId     = (TId)row.Cells[0].Value;
                int boundaryPt = 0;

                try
                {
                    string value = (string)row.Cells[2].FormattedValue;
                    if (string.IsNullOrEmpty(value))
                    {
                        value = "0";
                    }
                    boundaryPt = Convert.ToInt32(value);
                }
                catch (Exception ex)
                {
                    string message = "Не могу преобразовать введенное для критерия '" +
                                     this._model.Criteria[critId].Name +
                                     "' значение номера граничного эксперимента в целое число" +
                                     "\nОригинальное сообщение: " + ex.Message;
                    MessageBoxHelper.ShowError(message);
                    gotAllPoints = false;
                    return;
                }

                if (boundaryPt >= 0)
                {
                    boundaryPoints.Add(critId, boundaryPt);
                }
            }

            // Если все точки собраны без ошибок
            if (gotAllPoints)
            {
                // Сформируем допустимое множество
                ReadOnlyCollection <TId> admissibleSet = AdmissibleSetFinder.GetAdmissibleSet(boundaryPoints, this._model);
                // Применим его
                AdmissibleSetFinder.ApplyAdmissibleSet(admissibleSet, this._model);
                // Покажем его
                MatrixDataGridFiller.FillAdmissibleSetDataGrid(this._model, this.dgvData, this._showConstraints, this._repeatParams);
            }
        }
Ejemplo n.º 2
0
 private void btnResetAdmissibleSet_Click(object sender, EventArgs e)
 {
     AdmissibleSetFinder.ApplyAdmissibleSet(this._initialState, this._model);
     this.FillBoundaryPointsGrid();
     MatrixDataGridFiller.FillAdmissibleSetDataGrid(this._model, this.dgvData, this._showConstraints, this._repeatParams);
 }