mirror of
https://github.com/chylex/TweetDuck.git
synced 2025-04-25 00:15:48 +02:00
Refactor FormNotificationBase to store TweetNotification instead of copying data
This commit is contained in:
parent
380e580d65
commit
588bb9a093
@ -79,17 +79,15 @@ public bool CanResizeWindow{
|
||||
private readonly ResourceHandlerNotification resourceHandler = new ResourceHandlerNotification();
|
||||
private readonly float dpiScale;
|
||||
|
||||
private string currentColumnKey;
|
||||
private string currentChirpId;
|
||||
private string currentColumnTitle;
|
||||
private TweetNotification currentNotification;
|
||||
private int pauseCounter;
|
||||
|
||||
|
||||
public string CurrentTweetUrl => currentNotification?.TweetUrl;
|
||||
public string CurrentQuoteUrl => currentNotification?.QuoteUrl;
|
||||
public bool IsPaused => pauseCounter > 0;
|
||||
|
||||
|
||||
public bool FreezeTimer { get; set; }
|
||||
public bool ContextMenuOpen { get; set; }
|
||||
public string CurrentTweetUrl { get; private set; }
|
||||
public string CurrentQuoteUrl { get; private set; }
|
||||
|
||||
public event EventHandler Initialized;
|
||||
|
||||
@ -160,7 +158,7 @@ public virtual void HideNotification(bool loadBlank){
|
||||
}
|
||||
|
||||
Location = ControlExtensions.InvisibleLocation;
|
||||
currentColumnTitle = null;
|
||||
currentNotification = null;
|
||||
}
|
||||
|
||||
public virtual void FinishCurrentNotification(){}
|
||||
@ -183,13 +181,7 @@ protected virtual string GetTweetHTML(TweetNotification tweet){
|
||||
}
|
||||
|
||||
protected virtual void LoadTweet(TweetNotification tweet){
|
||||
CurrentTweetUrl = tweet.TweetUrl;
|
||||
CurrentQuoteUrl = tweet.QuoteUrl;
|
||||
|
||||
currentColumnKey = tweet.ColumnKey;
|
||||
currentChirpId = tweet.ChirpId;
|
||||
currentColumnTitle = tweet.ColumnTitle;
|
||||
|
||||
currentNotification = tweet;
|
||||
resourceHandler.SetHTML(GetTweetHTML(tweet));
|
||||
browser.Load(TwitterUtils.TweetDeckURL);
|
||||
}
|
||||
@ -203,11 +195,12 @@ protected virtual void OnNotificationReady(){
|
||||
}
|
||||
|
||||
protected virtual void UpdateTitle(){
|
||||
Text = string.IsNullOrEmpty(currentColumnTitle) || !Program.UserConfig.DisplayNotificationColumn ? Program.BrandName : Program.BrandName+" - "+currentColumnTitle;
|
||||
string title = currentNotification?.ColumnTitle;
|
||||
Text = string.IsNullOrEmpty(title) || !Program.UserConfig.DisplayNotificationColumn ? Program.BrandName : Program.BrandName+" - "+title;
|
||||
}
|
||||
|
||||
public void ShowTweetDetail(){
|
||||
owner.ShowTweetDetail(currentColumnKey, currentChirpId);
|
||||
owner.ShowTweetDetail(currentNotification.ColumnKey, currentNotification.ChirpId);
|
||||
}
|
||||
|
||||
public void MoveToVisibleLocation(){
|
||||
|
Loading…
Reference in New Issue
Block a user