Exemplo n.º 1
0
 public static Button CreateFixItButton([NotNull] this ModernDialog dlg, [CanBeNull] NonfatalErrorSolution solution, NonfatalErrorEntry entry = null)
 {
     if (dlg == null)
     {
         throw new ArgumentNullException(nameof(dlg));
     }
     return(solution == null ? null : dlg.CreateCloseDialogButton(solution.DisplayName, false, false, MessageBoxResult.OK, solution));
 }
Exemplo n.º 2
0
        public static Button CreateFixItButton([NotNull] this ModernDialog dlg, [CanBeNull] NonfatalErrorSolution solution, NonfatalErrorEntry entry = null)
        {
            if (dlg == null)
            {
                throw new ArgumentNullException(nameof(dlg));
            }
            if (solution == null)
            {
                return(null);
            }

            return(new Button {
                Content = GetFixButtonContent(solution),
                Command = solution,
                CommandParameter = null,
                IsDefault = false,
                IsCancel = false,
                MinHeight = 21,
                MinWidth = 65,
                Margin = new Thickness(4, 0, 0, 0)
            });
        }
Exemplo n.º 3
0
        private static object GetFixButtonContent(NonfatalErrorSolution solution)
        {
            if (solution.IconData == null)
            {
                return(solution.DisplayName);
            }

            var icon = new Path {
                Data              = solution.IconData,
                Margin            = new Thickness(0, 0, 6, -1),
                VerticalAlignment = VerticalAlignment.Center,
                Stretch           = Stretch.Uniform,
                Width             = 12,
                Height            = 12
            };

            icon.SetResourceReference(Shape.FillProperty, @"Accent");
            return(new DockPanel {
                Children = { icon, new TextBlock {
                                 Text = solution.DisplayName
                             } }
            });
        }