Пример #1
0
        public override void ZoomBounds(Control control, ZoomBoundsInfo infos)
        {
            C1InputPanel ip = control as C1InputPanel;

            if (ip != null)
            {
                ip.UpdateFontZoom(infos.TargetFactor, false);
                float k = infos.TargetFactor / infos.CurrentFactor;
                control.Scale(new SizeF(k, k));
            }
        }
Пример #2
0
        public static void Invoke_InputPanel_Ctl_Enabled(C1InputPanel inp, bool enabled)
        {
            if (inp.InvokeRequired)
            {
                inp.Invoke(new delInvoke_InputPanel_Ctl_Enabled(Invoke_InputPanel_Ctl_Enabled), new object[] { inp, enabled });
                return;
            }



            foreach (InputComponent c in inp.Items)
            {
                c.Enabled = enabled;
            }
        }
Пример #3
0
        /// <summary>
        /// inputpannel 그룹에 선택된 그룹만 보이게 한다.
        /// </summary>
        /// <param name="inp"></param>
        /// <param name="strGrpNames"></param>
        public static void Invoke_InputPanel_Group_Collapsed(C1InputPanel inp, string [] strGrpNames)
        {
            if (inp.InvokeRequired)
            {
                inp.Invoke(new delInvoke_InputPanel_Group_Collapsed(Invoke_InputPanel_Group_Collapsed), new object[] { inp, strGrpNames });
                return;
            }



            InputGroupHeader grp = null;

            //일단 전부 않보이게..
            foreach (InputComponent c in inp.Items)
            {
                grp = c as InputGroupHeader;

                if (grp != null)
                {
                    grp.Height     = 0;
                    grp.Collapsed  = true;
                    grp.Visibility = C1.Win.C1InputPanel.Visibility.Hidden;
                }
            }


            //대상만 보이게..
            foreach (InputComponent c in inp.Items)
            {
                grp = c as InputGroupHeader;

                if (grp != null)
                {
                    foreach (string strGrpName in strGrpNames)
                    {
                        if (grp.Name == strGrpName)
                        {
                            //grp.Height = -1;
                            grp.Collapsed  = false;
                            grp.Visibility = C1.Win.C1InputPanel.Visibility.Visible;
                            break;
                        }
                    }
                }
            }
        }
Пример #4
0
        /// <summary>
        /// InputComboBox에 string 배열의 값을 item으로 추가한다.
        /// </summary>
        /// <param name="inp"></param>
        /// <param name="cmb"></param>
        /// <param name="strItems"></param>
        /// <returns></returns>
        public static void Invoke_InputComboBox_Items_AddItems(C1InputPanel inp,
                                                               C1.Win.C1InputPanel.InputComboBox cmb, string[] strItems)
        {
            if (inp.InvokeRequired)
            {
                inp.Invoke(new delInvoke_InputComboBox_Items_AddItems(Invoke_InputComboBox_Items_AddItems), new object[] { inp, cmb, strItems });
                return;
            }

            InputOption io;

            foreach (string str in strItems)
            {
                io = new InputOption(str);
                cmb.Items.Add(io);
            }
        }
        private void InputPanel_ValidateCurrentItem(object sender, System.ComponentModel.CancelEventArgs e)
        {
            C1InputPanel inputPanel = sender as C1InputPanel;
            DataRowView  view       = inputPanel.CurrentItem as DataRowView;

            if (view != null)
            {
                var row       = view.Row;
                var errorList = new ObservableCollection <ErrorInfo>();
                if (row["Last"] != null && string.IsNullOrWhiteSpace(row["Last"].ToString()))
                {
                    errorList.Add(new ErrorInfo {
                        ErrorInputName = "Last", ErrorContent = "Last name is required."
                    });
                }
                if (row["Last"] != null && row["Last"].ToString().Length > 15)
                {
                    errorList.Add(new ErrorInfo {
                        ErrorInputName = "Last", ErrorContent = "Last Name should be less than 15 characters."
                    });
                }
                if (row["Weight"] != null && row["Weight"].ToString().Length > 0 && (double)row["Weight"] > 10000)
                {
                    errorList.Add(new ErrorInfo {
                        ErrorInputName = "Weight", ErrorContent = "Weight is too high."
                    });
                }
                if (row["BirthDate"] != null && !string.IsNullOrWhiteSpace(row["BirthDate"].ToString()) && (DateTime)row["BirthDate"] > DateTime.Now)
                {
                    errorList.Add(new ErrorInfo {
                        ErrorInputName = "BirthDate", ErrorContent = "The birth date should not late than now."
                    });
                }
                if (row["Phone"] != null && string.IsNullOrEmpty(row["Phone"].ToString().Replace("\0", "")))
                {
                    errorList.Add(new ErrorInfo {
                        ErrorInputName = "Phone", ErrorContent = "Phone number is required."
                    });
                }
                inputPanel.ValidationErrors = errorList;
                if (errorList.Count > 0)
                {
                    e.Cancel = true;
                }
            }
        }
