mui icon indicating copy to clipboard operation
mui copied to clipboard

ModernWindow not being destroyed when going "Back"

Open ccarv opened this issue 9 years ago • 5 comments

First time with C# and WPF w/ ModernUI Framework. Thank you guys for the hard work.

I'm trying to understand how I would properly initialize another ModernWindow as well as destroy the object when the back arrow is clicked. The window loads fine but going back doesn't destroy the object. Do I have to handle a close event somewhere to properly dispose of it?

public void navigateMediaSelection(object sender, RoutedEventArgs e)
{
    ModernWindow window = new ModernWindow();

    try
    {
        window.LinkNavigator.Navigate(new Uri("/Pages/MediaView/MovieView.xaml", UriKind.Relative), this);
    }
    catch (Exception error)
    {
        ModernDialog.ShowMessage(error.Message, FirstFloor.ModernUI.Resources.NavigationFailed, MessageBoxButton.OK);
    }
}

Also, I am trying to figure out how to change the DisplayName property that is set in MainWindow.xaml. I have a Link that would be better if it was bound to a variable since the page title will change.

Thank you

ccarv avatar Dec 18 '15 15:12 ccarv

My application uses Microsoft.Office.Interop.Excel services to open and read an Excel file. I need to close Excel and dispose of the objects. I've implemented IDispose on view model and the page, but they never fire. I've tried SessionEnding on the App, but it is never called when closing the application. I can't find any reference to my page object in the Exit event which is triggered. Do I need to intercept the navigation URIs?

bobthiele avatar Jan 26 '16 20:01 bobthiele

I found that I can add it to the UserControl_Unloaded() event. It doesn't fire until the application is actually closing, but it will fire for the opened window.

bobthiele avatar Jan 26 '16 20:01 bobthiele

@bobthiele I figured out what the problem was. I am not home at the moment but when I am later, I will post the alternative code.

I was creating the wrong Window class. IIRC, you are suppose to initialize a new window class with BBCodeBlock.

ccarv avatar Jan 26 '16 20:01 ccarv

@bobthiele Also, don't expect help from this GitHub. It appears the repository is dead and there are no active developers for it.

ccarv avatar Jan 26 '16 20:01 ccarv

Hey @feered can you post your alternative code? I have a problem with disposing viewmodels even in ModernTab when element is set to be not KeepAlive, so your code might be helpful for me.

Thanks!

lechu90ns avatar May 15 '16 11:05 lechu90ns