visualization problem
bocchinifabio opened this issue · 4 comments
bocchinifabio commented
Library version
Expected behaviour
Actual behaviour
Steps to reproduce behaviour
Code to reproduce behaviour
Questions
bocchinifabio commented
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?
rafallopatka commented
Could you give more info? Place where it crash, stacktrace, your code ?
bocchinifabio commented
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.
rafallopatka commented
I guest you didn't initialize Notifier or other object in proper way, try to check examples