/// <summary> /// /// </summary> /// <param name="cancellationToken"></param> /// <returns></returns> public async Task InitializeAsync( CancellationToken cancellationToken = default) { await Dispatcher.InvokeAsync(() => { Window = new RectangleWindow(); Window.Show(); }, DispatcherPriority.Normal, cancellationToken); }
private static void ApplyRectangle(RectangleWindow window, Point startPoint, Point endPoint) { var rectangle = startPoint.ToRectangle(endPoint); window.Border.Margin = new Thickness( rectangle.Left - window.Left, rectangle.Top - window.Top, window.Width + window.Left - rectangle.Right, window.Height + window.Top - rectangle.Bottom); }