void Construct(CMatrix M, int NumBehaviorsDefined, string[] BehaviorNames, int NumAdditionalColumns) { int i; // This assert could go away if this form were to ever need to be used for a matrix // without colums but is left in for now because it isn't being used that // way currently. For now at the very least there will always be a need // for 1+ the number of behavior number of columns. Debug.Assert(NumAdditionalColumns >= 1); CopyControls(); m_matrix = M; m_initializing = true; this.Text = m_szTitle; m_numTrials = NORMAL_TRIALS_FACTOR/m_matrix.RowCount; NumTrialsButton.Text = "" + m_numTrials; m_behaviorNameArray = BehaviorNames; m_numBehaviorsDefined = NumBehaviorsDefined; BehaviorCountLabel.Text = "Species Defined Behavior Count: " + NumBehaviorsDefined; MatrixTextBox.Text = M.ConvertToStringB(); MatrixDimensionsLabel.Text = "Matrix Dimensions: " + M.RowCount + "x" + M.ColumnCount; m_szFormatOK = UpdateModel(); RefreshButton.Enabled = false; DoneButton.Enabled = true; NumTrialsButton.Enabled = true; m_initializing = false; //---------------------------// // Display the behavior names //---------------------------// if(m_displayType == MBSDEFAULTS.BITMAPDISPLAYTYPE.INITIAL_BEHAVIOR) { BehaviorNameLabel.Text = ""; BehaviorNumberLabel.Visible = false; } else { BehaviorNameLabel.Text = m_behaviorNameArray[m_behaviorIndex]; BehaviorNumberLabel.Visible = true; BehaviorNumberLabel.Text = "" + "(" + (m_behaviorIndex+1) + ")"; } InitializeBehaviorTransitionAsAFunctionOfTimeBitMapVars(); RunTransitionOverTimeTest(CUtil.CopyMatrix(m_matrix)); // Generate and display initial data for(i=0; i<m_behaviorNameArray.Length; i++) { m_transitionLabelArray[i].Text = m_behaviorNameArray[i]; m_transitionLabelNumberArray[i].Visible = true; } for(; i<NUM_NRML_BUTTONS; i++) { m_transitionLabelArray[i].Text = ""; m_transitionLabelNumberArray[i].Visible = false; } }
private void RefreshButton_Click(object sender, EventArgs e) { int numAdditionalColumns; CMatrix m = new CMatrix(); string sz = CStringUtil.SzForceIntoMatrixDoubleFormat(MatrixTextBox.Text); if(m_displayType == MBSDEFAULTS.BITMAPDISPLAYTYPE.INITIAL_BEHAVIOR) numAdditionalColumns = 3; else numAdditionalColumns = 5; m.a = CStringUtil.SzMatrixToDouble2DArray(MatrixTextBox.Text); while(m.ColumnCount > m_numBehaviorsDefined + numAdditionalColumns) m.DeleteColumn(m.ColumnCount-1); while(m.ColumnCount < m_numBehaviorsDefined + numAdditionalColumns) m.AddColumn(); MatrixTextBox.Text = m.ConvertToStringB(); DoneButton.Enabled = true; NumTrialsButton.Enabled = true; RefreshButton.Enabled = false; if(true == (m_szFormatOK = UpdateModel())) RunTransitionOverTimeTest(CUtil.CopyMatrix(m)); }