/// <summary> /// Sends a confirm question to the ui to check if the setting is correct. /// If it is, it fires the given delegate. /// The function must match the signature, public void MyFunction(EnvVarSetting setting); . /// </summary> /// <param name="actionMsg">The action MSG.</param> /// <param name="setting">The setting.</param> /// <param name="function">The function.</param> /// <exception cref="System.ArgumentOutOfRangeException"></exception> public static void QuestionSetting(string actionMsg, EnvVarSetting setting, EnvVarSettingFunction function) { var builder = new StringBuilder(); builder.Append(UIText.AreYouSure); builder.Append(actionMsg); builder.Append(UIText.EnvVarXName); builder.Append(setting.Name); builder.Append(UIText.Comma); builder.Append(UIText.XValue); builder.Append(setting.Value); builder.Append(UIText.Comma); builder.Append(UIText.XTarget); builder.Append(setting.Target); builder.Append(UIText.EndCap); var result = MessageBox.Show( builder.ToString(), App.AppName, MessageBoxButton.YesNoCancel, MessageBoxImage.Warning); switch (result) { case MessageBoxResult.OK: case MessageBoxResult.Yes: function(setting); break; case MessageBoxResult.None: case MessageBoxResult.Cancel: case MessageBoxResult.No: break; default: throw new ArgumentOutOfRangeException(UIText.MboxRangeError); } }