예제 #1
0
        private static IDisposable ShowPinWindow(IntPtr hWnd, PinOperations operation)
        {
            var vmodel = new NotificationWindowViewModel
            {
                Title = ProductInfo.Title,
                Body  = $"{(operation.HasFlag(PinOperations.Window) ? "Window" : "Application")} {(operation.HasFlag(PinOperations.Pin) ? "Pinned" : "Unpinned")}",
            };
            var source = new CancellationTokenSource();
            var window = new PinWindow(hWnd)
            {
                DataContext = vmodel,
            };

            window.Show();

            Task.Delay(TimeSpan.FromMilliseconds(Settings.General.NotificationDuration), source.Token)
            .ContinueWith(_ => window.Close(), TaskScheduler.FromCurrentSynchronizationContext());

            return(Disposable.Create(() => source.Cancel()));
        }
예제 #2
0
        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());
        }
예제 #3
0
 public WindowPinnedEventArgs(IntPtr target, PinOperations operation)
 {
     this.Target       = target;
     this.PinOperation = operation;
 }
예제 #4
0
 private static void RaisePinnedEvent(IntPtr target, PinOperations operation)
 {
     WindowPinned?.Invoke(typeof(VirtualDesktopService), new WindowPinnedEventArgs(target, operation));
 }
예제 #5
0
 public WindowPinnedEventArgs(IntPtr target, PinOperations operation)
 {
     this.Target = target;
     this.PinOperation = operation;
 }
예제 #6
0
 private static void RaisePinnedEvent(IntPtr target, PinOperations operation)
 {
     WindowPinned?.Invoke(typeof(VirtualDesktopService), new WindowPinnedEventArgs(target, operation));
 }