Example #1
0
        private void NewImageBrush(bool editExisting)
        {
            FileBrowserControl control = new FileBrowserControl();
            PosDialogWindow    window  = new PosDialogWindow(control,
                                                             "Image Brush File Browser", 650, 440);

            PosDialogWindow.ShowPosDialogWindow(this, window);
            if (control.SelectedDirectoryEntry != null)
            {
                BitmapImage image = null;
                try
                {
                    image = new BitmapImage(
                        new Uri(control.SelectedDirectoryEntry.Fullpath, UriKind.Absolute));
                }
                catch (Exception)
                {
                    PosDialogWindow.ShowDialog(Window.GetWindow(this),
                                               "That is not a valid image file", "Error");
                }
                if (image != null)
                {
                    UserControl.SelectedBrush = new ImageBrush(image);
                }
            }
        }
Example #2
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);
        }
Example #3
0
        void WebBrowserHostControl_Initialized(object sender, EventArgs e)
        {
            PosDialogWindow window = (PosDialogWindow)Window.GetWindow(this);

            window.LocationChanged += new EventHandler(window_LocationChanged);
            window.Closing         += new System.ComponentModel.CancelEventHandler(window_Closing);
        }
        private void InitializeForGoogleMaps()
        {
            PosDialogWindow parent = (PosDialogWindow)Window.GetWindow(this);

            //webBrowser.Source = new Uri("http://www.google.com", UriKind.RelativeOrAbsolute);
            webBrowser.Navigate(new Uri("file:///D:/Viipe.com/PosControls/PosControls/bin/Debug/Maps.html"));
        }
Example #5
0
        void form_FormClosed(object sender, FormClosedEventArgs e)
        {
            PosDialogWindow window = (PosDialogWindow)Window.GetWindow(this);

            RemoveAllHandler();
            window.Close();
        }
Example #6
0
        private void NewVisualBrush(bool p)
        {
            FileBrowserControl control = new FileBrowserControl();
            PosDialogWindow    window  = new PosDialogWindow(control,
                                                             "Video Brush File Browser", 650, 440);

            PosDialogWindow.ShowPosDialogWindow(this, window);
            if (control.SelectedDirectoryEntry != null)
            {
                MediaElement media = null;
                try
                {
                    media        = new MediaElement();
                    media.Source =
                        new Uri(control.SelectedDirectoryEntry.Fullpath, UriKind.Absolute);
                    //if (!media.HasVideo)
                    //    throw new Exception("Not a video");
                }
                catch (Exception)
                {
                    media = null;
                    PosDialogWindow.ShowDialog(Window.GetWindow(this),
                                               "That is not a valid video file", "Error");
                }
                if (media != null)
                {
                    UserControl.SelectedBrush = new VisualBrush(media);
                }
            }
        }
Example #7
0
        private void PromptInteger()
        {
            Window parentWindow = Window.GetWindow(this);

            if (parentWindow is IShadeable)
            {
                ((IShadeable)parentWindow).ShowShadingOverlay = true;
            }
            int?currentValue = null;

            try
            {
                currentValue = Convert.ToInt32(Text);
            }
            catch
            {
            }
            int?newValue = PosDialogWindow.PromptNumber(KeyboardTitleText, currentValue);

            if ((newValue != null) && newValue.HasValue)
            {
                Text = "" + newValue;
            }
            if (parentWindow is IShadeable)
            {
                ((IShadeable)parentWindow).ShowShadingOverlay = false;
            }
        }
Example #8
0
        private void PromptForDate()
        {
            Window window = Window.GetWindow(this);

            if (window is PosDialogWindow)
            {
                PosDialogWindow dialogWindow = (PosDialogWindow)window;
                dialogWindow.ShowShadingOverlay = true;
                DateTime?date = PosDialogWindow.PromptForDay("Enter Date", CurrentDateTime);
                if (date.HasValue)
                {
                    Year  = date.Value.Year;
                    Month = date.Value.Month;
                    Day   = date.Value.Day;
                }
                dialogWindow.ShowShadingOverlay = false;
            }
            else
            {
                DateTime?date = PosDialogWindow.PromptForDay("Enter Date", CurrentDateTime);
                if (date.HasValue)
                {
                    Year  = date.Value.Year;
                    Month = date.Value.Month;
                    Day   = date.Value.Day;
                }
            }
        }
Example #9
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);
        }
Example #10
0
        public static bool?ShowPosDialogWindow(PosDialogWindow window)
        {
            DependencyObject control =
                Application.Current.Windows.Cast <Window>().SingleOrDefault(x => x.IsActive) ??
                Application.Current.MainWindow;

            return(control == null ? null : ShowPosDialogWindow(control, window));
        }
Example #11
0
        private void RemoveAllHandler()
        {
            PosDialogWindow window = (PosDialogWindow)Window.GetWindow(this);

            //form.FormClosing -= form_FormClosing;
            form.FormClosed       -= form_FormClosed;
            window.Closing        -= window_Closing;
            this.Initialized      -= WebBrowserHostControl_Initialized;
            this.SizeChanged      -= WebBrowserHostControl_SizeChanged;
            this.IsVisibleChanged -= WebBrowserHostControl_IsVisibleChanged;
        }
Example #12
0
 private void buttonResetDefault_Click(object sender, RoutedEventArgs e)
 {
     ThisContextMenu.IsOpen = false;
     if (PosDialogWindow.ShowDialog(
             "Are you sure you want to reset this brush to its default?", "Confirm Reset",
             DialogButtons.YesNo) == DialogButton.Yes)
     {
         UserControl.SelectedBrush =
             ConfigurationObjectManager.CreateBrush(UserControl.SelectedBrushName, true);
     }
 }
Example #13
0
        public Point GetControlPoint(Grid control)
        {
            PosDialogWindow window = (PosDialogWindow)Window.GetWindow(this);

            if (window != null)
            {
                Point            pt        = GetPhysicalTopLeftPoint(window);
                GeneralTransform transform = control.TransformToAncestor(window);
                Point            offset    = transform.Transform(new Point(0, 0));
                return(new Point(pt.X + offset.X, pt.Y + offset.Y));
            }
            return(new Point());
        }
 private void buttonSelectRange_Click(object sender, RoutedEventArgs e)
 {
     if (StartDate > EndDate)
     {
         PosDialogWindow.ShowDialog(
             "Your start date is later than your end date", "Invalid Range",
             DialogButtons.Ok);
     }
     else
     {
         Window.GetWindow(this).Close();
     }
 }
        private void buttonSave_Click(object sender, RoutedEventArgs e)
        {
            // Verify that gradient stops are not empty
            if (listBoxGradientStopCollection.Items.Count < 2)
            {
                PosDialogWindow.ShowDialog(
                    "You must enter at least two gradient stops.", "Error");
                return;
            }

            // Close Window
            Window.GetWindow(this).Close();
        }
Example #16
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);
        }
Example #17
0
        public static DialogButton ShowDialog(Window owner, string text, string title, DialogButtons buttons, bool shadeParent)
        {
            var window  = new PosDialogWindow(owner, shadeParent);
            var control = (DialogBoxControl)window.DockedControl;

            control.InitilizeButtonChoices(buttons);

            double width, height;

            MeasureText(control.textBox1, text, out width, out height);

            control.textBox1.Text     = text;
            window.IsClosable         = false;
            window.Width              = width;
            window.Height             = height;
            window.labelTitle.Content = title;
            if (owner.Topmost)
            {
                window.Topmost = true;
                owner.Topmost  = false;
            }
            var shadeable = owner as IShadeable;

            if (shadeable != null)
            {
                shadeable.ShowShadingOverlay = true;
            }
            window.ShowDialog();
            if (shadeable != null)
            {
                ((IShadeable)owner).ShowShadingOverlay = false;
            }
            if (window.Topmost)
            {
                owner.Topmost = true;
            }
            if (control.IsOK)
            {
                return(DialogButton.Ok);
            }
            if (control.IsYes)
            {
                return(DialogButton.Yes);
            }
            if (buttons == DialogButtons.OkCancel)
            {
                return(DialogButton.Cancel);
            }
            return(DialogButton.No);
        }
        private void buttonAdd_Click(object sender, RoutedEventArgs e)
        {
            GradientStopEditorControl control = new GradientStopEditorControl();
            PosDialogWindow           window  = new PosDialogWindow(control, "Gradient Stop Editor", 450, 500);

            if ((PosDialogWindow.ShowPosDialogWindow(this, window) != null) &&
                (control.GradientStop != null))
            {
                gradientStopCollection.Add(control.GradientStop);
                listBoxGradientStopCollection.Items.Add(
                    new FormattedListBoxItem(control.GradientStop, true));
                SetPreviewSwatch();
                buttonSave.IsEnabled = true;
            }
        }
Example #19
0
        private void NewGradientBrush(bool editExisting)
        {
            GradientBrushEditorControl control = new GradientBrushEditorControl();
            PosDialogWindow            window  = new PosDialogWindow(control,
                                                                     "Gradient Brush Editor", 780, 465);

            if (editExisting)
            {
                control.SelectedBrush = UserControl.SelectedBrush as GradientBrush;
            }
            if (PosDialogWindow.ShowPosDialogWindow(this, window) != null)
            {
                UserControl.SelectedBrush = control.SelectedBrush;
            }
        }
Example #20
0
        private void NewSolidColorBrush(bool editExisting)
        {
            SolidColorBrushEditorControl control = new SolidColorBrushEditorControl();
            PosDialogWindow window = new PosDialogWindow(control,
                                                         "Solid Color Brush Editor", 500, 260);

            if (editExisting)
            {
                control.SelectedBrush = UserControl.SelectedBrush as SolidColorBrush;
            }
            if (PosDialogWindow.ShowPosDialogWindow(this, window) != null)
            {
                UserControl.SelectedBrush = control.SelectedBrush;
            }
        }
