diff --git a/Core/Notification/FormNotificationBase.cs b/Core/Notification/FormNotificationBase.cs index a4ae66d3..1582574b 100644 --- a/Core/Notification/FormNotificationBase.cs +++ b/Core/Notification/FormNotificationBase.cs @@ -140,6 +140,7 @@ protected FormNotificationBase(FormBrowser owner, bool enableContextMenu){ DpiScale = this.GetDPIScale(); browser.SetupResourceHandler(TwitterUtils.TweetDeckURL, this.resourceHandler); + browser.SetupResourceHandler(TweetNotification.AppLogoLink, TweetNotification.AppLogoHandler); Controls.Add(browser); diff --git a/Core/Notification/TweetNotification.cs b/Core/Notification/TweetNotification.cs index b16405af..12487773 100644 --- a/Core/Notification/TweetNotification.cs +++ b/Core/Notification/TweetNotification.cs @@ -1,5 +1,6 @@ using System; using System.Text; +using CefSharp; using TweetDuck.Core.Bridge; using TweetDuck.Resources; @@ -8,6 +9,9 @@ sealed class TweetNotification{ private const string DefaultHeadLayout = @"<html id='tduck' class='os-windows txt-size--14' data-td-font='medium' data-td-theme='dark'><head><meta charset='utf-8'><meta http-equiv='X-UA-Compatible' content='chrome=1'><link rel='stylesheet' href='https://ton.twimg.com/tweetdeck-web/web/css/font.5ef884f9f9.css'><link rel='stylesheet' href='https://ton.twimg.com/tweetdeck-web/web/css/app-dark.5631e0dd42.css'><style type='text/css'>body{background:#222426}</style>"; private static readonly string CustomCSS = ScriptLoader.LoadResource("styles/notification.css"); + public const string AppLogoLink = "https://ton.twimg.com/tduck/avatar"; + public static readonly IResourceHandler AppLogoHandler = ResourceHandler.FromByteArray(Properties.Resources.avatar, "image/png"); + public static TweetNotification Example(string html, int characters){ return new TweetNotification(string.Empty, string.Empty, "Home", html, characters, string.Empty, string.Empty, true); } diff --git a/Core/TweetDeckBrowser.cs b/Core/TweetDeckBrowser.cs index 3680b39b..318ddd67 100644 --- a/Core/TweetDeckBrowser.cs +++ b/Core/TweetDeckBrowser.cs @@ -66,6 +66,8 @@ public TweetDeckBrowser(FormBrowser owner, PluginManager plugins, TweetDeckBridg this.browser.Dock = DockStyle.None; this.browser.Location = ControlExtensions.InvisibleLocation; + this.browser.SetupResourceHandler(TweetNotification.AppLogoLink, TweetNotification.AppLogoHandler); + owner.Controls.Add(browser); this.plugins = plugins; diff --git a/Properties/Resources.Designer.cs b/Properties/Resources.Designer.cs index b3403071..b2731f44 100644 --- a/Properties/Resources.Designer.cs +++ b/Properties/Resources.Designer.cs @@ -19,7 +19,7 @@ namespace TweetDuck.Properties { // class via a tool like ResGen or Visual Studio. // To add or remove a member, edit your .ResX file then rerun ResGen // with the /str option, or rebuild your VS project. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] internal class Resources { @@ -60,6 +60,16 @@ internal Resources() { } } + /// <summary> + /// Looks up a localized resource of type System.Byte[]. + /// </summary> + internal static byte[] avatar { + get { + object obj = ResourceManager.GetObject("avatar", resourceCulture); + return ((byte[])(obj)); + } + } + /// <summary> /// Looks up a localized resource of type System.Drawing.Icon similar to (Icon). /// </summary> diff --git a/Properties/Resources.resx b/Properties/Resources.resx index d6afc110..d01687dc 100644 --- a/Properties/Resources.resx +++ b/Properties/Resources.resx @@ -118,6 +118,9 @@ <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> </resheader> <assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" /> + <data name="avatar" type="System.Resources.ResXFileRef, System.Windows.Forms"> + <value>..\Resources\avatar.png;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + </data> <data name="icon" type="System.Resources.ResXFileRef, System.Windows.Forms"> <value>..\Resources\icon.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> </data> diff --git a/Resources/avatar.png b/Resources/avatar.png new file mode 100644 index 00000000..e61b1cae Binary files /dev/null and b/Resources/avatar.png differ diff --git a/TweetDuck.csproj b/TweetDuck.csproj index fdb03ed8..04ba3a36 100644 --- a/TweetDuck.csproj +++ b/TweetDuck.csproj @@ -280,6 +280,11 @@ <Compile Include="Plugins\Events\PluginErrorEventArgs.cs" /> <Compile Include="Plugins\PluginManager.cs" /> <Compile Include="Plugins\PluginScriptGenerator.cs" /> + <Compile Include="Properties\Resources.Designer.cs"> + <AutoGen>True</AutoGen> + <DesignTime>True</DesignTime> + <DependentUpon>Resources.resx</DependentUpon> + </Compile> <Compile Include="Reporter.cs" /> <Compile Include="Updates\FormUpdateDownload.cs"> <SubType>Form</SubType> @@ -301,11 +306,6 @@ <Compile Include="Updates\UpdateInfo.cs" /> <Compile Include="Program.cs" /> <Compile Include="Properties\AssemblyInfo.cs" /> - <Compile Include="Properties\Resources.Designer.cs"> - <AutoGen>True</AutoGen> - <DesignTime>True</DesignTime> - <DependentUpon>Resources.resx</DependentUpon> - </Compile> <Compile Include="Resources\ScriptLoader.cs" /> <Compile Include="Updates\UpdateEventArgs.cs" /> <Compile Include="Updates\UpdaterSettings.cs" /> @@ -343,8 +343,8 @@ </EmbeddedResource> <EmbeddedResource Include="Properties\Resources.resx"> <Generator>ResXFileCodeGenerator</Generator> - <LastGenOutput>Resources.Designer.cs</LastGenOutput> <SubType>Designer</SubType> + <LastGenOutput>Resources.Designer.cs</LastGenOutput> </EmbeddedResource> </ItemGroup> <ItemGroup> @@ -363,6 +363,7 @@ <Folder Include="Resources\Plugins\" /> </ItemGroup> <ItemGroup> + <Content Include="Resources\avatar.png" /> <Content Include="Resources\Scripts\code.js" /> <Content Include="Resources\Scripts\introduction.js" /> <Content Include="Resources\Scripts\notification.js" />