public static CimResponseType PromptUser(string message, CimPromptType prompt) { Console.WriteLine("Got PromptUser callback"); Console.WriteLine("Message : {0}", message); // Prompt the user to get proper Cim Response Type return(CimResponseType.Yes); }
private CimResponseType PromptUserCallback(string message, CimPromptType promptType) { Action action = null; Action action1 = null; string str = this.JobContext.PrependComputerNameToMessage(message); Exception obj = null; int num = 0; this._userWasPromptedForContinuationOfProcessing = true; CimPromptType cimPromptType = promptType; switch (cimPromptType) { case CimPromptType.None: { CimChildJobBase <T> cimChildJobBase = this; if (action1 == null) { action1 = () => num = (int)this.ShouldProcess(message, null, null); } cimChildJobBase.ExceptionSafeWrapper(action1); break; } case CimPromptType.Critical: { CimChildJobBase <T> cimChildJobBase1 = this; if (action == null) { action = () => { if (!this.ShouldContinue(str, (string)null, out obj)) { num = (int)CimResponseType.None; return; } else { num = (int)CimResponseType.Yes; return; } } ; } cimChildJobBase1.ExceptionSafeWrapper(action); break; } } if (obj != null) { num = 2; } if (num == 1 || num == 3) { this._userRespondedYesToAtLeastOneShouldProcess = true; } return((CimResponseType)num); }
private CimResponseType PromptUserCallback(string message, CimPromptType promptType) { message = this.JobContext.PrependComputerNameToMessage(message); Exception exceptionThrownOnCmdletThread = null; CimResponseType result = CimResponseType.No; _userWasPromptedForContinuationOfProcessing = true; switch (promptType) { case CimPromptType.Critical: this.ExceptionSafeWrapper( delegate { if (this.ShouldContinue(message, null, out exceptionThrownOnCmdletThread)) { result = CimResponseType.Yes; } else { result = CimResponseType.No; } }); break; case CimPromptType.Normal: this.ExceptionSafeWrapper( delegate { result = this.ShouldProcess(message, null, null); }); break; default: Dbg.Assert(false, "Unrecognized CimPromptType"); break; } if (exceptionThrownOnCmdletThread != null) { result = CimResponseType.NoToAll; } if ((result == CimResponseType.Yes) || (result == CimResponseType.YesToAll)) { _userRespondedYesToAtLeastOneShouldProcess = true; } return(result); }
public override void Execute(CmdletOperationBase cmdlet) { bool flag; ValidationHelper.ValidateNoNullArgument(cmdlet, "cmdlet"); bool flag1 = false; bool flag2 = false; CimPromptType cimPromptType = this.prompt; switch (cimPromptType) { case CimPromptType.None: { flag = cmdlet.ShouldProcess(this.message); if (!flag) { if (flag) { break; } this.responseType = CimResponseType.None; break; } else { this.responseType = CimResponseType.Yes; break; } } case CimPromptType.Critical: { flag = cmdlet.ShouldContinue(this.message, "caption", ref flag1, ref flag2); if (!flag1) { if (!flag2) { if (!flag) { if (flag) { break; } this.responseType = CimResponseType.None; break; } else { this.responseType = CimResponseType.Yes; break; } } else { this.responseType = CimResponseType.NoToAll; break; } } else { this.responseType = CimResponseType.YesToAll; break; } } } this.OnComplete(); }
public CimPromptUser(string message, CimPromptType prompt) { this.message = message; this.prompt = prompt; }
/// <summary> /// Constructor /// </summary> public CimPromptUser(string message, CimPromptType prompt) { this.message = message; this.prompt = prompt; }
/// <summary> /// PromptUser callback /// </summary> /// <param name="message"></param> /// <param name="prompt"></param> /// <returns></returns> public CimResponseType PromptUser(string message, CimPromptType prompt) { DebugHelper.WriteLogEx("message:{0} prompt:{1}", 0, message, prompt); try { CimPromptUser action = new CimPromptUser(message, prompt); this.FireNewActionEvent(action); return action.GetResponse(); } catch (Exception ex) { DebugHelper.WriteLogEx("{0}", 0, ex); return CimResponseType.NoToAll; } }
public CimResponseType PromptUser(string message, CimPromptType prompt) { CimResponseType response; object[] objArray = new object[2]; objArray[0] = message; objArray[1] = prompt; DebugHelper.WriteLogEx("message:{0} prompt:{1}", 0, objArray); try { CimPromptUser cimPromptUser = new CimPromptUser(message, prompt); this.FireNewActionEvent(cimPromptUser); response = cimPromptUser.GetResponse(); } catch (Exception exception1) { Exception exception = exception1; object[] objArray1 = new object[1]; objArray1[0] = exception; DebugHelper.WriteLogEx("{0}", 0, objArray1); response = CimResponseType.NoToAll; } return response; }