Пример #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);
                }
            }
        }
Пример #2
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);
                }
            }
        }
Пример #3
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);
     }
 }
Пример #4
0
 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();
        }
Пример #6
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);
        }
Пример #7
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;
            }
        }
Пример #8
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);
        }
Пример #9
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);
        }
Пример #10
0
        public static double?PromptPercentage(DependencyObject parentControl, string fieldName, double?defaultValue)
        {
            NumberEntryControl control     = new NumberEntryControl();
            PosDialogWindow    window      = new PosDialogWindow(control, fieldName);
            Window             ownerWindow = GetWindow(parentControl);

            control.SetDefaultEnterEventHandler();
            control.DisplayAsPercentage = true;
            control.UseDecimalPoint     = true;
            control.FloatValue          = defaultValue;
            window.IsClosable           = true;
            window.Width  = 210;
            window.Height = 340;
            if (ownerWindow is IShadeable)
            {
                (ownerWindow as IShadeable).ShowShadingOverlay = true;
            }
            window.ShowDialog(ownerWindow);
            if (ownerWindow is IShadeable)
            {
                (ownerWindow as IShadeable).ShowShadingOverlay = false;
            }
            double?value = null;

            if (!window.ClosedByUser)
            {
                try
                {
                    value = Convert.ToDouble(control.Text.Replace("%", "")) / 100;
                }
                catch
                {
                }
            }
            return(value);
        }