private static TaskDialogResult ShowEmulatedTaskDialog(TaskDialogOptions options) { TaskDialog td = new TaskDialog(); TaskDialogViewModel tdvm = new TaskDialogViewModel(options); td.DataContext = tdvm; if (options.Owner != null) { td.Owner = options.Owner; } td.ShowDialog(); TaskDialogResult result = null; int diagResult = -1; TaskDialogSimpleResult simpResult = TaskDialogSimpleResult.None; bool verificationChecked = false; int radioButtonResult = -1; int? commandButtonResult = null; int? customButtonResult = null; diagResult = tdvm.DialogResult; radioButtonResult = tdvm.RadioResult - RadioButtonIDOffset; verificationChecked = tdvm.VerificationChecked; if (diagResult >= CommandButtonIDOffset) { simpResult = TaskDialogSimpleResult.Command; commandButtonResult = diagResult - CommandButtonIDOffset; } //else if (diagResult >= RadioButtonIDOffset) //{ // simpResult = (TaskDialogSimpleResult)diagResult; // radioButtonResult = diagResult - RadioButtonIDOffset; //} else if (diagResult >= CustomButtonIDOffset) { simpResult = TaskDialogSimpleResult.Custom; customButtonResult = diagResult - CustomButtonIDOffset; } // This occurs usually when the red X button is clicked else if (diagResult == -1) { simpResult = TaskDialogSimpleResult.Cancel; } else { simpResult = (TaskDialogSimpleResult)diagResult; } result = new TaskDialogResult( simpResult, (String.IsNullOrEmpty(options.VerificationText) ? null : (bool?)verificationChecked), ((options.RadioButtons == null || options.RadioButtons.Length == 0) ? null : (int?)radioButtonResult), ((options.CommandButtons == null || options.CommandButtons.Length == 0) ? null : commandButtonResult), ((options.CustomButtons == null || options.CustomButtons.Length == 0) ? null : customButtonResult)); return(result); }
private static TaskDialogResult ShowEmulatedTaskDialog(TaskDialogOptions options) { TaskDialog td = new TaskDialog(); TaskDialogViewModel tdvm = new TaskDialogViewModel(options); td.DataContext = tdvm; if (options.Owner != null) { td.Owner = options.Owner; } td.ShowDialog(); TaskDialogResult result = null; int diagResult = -1; TaskDialogSimpleResult simpResult = TaskDialogSimpleResult.None; bool verificationChecked = false; int radioButtonResult = -1; int? commandButtonResult = null; int? customButtonResult = null; diagResult = tdvm.DialogResult; radioButtonResult = tdvm.RadioResult - RadioButtonIDOffset; verificationChecked = tdvm.VerificationChecked; if (diagResult >= CommandButtonIDOffset) { simpResult = TaskDialogSimpleResult.Command; commandButtonResult = diagResult - CommandButtonIDOffset; } //else if (diagResult >= RadioButtonIDOffset) //{ // simpResult = (TaskDialogSimpleResult)diagResult; // radioButtonResult = diagResult - RadioButtonIDOffset; //} else if (diagResult >= CustomButtonIDOffset) { simpResult = TaskDialogSimpleResult.Custom; customButtonResult = diagResult - CustomButtonIDOffset; } // This occurs usually when the red X button is clicked else if (diagResult == -1) { simpResult = TaskDialogSimpleResult.Cancel; } else { simpResult = (TaskDialogSimpleResult)diagResult; } result = new TaskDialogResult( simpResult, (String.IsNullOrEmpty(options.VerificationText) ? null : (bool?)verificationChecked), ((options.RadioButtons == null || options.RadioButtons.Length == 0) ? null : (int?)radioButtonResult), ((options.CommandButtons == null || options.CommandButtons.Length == 0) ? null : commandButtonResult), ((options.CustomButtons == null || options.CustomButtons.Length == 0) ? null : customButtonResult)); return result; }