Print Page | Close Window

WPF Parameters

Printed From: IdeaBlade
Category: Cocktail
Forum Name: Community Forum
Forum Discription: A professional application framework using Caliburn.Micro and DevForce
URL: http://www.ideablade.com/forum/forum_posts.asp?TID=3555
Printed Date: 02-May-2024 at 12:26pm


Topic: WPF Parameters
Posted By: JChris
Subject: WPF Parameters
Date Posted: 27-Jul-2012 at 1:15pm
Is there a way to start a Cocktail WPF application with command line parameters?  



Replies:
Posted By: mgood
Date Posted: 27-Jul-2012 at 2:12pm
There most certainly is. Are you asking how you start the process with command line parameters or how to obtain the parameters in your code?
 
If it's the latter, the command line parameters are part of the StartupEventArgs passed to the Application.Startup event. Simply override OnStartup in your bootstrapper and grab the parameters from the event args.
 
http://msdn.microsoft.com/en-us/library/system.windows.application.startup.aspx - http://msdn.microsoft.com/en-us/library/system.windows.application.startup.aspx
 
Alternatively, you can get them by calling Environment.GetCommandLineArgs().
 
http://msdn.microsoft.com/en-us/library/system.environment.getcommandlineargs.aspx - http://msdn.microsoft.com/en-us/library/system.environment.getcommandlineargs.aspx


Posted By: JChris
Date Posted: 27-Jul-2012 at 2:24pm
Thanks Marcel.  Works great!



Print Page | Close Window