public bool CheckClearInput(string clearTo = "")
{
if (CanSaveToDraft && InputData.IsChanged)
{
var action = Setting.TweetBoxClosingAction.Value;
if (action == TweetBoxClosingAction.Confirm)
{
var msg = _parent.Messenger.GetResponseSafe(() =>
new TaskDialogMessage(new TaskDialogOptions
{
Title = InputAreaResources.MsgSaveToDraftTitle,
MainIcon = VistaTaskDialogIcon.Information,
MainInstruction = InputAreaResources.MsgSaveToDraftInst,
CommonButtons = TaskDialogCommonButtons.YesNoCancel,
VerificationText = Resources.MsgDoNotShowAgain,
AllowDialogCancellation = true,
}));
switch (msg.Response.Result)
{
case TaskDialogSimpleResult.Yes:
action = TweetBoxClosingAction.SaveToDraft;
break;
case TaskDialogSimpleResult.No:
action = TweetBoxClosingAction.Discard;
break;
default:
return false;
}
if (msg.Response.VerificationChecked.GetValueOrDefault())
{
Setting.TweetBoxClosingAction.Value = action;
}
}
switch (action)
{
case TweetBoxClosingAction.Discard:
break;
case TweetBoxClosingAction.SaveToDraft:
ClearInput(clearTo, true);
return true;
default:
throw new InvalidOperationException("Invalid return value:" + action);
}
}
ClearInput(clearTo);
return true;
}