예제 #1
0
        public static void Show(Exception Error, string Title, string Subtitle)
        {
            var Reporter = new ApplicationErrorReporter(Error, Title, Subtitle);
            DialogOptionsWindow WinDialog = null;

            Display.OpenContentDialogWindow(ref WinDialog, "Problem...", Reporter);
        }
        /// <summary>
        /// Starts execution of progressive task. Returns indication of successful start.
        /// </summary>
        public static bool Execute(string Title, Func <ThreadWorker <TResult>, OperationResult <TResult> > WorkTask, Action <OperationResult <TResult> > EndTask)
        {
            try
            {
                DialogOptionsWindow Dialog = null;
                var Executor = new ProgressiveThreadedExecutor <TResult>(WorkTask, EndTask);
                Display.OpenContentDialogWindow <ProgressiveThreadedExecutorControl>(ref Dialog, Title, Executor.VisualControl, double.NaN, double.NaN);
            }
            catch (Exception Problem)
            {
                Display.DialogMessage("Attention!", "Report generation cannot be initiated!.\nProblem: " + Problem.Message,
                                      EMessageType.Error);
                return(false);
            }

            return(true);
        }
예제 #3
0
        private void UserControl_Loaded(object sender, RoutedEventArgs e)
        {
            this.ParentWindow = this.GetNearestVisualDominantOfType <DialogOptionsWindow>();

            this.FontFamilySelector.ItemsSource = Display.AvailableFontFamilies;
            this.FontSizeSelector.ItemsSource   = Display.AvailableFontSizes;

            this.SelectedTextFormat = InitialTextFormat.CreateClone(ECloneOperationScope.Deep, null);
            this.FontNameText.Text  = this.SelectedTextFormat.FontFamilyName;
            this.FontSizeText.Text  = this.SelectedTextFormat.FontSize.ToString();

            this.FontFamilySelector.SelectionChanged +=
                ((snd, args) =>
            {
                if (!this.FontNameText.IsFocused)
                {
                    this.FontNameText.Text = ((FontFamily)this.FontFamilySelector.SelectedItem).Source;
                }

                GenerateSelectedTextFormat();
            });

            this.FontSizeSelector.SelectionChanged +=
                ((snd, args) =>
            {
                if (!this.FontSizeText.IsFocused)
                {
                    this.FontSizeText.Text = ((int)this.FontSizeSelector.SelectedItem).ToString();
                }

                GenerateSelectedTextFormat();
            });

            this.StyleSelector.SelectionAction     = (() => GenerateSelectedTextFormat());
            this.AlignmentSelector.SelectionAction = ((alignment) => GenerateSelectedTextFormat());
        }
예제 #4
0
        public static void Execute(string Title, Func <BackgroundWorker, bool> WorkTask, Action EndTask)
        {
            DialogOptionsWindow Dialog = null;

            Display.OpenContentDialogWindow <ProgressiveBackgroundExecutor>(ref Dialog, Title, null, double.NaN, double.NaN, WorkTask, EndTask);
        }
예제 #5
0
        private void UserControl_Loaded(object sender, RoutedEventArgs e)
        {
            // Required because the poup loads the control even when not yet shown.
            if (!this.IsVisible)
            {
                return;
            }

            this.IsOverPopup = this.Parent is Popup;

            if (this.IsOverPopup)
            {
                this.Background      = Brushes.White;
                this.BorderThickness = new Thickness(0.5);

                this.BtnOK.IsDefault    = false;
                this.BtnCancel.IsCancel = false;

                /*- this.HelpText.Text = "Hold the Ctrl key to extend selection.";
                 * this.BtnOK.SetVisible(false);
                 * this.BtnCancel.SetVisible(false); */
            }

            this.ParentWindow = this.GetNearestVisualDominantOfType <DialogOptionsWindow>();

            if (this.ParentWindow != null)
            {
                this.ParentWindow.MinWidth   = 200;
                this.ParentWindow.ResizeMode = ResizeMode.NoResize;
            }

            this.SelectedBrush = (this.InitialBrush == null ? null : this.InitialBrush.Clone());

            this.BrushKindPicker.SelectionAction =
                (TypeIndex =>
            {
                this.PrimaryBrushColorsPalette.IsSelected = true;

                GenerateSelectedBrush();
            });

            this.OrientationPicker.SelectionAction =
                (direction =>
            {
                if (direction == Orientation.Vertical)
                {
                    this.BrushColorsTab.TabStripPlacement = Dock.Left;
                }
                else
                {
                    this.BrushColorsTab.TabStripPlacement = Dock.Top;
                }

                GenerateSelectedBrush();
            });

            this.PrimaryColorPicker.SelectionAction   = ((color, doubleclicked) => GenerateSelectedBrush(true, doubleclicked));
            this.SecondaryColorPicker.SelectionAction = ((color, doubleclicked) => GenerateSelectedBrush(true, doubleclicked));
            this.TertiaryColorPicker.SelectionAction  = ((color, doubleclicked) => GenerateSelectedBrush(true, doubleclicked));

            this.TransparencyPicker.SelectionAction = (opacity => GenerateSelectedBrush());

            this.IsReadyForSelection = true;
        }