mirror of
https://github.com/chylex/TweetDuck.git
synced 2025-05-24 23:34:05 +02:00
Fix 'Escape' key not clearing notification tweet queue & refactor HideNotification
This commit is contained in:
parent
64977964e8
commit
512b5666ac
@ -19,7 +19,7 @@ bool IKeyboardHandler.OnPreKeyEvent(IWebBrowser browserControl, IBrowser browser
|
|||||||
return true;
|
return true;
|
||||||
|
|
||||||
case Keys.Escape:
|
case Keys.Escape:
|
||||||
notification.InvokeAsyncSafe(() => notification.HideNotification(true));
|
notification.InvokeAsyncSafe(notification.HideNotification);
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
case Keys.Space:
|
case Keys.Space:
|
||||||
|
@ -167,11 +167,8 @@ private void Browser_IsBrowserInitializedChanged(object sender, IsBrowserInitial
|
|||||||
|
|
||||||
// notification methods
|
// notification methods
|
||||||
|
|
||||||
public virtual void HideNotification(bool loadBlank){
|
public virtual void HideNotification(){
|
||||||
if (loadBlank){
|
browser.Load("about:blank");
|
||||||
browser.Load("about:blank");
|
|
||||||
}
|
|
||||||
|
|
||||||
Location = ControlExtensions.InvisibleLocation;
|
Location = ControlExtensions.InvisibleLocation;
|
||||||
currentNotification = null;
|
currentNotification = null;
|
||||||
}
|
}
|
||||||
|
@ -148,7 +148,7 @@ private IntPtr MouseHookProc(int nCode, IntPtr wParam, IntPtr lParam){
|
|||||||
|
|
||||||
private void FormNotification_FormClosing(object sender, FormClosingEventArgs e){
|
private void FormNotification_FormClosing(object sender, FormClosingEventArgs e){
|
||||||
if (e.CloseReason == CloseReason.UserClosing){
|
if (e.CloseReason == CloseReason.UserClosing){
|
||||||
HideNotification(true);
|
HideNotification();
|
||||||
e.Cancel = true;
|
e.Cancel = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -205,8 +205,8 @@ public void ShowNotificationForSettings(bool reset){
|
|||||||
UpdateTitle();
|
UpdateTitle();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void HideNotification(bool loadBlank){
|
public override void HideNotification(){
|
||||||
base.HideNotification(loadBlank);
|
base.HideNotification();
|
||||||
|
|
||||||
progressBarTimer.Value = Program.UserConfig.NotificationTimerCountDown ? 1000 : 0;
|
progressBarTimer.Value = Program.UserConfig.NotificationTimerCountDown ? 1000 : 0;
|
||||||
timerProgress.Stop();
|
timerProgress.Stop();
|
||||||
|
@ -40,7 +40,6 @@ private void InitializeComponent() {
|
|||||||
//
|
//
|
||||||
// FormNotificationTweet
|
// FormNotificationTweet
|
||||||
//
|
//
|
||||||
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.FormNotificationTweet_FormClosing);
|
|
||||||
this.ResumeLayout(true);
|
this.ResumeLayout(true);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -26,20 +26,6 @@ public FormNotificationTweet(FormBrowser owner, PluginManager pluginManager) : b
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void FormNotificationTweet_FormClosing(object sender, FormClosingEventArgs e){
|
|
||||||
if (e.CloseReason == CloseReason.UserClosing){
|
|
||||||
tweetQueue.Clear(); // already canceled
|
|
||||||
TrimQueue();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void TrimQueue(){
|
|
||||||
if (needsTrim){
|
|
||||||
tweetQueue.TrimExcess();
|
|
||||||
needsTrim = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// event handlers
|
// event handlers
|
||||||
|
|
||||||
private void Config_MuteToggled(object sender, EventArgs e){
|
private void Config_MuteToggled(object sender, EventArgs e){
|
||||||
@ -68,11 +54,9 @@ private void timerIdlePauseCheck_Tick(object sender, EventArgs e){
|
|||||||
// notification methods
|
// notification methods
|
||||||
|
|
||||||
public override void ShowNotification(TweetNotification notification){
|
public override void ShowNotification(TweetNotification notification){
|
||||||
if (IsPaused){
|
tweetQueue.Enqueue(notification);
|
||||||
tweetQueue.Enqueue(notification);
|
|
||||||
}
|
if (!IsPaused){
|
||||||
else{
|
|
||||||
tweetQueue.Enqueue(notification);
|
|
||||||
UpdateTitle();
|
UpdateTitle();
|
||||||
|
|
||||||
if (totalTime == 0){
|
if (totalTime == 0){
|
||||||
@ -83,13 +67,22 @@ public override void ShowNotification(TweetNotification notification){
|
|||||||
needsTrim |= tweetQueue.Count >= TrimMinimum;
|
needsTrim |= tweetQueue.Count >= TrimMinimum;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override void HideNotification(){
|
||||||
|
base.HideNotification();
|
||||||
|
tweetQueue.Clear();
|
||||||
|
|
||||||
|
if (needsTrim){
|
||||||
|
tweetQueue.TrimExcess();
|
||||||
|
needsTrim = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public override void FinishCurrentNotification(){
|
public override void FinishCurrentNotification(){
|
||||||
if (tweetQueue.Count > 0){
|
if (tweetQueue.Count > 0){
|
||||||
LoadNextNotification();
|
LoadNextNotification();
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
HideNotification(true);
|
HideNotification();
|
||||||
TrimQueue();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -110,7 +110,7 @@ public override void OnReady(){
|
|||||||
|
|
||||||
private void TabSettingsNotifications_ParentChanged(object sender, EventArgs e){
|
private void TabSettingsNotifications_ParentChanged(object sender, EventArgs e){
|
||||||
if (Parent == null){
|
if (Parent == null){
|
||||||
notification.HideNotification(false);
|
notification.HideNotification();
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
notification.ShowNotificationForSettings(true);
|
notification.ShowNotificationForSettings(true);
|
||||||
|
Loading…
Reference in New Issue
Block a user