Esempio n. 1
0
        private void btn_Login_Click(object sender, EventArgs e)
        {
            string email    = txb_LoginEmail.Text;
            string password = txb_LoginPassword.Text;

            bool result1 = my.UserChecking(email, password);

            if (result1)
            {
                if (my.AdminChecking())
                {
                    SelectForm selectForm = new SelectForm();
                    selectForm.ShowDialog();
                }
                else
                {
                    AdminSelectForm adminSelectForm = new AdminSelectForm();
                    adminSelectForm.ShowDialog();
                }
            }
            else
            {
                MessageBox.Show("Wrong!");
            }
        }
 protected override bool RunDialog(IntPtr hwndOwner)
 {
     using (SelectForm frm = new SelectForm())
     {
         frm.Text  = this.Title;
         frm.Items = this.Items;
         if (this.Selected != null)
         {
             frm.Selected = this.Selected;
         }
         else
         {
             frm.SelectedIndex = this.SelectedIndex;
         }
         frm.CanEdit = this.CanEdit;
         Form owner = (Form)Control.FromHandle(hwndOwner);
         if (owner != null)
         {
             frm.TopMost = owner.TopMost;
         }
         bool flag = frm.ShowDialog() == DialogResult.OK;
         if (flag)
         {
             this.Selected      = frm.Selected;
             this.SelectedIndex = frm.SelectedIndex;
         }
         return(flag);
     }
 }
Esempio n. 3
0
        /// <summary>
        /// Displays a selection form to the user.
        /// </summary>
        /// <remarks>
        /// This method is called by the <see cref="SynchronizationContext"/> in order to create and execute the
        /// form on the appropriate thread.
        /// </remarks>
        /// <param name="p_lstOptions">The options from which to select.</param>
        /// <param name="p_strTitle">The title of the selection form.</param>
        /// <param name="p_booSelectMany">Whether more than one items can be selected.</param>
        /// <returns>The selected option names.</returns>
        private string[] ShowSelect(IList <SelectOption> p_lstOptions, string p_strTitle, bool p_booSelectMany)
        {
            SelectForm sfmSelectForm = new SelectForm(p_lstOptions, p_strTitle, p_booSelectMany);

            sfmSelectForm.ShowDialog();
            return(sfmSelectForm.SelectedOptionNames);
        }
Esempio n. 4
0
        /// <summary>
        /// 右侧血压按钮事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnRight_Click(object sender, EventArgs e)
        {
            SelectForm select = new SelectForm(this.Model.IDCardNo, "20")
            {
                StartPosition = FormStartPosition.CenterScreen
            };

            if (select.ShowDialog() == DialogResult.OK)
            {
                // 根据设定值判断为左侧血压(L)还是右侧血压(R)
                if (LRType.Equals("L"))
                {
                    this.healthHouserModel.RightHeight = new decimal?((int.Parse(select.m_Result.value1) + m));
                    this.healthHouserModel.RightPre    = new decimal?((int.Parse(select.m_Result.value2) + n));
                }
                else
                {
                    this.healthHouserModel.RightHeight = new decimal?(int.Parse(select.m_Result.value1));
                    this.healthHouserModel.RightPre    = new decimal?(int.Parse(select.m_Result.value2));
                }

                this.txtRightHeight.Text = this.healthHouserModel.RightHeight.ToString();
                this.txtRightPre.Text    = this.healthHouserModel.RightPre.ToString();
                this.txtPulseRate.Text   = select.m_Result.value3;
            }
        }
        private void btnSelectBE_Click(object sender, EventArgs e)
        {
            SelectForm select = new SelectForm(this.Model.IDCardNo, "33")
            {
                StartPosition = FormStartPosition.CenterScreen
            };

            if (select.ShowDialog() == DialogResult.OK)
            {
                this.HHAssistCheck.PRO = select.m_Result.value6.ToString();
                this.HHAssistCheck.GLU = select.m_Result.value5.ToString();
                this.HHAssistCheck.KET = select.m_Result.value4.ToString();
                this.HHAssistCheck.BLD = select.m_Result.value2.ToString();
                this.HHAssistCheck.LEU = select.m_Result.value9.ToString();  //白细胞
                this.HHAssistCheck.NIT = select.m_Result.value8.ToString();  //亚硝酸
                this.HHAssistCheck.UBG = select.m_Result.value1.ToString();  //尿胆原
                this.HHAssistCheck.BIL = select.m_Result.value3.ToString();  //胆红素
                this.HHAssistCheck.PH  = select.m_Result.value7.ToString();  //ph
                this.HHAssistCheck.SG  = select.m_Result.value10.ToString(); //比重
                this.HHAssistCheck.VC  = select.m_Result.value11.ToString(); //vc

                this.tbPRO.Text = select.m_Result.value6;
                this.tbGLU.Text = select.m_Result.value5;
                this.tbKET.Text = select.m_Result.value4;
                this.tbBLD.Text = select.m_Result.value2;
                this.tbLEU.Text = select.m_Result.value9.ToString();  //白细胞
                this.tbNIT.Text = select.m_Result.value8.ToString();  //亚硝酸
                this.tbUBG.Text = select.m_Result.value1.ToString();  //尿胆原
                this.tbBIL.Text = select.m_Result.value3.ToString();  //胆红素
                this.tbPH.Text  = select.m_Result.value7.ToString();  //ph
                this.tbSG.Text  = select.m_Result.value10.ToString(); //比重
                this.tbVC.Text  = select.m_Result.value11.ToString(); //VC
            }
        }
