H
Horst Klein
I try to load a xaml on this way the XAML-Window is shown.
But if I close the Window the process does not stops!
What's wrong?
<Application x:Class="App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Startup="AppStartUp"
ShutdownMode="OnMainWindowClose"
/>
Private Sub AppStartup(ByVal sender As Object, ByVal e As StartupEventArgs)
Try
ParseCommandLineArgs(e)
ExecuteCommandLineArgs()
Catch ex As Exception
MessageBox.Show(ex.ToString)
End Try
End Sub
Private Sub ExecuteCommandLineArgs()
Dim mainWindow As String =
App.CommandLineArgs.Item("/mainwindow").ToString
Dim xamlStream As FileStream = New FileStream("C:\WPF Test\" + mainWindow
+ ".xaml", FileMode.Open)
Dim genericControl As ContentControl = XamlReader.Load(xamlStream)
Me.ShutdownMode = System.Windows.ShutdownMode.OnMainWindowClose
Me.MainWindow = DirectCast(genericControl, Window)
Me.MainWindow.ShowDialog()
Me.Shutdown()
End Sub
But if I close the Window the process does not stops!
What's wrong?
<Application x:Class="App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Startup="AppStartUp"
ShutdownMode="OnMainWindowClose"
/>
Private Sub AppStartup(ByVal sender As Object, ByVal e As StartupEventArgs)
Try
ParseCommandLineArgs(e)
ExecuteCommandLineArgs()
Catch ex As Exception
MessageBox.Show(ex.ToString)
End Try
End Sub
Private Sub ExecuteCommandLineArgs()
Dim mainWindow As String =
App.CommandLineArgs.Item("/mainwindow").ToString
Dim xamlStream As FileStream = New FileStream("C:\WPF Test\" + mainWindow
+ ".xaml", FileMode.Open)
Dim genericControl As ContentControl = XamlReader.Load(xamlStream)
Me.ShutdownMode = System.Windows.ShutdownMode.OnMainWindowClose
Me.MainWindow = DirectCast(genericControl, Window)
Me.MainWindow.ShowDialog()
Me.Shutdown()
End Sub