Example #21
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            DateTimeComboControl editor = new DateTimeComboControl();
            PosDialogWindow      window = new PosDialogWindow(editor, "Modify Date and Time");

            editor.SelectedDateTime         = SelectedDateTime;
            ParentWindow.ShowShadingOverlay = true;
            window.Width  = 560;
            window.Height = 475;
            window.ShowDialog((Window)ParentWindow);
            ParentWindow.ShowShadingOverlay = false;
            if (!window.ClosedByUser)
            {
                SelectedDateTime = editor.SelectedDateTime;
            }
        }
Example #22
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);
        }
Example #23
0
        private void PromptPercentage()
        {
            double?currentValue = null;

            try
            {
                currentValue = Convert.ToDouble(Text.Replace("%", ""));
            }
            catch
            {
            }
            double?prompt = PosDialogWindow.PromptPercentage(this, KeyboardTitleText, (double?)null);

            if (prompt != null && prompt.HasValue)
            {
                Text = "" + (prompt.Value * 100).ToString("F1") + "%";
            }
        }
Example #24
0
        private TimeSpan?PromptForTime()
        {
            TimeSpan?time   = null;
            Window   window = Window.GetWindow(this);

            if (window is IShadeable)
            {
                IShadeable dialogWindow = (IShadeable)window;
                dialogWindow.ShowShadingOverlay = true;
                time = PosDialogWindow.PromptForTime("Enter Time", CurrentDateTime.TimeOfDay);
                dialogWindow.ShowShadingOverlay = false;
            }
            else
            {
                time = PosDialogWindow.PromptForTime("Enter Time", CurrentDateTime.TimeOfDay);
            }
            return(time);
        }
Example #25
0
        private void PromptCurrency()
        {
            Window parentWindow = Window.GetWindow(this);

            if (parentWindow is IShadeable)
            {
                ((IShadeable)parentWindow).ShowShadingOverlay = true;
            }
            double?prompt = PosDialogWindow.PromptCurrency(KeyboardTitleText, (double?)null);

            if ((prompt != null) && prompt.HasValue)
            {
                Text = prompt.Value.ToString("C2");
            }
            if (parentWindow is IShadeable)
            {
                ((IShadeable)parentWindow).ShowShadingOverlay = false;
            }
        }
Example #26
0
        private void PromptKeyboard(bool isPassword)
        {
            Window parentWindow = Window.GetWindow(this);

            if (parentWindow is IShadeable)
            {
                ((IShadeable)parentWindow).ShowShadingOverlay = true;
            }
            string prompt = PosDialogWindow.PromptKeyboard(KeyboardTitleText, Text, isPassword, KeyboardShiftMode);

            if (prompt != null)
            {
                Text = prompt;
            }
            if (parentWindow is IShadeable)
            {
                ((IShadeable)parentWindow).ShowShadingOverlay = false;
            }
        }
Example #27
0
        private void SetWindowLocation()
        {
            PosDialogWindow window = (PosDialogWindow)Window.GetWindow(this);

            if ((window != null) && !form.IsDisposed)
            {
                try
                {
                    Point topLeftPoint = GetControlPoint(gridControl);
                    form.Location = new System.Drawing.Point((int)topLeftPoint.X, (int)topLeftPoint.Y);

                    webBrowser.Width  = form.Width = (int)gridControl.ActualWidth;
                    webBrowser.Height = form.Height = (int)gridControl.ActualHeight;
                }
                catch
                {
                }
            }
        }
Example #28
0
        /// <summary>
        /// ToDo: Unfinished
        /// </summary>
        #warning This ShowDialog method is unfinished
        public static int ShowDialog(Window owner, string text, string title,
                                     string[] buttonChoices)
        {
            PosDialogWindow  window  = new PosDialogWindow(owner);
            DialogBoxControl control = (DialogBoxControl)window.DockedControl;

            double width, height;

            MeasureText(control.textBox1, text, out width, out height);

            control.textBox1.Text     = text;
            window.IsClosable         = false;
            window.Width              = width;
            window.Height             = height;
            window.labelTitle.Content = title;
            window.ShowDialog();

            // Return the selected button index, not -1
            return(-1);
        }
Example #29
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);
        }
Example #30
0
        public static bool?ShowPosDialogWindow(DependencyObject control,
                                               PosDialogWindow window)
        {
            Window parentWindow =
                (control is Window ? (Window)control : GetWindow(control));
            var shadeable = parentWindow as IShadeable;

            if (shadeable != null)
            {
                shadeable.ShowShadingOverlay = true;
            }

            bool?result = window.ShowDialog(parentWindow);

            if (shadeable != null)
            {
                shadeable.ShowShadingOverlay = false;
            }

            return(window.ClosedByUser ? null : result);
        }