Esempio n. 6
0
        public void TestThatSelectLabelDisplaysItemSelected()
        {
            selectForm = new SelectForm();
            selectForm.ShowInTaskbar = false;
            selectForm.ShowDialog();
            string outputString = selectForm.SelectLabel.Text;

            Assert.AreEqual("Asus G71GX-RXO5 $719.97", outputString);
        }
Esempio n. 7
0
        /// <summary>
        /// 体重按钮事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnWeight_Click(object sender, EventArgs e)
        {
            SelectForm select = new SelectForm(this.Model.IDCardNo, "22")
            {
                StartPosition = FormStartPosition.CenterScreen
            };

            if (select.ShowDialog() == DialogResult.OK)
            {
                this.txtWeight.Text = select.m_Result.value1;
            }
        }
Esempio n. 8
0
        private void Edit_Delegate_ButtonPressed(Object sender, ButtonPressedEventArgs e)
        {
            SelectForm Form = new SelectForm("Выберите сотрудника для делегирования...", CardHost, Context, SelectionType.StaffEmployee, Guid.Empty, Edit_Delegate.Text);

            switch (Form.ShowDialog())
            {
            case DialogResult.OK:
                Edit_Delegate.EditValue = Form.SelectedItem.Name;
                Edit_Delegate.Tag       = Form.SelectedItem.Id;
                break;
            }
        }
Esempio n. 9
0
        public void TestSelectLabelDisplayItemSelected()
        {
            //Arrange
            string outputString;

            //Act
            selectForm = new SelectForm();
            selectForm.ShowInTaskbar = false;
            selectForm.ShowDialog();
            outputString = selectForm.SelectLabel.Text;
            //Assert
            Assert.AreEqual("Asus G71GX-RX05 $719.97", outputString);
        }
Esempio n. 10
0
        /// <summary>
        /// 血氧按钮事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnBloodOxygen_Click(object sender, EventArgs e)
        {
            SelectForm select = new SelectForm(this.Model.IDCardNo, "32")
            {
                StartPosition = FormStartPosition.CenterScreen
            };

            if (select.ShowDialog() == DialogResult.OK)
            {
                this.txtBloodOxygen.Text = select.m_Result.value1;
                this.txtPulseRate.Text   = select.m_Result.value2;
            }
        }
        public void TestMethod1()
        {
            // arrange
            SelectForm selectForm;

            //act
            selectForm = new SelectForm();
            selectForm.ShowInTaskbar = false;
            selectForm.ShowDialog();

            //assert
            Assert.IsTrue(selectForm.HasLoadedDataSource());
        }
