Beispiel #1
0
		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);
		}
Beispiel #2
0
		public bool IsAdSelected(IRibbonControl control) { return control.CurrentAd() != null; }
Beispiel #3
0
		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();
		}