예제 #1
0
        private void InitializeComponent()
        {
            AvaloniaXamlLoader.Load(this);

            _img = this.Get <Control>("img");
            _img.PointerMoved   += Image_PointerMoved;
            _img.PointerPressed += Img_PointerPressed;

            // Delegate is called from bg thread, use synchronous call to avoid concurrency issues within Avalonia.
            _viewModel = new SnowViewModel();
        }
예제 #2
0
        private void InitializeComponent()
        {
            AvaloniaXamlLoaderPortableXaml.Load(this);

            _img = ((Grid)Content).Children.First();
            _img.PointerMoved   += Image_PointerMoved;
            _img.PointerPressed += Img_PointerPressed;

            // Delegate is called from bg thread, use synchronous call to avoid concurrency issues within Avalonia.
            _viewModel = new SnowViewModel(() =>
                                           Dispatcher.UIThread.InvokeAsync(() => _img.InvalidateVisual()).Wait());
        }