Ejemplo n.º 1
0
        public static double?PromptCurrency(string fieldName, double?defaultValue)
        {
            NumberEntryControl control = new NumberEntryControl();
            PosDialogWindow    window  = new PosDialogWindow(control, fieldName);

            control.SetDefaultEnterEventHandler();
            control.DisplayAsCurrency = true;
            control.FloatValue        = defaultValue;
            window.IsClosable         = true;
            window.Width  = 210;
            window.Height = 340;
            window.ShowDialogForActiveWindow();
            double?value = null;

            if (!window.ClosedByUser)
            {
                try
                {
                    value = Convert.ToDouble(StripCurrencySymbols(control.Text));
                }
                catch
                {
                }
            }
            return(value);
        }
Ejemplo n.º 2
0
        public static int?PromptNumber(string fieldName, int?defaultValue)
        {
            NumberEntryControl control = new NumberEntryControl();
            PosDialogWindow    window  = new PosDialogWindow(control, fieldName);

            if (defaultValue.HasValue)
            {
                control.Text = "" + defaultValue.Value;
            }
            else
            {
                control.Text = "";
            }
            control.SetDefaultEnterEventHandler();
            window.IsClosable = true;
            window.Width      = 210;
            window.Height     = 340;
            window.ShowDialogForActiveWindow();
            int?value = null;

            if (!window.ClosedByUser)
            {
                try
                {
                    value = Convert.ToInt32(control.Text);
                }
                catch
                {
                }
            }
            return(value);
        }
Ejemplo n.º 3
0
        public static DateTime?PromptForDay(string fieldName, DateTime?day = null)
        {
            DateEntryControl control = new DateEntryControl();
            PosDialogWindow  window  = new PosDialogWindow(control, fieldName);

            control.SelectedDay = day.HasValue ? day.Value : DateTime.Now;
            window.IsClosable   = false;
            window.Width        = 410;
            window.Height       = 430;
            window.ShowDialogForActiveWindow();

            return(control.SelectedDay);
        }
Ejemplo n.º 4
0
        public static bool PromptDateRange(string fieldName, ref DateTime startDate, ref DateTime endDate)
        {
            StartDateEndDateControl control = new StartDateEndDateControl();
            PosDialogWindow         window  = new PosDialogWindow(control, fieldName, 670, 500)
            {
                IsClosable = true
            };

            window.ShowDialogForActiveWindow();
            if (window.ClosedByUser)
            {
                return(false);
            }
            startDate = control.StartDate;
            endDate   = control.EndDate;
            return(true);
        }
Ejemplo n.º 5
0
        /*
         * public static PhoneNumber PromptPhoneNumber(string fieldName, PhoneNumber phoneNumber)
         * {
         *  // Todo: PromptPhoneNumber
         *  throw new NotImplementedException();
         * }
         */

        public static TimeSpan?PromptForTime(string fieldName, TimeSpan?timeOfDay)
        {
            TimeEntryControl control = new TimeEntryControl();
            PosDialogWindow  window  = new PosDialogWindow(control, fieldName);

            if (timeOfDay.HasValue)
            {
                control.TimeOfDay = timeOfDay.Value;
            }
            //control.UseMilitaryFormat = true;
            window.IsClosable = false;
            window.Width      = 250;
            window.Height     = 390;
            window.ShowDialogForActiveWindow();
            if (!control.IsOK)
            {
                return(null);
            }
            return(control.TimeOfDay);
        }
Ejemplo n.º 6
0
        public static string PromptKeyboard(string fieldName, string defaultValue, bool isPassword, ShiftMode keyboardShiftMode)
        {
            KeyboardEntryControl control = new KeyboardEntryControl();
            PosDialogWindow      window  = new PosDialogWindow(control, fieldName);

            control.UsePasswordTextField = isPassword;
            control.ShiftMode            = keyboardShiftMode;
            control.Text      = defaultValue;
            window.IsClosable = false;
            window.Width      = 835;
            window.Height     = 390;
            window.ShowDialogForActiveWindow();
            if (control.WasCanceled)
            {
                return(null);
            }
            if (control.Text == null)
            {
                return("");
            }
            return(control.Text);
        }