public PriceView( IServiceProvider serviceProvider, PriceViewModel viewModel, INativeBrowser nativeBrowser, INativeCursor cursor) : base(serviceProvider, closeOnBlur: true) { this.viewModel = viewModel; this.nativeBrowser = nativeBrowser; InitializeComponent(); DataContext = viewModel; Loaded += OverlayWindow_Loaded; Show(); Activate(); var position = cursor.GetCursorPosition(); SetWindowPositionFromBottomRight(position.X - 10, position.Y - 10); if (viewModel.IsError) { Dispatcher.InvokeAsync(async() => { await Task.Delay(1500); Close(); }); } }
public PriceView( IServiceProvider serviceProvider, PriceViewModel viewModel, INativeBrowser nativeBrowser, INativeCursor cursor) : base(serviceProvider, closeOnBlur: true) { this.viewModel = viewModel; this.nativeBrowser = nativeBrowser; InitializeComponent(); DataContext = viewModel; Loaded += OverlayWindow_Loaded; Show(); Activate(); if (GetMouseXPercent() > 0.5) { MoveWhenOpeningPreview = true; SetWindowPositionPercent(0.66 - GetWidthPercent(), 0.5 - (GetHeightPercent() / 2)); } else { SetWindowPositionPercent(0.34, 0.5 - (GetHeightPercent() / 2)); } if (viewModel.IsError) { Dispatcher.InvokeAsync(async() => { await Task.Delay(1500); Close(); }); } viewModel.PropertyChanged += ViewModel_PropertyChanged; }