private void ShowNotification(LivestreamNotification livestreamNotification) { var vmTopLeft = GetNotificationTopLeft(livestreamNotification); var settings = new WindowSettingsBuilder().NoResizeBorderless() .WithTopLeft(vmTopLeft.Y, vmTopLeft.X) .TransparentBackground() .AsTopmost() .Create(); var notificationViewModel = new NotificationViewModel(livestreamNotification, monitorStreamsModel); // put remaining notifications into their correct position after this LivestreamNotification closes notificationViewModel.Deactivated += (sender, args) => { AdjustWindows(); RemoveNotification(notificationViewModel.LivestreamNotification); }; Execute.OnUIThread(() => { windowManager.ShowWindow(notificationViewModel, null, settings); // Close the popup after a brief duration var timer = new DispatcherTimer() { Interval = livestreamNotification.Duration }; timer.Tick += (sender, args) => { notificationViewModel.TryClose(); timer.Stop(); }; timer.Start(); }); }
protected override void OnStartup(object sender, StartupEventArgs e) { var settingsBuilder = new WindowSettingsBuilder() .AsTopmost() .SizeToContent(); // Can't use SystemParameters.WorkArea as that defines only the primary monitor, virtual screen defines the multi-monitor work area var virtualTopLeft = new Point(SystemParameters.VirtualScreenLeft, SystemParameters.VirtualScreenTop); var virtualSize = new Size(SystemParameters.VirtualScreenWidth, SystemParameters.VirtualScreenHeight); var virtualRect = new Rect(virtualTopLeft, virtualSize); // Guard against the existing window position being outside the screen, if it is just center the app to teh screen if ((Settings.Default.Top == 0 && Settings.Default.Left == 0) || !virtualRect.Contains(new Point(Settings.Default.Left, Settings.Default.Top))) { settingsBuilder.WithStartupLocation(WindowStartupLocation.CenterScreen); } else { settingsBuilder.WithTopLeft(Settings.Default.Top, Settings.Default.Left); } var settings = settingsBuilder.Create(); DisplayRootViewFor <ShellViewModel>(settings); }
public void OpenQualities() { var settings = new WindowSettingsBuilder() .AsTopmost() .SizeToContent(SizeToContent.Width) .Height(300) .Create(); windowManager.ShowDialog(apiClientsQualitiesViewModel, null, settings); // remove focus from the toggle button after it has been clicked // looks nicer ¯\_(ツ)_/¯ Keyboard.ClearFocus(); }
private MessageBoxViewModel ShowLivestreamerLoadMessageBox(string title, string messageText) { var messageBoxViewModel = new MessageBoxViewModel { DisplayName = title, MessageText = messageText }; messageBoxViewModel.ShowHideOnLoadCheckbox(settingsHandler); var settings = new WindowSettingsBuilder().SizeToContent() .NoResizeBorderless() .Create(); windowManager.ShowWindow(messageBoxViewModel, null, settings); return(messageBoxViewModel); }
public void ShowExpCardCalculator(ContentControl sender) { if (ExpCardCalculatorViewModel.IsActive) { return; } var senderPosition = sender.PointToScreen(new Point()); // allows us to position the new window below the button we just clicked var settings = new WindowSettingsBuilder() .SizeToContent() .WithTopLeft(senderPosition.Y + sender.ActualHeight, senderPosition.X) .HideMaximizeButton() .HideMinimizeButton() .HideIcon() .Create(); windowManager.ShowWindow(ExpCardCalculatorViewModel, null, settings); }
private bool CheckLivestreamerExists() { if (File.Exists(settingsHandler.Settings.LivestreamerFullPath)) { return(true); } var msgBox = new MessageBoxViewModel { DisplayName = "Livestreamer/Streamlink not found", MessageText = $"Could not find livestreamer/streamlink @ '{settingsHandler.Settings.LivestreamerFullPath}'" + Environment.NewLine + "Please download and install streamlink from 'https://streamlink.github.io/install.html#windows-binaries'" + Environment.NewLine + "OR download and install livestreamer from 'http://docs.livestreamer.io/install.html#windows-binaries'" }; var settings = new WindowSettingsBuilder().SizeToContent() .NoResizeBorderless() .Create(); windowManager.ShowWindow(msgBox, null, settings); return(false); }