1
0
mirror of https://github.com/chylex/TweetDuck.git synced 2025-06-01 11:34:04 +02:00

Fix the notification form showing too early and not loading in Settings Form

This commit is contained in:
chylex 2016-04-11 16:47:48 +02:00
parent dfe2e91012
commit 5c91dec62a
2 changed files with 15 additions and 2 deletions

View File

@ -22,7 +22,7 @@ public FormNotification(Form owner, bool autoHide){
this.owner = owner; this.owner = owner;
this.autoHide = autoHide; this.autoHide = autoHide;
browser = new ChromiumWebBrowser(""){ MenuHandler = new MenuHandlerEmpty() }; browser = new ChromiumWebBrowser("about:blank"){ MenuHandler = new MenuHandlerEmpty() };
panelBrowser.Controls.Add(browser); panelBrowser.Controls.Add(browser);
} }

View File

@ -12,9 +12,11 @@ private static UserConfig Config{
} }
private readonly FormNotification notification; private readonly FormNotification notification;
private bool isLoaded;
public FormSettings(FormBrowser browserForm){ public FormSettings(FormBrowser browserForm){
InitializeComponent(); InitializeComponent();
Shown += (sender, args) => isLoaded = true;
notification = new FormNotification(browserForm,false); notification = new FormNotification(browserForm,false);
notification.Show(this); notification.Show(this);
@ -49,7 +51,6 @@ public FormSettings(FormBrowser browserForm){
comboBoxDisplay.SelectedIndex = Math.Min(comboBoxDisplay.Items.Count-1,Config.NotificationDisplay); comboBoxDisplay.SelectedIndex = Math.Min(comboBoxDisplay.Items.Count-1,Config.NotificationDisplay);
trackBarEdgeDistance.Value = Config.NotificationEdgeDistance; trackBarEdgeDistance.Value = Config.NotificationEdgeDistance;
notification.HideNotification();
} }
private void FormSettings_FormClosing(object sender, FormClosingEventArgs e){ private void FormSettings_FormClosing(object sender, FormClosingEventArgs e){
@ -57,6 +58,8 @@ private void FormSettings_FormClosing(object sender, FormClosingEventArgs e){
} }
private void radioLoc_CheckedChanged(object sender, EventArgs e){ private void radioLoc_CheckedChanged(object sender, EventArgs e){
if (!isLoaded)return;
if (radioLocTL.Checked)Config.NotificationPosition = TweetNotification.Position.TopLeft; if (radioLocTL.Checked)Config.NotificationPosition = TweetNotification.Position.TopLeft;
else if (radioLocTR.Checked)Config.NotificationPosition = TweetNotification.Position.TopRight; else if (radioLocTR.Checked)Config.NotificationPosition = TweetNotification.Position.TopRight;
else if (radioLocBL.Checked)Config.NotificationPosition = TweetNotification.Position.BottomLeft; else if (radioLocBL.Checked)Config.NotificationPosition = TweetNotification.Position.BottomLeft;
@ -74,20 +77,28 @@ private void radioLoc_CheckedChanged(object sender, EventArgs e){
} }
private void radioLoc_Click(object sender, EventArgs e){ private void radioLoc_Click(object sender, EventArgs e){
if (!isLoaded)return;
notification.ShowNotificationForSettings(false); notification.ShowNotificationForSettings(false);
} }
private void comboBoxDisplay_SelectedValueChanged(object sender, EventArgs e){ private void comboBoxDisplay_SelectedValueChanged(object sender, EventArgs e){
if (!isLoaded)return;
Config.NotificationDisplay = comboBoxDisplay.SelectedIndex; Config.NotificationDisplay = comboBoxDisplay.SelectedIndex;
notification.ShowNotificationForSettings(false); notification.ShowNotificationForSettings(false);
} }
private void trackBarEdgeDistance_ValueChanged(object sender, EventArgs e){ private void trackBarEdgeDistance_ValueChanged(object sender, EventArgs e){
if (!isLoaded)return;
Config.NotificationEdgeDistance = trackBarEdgeDistance.Value; Config.NotificationEdgeDistance = trackBarEdgeDistance.Value;
notification.ShowNotificationForSettings(false); notification.ShowNotificationForSettings(false);
} }
private void radioDur_CheckedChanged(object sender, EventArgs e){ private void radioDur_CheckedChanged(object sender, EventArgs e){
if (!isLoaded)return;
if (radioDurShort.Checked)Config.NotificationDuration = TweetNotification.Duration.Short; if (radioDurShort.Checked)Config.NotificationDuration = TweetNotification.Duration.Short;
else if (radioDurMedium.Checked)Config.NotificationDuration = TweetNotification.Duration.Medium; else if (radioDurMedium.Checked)Config.NotificationDuration = TweetNotification.Duration.Medium;
else if (radioDurLong.Checked)Config.NotificationDuration = TweetNotification.Duration.Long; else if (radioDurLong.Checked)Config.NotificationDuration = TweetNotification.Duration.Long;
@ -97,6 +108,8 @@ private void radioDur_CheckedChanged(object sender, EventArgs e){
} }
private void radioDur_Click(object sender, EventArgs e){ private void radioDur_Click(object sender, EventArgs e){
if (!isLoaded)return;
notification.ShowNotificationForSettings(true); notification.ShowNotificationForSettings(true);
} }
} }