Click here to Skip to main content
15,896,063 members
Home / Discussions / WPF
   

WPF

 
AnswerRe: Any trick for *REUSABLE* "Application" class? Pin
Ian Shlasko21-Apr-11 8:46
Ian Shlasko21-Apr-11 8:46 
GeneralRe: Any trick for *REUSABLE* "Application" class? Pin
SledgeHammer0121-Apr-11 8:48
SledgeHammer0121-Apr-11 8:48 
GeneralRe: Any trick for *REUSABLE* "Application" class? Pin
Ian Shlasko21-Apr-11 8:48
Ian Shlasko21-Apr-11 8:48 
GeneralRe: Any trick for *REUSABLE* "Application" class? Pin
SledgeHammer0121-Apr-11 8:59
SledgeHammer0121-Apr-11 8:59 
GeneralRe: Any trick for *REUSABLE* "Application" class? Pin
Ian Shlasko21-Apr-11 9:10
Ian Shlasko21-Apr-11 9:10 
GeneralRe: Any trick for *REUSABLE* "Application" class? Pin
SledgeHammer0121-Apr-11 9:33
SledgeHammer0121-Apr-11 9:33 
GeneralRe: Any trick for *REUSABLE* "Application" class? Pin
Ian Shlasko21-Apr-11 10:00
Ian Shlasko21-Apr-11 10:00 
GeneralRe: Any trick for *REUSABLE* "Application" class? Pin
SledgeHammer0121-Apr-11 11:29
SledgeHammer0121-Apr-11 11:29 
Yeah, I ended up having an ApplicationEx.StartupEx method (lol, you can totally tell I come from the MFC / Win32 world with all the "Ex" names) that takes the type for the user application class along with the args and then it creates the application and/or manages the single instance stuff. It does require the user to stub out a Main() and forward the call to my DLL though. I was trying to avoid that. Oh well.

Now I'm just having a bit of trouble figuring out a common place to process the command line for the first and subsequent instances since some of the WPF start up code is syncronous (Application.Run()). I've got it working for the second instance though. It does forward the args to the first instance.

I'm using the WindowsFormsApplicationBase technique to do the singleton app stuff. It does have the different entry points for the first / subsequent start ups (OnStartup / OnStartupNextInstance).

2nd+ instance is going through OnStartupNextInstance and calling a virtual method in ApplicationEx, but 1st instance is a bit trickier since I haven't quite convinced myself if that case should be passed in before the main window is created, but I'm thinking it probably should.

Its weird though... popping up a message box before the main window is created somehow creates the main window...
GeneralRe: Any trick for *REUSABLE* "Application" class? Pin
Ian Shlasko21-Apr-11 15:27
Ian Shlasko21-Apr-11 15:27 
GeneralRe: Any trick for *REUSABLE* "Application" class? Pin
SledgeHammer0121-Apr-11 17:06
SledgeHammer0121-Apr-11 17:06 
GeneralRe: Any trick for *REUSABLE* "Application" class? Pin
Ian Shlasko21-Apr-11 17:22
Ian Shlasko21-Apr-11 17:22 
GeneralRe: Any trick for *REUSABLE* "Application" class? Pin
Pete O'Hanlon22-Apr-11 9:25
mvePete O'Hanlon22-Apr-11 9:25 
GeneralRe: Any trick for *REUSABLE* "Application" class? Pin
SledgeHammer0122-Apr-11 9:52
SledgeHammer0122-Apr-11 9:52 
GeneralRe: Any trick for *REUSABLE* "Application" class? Pin
Pete O'Hanlon22-Apr-11 9:56
mvePete O'Hanlon22-Apr-11 9:56 
QuestionHmm ...MVVM ... Is this Bad? I can't decide Pin
Jammer21-Apr-11 4:26
Jammer21-Apr-11 4:26 
AnswerRe: Hmm ...MVVM ... Is this Bad? I can't decide Pin
BobJanova21-Apr-11 4:51
BobJanova21-Apr-11 4:51 
GeneralRe: Hmm ...MVVM ... Is this Bad? I can't decide Pin
Jammer21-Apr-11 5:02
Jammer21-Apr-11 5:02 
GeneralRe: Hmm ...MVVM ... Is this Bad? I can't decide Pin
Pete O'Hanlon21-Apr-11 10:04
mvePete O'Hanlon21-Apr-11 10:04 
GeneralRe: Hmm ...MVVM ... Is this Bad? I can't decide Pin
Jammer22-Apr-11 2:57
Jammer22-Apr-11 2:57 
GeneralRe: Hmm ...MVVM ... Is this Bad? I can't decide Pin
Pete O'Hanlon22-Apr-11 9:12
mvePete O'Hanlon22-Apr-11 9:12 
GeneralRe: Hmm ...MVVM ... Is this Bad? I can't decide Pin
Jammer22-Apr-11 10:38
Jammer22-Apr-11 10:38 
GeneralRe: Hmm ...MVVM ... Is this Bad? I can't decide Pin
Jammer25-Apr-11 22:38
Jammer25-Apr-11 22:38 
AnswerRe: Hmm ...MVVM ... Is this Bad? I can't decide [modified] Pin
BubingaMan28-Apr-11 1:59
BubingaMan28-Apr-11 1:59 
QuestionHow to read the data from listbox Itemsource datatemplate and display it in UI controls Pin
Rocky2320-Apr-11 2:24
Rocky2320-Apr-11 2:24 
AnswerRe: How to read the data from listbox Itemsource datatemplate and display it in UI controls Pin
Tarun.K.S20-Apr-11 3:05
Tarun.K.S20-Apr-11 3:05 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.