protected internal virtual string GetText(OperationSymbol operation, OperationSettings os) { if (os != null && os.Text != null) { return(os.Text); } return(operation.NiceToString()); }
protected internal virtual ImageSource GetImage(OperationSymbol operation, OperationSettings os) { if (os != null && os.Icon != null) { return(os.Icon); } if (IsSave(operation)) { return(ImageLoader.GetImageSortName("save.png")); } return(null); }
protected internal virtual Brush GetBackground(OperationInfo oi, OperationSettings os) { if (os != null && os.Color != null) { return(new SolidColorBrush(os.Color.Value)); } var bc = BackgroundColors.LastOrDefault(a => a.IsApplicable(oi)); if (bc != null) { return(new SolidColorBrush(bc.Color)); } return(null); }
public OS GetSettings <OS>(Type type, OperationSymbol operation) where OS : OperationSettings { OperationSettings settings = Settings.TryGetValue(type)?.TryGetC(operation); if (settings != null) { var result = settings as OS; if (result == null) { throw new InvalidOperationException("{0}({1}) should be a {2}".FormatWith(settings.GetType().TypeName(), operation.Key, typeof(OS).TypeName())); } return(result); } return(null); }
public static void AddSetting(OperationSettings setting) { Manager.Settings.GetOrAddDefinition(setting.OverridenType).AddOrThrow(setting.OperationSymbol, setting, "{0} repeated"); Manager.Settings.ClearCache(); }
public static void ReplaceSetting(OperationSettings setting) { Manager.Settings.GetOrAddDefinition(setting.OverridenType)[setting.OperationSymbol] = setting; Manager.Settings.ClearCache(); }
public bool ConfirmMessage() { string message = OperationSettings != null && OperationSettings.ConfirmMessage != null?OperationSettings.ConfirmMessage(this) : OperationInfo.OperationType == OperationType.Delete && Entities.Count > 1 ? OperationMessage.PleaseConfirmYouDLikeToDeleteTheSelectedEntitiesFromTheSystem.NiceToString() : OperationInfo.OperationType == OperationType.Delete && Entities.Count == 1 ? OperationMessage.PleaseConfirmYouDLikeToDeleteTheEntityFromTheSystem.NiceToString() : null; if (message == null) { return(true); } return(MessageBox.Show(Window.GetWindow(SearchControl), message, OperationInfo.OperationSymbol.NiceToString(), MessageBoxButton.OKCancel) == MessageBoxResult.OK); }