コード例 #1
0
        /// <summary>
        /// Initializes a new instance of the UserControlSimcaGraph class
        /// </summary>
        public UserControlSimcaGraph()
        {
            InitializeComponent();

            this.DataType = SimcaData.SIMCA_DATA_TYPE.SCORE_PLOT;
            _graphZoomHistory.Clear();
            SetDefaultData();
        }
コード例 #2
0
ファイル: FormSimcaGrid.cs プロジェクト: 15831944/masspp
        /// <summary>
        /// menuItemPaste Click event handler
        /// </summary>
        /// <param name="sender">object</param>
        /// <param name="e">EventArgs</param>
        private void MenuItemPaste_Click(object sender, EventArgs e)
        {
            string msg      = string.Empty;
            string typeName = string.Empty;

            SimcaData.SIMCA_DATA_TYPE dataType = SimcaData.SIMCA_DATA_TYPE.SCORE_PLOT;

            // Set message
            switch ((TAB_ID)_tabControlGrid.SelectedIndex)
            {
            case TAB_ID.SCORE_PLOT:
                dataType = SimcaData.SIMCA_DATA_TYPE.SCORE_PLOT;
                typeName = "score";
                msg      = string.Format(MSG_FMT_CONVERT_GRID_VALUE, typeName);
                break;

            case TAB_ID.LOADING_PLOT:
                dataType = SimcaData.SIMCA_DATA_TYPE.LOADING_PLOT;
                typeName = "loading";
                msg      = string.Format(MSG_FMT_CONVERT_GRID_VALUE, typeName);
                break;

            case TAB_ID.S_PLOT:
                dataType = SimcaData.SIMCA_DATA_TYPE.S_PLOT;
                typeName = "S";
                msg      = string.Format(MSG_FMT_CONVERT_GRID_VALUE, typeName);
                break;

            default:
                break;
            }

            if (msg == string.Empty)
            {
                return;
            }

            // A check dialog is opened.
            if (DialogResult.OK != MessageBox.Show(
                    msg,
                    "Question",
                    MessageBoxButtons.OKCancel,
                    MessageBoxIcon.Question))
            {
                return;
            }

            // Data will be set if data is in a clipboard.
            PasteClipboardData(dataType, typeName);
        }
コード例 #3
0
ファイル: FormSimcaGrid.cs プロジェクト: 15831944/masspp
        /// <summary>
        /// Paste of clipboard data
        /// </summary>
        /// <param name="dataType">Data type</param>
        /// <param name="typeName">Data type name</param>
        private void PasteClipboardData(SimcaData.SIMCA_DATA_TYPE dataType, string typeName)
        {
            // Set wait Cursor
            Cursor preCursor = Cursor.Current;

            Cursor.Current = Cursors.WaitCursor;

            int index = _tabControlGrid.SelectedIndex;

            // Data will be set if data is in a clipboard.
            if (Clipboard.ContainsText())
            {
                string clipboardText = Clipboard.GetText();
                SimcaData.SIMCA_READ_ERR_CODE errorCode = SimcaData.SIMCA_READ_ERR_CODE.OK;

                // Convert TSV to CSV
                string workPaste = ConvTsvToCsv(clipboardText);
                if (workPaste == null)
                {
                    errorCode = SimcaData.SIMCA_READ_ERR_CODE.NG_FORMAT;
                }

                SimcaData tempData = new SimcaData(dataType);
                if (errorCode == SimcaData.SIMCA_READ_ERR_CODE.OK)
                {
                    errorCode = tempData.SetPasteData(workPaste, null);
                }

                string formatErrMsg;
                if (errorCode == SimcaData.SIMCA_READ_ERR_CODE.NG_DATA)
                {   // NG_DATA
                    formatErrMsg = ERR_MSG_FMT_FILE_READ_DATA;
                }
                else if (errorCode == SimcaData.SIMCA_READ_ERR_CODE.NG_FORMAT)
                {   // NG_FORMAT
                    formatErrMsg = ERR_MSG_FMT_FILE_READ_FMT;
                }
                else
                {   // OK
                    Update(tempData);
                    _pasteValue[index]  = workPaste;
                    _enableApply[index] = true;
                    _enableSave[index]  = true;
                    UpdataButton();
                    Cursor.Current = preCursor;
                    return;
                }

                string workMsg = string.Format(formatErrMsg, typeName, "paste data");
                workMsg = char.ToUpper(workMsg[0]) + workMsg.Substring(1);
                MessageBox.Show(
                    workMsg,
                    "Error",
                    MessageBoxButtons.OK,
                    MessageBoxIcon.Error);
                SimcaData clrData = new SimcaData(dataType);
                Update(clrData);
                _pasteValue[index]  = string.Empty;
                _enableApply[index] = false;
                _enableSave[index]  = false;
                UpdataButton();
                Cursor.Current = preCursor;
                return;
            }
        }
