// helper function to get handle from command-line or user-input private Boolean?getHandle(String[] args, out String handle) { // check command-line for a handle if (args.Length > 0) { var input = args[0]; if (!String.IsNullOrWhiteSpace(input)) { // handle found, return to regularly scheduled program handle = input; return(true); } } //NOTE: temporally change shutdown mode, // so user can quit by choose not providing a handle Current.ShutdownMode = ShutdownMode.OnExplicitShutdown; // prompt user to enter a handle var editor = new EditHandleWindow(); var result = editor.ShowDialog(); // return user's input to main program handle = (result.HasValue && result.Value) ? editor.Handle : null; return(result); }
// helper function to get handle from command-line or user-input private Boolean? getHandle(String[] args, out String handle) { // check command-line for a handle if (args.Length > 0) { var input = args[0]; if (!String.IsNullOrWhiteSpace(input)) { // handle found, return to regularly scheduled program handle = input; return true; } } //NOTE: temporally change shutdown mode, // so user can quit by choose not providing a handle Current.ShutdownMode = ShutdownMode.OnExplicitShutdown; // prompt user to enter a handle var editor = new EditHandleWindow(); var result = editor.ShowDialog(); // return user's input to main program handle = (result.HasValue && result.Value) ? editor.Handle : null; return result; }