Exemple #1
0
        private void menuItemFillNBelow_Click(object sender, System.EventArgs e)
        {
            if (subItemSelected < NUM_COLUMNS || li == null)
            {
                MessageBox.Show("Add one or more factors, then select a cell in a column with factors",
                                "Invalid selection", MessageBoxButtons.OK,
                                MessageBoxIcon.Exclamation);
                return;
            }

            var idx    = 0;
            var nBlock = 1;
            var inputBlockSizeParams = new frmInputBlockSize();

            var res = inputBlockSizeParams.ShowDialog();

            if (res == DialogResult.Cancel)
            {
                return;
            }
            if (res == DialogResult.OK)
            {
                nBlock = inputBlockSizeParams.blockSize;
            }

            foreach (ListViewItem item in mlstViewDataSets.Items)
            {
                if ((int)item.Tag == (int)li.Tag)
                {
                    break;
                }
                else
                {
                    idx++;
                }
            }
            var factorVal = li.SubItems[subItemSelected].Text;

            for (var num = idx; num < idx + nBlock; num++)
            {
                if (num < mlstViewDataSets.Items.Count)
                {
                    mlstViewDataSets.Items[num].SubItems[subItemSelected].Text = factorVal;
                    marrDatasetInfo[num].marrFactorAssnmnts[subItemSelected - NUM_COLUMNS].Value = factorVal;
                }
            }
        }
        private void menuItemFillNCycl_Click(object sender, System.EventArgs e)
        {
            if (subItemSelected < NUM_COLUMNS || li == null)
            {
                MessageBox.Show("Add one or more factors, then select a cell in a column with factors", "Invalid selection", MessageBoxButtons.OK,
                                MessageBoxIcon.Exclamation);
                return;
            }

            var idx = 0;
            var nBlock = 1;
            var mfrmInputBlockSize = new frmInputBlockSize();

            var res = mfrmInputBlockSize.ShowDialog();
            if (res == DialogResult.Cancel)
                return;
            if (res == DialogResult.OK)
            {
                nBlock = mfrmInputBlockSize.blockSize;
            }

            foreach (ListViewItem item in mlstViewDataSets.Items)
            {
                if ((int)item.Tag == (int)li.Tag)
                    break;
                else
                    idx++; // which item is clicked ?
            }
            var factorVal = li.SubItems[subItemSelected].Text; // get it's factor value

            var numVals = marrFactorInfo[subItemSelected - NUM_COLUMNS].vCount; //number of values in this factor

            var fvals = marrFactorInfo[subItemSelected - NUM_COLUMNS].FactorValues;

            int startIdxVal; //start with this value and its index is...
            for (startIdxVal = 0; startIdxVal < numVals; startIdxVal++)
                if (fvals[startIdxVal].Equals(factorVal))
                    break;

            var start = idx;
            var cycle = 0;
            while (start < mlstViewDataSets.Items.Count)//all cycles
            {
                for (var num = start; num < (start + nBlock); num++)//set values in one block
                {
                    if (num < mlstViewDataSets.Items.Count)
                    {
                        factorVal = fvals[(startIdxVal + cycle) % numVals]; // index should go in a cycle, hence the mod operator.
                        mlstViewDataSets.Items[num].SubItems[subItemSelected].Text = factorVal; // update in the view
                        // update in the datasaet info
                        marrDatasetInfo[num].marrFactorAssnmnts[subItemSelected - NUM_COLUMNS].Value = factorVal;
                    }
                    else
                        break;
                }
                start = start + nBlock; //jump to the next block,
                cycle++; //i.e. the next cycle
            }
        }
        private void menuItemFillNBelow_Click(object sender, System.EventArgs e)
        {
            if (subItemSelected < NUM_COLUMNS || li == null)
            {
                MessageBox.Show("Add one or more factors, then select a cell in a column with factors", "Invalid selection", MessageBoxButtons.OK,
                                MessageBoxIcon.Exclamation);
                return;
            }

            var idx = 0;
            var nBlock = 1;
            var mfrmInputBlockSize = new frmInputBlockSize();

            var res = mfrmInputBlockSize.ShowDialog();
            if (res == DialogResult.Cancel)
                return;
            if (res == DialogResult.OK)
            {
                nBlock = mfrmInputBlockSize.blockSize;
            }

            foreach (ListViewItem item in mlstViewDataSets.Items)
            {
                if ((int)item.Tag == (int)li.Tag)
                    break;
                else
                    idx++;
            }
            var factorVal = li.SubItems[subItemSelected].Text;
            for (var num = idx; num < idx + nBlock; num++)
            {
                if (num < mlstViewDataSets.Items.Count)
                {
                    mlstViewDataSets.Items[num].SubItems[subItemSelected].Text = factorVal;
                    marrDatasetInfo[num].marrFactorAssnmnts[subItemSelected - NUM_COLUMNS].Value = factorVal;
                }

            }
        }
Exemple #4
0
        private void menuItemFillNCycl_Click(object sender, System.EventArgs e)
        {
            if (subItemSelected < NUM_COLUMNS || li == null)
            {
                MessageBox.Show("Add one or more factors, then select a cell in a column with factors",
                                "Invalid selection", MessageBoxButtons.OK,
                                MessageBoxIcon.Exclamation);
                return;
            }

            var idx    = 0;
            var nBlock = 1;
            var inputBlockSizeParams = new frmInputBlockSize();

            var res = inputBlockSizeParams.ShowDialog();

            if (res == DialogResult.Cancel)
            {
                return;
            }
            if (res == DialogResult.OK)
            {
                nBlock = inputBlockSizeParams.blockSize;
            }

            foreach (ListViewItem item in mlstViewDataSets.Items)
            {
                if ((int)item.Tag == (int)li.Tag)
                {
                    break;
                }
                else
                {
                    idx++; // which item is clicked ?
                }
            }
            var factorVal = li.SubItems[subItemSelected].Text;                  // get it's factor value

            var numVals = marrFactorInfo[subItemSelected - NUM_COLUMNS].vCount; //number of values in this factor

            var fvals = marrFactorInfo[subItemSelected - NUM_COLUMNS].FactorValues;

            int startIdxVal; //start with this value and its index is...

            for (startIdxVal = 0; startIdxVal < numVals; startIdxVal++)
            {
                if (fvals[startIdxVal].Equals(factorVal))
                {
                    break;
                }
            }

            var start = idx;
            var cycle = 0;

            while (start < mlstViewDataSets.Items.Count)             //all cycles
            {
                for (var num = start; num < (start + nBlock); num++) //set values in one block
                {
                    if (num < mlstViewDataSets.Items.Count)
                    {
                        factorVal = fvals[(startIdxVal + cycle) % numVals];
                        // index should go in a cycle, hence the mod operator.
                        mlstViewDataSets.Items[num].SubItems[subItemSelected].Text = factorVal; // update in the view
                        // update in the datasaet info
                        marrDatasetInfo[num].marrFactorAssnmnts[subItemSelected - NUM_COLUMNS].Value = factorVal;
                    }
                    else
                    {
                        break;
                    }
                }
                start = start + nBlock; //jump to the next block,
                cycle++;                //i.e. the next cycle
            }
        }