Example #1
0
 // The command-line argument is set through the Visual Studio
 // project properties (the Debug tab).
 private static void App_Startup(object sender, StartupEventArgs e)
 {
     // At this point, the main window has been set but not shown.
     if (e.Args.Length > 0)
     {
         string file = e.Args[0];
         if (File.Exists(file))
         {
             // Configure the main window.
             FileViewer win = (FileViewer)Application.Current.MainWindow;
             win.LoadFile(file);
         }
     }
 }
Example #2
0
        // The command-line argument is set through the Visual Studio
        // project properties (the Debug tab).
        private void OnApplicationStartup(object sender, StartupEventArgs e)
        {
            // At this point, the main window has been created but not shown.
            var win = new FileViewer();

            if (e.Args.Length > 0)
            {
                var file = e.Args[0];
                if (File.Exists(file))
                {
                    // Configure the main window.
                    win.LoadFile(file);
                }
            }

            // This window will automatically be set as the Application.MainWindow.
            win.Show();
        }
Example #3
0
        // The command-line argument is set through the Visual Studio
        // project properties (the Debug tab).
        private void App_Startup(object sender, StartupEventArgs e)
        {           
            // At this point, the main window has been created but not shown.
            FileViewer win = new FileViewer();

            if (e.Args.Length > 0)
            {
                string file = e.Args[0];
                if (File.Exists(file))
                {
                    // Configure the main window.                    
                    win.LoadFile(file);
                }
            }

            // This window will automatically be set as the Application.MainWindow.
            win.Show();
        }