本文整理汇总了C#中IRibbonControl.CurrentAd方法的典型用法代码示例。如果您正苦于以下问题:C# IRibbonControl.CurrentAd方法的具体用法?C# IRibbonControl.CurrentAd怎么用?C# IRibbonControl.CurrentAd使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IRibbonControl
的用法示例。
在下文中一共展示了IRibbonControl.CurrentAd方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AutoFormat
public void AutoFormat(IRibbonControl control) {
var ad = control.CurrentAd();
if (ad == null) return;
var warnings = ad.CheckWarnings();
if (warnings.Any()
&& !Dialog.Warn("This ad has unresolved warnings:\r\n • " + warnings.Join("\r\n • ", w => w.Message)
+ "\r\nThe autoformatter may not catch everything. Do you want to autoformat anyway?"))
return;
ad.Presentation.Formatter.FormatText(ad);
}
示例2: IsAdSelected
public bool IsAdSelected(IRibbonControl control) { return control.CurrentAd() != null; }
示例3: DeleteAd
public void DeleteAd(IRibbonControl control) {
string message;
var ad = control.CurrentAd();
if (ad == null) return;
if (!control.Journal().ConfirmModification())
return;
if (ad.Row.Payments.Any())
message = String.Format(CultureInfo.CurrentCulture, "Are you sure you want to delete this ad?\r\nThe ad's {0:c} in payments will not be deleted.\r\nYou should probably delete them first.",
ad.Row.Payments.Sum(p => p.Amount));
else if (ad.Row.Pledges.Any())
message = String.Format(CultureInfo.CurrentCulture, "Are you sure you want to delete this ad?\r\nThe ad's {0:c} in pledges will not be deleted.\r\nYou should probably delete them first.",
ad.Row.Pledges.Sum(p => p.Amount));
else
message = "Are you sure you want to delete this ad?";
if (Dialog.Warn(message))
ad.Delete();
}