private static IDisposable ShowPinWindow(IntPtr hWnd, PinOperations operation) { var vmodel = new NotificationWindowViewModel { Title = ProductInfo.Title, Header = ProductInfo.Title, Body = $"{(operation.HasFlag(PinOperations.Pin) ? "Pinned" : "Unpinned")} this {(operation.HasFlag(PinOperations.Window) ? "window" : "application")}", }; var source = new CancellationTokenSource(); var window = new PinNotificationWindow(hWnd) { DataContext = vmodel, }; window.Show(); Task.Delay(TimeSpan.FromMilliseconds(Settings.General.NotificationDuration), source.Token) .ContinueWith(_ => window.Close(), TaskScheduler.FromCurrentSynchronizationContext()); return Disposable.Create(() => source.Cancel()); }
private static IDisposable ShowDesktopWindow(int index) { var vmodel = new NotificationWindowViewModel { Title = ProductInfo.Title, Header = "Virtual Desktop Switched", Body = "Current Desktop: Desktop " + index, }; var source = new CancellationTokenSource(); var window = new NotificationWindow() { DataContext = vmodel, }; window.Show(); Task.Delay(TimeSpan.FromMilliseconds(Settings.General.NotificationDuration), source.Token) .ContinueWith(_ => window.Close(), TaskScheduler.FromCurrentSynchronizationContext()); return Disposable.Create(() => source.Cancel()); }