Пример #6
0
        /// <summary>
        /// InputComboBox에 string 배열의 값을 Group으로 추가한다.
        /// </summary>
        /// <param name="inp"></param>
        /// <param name="cmb"></param>
        /// <param name="strItems"></param>
        /// <returns></returns>
        public static void Invoke_InputComboBox_Items_AddGroups(C1InputPanel inp,
                                                                C1.Win.C1InputPanel.InputComboBox cmb, string[] strGroups)
        {
            if (inp.InvokeRequired)
            {
                inp.Invoke(new delInvoke_InputComboBox_Items_AddItems(Invoke_InputComboBox_Items_AddGroups), new object[] { inp, cmb, strGroups });
                return;
            }

            InputGroupHeader ig;

            foreach (string str in strGroups)
            {
                ig      = new InputGroupHeader();
                ig.Text = str;
                cmb.Items.Add(ig);
            }
        }
Пример #7
0
        /// <summary>
        /// InputComboBox에 값을 선택한다.
        /// </summary>
        /// <param name="cmb"></param>
        /// <param name="strField"></param>
        public static void Invoke_InputComboBox_SetSelectedValue(C1InputPanel inp,
                                                                 C1.Win.C1InputPanel.InputComboBox cmb, string strValue)
        {
            if (inp.InvokeRequired)
            {
                inp.Invoke(new delInvoke_InputComboBox_SetSelectedValue(Invoke_InputComboBox_SetSelectedValue), new object[] { inp, cmb, strValue });
                return;
            }

            if (cmb.DataSource != null)
            {
                foreach (DataRowView dr in ((DataTable)cmb.DataSource).DefaultView)
                {
                    if (dr[cmb.DisplayMember].ToString() == strValue)
                    {
                        cmb.SelectedValue = dr;
                        return;
                    }
                }

                cmb.SelectedIndex = -1;
            }
            else
            {
                InputOption io;
                foreach (InputComponent i in cmb.Items)
                {
                    io = i as InputOption;
                    if (io != null)
                    {
                        if (io.Text == strValue)
                        {
                            cmb.SelectedOption = io;
                            return;
                        }
                    }
                }
                cmb.SelectedIndex = -1;
            }
        }
Пример #8
0
        /// <summary>
        /// InputComboBox에 값을 선택한다.
        /// </summary>
        /// <param name="cmb"></param>
        /// <param name="strField"></param>
        public static void Invoke_InputComboBox_SetSelectedValue(C1InputPanel inp,
                                                                 C1.Win.C1InputPanel.InputComboBox cmb, string strField, string strValue)
        {
            if (inp.InvokeRequired)
            {
                inp.Invoke(new delInvoke_InputComboBox_SetSelectedValue2(Invoke_InputComboBox_SetSelectedValue), new object[] { inp, cmb, strField, strValue });
                return;
            }

            if (cmb.DataSource != null)
            {
                DataView dv;

                DataTable dt = cmb.DataSource as DataTable;


                if (dt != null)
                {
                    dv = dt.DefaultView;
                }
                else
                {
                    dv = cmb.DataSource as DataView;
                }


                foreach (DataRowView dr in dv)
                {
                    if (dr[strField].ToString().Trim() == strValue)
                    {
                        Application.DoEvents();
                        cmb.SelectedValue = dr;
                        return;
                    }
                }

                cmb.SelectedIndex = -1;
            }
        }
Пример #9
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="inp"></param>
        /// <returns></returns>
        public static void Invoke_InputPanel_Reset(C1InputPanel inp)
        {
            if (inp.InvokeRequired)
            {
                inp.Invoke(new delInvoke_InputPanel_Reset(Invoke_InputPanel_Reset), new object[] { inp });
                return;
            }

            foreach (InputComponent ctl in inp.Items)
            {
                InputDatePicker dt = ctl as InputDatePicker;
                if (dt != null)
                {
                    dt.ValueIsNull = true;
                    continue;
                }

                InputTimePicker tm = ctl as InputTimePicker;
                if (tm != null)
                {
                    tm.ValueIsNull = true;
                    continue;
                }

                InputTextBox txt = ctl as InputTextBox;
                if (txt != null)
                {
                    txt.Text = string.Empty;
                    continue;
                }

                InputComboBox cmb = ctl as InputComboBox;
                if (cmb != null)
                {
                    cmb.SelectedIndex = -1;
                    continue;
                }
            }
        }