public TabSettingsNotifications(FormNotificationExample notification) { InitializeComponent(); this.notification = notification; this.notification.Initialized += (sender, args) => { this.InvokeAsyncSafe(() => { this.notification.ShowExampleNotification(true); this.notification.Move += notification_Move; this.notification.ResizeEnd += notification_ResizeEnd; }); }; this.notification.Activated += notification_Activated; this.notification.Show(); switch (Config.NotificationPosition) { case TweetNotification.Position.TopLeft: radioLocTL.Checked = true; break; case TweetNotification.Position.TopRight: radioLocTR.Checked = true; break; case TweetNotification.Position.BottomLeft: radioLocBL.Checked = true; break; case TweetNotification.Position.BottomRight: radioLocBR.Checked = true; break; case TweetNotification.Position.Custom: radioLocCustom.Checked = true; break; } comboBoxDisplay.Enabled = trackBarEdgeDistance.Enabled = !radioLocCustom.Checked; switch (Config.NotificationSize) { case TweetNotification.Size.Auto: radioSizeAuto.Checked = true; break; case TweetNotification.Size.Custom: radioSizeCustom.Checked = true; break; } toolTip.SetToolTip(trackBarDuration, toolTip.GetToolTip(labelDurationValue)); trackBarDuration.SetValueSafe(Config.NotificationDurationValue); labelDurationValue.Text = Config.NotificationDurationValue + " ms/c"; comboBoxIdlePause.Items.Add("Disabled"); comboBoxIdlePause.Items.Add("30 seconds"); comboBoxIdlePause.Items.Add("1 minute"); comboBoxIdlePause.Items.Add("2 minutes"); comboBoxIdlePause.Items.Add("5 minutes"); comboBoxIdlePause.SelectedIndex = Math.Max(0, Array.FindIndex(IdlePauseSeconds, val => val == Config.NotificationIdlePauseSeconds)); comboBoxDisplay.Items.Add("(Same as TweetDuck)"); foreach (Screen screen in Screen.AllScreens) { comboBoxDisplay.Items.Add(screen.DeviceName.TrimStart('\\', '.') + " (" + screen.Bounds.Width + "x" + screen.Bounds.Height + ")"); } comboBoxDisplay.SelectedIndex = Math.Min(comboBoxDisplay.Items.Count - 1, Config.NotificationDisplay); checkColumnName.Checked = Config.DisplayNotificationColumn; checkNotificationTimer.Checked = Config.DisplayNotificationTimer; checkTimerCountDown.Enabled = checkNotificationTimer.Checked; checkTimerCountDown.Checked = Config.NotificationTimerCountDown; checkMediaPreviews.Checked = Config.NotificationMediaPreviews; checkSkipOnLinkClick.Checked = Config.NotificationSkipOnLinkClick; checkNonIntrusive.Checked = Config.NotificationNonIntrusiveMode; trackBarScrollSpeed.SetValueSafe(Config.NotificationScrollSpeed); labelScrollSpeedValue.Text = trackBarScrollSpeed.Value + "%"; trackBarEdgeDistance.SetValueSafe(Config.NotificationEdgeDistance); labelEdgeDistanceValue.Text = trackBarEdgeDistance.Value + " px"; Disposed += (sender, args) => this.notification.Dispose(); }
public TabSettingsNotifications(FormNotificationExample notification) { InitializeComponent(); this.notification = notification; this.notification.Ready += (sender, args) => { this.InvokeAsyncSafe(() => { this.notification.ShowExampleNotification(true); this.notification.Move += notification_Move; this.notification.ResizeEnd += notification_ResizeEnd; }); }; this.notification.Show(); Disposed += (sender, args) => this.notification.Dispose(); // general toolTip.SetToolTip(checkColumnName, "Shows column name each notification originated\r\nfrom in the notification window title."); toolTip.SetToolTip(checkMediaPreviews, "Shows image and video thumbnails in the notification window."); toolTip.SetToolTip(checkSkipOnLinkClick, "Skips current notification when a link\r\ninside the notification is clicked."); toolTip.SetToolTip(checkNonIntrusive, "When not idle and the cursor is within the notification window area,\r\nit will be delayed until the cursor moves away to prevent accidental clicks."); toolTip.SetToolTip(comboBoxIdlePause, "Pauses new notifications after going idle for a set amount of time."); checkColumnName.Checked = Config.DisplayNotificationColumn; checkMediaPreviews.Checked = Config.NotificationMediaPreviews; checkSkipOnLinkClick.Checked = Config.NotificationSkipOnLinkClick; checkNonIntrusive.Checked = Config.NotificationNonIntrusiveMode; comboBoxIdlePause.Items.Add("Disabled"); comboBoxIdlePause.Items.Add("30 seconds"); comboBoxIdlePause.Items.Add("1 minute"); comboBoxIdlePause.Items.Add("2 minutes"); comboBoxIdlePause.Items.Add("5 minutes"); comboBoxIdlePause.SelectedIndex = Math.Max(0, Array.FindIndex(IdlePauseSeconds, val => val == Config.NotificationIdlePauseSeconds)); trackBarOpacity.SetValueSafe(Config.NotificationWindowOpacity); labelOpacityValue.Text = Config.NotificationWindowOpacity + "%"; // timer toolTip.SetToolTip(checkTimerCountDown, "The notification timer counts down instead of up."); toolTip.SetToolTip(labelDurationValue, "Milliseconds per character."); toolTip.SetToolTip(trackBarDuration, toolTip.GetToolTip(labelDurationValue)); checkNotificationTimer.Checked = Config.DisplayNotificationTimer; checkTimerCountDown.Enabled = checkNotificationTimer.Checked; checkTimerCountDown.Checked = Config.NotificationTimerCountDown; trackBarDuration.SetValueSafe(Config.NotificationDurationValue); labelDurationValue.Text = Config.NotificationDurationValue + " ms/c"; // location toolTip.SetToolTip(radioLocCustom, "Drag the example notification window to the desired location."); switch (Config.NotificationPosition) { case DesktopNotification.Position.TopLeft: radioLocTL.Checked = true; break; case DesktopNotification.Position.TopRight: radioLocTR.Checked = true; break; case DesktopNotification.Position.BottomLeft: radioLocBL.Checked = true; break; case DesktopNotification.Position.BottomRight: radioLocBR.Checked = true; break; case DesktopNotification.Position.Custom: radioLocCustom.Checked = true; break; } comboBoxDisplay.Enabled = trackBarEdgeDistance.Enabled = !radioLocCustom.Checked; comboBoxDisplay.Items.Add("(Same as TweetDuck)"); foreach (Screen screen in Screen.AllScreens) { comboBoxDisplay.Items.Add($"{screen.DeviceName.TrimStart('\\', '.')} ({screen.Bounds.Width}x{screen.Bounds.Height})"); } comboBoxDisplay.SelectedIndex = Math.Min(comboBoxDisplay.Items.Count - 1, Config.NotificationDisplay); trackBarEdgeDistance.SetValueSafe(Config.NotificationEdgeDistance); labelEdgeDistanceValue.Text = trackBarEdgeDistance.Value + " px"; // size toolTip.SetToolTip(radioSizeAuto, "Notification size is based on the font size and browser zoom level."); toolTip.SetToolTip(radioSizeCustom, "Resize the example notification window to the desired size."); switch (Config.NotificationSize) { case DesktopNotification.Size.Auto: radioSizeAuto.Checked = true; break; case DesktopNotification.Size.Custom: radioSizeCustom.Checked = true; break; } trackBarScrollSpeed.SetValueSafe(Config.NotificationScrollSpeed); labelScrollSpeedValue.Text = trackBarScrollSpeed.Value + "%"; }