コード例 #4
0
ファイル: FormSimcaGrid.cs プロジェクト: 15831944/masspp
 /// <summary>
 /// Tab select
 /// </summary>
 /// <param name="dataType">data type</param>
 public void TabSelect(SimcaData.SIMCA_DATA_TYPE dataType)
 {
     _tabControlGrid.SelectedIndex = (int)dataType;
 }
コード例 #5
0
        /// <summary>
        /// Initializes a new instance of the FormSimcaSelectAxis class
        /// </summary>
        /// <param name="data">SIMCA data</param>
        public FormSimcaSelectAxis(SimcaData data)
        {
            InitializeComponent();

            Size formSize = this.Size;

            string[] axisNameArray = data.GetAxisNameArray();
            if (axisNameArray == null)
            {
                return;
            }

            _dataType = data.DataType;

            this.SuspendLayout();

            // Create option button (1st(X) Axis)
            _radioButtonArray1st = new RadioButton[axisNameArray.Count()];
            formSize.Height      = FORM_HEIGHT_MIN;
            for (int index = 0; index < axisNameArray.Count(); index++)
            {
                formSize.Height += FORM_HEIGHT_ADD;

                // Create instance
                RadioButton btn = _radioButtonArray1st[index] = new RadioButton();

                // Set properties
                btn.AutoSize = RADIO_BTN_AUTO_SIZE;
                btn.Name     = RADIO_BTN_NAME_1ST + index.ToString();
                btn.Text     = axisNameArray[index];
                btn.Size     = new Size(RADIO_BTN_WIDTH, RADIO_BTN_HEIGHT);
                btn.Location = new Point(
                    RADIO_BTN_LOC_LEFT,
                    (index * RADIO_BTN_LOC_ADD) + RADIO_BTN_LOC_TOP);

                // Set event
                btn.CheckedChanged += this.RadioButtonArray1st_CheckedChanged;

                if ((index + 1) >= MAX_SELECT_NO)
                {
                    break;
                }
            }

            // Control is added to a group box
            _groupBox1st.Controls.AddRange(_radioButtonArray1st);

            // Create option button (2nd(Y) Axis)
            if (_dataType == SimcaData.SIMCA_DATA_TYPE.S_PLOT)
            {
                _groupBox2nd.Visible = false;
                formSize.Width       = FORM_WIDTH_MIN;
            }
            else
            {
                _radioButtonArray2nd = new RadioButton[axisNameArray.Count()];
                for (int index = 0; index < axisNameArray.Count(); index++)
                {
                    // Create instance
                    RadioButton btn = _radioButtonArray2nd[index] = new RadioButton();

                    // Set properties
                    btn.AutoSize = RADIO_BTN_AUTO_SIZE;
                    btn.Name     = RADIO_BTN_NAME_2ND + index.ToString();
                    btn.Text     = axisNameArray[index];
                    btn.Size     = new Size(RADIO_BTN_WIDTH, RADIO_BTN_HEIGHT);
                    btn.Location = new Point(
                        RADIO_BTN_LOC_LEFT,
                        (index * RADIO_BTN_LOC_ADD) + RADIO_BTN_LOC_TOP);

                    // Set event
                    btn.CheckedChanged += this.RadioButtonArray2nd_CheckedChanged;

                    if ((index + 1) >= MAX_SELECT_NO)
                    {
                        break;
                    }
                }

                // Set select index
                _radioButtonArray2nd[data.AxisYDataIndex].Checked = true;
                this.SelectAxisIndexY = data.AxisYDataIndex;

                // Control is added to a group box
                _groupBox2nd.Controls.AddRange(_radioButtonArray2nd);
            }

            // Set select index
            _radioButtonArray1st[data.AxisXDataIndex].Checked = true;
            this.SelectAxisIndexX = data.AxisXDataIndex;

            this.ResumeLayout(false);

            this.Size = formSize;
        }