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

Add an example tweet to the Settings Form

This commit is contained in:
chylex 2016-04-11 14:11:47 +02:00
parent 496c1a91a3
commit 3b10bc9c7c
3 changed files with 38 additions and 6 deletions

View File

@ -19,8 +19,8 @@ public FormNotification(Form owner){
this.owner = owner;
browser = new ChromiumWebBrowser(""){ MenuHandler = new MenuHandlerEmpty() };
Controls.Add(browser);
browser = new ChromiumWebBrowser("about:blank"){ MenuHandler = new MenuHandlerEmpty() };
panelBrowser.Controls.Add(browser);
}
public void ShowNotification(TweetNotification notification){
@ -33,8 +33,12 @@ public void ShowNotification(TweetNotification notification){
}
}
public void ShowNotificationForSettings(){
browser.Load("about:blank");
if (browser.Address == "about:blank"){
browser.Load("about:blank");
browser.LoadHtml(TweetNotification.ExampleTweet.GenerateHtml(),"http://tweetdeck.twitter.com/");
resetAnimation = true;
}
MoveToVisibleLocation();
}

View File

@ -23,8 +23,12 @@ public void OnBeforeContextMenu(IWebBrowser browserControl, IBrowser browser, IF
model.AddItem(CefMenuCommand.Reload,"Reload");
model.AddSeparator();
model.AddItem((CefMenuCommand)MenuSettings,"Settings");
model.AddSeparator();
if (TweetNotification.IsReady){
model.AddItem((CefMenuCommand)MenuSettings,"Settings");
model.AddSeparator();
}
model.AddItem((CefMenuCommand)MenuAbout,"About TweetDick");
}

View File

@ -6,6 +6,30 @@ sealed class TweetNotification{
private static string FontSizeClass { get; set; }
private static string HeadTag { get; set; }
public static bool IsReady{
get{
return FontSizeClass != null && HeadTag != null;
}
}
public static TweetNotification ExampleTweet{
get{
StringBuilder build = new StringBuilder();
build.Append(@"<article><div class='js-stream-item-content item-box js-show-detail'><div class='js-tweet tweet'>");
build.Append(@"<header class='tweet-header'>");
build.Append(@"<time class='tweet-timestamp js-timestamp pull-right txt-mute'><a target='_blank' rel='url' href='https://twitter.com/chylexMC' class='txt-small'>0s</a></time>");
build.Append(@"<a target='_blank' rel='user' href='https://twitter.com/chylexMC' class='account-link link-complex block'>");
build.Append(@"<div class='obj-left item-img tweet-img'><img width='48' height='48' alt='chylexMC's avatar' src='https://pbs.twimg.com/profile_images/645532929930608642/J56NBJVY_normal.png' class='tweet-avatar avatar pull-right'></div>");
build.Append(@"<div class='nbfc'><span class='account-inline txt-ellipsis'><b class='fullname link-complex-target'>chylex</b> <span class='username txt-mute'>@chylexMC</span></span></div>");
build.Append(@"</a>");
build.Append(@"</header>");
build.Append(@"<div class='tweet-body'><p class='js-tweet-text tweet-text with-linebreaks'>This is an example tweet, which lets you test the location and duration of popup notifications.</p></div>");
build.Append(@"</div></div></article>");
return new TweetNotification(build.ToString(),95);
}
}
public static void SetFontSizeClass(string newFSClass){
FontSizeClass = newFSClass;
}