상속: MetroTrilithon.Mvvm.WindowViewModel
예제 #1
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());
        }
예제 #2
0
        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());
        }