Closed bocchinifabio closed 5 years ago
I have this error mesage when I try to show a message in wpf app: System.InvalidOperationException: 'Cannot set Owner property to a Window that has not been shown previously.' someone can help me?
Could you give more info? Place where it crash, stacktrace, your code ?
Hi,
I’m sorry, I use the code inside the basic example, I put the ToastViewModel class inside my project and I use this code for call it:
private void Image_MouseDown(object sender, MouseButtonEventArgs e) { ShowMessage(_vm.ShowInformation, "Information"); }
private void OnUnload(object sender, RoutedEventArgs e)
{
_vm.OnUnloaded();
}
void ShowMessage(Action<string, MessageOptions> action, string name)
{
MessageOptions opts = new MessageOptions
{
CloseClickAction = CloseAction,
Tag = $"[This is Tag Value ({++_count})]",
FreezeOnMouseEnter = false,//cbFreezeOnMouseEnter.IsChecked.GetValueOrDefault(),
UnfreezeOnMouseLeave = false,//cbUnfreezeOnMouseLeave.IsChecked.GetValueOrDefault(),
ShowCloseButton = true //cbShowCloseButton.IsChecked.GetValueOrDefault()
};
_lastMessage = $"{_count} {name}";
action(_lastMessage, opts);
//bClearLast.IsEnabled = true;
}
private void CloseAction(NotificationBase obj)
{
var opts = obj.DisplayPart.Notification.Options;
_vm.ShowInformation($"Notification close clicked, Tag: {opts.Tag}");
}
Of course the versionof your library is the last one and the framework is 7.2. the code above is in the mainWindow.xaml.cs and when I call the show message procedure the program crash immediatly.
I hope this can help you, tank you very mutch.
Inviato da Posta per Windows 10
Da: Rafał Łopatka Inviato: sabato 20 aprile 2019 13:34 A: rafallopatka/ToastNotifications Cc: bocchinifabio; State change Oggetto: Re: [rafallopatka/ToastNotifications] visualization problem (#89)
Could you give more info? Place where it crash, stacktrace, your code ? — You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub, or mute the thread.
I guest you didn't initialize Notifier or other object in proper way, try to check examples
Library version
Expected behaviour
Actual behaviour
Steps to reproduce behaviour
Code to reproduce behaviour
Questions