Esempio n. 12
0
        private void Form_OnExportData(object sender, ResultEventArgs e)
        {
            if (this._exporters.Count > 1)
            {
                var ttl    = "Exporters";
                var msg    = "Select the target to export data to.";
                var frm    = new SelectForm(ttl, msg, this._exporters.Keys.Select(x => x.ToString()));
                var result = frm.ShowDialog();

                if (result != DialogResult.OK)
                {
                    return;
                }

                ControllerType type;
                if (Enum.TryParse(frm.SelectedItems[0], out type))
                {
                    this._selectedExporter = this._exporters[type];
                }
            }

            if (this._selectedExporter == null)
            {
                return;
            }

            string target;

            switch (this._selectedExporter.Type)
            {
            case ControllerType.EXCEL:
                SaveFileDialog dialog = new SaveFileDialog {
                    Filter = "Excel Files|*.xlsx"
                };
                if (dialog.ShowDialog() != DialogResult.OK)
                {
                    return;
                }
                target = dialog.FileName;
                break;

            //case ControllerType.JSON:
            //    break;
            //case ControllerType.SQL:
            //    break;
            default:
                throw new ArgumentOutOfRangeException();
            }

            //e.Result = this._controller.ExportData(this._selectedExporter, target);
        }
Esempio n. 13
0
        private void OnMultipleExcelPages(object sender, MuliPageEventArgs e)
        {
            var title   = "Select Excel Sheets";
            var message = "The selected file contains multiple sheets. Please specify which sheet(s) to use!";
            var frm     = new SelectForm(title, message, e.Pages);

            if (frm.ShowDialog() == DialogResult.OK)
            {
                e.Pages = frm.SelectedItems.ToList();
            }
            else
            {
                e.Cancel = true;
            }
        }
Esempio n. 14
0
        public void TestThatSelectLabelDisplaysItemSelected()
        {
            // arrange

            string outputString;

            // act
            selectForm = new SelectForm();
            selectForm.ShowInTaskbar = false;
            selectForm.ShowDialog();
            outputString = selectForm.SelectionTextbox.Text;

            // assert
            Assert.AreEqual("Asus G71GX-RX05 719.97", outputString);
        }
Esempio n. 15
0
        public void addRole(Form parent)
        {
            SelectForm sf = new SelectForm(new SelectFormViewModel(DBRoleStorage.Instance.GetView()));

            sf.DGVData.Columns["creator"].Visible        = sf.DGVData.Columns["create_date"].Visible = sf.DGVData.Columns["modifier"].Visible = sf.DGVData.Columns["modify_date"].Visible = false;
            sf.DGVData.Columns["name"].HeaderText        = "Наименование";
            sf.DGVData.Columns["description"].HeaderText = "Описание";
            if (sf.ShowDialog(parent) == DialogResult.OK)
            {
                Role    role = DBRoleStorage.Instance.GetRole(sf.SelectedId);
                DataRow row  = Roles.NewRow();
                row["id"]   = role.Id;
                row["name"] = role.Name;
                Roles.Rows.Add(row);
            }
        }
Esempio n. 16
0
 protected override bool RunDialog(IntPtr hwndOwner)
 {
     using (SelectForm frm = new SelectForm())
     {
         frm.Text          = this.Title;
         frm.Items         = this.Items;
         frm.Selected      = this.Selected;
         frm.DropDownStyle = this.DropDownStyle;
         bool flag = frm.ShowDialog() == DialogResult.OK;
         if (flag)
         {
             this.Selected      = frm.Selected;
             this.SelectedIndex = frm.SelectedIndex;
         }
         return(flag);
     }
 }
Esempio n. 17
0
        public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
        {
            using (Transaction transaction = new Transaction(commandData.Application.ActiveUIDocument.Document, "WalterSelect"))
            {
                try
                {
                    transaction.Start();
                    SelectForm frmSelect = new SelectForm(commandData.Application);
                    frmSelect.ShowDialog();
                    transaction.Commit();
                }
                catch (Exception)
                {
                    return(Result.Failed);
                }
            }

            return(Result.Succeeded);
        }
Esempio n. 18
0
 protected override bool RunDialog(IntPtr hwndOwner)
 {
     using (SelectForm frm = new SelectForm())
     {
         frm.Text  = this.Title;
         frm.Items = this.Items;
         if (this.Selected != null)
         {
             frm.Selected = this.Selected;
         }
         else
         {
             frm.SelectedIndex = this.SelectedIndex;
         }
         frm.CanEdit = this.CanEdit;
         bool flag = frm.ShowDialog() == DialogResult.OK;
         if (flag)
         {
             this.Selected      = frm.Selected;
             this.SelectedIndex = frm.SelectedIndex;
         }
         return(flag);
     }
 }
Esempio n. 19
0
        private void Form_OnMapFields(object sender, CancelEventArgs e)
        {
            if (this._selectedExporter == null ||
                (this._exporters.Count > 1 &&
                 MessageBox.Show("Reset Exporter?", "", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes))
            {
                var ttl    = "Exporters";
                var msg    = "Select the target to map to.";
                var frm    = new SelectForm(ttl, msg, this._exporters.Keys.Select(x => x.ToString()));
                var result = frm.ShowDialog();

                if (result != DialogResult.OK)
                {
                    return;
                }

                ControllerType type;
                if (Enum.TryParse(frm.SelectedItems[0], out type))
                {
                    this._selectedExporter = this._exporters[type];
                }

                this._target = null;
            }

            if (this._selectedExporter == null)
            {
                return;
            }

            if (string.IsNullOrWhiteSpace(this._target) ||
                MessageBox.Show("Reset Export Target?", "", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
            {
                try
                {
                    switch (this._selectedExporter.Type)
                    {
                    case ControllerType.EXCEL:
                        this._selectedExporter.MultiplePages += this.OnMultipleExcelPages;
                        OpenFileDialog dialog = new OpenFileDialog {
                            Filter = "Excel Files|*.xls;*.xlsx;*.xlsm"
                        };
                        if (dialog.ShowDialog() != DialogResult.OK)
                        {
                            return;
                        }
                        this._target = dialog.FileName;
                        break;

                    //case ControllerType.JSON:
                    //    break;
                    //case ControllerType.SQL:
                    //    break;
                    default:
                        throw new ArgumentOutOfRangeException();
                    }
                }
                finally
                {
                    switch (this._selectedImporter.Type)
                    {
                    case ControllerType.EXCEL:
                        this._selectedImporter.MultiplePages -= this.OnMultipleExcelPages;
                        break;

                    //case ControllerType.JSON:
                    //    break;
                    //case ControllerType.SQL:
                    //    break;
                    default:
                        throw new ArgumentOutOfRangeException();
                    }
                }

                //this._controller.LoadTargetSchema(this._selectedExporter, this._target);

                this._controller.Pages = null;
            }

            if (this._controller.Pages == null ||
                MessageBox.Show("Reset Configuration?", "", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
            {
                this._controller.Pages = new List <PageConfig>();

                //foreach (SchemaInfo schema in this._controller.TargetSchema)
                //{
                //    this._controller.Pages.Add(new PageConfig(schema.Name, schema.Fields.ToArray()));
                //}
            }

            using (var controller = new MapFieldsController(this._controller))
            {
                controller.ShowDialog();
            }
        }
Esempio n. 20
0
        private void Form_OnLoadData(object sender, ResultEventArgs e)
        {
            this._form = new MainForm();

            if (this._importers.Count > 1)
            {
                var ttl = "Data Source";
                var msg = "Select the source from which to copy data.";
                var frm = new SelectForm(ttl, msg, this._importers.Keys.Select(x => x.ToString()));

                if (frm.ShowDialog() != DialogResult.OK)
                {
                    return;
                }

                ControllerType type;
                if (Enum.TryParse(frm.SelectedItems[0], out type))
                {
                    this._selectedImporter = this._importers[type];
                }
            }

            if (this._selectedImporter == null)
            {
                return;
            }

            try
            {
                switch (this._selectedImporter.Type)
                {
                case ControllerType.EXCEL:
                    this._selectedImporter.MultiplePages += this.OnMultipleExcelPages;
                    OpenFileDialog dialog = new OpenFileDialog {
                        Filter = "Excel Files|*.xls;*.xlsx;*.xlsm"
                    };
                    if (dialog.ShowDialog() != DialogResult.OK)
                    {
                        return;
                    }
                    this._source = dialog.FileName;
                    break;

                //case ControllerType.JSON:
                //    break;
                //case ControllerType.SQL:
                //    break;
                default:
                    throw new ArgumentOutOfRangeException();
                }

                //e.Result = this._controller.ImportData(this._selectedImporter, this._source);
            }
            finally
            {
                switch (this._selectedImporter.Type)
                {
                case ControllerType.EXCEL:
                    this._selectedImporter.MultiplePages -= this.OnMultipleExcelPages;
                    break;

                //case ControllerType.JSON:
                //    break;
                //case ControllerType.SQL:
                //    break;
                default:
                    throw new ArgumentOutOfRangeException();
                }
            }
        }
Esempio n. 21
0
        private void contextMenu_createStatement(object sender, EventArgs e)
        {
            SelectForm createStmForm = new SelectForm(selectedDatabase, tcpClient);

            createStmForm.ShowDialog(this);
        }
Esempio n. 22
0
        /// <summary>
        /// 輸出按鈕
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void buttonImport_Click(object sender, EventArgs e)
        {
            try
            {
                OpenFileDialog fileDialog = new OpenFileDialog();

                //File type
                fileDialog.Filter = "csv files(*.csv)|*.csv";

                if (fileDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    String[] headers = OutputFile.CSV.ReadHeaders(fileDialog.FileName);

                    if (headers == null)
                    {
                        MessageBox.Show(String.Format("該{0}檔案不存在數據"), fileDialog.FileName);
                    }
                    else
                    {
                        var names      = OutputFile.Config.GetNames();
                        var rules      = OutputFile.Config.GetRules();
                        var selectForm = new SelectForm(headers, names);
                        selectForm.ShowDialog();

                        headers = selectForm.GetHeaders();

                        var selectNumber = selectForm.GetSelect();
                        for (int point = 0; point < selectNumber.Length; point++)
                        {
                            Console.WriteLine(selectNumber[point]);
                        }

                        var series    = GetSeries(headers, selectNumber);
                        var seriesAvg = GetSeries(headers, selectNumber);
                        CleanArray();
                        CleanAvgArray();
                        CleanChart(ref _chart, true);
                        CleanChart(ref _chartAvg, true);

                        foreach (Series s in series)
                        {
                            try { _chart.Series.Add(s); }
                            catch (ArgumentException ex) { }
                        }

                        foreach (Series s in seriesAvg)
                        {
                            try { _chartAvg.Series.Add(s); }
                            catch (ArgumentException ex) { }
                        }


                        DrawCSV(fileDialog.FileName, rules, selectNumber);

                        if (OutputFile.CSV.OldToNewCSV(fileDialog.FileName,
                                                       OutputFile.Config.GetRules(), _listHeader.ToArray()) == true)
                        {
                            MessageBox.Show("檔案輸出成功");
                        }
                        else
                        {
                            MessageBox.Show("檔案輸出失敗");
                        }
                    }
                }
                else
                {
                    MessageBox.Show("請選擇正確檔案");
                }
            }
            catch (IOException ex)
            {
                MessageBox.Show("請先關閉該檔案");
            }
            catch (NullReferenceException ex)
            {
                MessageBox.Show("請確認檔案是否存在");
            }
        }
Esempio n. 23
0
 private void button1_Click(object sender, EventArgs e)
 {
     LoadFile("d:/Frank/SBML Models/BorisEjb.xml");
     SelectForm.InitializeFromModel(CurrentModel);
     SelectForm.ShowDialog();
 }