Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I have been able to display a balloon tip by initialising the icon in the viewmodel instead of the XAML.</p> <p>Just calling the ShowBalloonTip method in my command do the trick.</p> <p>I created a wrapper for the notify Icon: NotifyService:</p> <pre><code>public class NotifyService : INotifyService { private TaskbarIcon icon = new TaskbarIcon { Name = "NotifyIcon", Icon = new System.Drawing.Icon( Application.GetResourceStream(Utils.FileUtils.MakeUri("/Icons/email.ico")).Stream), }; public void Notify(string message) { icon.ShowBalloonTip("title", message, BalloonIcon.None); } public void ChangeIconSource(string path) { icon.Icon = new System.Drawing.Icon( Application.GetResourceStream(Utils.FileUtils.MakeUri(path)).Stream); } } </code></pre> <p>And I used it in my view model: viewmodel</p> <pre><code>public class MainWindowViewModel : WindowViewModelBase { private readonly INotifyService notifyService = new NotifyService(); #region Fields private static HomeWindowViewModel homeViewModel = new HomeWindowViewModel(); #endregion /// Initializes a new instance of the &lt;see cref="MainWindowViewModel"/&gt; class. /// &lt;/summary&gt; public MainWindowViewModel() : base() { CurrentViewModel = homeViewModel; } #region Methods protected override void OnViewModelPropertyChanged(IViewModel viewModel, string propertyName) { int t = 2; } protected override void OnViewModelCommandExecuted(IViewModel viewModel, ICatelCommand command, object commandParameter) { int t = 2; notifyService.ChangeIconSource(@"/Icons/new_email.ico"); notifyService.Notify("test"); } #endregion } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload