mirror of
https://github.com/greenshot/greenshot
synced 2025-07-16 10:03:44 -07:00
Updates for the notification service, now an icon is shown and it now follows the configuration settings. [skip ci]
This commit is contained in:
parent
1ba0bf9b10
commit
7e96c99b3d
23 changed files with 90 additions and 43 deletions
|
@ -58,7 +58,7 @@ namespace Greenshot.Destinations {
|
||||||
|
|
||||||
public override Image DisplayIcon {
|
public override Image DisplayIcon {
|
||||||
get {
|
get {
|
||||||
return GreenshotResources.getImage("Clipboard.Image");
|
return GreenshotResources.GetImage("Clipboard.Image");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -37,7 +37,7 @@ namespace Greenshot.Destinations {
|
||||||
private static readonly EditorConfiguration editorConfiguration = IniConfig.GetIniSection<EditorConfiguration>();
|
private static readonly EditorConfiguration editorConfiguration = IniConfig.GetIniSection<EditorConfiguration>();
|
||||||
public const string DESIGNATION = "Editor";
|
public const string DESIGNATION = "Editor";
|
||||||
private readonly IImageEditor editor;
|
private readonly IImageEditor editor;
|
||||||
private static readonly Image greenshotIcon = GreenshotResources.getGreenshotIcon().ToBitmap();
|
private static readonly Image greenshotIcon = GreenshotResources.GetGreenshotIcon().ToBitmap();
|
||||||
|
|
||||||
public EditorDestination() {
|
public EditorDestination() {
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,7 +32,7 @@ namespace Greenshot.Destinations {
|
||||||
/// Description of EmailDestination.
|
/// Description of EmailDestination.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class EmailDestination : AbstractDestination {
|
public class EmailDestination : AbstractDestination {
|
||||||
private static readonly Image MailIcon = GreenshotResources.getImage("Email.Image");
|
private static readonly Image MailIcon = GreenshotResources.GetImage("Email.Image");
|
||||||
private static bool _isActiveFlag;
|
private static bool _isActiveFlag;
|
||||||
private static string _mapiClient;
|
private static string _mapiClient;
|
||||||
public const string DESIGNATION = "EMail";
|
public const string DESIGNATION = "EMail";
|
||||||
|
|
|
@ -48,7 +48,7 @@ namespace Greenshot.Destinations {
|
||||||
|
|
||||||
public override Keys EditorShortcutKeys => Keys.Control | Keys.S;
|
public override Keys EditorShortcutKeys => Keys.Control | Keys.S;
|
||||||
|
|
||||||
public override Image DisplayIcon => GreenshotResources.getImage("Save.Image");
|
public override Image DisplayIcon => GreenshotResources.GetImage("Save.Image");
|
||||||
|
|
||||||
public override ExportInformation ExportCapture(bool manuallyInitiated, ISurface surface, ICaptureDetails captureDetails) {
|
public override ExportInformation ExportCapture(bool manuallyInitiated, ISurface surface, ICaptureDetails captureDetails) {
|
||||||
ExportInformation exportInformation = new ExportInformation(Designation, Description);
|
ExportInformation exportInformation = new ExportInformation(Designation, Description);
|
||||||
|
|
|
@ -61,7 +61,7 @@ namespace Greenshot.Destinations {
|
||||||
|
|
||||||
public override Image DisplayIcon {
|
public override Image DisplayIcon {
|
||||||
get {
|
get {
|
||||||
return GreenshotResources.getImage("Save.Image");
|
return GreenshotResources.GetImage("Save.Image");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -59,7 +59,7 @@ namespace Greenshot.Destinations {
|
||||||
|
|
||||||
public override Keys EditorShortcutKeys => Keys.Control | Keys.P;
|
public override Keys EditorShortcutKeys => Keys.Control | Keys.P;
|
||||||
|
|
||||||
public override Image DisplayIcon => GreenshotResources.getImage("Printer.Image");
|
public override Image DisplayIcon => GreenshotResources.GetImage("Printer.Image");
|
||||||
|
|
||||||
public override bool IsDynamic => true;
|
public override bool IsDynamic => true;
|
||||||
|
|
||||||
|
|
|
@ -59,7 +59,7 @@ namespace Greenshot.Forms {
|
||||||
/// Initialize the background brush
|
/// Initialize the background brush
|
||||||
/// </summary>
|
/// </summary>
|
||||||
static CaptureForm() {
|
static CaptureForm() {
|
||||||
Image backgroundForTransparency = GreenshotResources.getImage("Checkerboard.Image");
|
Image backgroundForTransparency = GreenshotResources.GetImage("Checkerboard.Image");
|
||||||
BackgroundBrush = new TextureBrush(backgroundForTransparency, WrapMode.Tile);
|
BackgroundBrush = new TextureBrush(backgroundForTransparency, WrapMode.Tile);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -415,7 +415,7 @@ namespace Greenshot.Forms {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="cursorLocation"></param>
|
/// <param name="cursorLocation"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
|
|
|
@ -175,7 +175,7 @@ namespace Greenshot {
|
||||||
{
|
{
|
||||||
panel1.Controls.Add(_surface);
|
panel1.Controls.Add(_surface);
|
||||||
}
|
}
|
||||||
Image backgroundForTransparency = GreenshotResources.getImage("Checkerboard.Image");
|
Image backgroundForTransparency = GreenshotResources.GetImage("Checkerboard.Image");
|
||||||
if (_surface != null)
|
if (_surface != null)
|
||||||
{
|
{
|
||||||
_surface.TransparencyBackgroundBrush = new TextureBrush(backgroundForTransparency, WrapMode.Tile);
|
_surface.TransparencyBackgroundBrush = new TextureBrush(backgroundForTransparency, WrapMode.Tile);
|
||||||
|
|
|
@ -38,7 +38,7 @@ namespace Greenshot.Forms {
|
||||||
// The InitializeComponent() call is required for Windows Forms designer support.
|
// The InitializeComponent() call is required for Windows Forms designer support.
|
||||||
//
|
//
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
Icon = GreenshotResources.getGreenshotIcon();
|
Icon = GreenshotResources.GetGreenshotIcon();
|
||||||
Load += FormLoad;
|
Load += FormLoad;
|
||||||
FormClosing += PreventFormClose;
|
FormClosing += PreventFormClose;
|
||||||
}
|
}
|
||||||
|
|
|
@ -231,7 +231,7 @@ namespace Greenshot {
|
||||||
// A dirty fix to make sure the message box is visible as a Greenshot window on the taskbar
|
// A dirty fix to make sure the message box is visible as a Greenshot window on the taskbar
|
||||||
using Form dummyForm = new Form
|
using Form dummyForm = new Form
|
||||||
{
|
{
|
||||||
Icon = GreenshotResources.getGreenshotIcon(),
|
Icon = GreenshotResources.GetGreenshotIcon(),
|
||||||
ShowInTaskbar = true,
|
ShowInTaskbar = true,
|
||||||
FormBorderStyle = FormBorderStyle.None,
|
FormBorderStyle = FormBorderStyle.None,
|
||||||
Location = new Point(int.MinValue, int.MinValue)
|
Location = new Point(int.MinValue, int.MinValue)
|
||||||
|
@ -345,7 +345,7 @@ namespace Greenshot {
|
||||||
// Make the main menu available
|
// Make the main menu available
|
||||||
SimpleServiceProvider.Current.AddService(contextMenu);
|
SimpleServiceProvider.Current.AddService(contextMenu);
|
||||||
|
|
||||||
notifyIcon.Icon = GreenshotResources.getGreenshotIcon();
|
notifyIcon.Icon = GreenshotResources.GetGreenshotIcon();
|
||||||
// Make the notify icon available
|
// Make the notify icon available
|
||||||
SimpleServiceProvider.Current.AddService(notifyIcon);
|
SimpleServiceProvider.Current.AddService(notifyIcon);
|
||||||
|
|
||||||
|
@ -371,6 +371,7 @@ namespace Greenshot {
|
||||||
// Check to see if there is already another INotificationService
|
// Check to see if there is already another INotificationService
|
||||||
if (SimpleServiceProvider.Current.GetInstance<INotificationService>() == null)
|
if (SimpleServiceProvider.Current.GetInstance<INotificationService>() == null)
|
||||||
{
|
{
|
||||||
|
// If not we add the internal NotifyIcon notification service
|
||||||
SimpleServiceProvider.Current.AddService<INotificationService>(new NotifyIconNotificationService());
|
SimpleServiceProvider.Current.AddService<INotificationService>(new NotifyIconNotificationService());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,6 +22,8 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using GreenshotPlugin.Core;
|
using GreenshotPlugin.Core;
|
||||||
|
using GreenshotPlugin.IniFile;
|
||||||
|
using GreenshotPlugin.Interfaces;
|
||||||
using log4net;
|
using log4net;
|
||||||
|
|
||||||
namespace Greenshot.Helpers
|
namespace Greenshot.Helpers
|
||||||
|
@ -32,6 +34,7 @@ namespace Greenshot.Helpers
|
||||||
public class NotifyIconNotificationService : INotificationService
|
public class NotifyIconNotificationService : INotificationService
|
||||||
{
|
{
|
||||||
private static readonly ILog Log = LogManager.GetLogger(typeof(NotifyIconNotificationService));
|
private static readonly ILog Log = LogManager.GetLogger(typeof(NotifyIconNotificationService));
|
||||||
|
private static readonly CoreConfiguration CoreConfiguration = IniConfig.GetIniSection<CoreConfiguration>();
|
||||||
private readonly NotifyIcon _notifyIcon;
|
private readonly NotifyIcon _notifyIcon;
|
||||||
|
|
||||||
public NotifyIconNotificationService()
|
public NotifyIconNotificationService()
|
||||||
|
@ -83,7 +86,13 @@ namespace Greenshot.Helpers
|
||||||
/// <param name="level">ToolTipIcon</param>
|
/// <param name="level">ToolTipIcon</param>
|
||||||
/// <param name="onClickAction">Action</param>
|
/// <param name="onClickAction">Action</param>
|
||||||
/// <param name="onClosedAction">Action</param>
|
/// <param name="onClosedAction">Action</param>
|
||||||
public void ShowMessage(string message, int timeout, ToolTipIcon level, Action onClickAction = null, Action onClosedAction = null) {
|
private void ShowMessage(string message, int timeout, ToolTipIcon level, Action onClickAction = null, Action onClosedAction = null) {
|
||||||
|
// Do not inform the user if this is disabled
|
||||||
|
if (!CoreConfiguration.ShowTrayNotification)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
void BalloonClickedHandler(object s, EventArgs e)
|
void BalloonClickedHandler(object s, EventArgs e)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
|
|
@ -40,7 +40,7 @@ namespace GreenshotJiraPlugin.Forms {
|
||||||
|
|
||||||
public JiraForm(JiraConnector jiraConnector) {
|
public JiraForm(JiraConnector jiraConnector) {
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
Icon = GreenshotResources.getGreenshotIcon();
|
Icon = GreenshotResources.GetGreenshotIcon();
|
||||||
AcceptButton = uploadButton;
|
AcceptButton = uploadButton;
|
||||||
CancelButton = cancelButton;
|
CancelButton = cancelButton;
|
||||||
|
|
||||||
|
|
|
@ -40,7 +40,7 @@ namespace GreenshotOfficePlugin.Destinations {
|
||||||
private const int IconApplication = 0;
|
private const int IconApplication = 0;
|
||||||
private const int IconMeeting = 2;
|
private const int IconMeeting = 2;
|
||||||
|
|
||||||
private static readonly Image MailIcon = GreenshotResources.getImage("Email.Image");
|
private static readonly Image MailIcon = GreenshotResources.GetImage("Email.Image");
|
||||||
private static readonly OfficeConfiguration OfficeConfig = IniConfig.GetIniSection<OfficeConfiguration>();
|
private static readonly OfficeConfiguration OfficeConfig = IniConfig.GetIniSection<OfficeConfiguration>();
|
||||||
private static readonly string ExePath;
|
private static readonly string ExePath;
|
||||||
private static readonly bool IsActiveFlag;
|
private static readonly bool IsActiveFlag;
|
||||||
|
|
|
@ -51,7 +51,7 @@ namespace GreenshotPlugin.Controls {
|
||||||
// The InitializeComponent() call is required for Windows Forms designer support.
|
// The InitializeComponent() call is required for Windows Forms designer support.
|
||||||
//
|
//
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
Icon = GreenshotResources.getGreenshotIcon();
|
Icon = GreenshotResources.GetGreenshotIcon();
|
||||||
_shouldClose = false;
|
_shouldClose = false;
|
||||||
Text = title;
|
Text = title;
|
||||||
label_pleasewait.Text = text;
|
label_pleasewait.Text = text;
|
||||||
|
|
|
@ -146,7 +146,7 @@ namespace GreenshotPlugin.Controls {
|
||||||
protected override void OnLoad(EventArgs e) {
|
protected override void OnLoad(EventArgs e) {
|
||||||
// Every GreenshotForm should have it's default icon
|
// Every GreenshotForm should have it's default icon
|
||||||
// And it might not ne needed for a Tool Window, but still for the task manager / switcher it's important
|
// And it might not ne needed for a Tool Window, but still for the task manager / switcher it's important
|
||||||
Icon = GreenshotResources.getGreenshotIcon();
|
Icon = GreenshotResources.GetGreenshotIcon();
|
||||||
if (!DesignMode) {
|
if (!DesignMode) {
|
||||||
if (!_applyLanguageManually) {
|
if (!_applyLanguageManually) {
|
||||||
ApplyLanguage();
|
ApplyLanguage();
|
||||||
|
|
|
@ -50,7 +50,7 @@ namespace GreenshotPlugin.Controls {
|
||||||
}
|
}
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
ClientSize = size;
|
ClientSize = size;
|
||||||
Icon = GreenshotResources.getGreenshotIcon();
|
Icon = GreenshotResources.GetGreenshotIcon();
|
||||||
Text = browserTitle;
|
Text = browserTitle;
|
||||||
_addressTextBox.Text = authorizationLink;
|
_addressTextBox.Text = authorizationLink;
|
||||||
|
|
||||||
|
|
|
@ -37,7 +37,7 @@ namespace GreenshotPlugin.Controls {
|
||||||
// The InitializeComponent() call is required for Windows Forms designer support.
|
// The InitializeComponent() call is required for Windows Forms designer support.
|
||||||
//
|
//
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
Icon = GreenshotResources.getGreenshotIcon();
|
Icon = GreenshotResources.GetGreenshotIcon();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -234,7 +234,7 @@ namespace GreenshotPlugin.Core {
|
||||||
menu.Items.Add(new ToolStripSeparator());
|
menu.Items.Add(new ToolStripSeparator());
|
||||||
ToolStripMenuItem closeItem = new ToolStripMenuItem(Language.GetString("editor_close"))
|
ToolStripMenuItem closeItem = new ToolStripMenuItem(Language.GetString("editor_close"))
|
||||||
{
|
{
|
||||||
Image = GreenshotResources.getImage("Close.Image")
|
Image = GreenshotResources.GetImage("Close.Image")
|
||||||
};
|
};
|
||||||
closeItem.Click += delegate {
|
closeItem.Click += delegate {
|
||||||
// This menu entry is the close itself, we can dispose the surface
|
// This menu entry is the close itself, we can dispose the surface
|
||||||
|
|
|
@ -1,20 +1,20 @@
|
||||||
/*
|
/*
|
||||||
* Greenshot - a free and open source screenshot tool
|
* Greenshot - a free and open source screenshot tool
|
||||||
* Copyright (C) 2007-2020 Thomas Braun, Jens Klingen, Robin Krom
|
* Copyright (C) 2007-2020 Thomas Braun, Jens Klingen, Robin Krom
|
||||||
*
|
*
|
||||||
* For more information see: http://getgreenshot.org/
|
* For more information see: http://getgreenshot.org/
|
||||||
* The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot
|
* The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 1 of the License, or
|
* the Free Software Foundation, either version 1 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
@ -26,21 +26,18 @@ namespace GreenshotPlugin.Core {
|
||||||
/// Centralized storage of the icons & bitmaps
|
/// Centralized storage of the icons & bitmaps
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static class GreenshotResources {
|
public static class GreenshotResources {
|
||||||
private static readonly ComponentResourceManager greenshotResources = new ComponentResourceManager(typeof(GreenshotResources));
|
private static readonly ComponentResourceManager GreenshotResourceManager = new ComponentResourceManager(typeof(GreenshotResources));
|
||||||
|
|
||||||
public static Image getImage(string imageName) {
|
public static Image GetImage(string imageName) {
|
||||||
return (Image)greenshotResources.GetObject(imageName);
|
return (Image)GreenshotResourceManager.GetObject(imageName);
|
||||||
}
|
}
|
||||||
public static Icon getIcon(string imageName) {
|
public static Icon GetIcon(string imageName) {
|
||||||
return (Icon)greenshotResources.GetObject(imageName);
|
return (Icon)GreenshotResourceManager.GetObject(imageName);
|
||||||
}
|
|
||||||
|
|
||||||
public static Icon getGreenshotIcon() {
|
|
||||||
return getIcon("Greenshot.Icon");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Image getGreenshotImage() {
|
public static Icon GetGreenshotIcon() {
|
||||||
return getImage("Greenshot.Image");
|
return GetIcon("Greenshot.Icon");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,8 +21,11 @@
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
|
||||||
namespace Greenshot.Helpers
|
namespace GreenshotPlugin.Interfaces
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// This is the interface for the different notification service implementations
|
||||||
|
/// </summary>
|
||||||
public interface INotificationService
|
public interface INotificationService
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -167,7 +167,7 @@ namespace GreenshotWin10Plugin.Destinations
|
||||||
|
|
||||||
// Create logo
|
// Create logo
|
||||||
RandomAccessStreamReference logoRandomAccessStreamReference;
|
RandomAccessStreamReference logoRandomAccessStreamReference;
|
||||||
using (var logo = GreenshotResources.getGreenshotIcon().ToBitmap())
|
using (var logo = GreenshotResources.GetGreenshotIcon().ToBitmap())
|
||||||
using (var logoThumbnail = ImageHelper.CreateThumbnail(logo, 30, 30))
|
using (var logoThumbnail = ImageHelper.CreateThumbnail(logo, 30, 30))
|
||||||
{
|
{
|
||||||
ImageOutput.SaveToStream(logoThumbnail, null, logoStream, outputSettings);
|
ImageOutput.SaveToStream(logoThumbnail, null, logoStream, outputSettings);
|
||||||
|
|
|
@ -20,20 +20,51 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
using System.Drawing.Imaging;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Windows.UI.Notifications;
|
using Windows.UI.Notifications;
|
||||||
using Greenshot.Helpers;
|
using GreenshotPlugin.Core;
|
||||||
|
using GreenshotPlugin.IniFile;
|
||||||
|
using GreenshotPlugin.Interfaces;
|
||||||
using log4net;
|
using log4net;
|
||||||
|
|
||||||
namespace GreenshotWin10Plugin
|
namespace GreenshotWin10Plugin
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// This service provides a way to inform (notify) the user.
|
||||||
|
/// </summary>
|
||||||
public class ToastNotificationService : INotificationService
|
public class ToastNotificationService : INotificationService
|
||||||
{
|
{
|
||||||
private static readonly ILog Log = LogManager.GetLogger(typeof(ToastNotificationService));
|
private static readonly ILog Log = LogManager.GetLogger(typeof(ToastNotificationService));
|
||||||
|
private static readonly CoreConfiguration CoreConfiguration = IniConfig.GetIniSection<CoreConfiguration>();
|
||||||
|
|
||||||
|
private readonly string _imageFilePath;
|
||||||
|
public ToastNotificationService()
|
||||||
|
{
|
||||||
|
var localAppData = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "Greenshot");
|
||||||
|
if (!Directory.Exists(localAppData))
|
||||||
|
{
|
||||||
|
Directory.CreateDirectory(localAppData);
|
||||||
|
}
|
||||||
|
_imageFilePath = Path.Combine(localAppData, "greenshot.png");
|
||||||
|
|
||||||
|
if (File.Exists(_imageFilePath))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
using var greenshotImage = GreenshotResources.GetGreenshotIcon().ToBitmap();
|
||||||
|
greenshotImage.Save(_imageFilePath, ImageFormat.Png);
|
||||||
|
}
|
||||||
|
|
||||||
private void ShowMessage(string message, Action onClickAction, Action onClosedAction)
|
private void ShowMessage(string message, Action onClickAction, Action onClosedAction)
|
||||||
{
|
{
|
||||||
|
// Do not inform the user if this is disabled
|
||||||
|
if (!CoreConfiguration.ShowTrayNotification)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
// Get a toast XML template
|
// Get a toast XML template
|
||||||
var toastXml = ToastNotificationManager.GetTemplateContent(ToastTemplateType.ToastImageAndText01);
|
var toastXml = ToastNotificationManager.GetTemplateContent(ToastTemplateType.ToastImageAndText01);
|
||||||
|
|
||||||
|
@ -41,10 +72,17 @@ namespace GreenshotWin10Plugin
|
||||||
var stringElement = toastXml.GetElementsByTagName("text").First();
|
var stringElement = toastXml.GetElementsByTagName("text").First();
|
||||||
stringElement.AppendChild(toastXml.CreateTextNode(message));
|
stringElement.AppendChild(toastXml.CreateTextNode(message));
|
||||||
|
|
||||||
// Specify the absolute path to an image
|
if (_imageFilePath != null && File.Exists(_imageFilePath))
|
||||||
//string imagePath = "file:///" + Path.GetFullPath("toastImageAndText.png");
|
{
|
||||||
//var imageElement = toastXml.GetElementsByTagName("image").First();
|
// Specify the absolute path to an image
|
||||||
//imageElement.Attributes.GetNamedItem("src").NodeValue = imagePath;
|
var imageElement = toastXml.GetElementsByTagName("image").First();
|
||||||
|
var imageSrcNode = imageElement.Attributes.GetNamedItem("src");
|
||||||
|
if (imageSrcNode != null)
|
||||||
|
{
|
||||||
|
imageSrcNode.NodeValue = _imageFilePath;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Create the toast and attach event listeners
|
// Create the toast and attach event listeners
|
||||||
var toast = new ToastNotification(toastXml);
|
var toast = new ToastNotification(toastXml);
|
||||||
|
|
|
@ -20,7 +20,6 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using Greenshot.Helpers;
|
|
||||||
using GreenshotPlugin.Core;
|
using GreenshotPlugin.Core;
|
||||||
using GreenshotPlugin.Interfaces;
|
using GreenshotPlugin.Interfaces;
|
||||||
using GreenshotPlugin.Interfaces.Ocr;
|
using GreenshotPlugin.Interfaces.Ocr;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue