Пример #1
0
        private void buttonVisionAdd_Click(object sender, EventArgs e)
        {
            FormVision visionFrm = new FormVision();

            visionFrm.Text = "Add Capture Card Entry";
            WindowsFormClient.RgbInput.Window          window = new RgbInput.Window();
            WindowsFormClient.RgbInput.Input           input  = new RgbInput.Input();
            WindowsFormClient.RgbInput.OnScreenDisplay osd    = new RgbInput.OnScreenDisplay();

            // set the empty object to the form
            visionFrm.WindowObj          = window;
            visionFrm.InputObj           = input;
            visionFrm.OnScreenDisplayObj = osd;
            visionFrm.NumberOfInputs     = ServerDbHelper.GetInstance().GetSystemInputCount();

            if (visionFrm.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                // add to db
                visionInputPresenter.AddVisionInput(visionFrm.WindowObj, visionFrm.InputObj, visionFrm.OnScreenDisplayObj);
            }
        }
Пример #2
0
        private void buttonVisionEdit_Click(object sender, EventArgs e)
        {
            Dictionary <uint, FormVision> updatedList = new Dictionary <uint, FormVision>();

            foreach (DataGridViewRow row in dataGridVisionInput.Rows)
            {
                if (row.Cells[0].Value != null &&
                    (bool)row.Cells[0].Value)
                {
                    // show the form user
                    uint   visionDataId = (uint)row.Cells[1].Value;
                    string visionWnd    = (string)row.Cells[2].Value;
                    string visionInput  = (string)row.Cells[3].Value;
                    string visionOSD    = (string)row.Cells[4].Value;

                    FormVision formVision = new FormVision();
                    formVision.WindowObj          = visionInputPresenter.GetWindowFromString(visionWnd);
                    formVision.InputObj           = visionInputPresenter.GetInputFromString(visionInput);
                    formVision.OnScreenDisplayObj = visionInputPresenter.GetOSDFromString(visionOSD);
                    formVision.NumberOfInputs     = ServerDbHelper.GetInstance().GetSystemInputCount();

                    if (formVision.ShowDialog(this) == System.Windows.Forms.DialogResult.OK)
                    {
                        updatedList.Add(visionDataId, formVision);
                    }
                }
            }

            foreach (KeyValuePair <uint, FormVision> data in updatedList)
            {
                visionInputPresenter.EditVisionInput(
                    data.Key,
                    data.Value.WindowObj,
                    data.Value.InputObj,
                    data.Value.OnScreenDisplayObj);
            }
        }