Ejemplo n.º 1
0
        public MainWindow(string imagePath)
        {
            MouseMovementHandler movementHandler = new MouseMovementHandler();

            movementHandler.MovementDetected += MouseMoved;
            movementHandler.MouseButtonUp    += MouseButtonUp;
            Application.AddMessageFilter(movementHandler);

            InitializeComponent();

            InitializeUI();
            InitializeTooltips();

            preFullscreenState = WindowState;

            imageViewer.BringToFront();

            if (!string.IsNullOrWhiteSpace(imagePath))
            {
                try
                {
                    imageEnumerator = new ImageDirectory(imagePath);
                    imageEnumerator.EnumerationUpdated
                        += ImageEnumerationUpdated;
                }
                catch (Exception) { SystemSounds.Exclamation.Play(); }
                ChangeImage(0);
            }

            KeyPreview = true;
        }
Ejemplo n.º 2
0
        private Brush CreateBrush(Window window, FrameworkElement element)
        {
            var brush = new RadialGradientBrush(Color, Colors.Transparent)
            {
                MappingMode       = BrushMappingMode.Absolute,
                RadiusX           = Radius,
                RadiusY           = Radius,
                Opacity           = Opacity,
                Transform         = Transform,
                RelativeTransform = RelativeTransform,
                Center            = new Point(double.NegativeInfinity, double.NegativeInfinity),
            };
            var handler = new MouseMovementHandler(element, brush, window);

            window.MouseMove += handler.OnMouseMove;
            window.Closed    += handler.OnClosed;
            return(brush);
        }