public static string GetDisplayText(this SerieDTO serie, bool extendedVersion) { string dropSetString = ""; string repType = ""; string kgText = string.Empty; if (extendedVersion) { if (serie.Weight.HasValue) { kgText = Settings.Settings1.Default.WeightType == (int)WeightType.Kg ? ApplicationStrings.WeightType_Kg : ApplicationStrings.WeightType_Pound; } if (serie.DropSet != DropSetType.None) { dropSetString = "^" + (int)serie.DropSet; } if (serie.SetType != SetType.Normalna) { var localier = new EnumLocalizer(LocalizedPropertyGridStrings.ResourceManager); repType = localier.Translate((TrainingPlanSerieRepetitions)serie.SetType); } } double?weightDisp = null; if (serie.Weight.HasValue) { weightDisp = serie.Weight.Value.ToDisplayWeight(); } string format = string.Format("{0}x{1:#.##}", serie.RepetitionNumber, weightDisp); return(string.Format("{0}{3} {1}{2}", format, repType, dropSetString, kgText)); }
protected void FillSearchControls() { sortOrders.Clear(); exerciseTypes.Clear(); searchGroups.Clear(); ExerciseName = null; foreach (SearchSortOrder type in Enum.GetValues(typeof(SearchSortOrder))) { CheckListItem <SearchSortOrder> item = new CheckListItem <SearchSortOrder>(EnumLocalizer.Default.Translate(type), type); sortOrders.Add(item); } var strengthTrainingLocalizer = new EnumLocalizer(StrengthTrainingEntryStrings.ResourceManager); foreach (ExerciseSearchCriteriaGroup type in Enum.GetValues(typeof(ExerciseSearchCriteriaGroup))) { CheckListItem <ExerciseSearchCriteriaGroup> item = new CheckListItem <ExerciseSearchCriteriaGroup>(strengthTrainingLocalizer.Translate(type), type); if (type == ExerciseSearchCriteriaGroup.Other) {//by default search only in other user exercises item.IsChecked = true; } SearchGroups.Add(item); } foreach (ExerciseType type in Enum.GetValues(typeof(ExerciseType))) { if (type != ExerciseType.NotSet) { CheckListItem <ExerciseType> item = new CheckListItem <ExerciseType>(EnumLocalizer.Default.Translate(type), type); exerciseTypes.Add(item); } } }
/// <summary> /// Updates all elements to display the current effect and brightness /// </summary> public void Update() { //Update UI on main thread Dispatcher.Invoke(new Action(() => { var orchestrator = OrchestratorCollection.GetOrchestratorForDevice(_device); var activeEffect = orchestrator.GetActiveEffectName(); if (string.IsNullOrEmpty(activeEffect)) { ActiveEffectLabel.Content = MainWindows.Resources.None; } else { ActiveEffectLabel.Content = $"{activeEffect} ({EnumLocalizer.GetLocalizedEnum(_device.OperationMode)})"; } _selectedEffect = activeEffect; var activeBrightness = orchestrator.GetActiveBrightness(); Brightness = activeBrightness < 0 ? 0 : activeBrightness; OnPropertyChanged(nameof(Brightness)); //Call property changed to correctly set slider position //Update the colors in the mainwindow _parent.UpdateLayoutColors(_device.Name); //Update the dropdown EffectComboBox.UpdateSelection(_selectedEffect); })); }
//public static void LoadContent(this TrainingPlanInfo plan, bool force = false) //{ // if(plan.Tag==null || force) // { // var newPlan = ServiceManager.GetTrainingPlan(plan.GlobalId); // plan.Author = newPlan.Author; // //plan.DaysCount = newPlan.DaysCount; // plan.Difficult = newPlan.Difficult; // plan.Language = newPlan.Language; // plan.PublishDate = newPlan.PublishDate; // plan.Status = newPlan.Status; // plan.Rating = newPlan.Rating; // plan.UserRating = newPlan.UserRating; // plan.UserShortComment = newPlan.UserShortComment; // plan.Purpose = newPlan.Purpose; // plan.Tag = newPlan; // plan.TrainingType = newPlan.TrainingType; // plan.Version = newPlan.Version; // } //} public static string GetDisplayText(this TrainingPlanSerie serie, bool isCardio) { string dropSetString = ""; string repType = ""; string superSlow = ""; string restPause = ""; if (isCardio) { decimal seconds = serie.RepetitionNumberMin.HasValue ? serie.RepetitionNumberMin.Value : 0; var time = TimeSpan.FromSeconds((double)seconds); return(time.ToString()); } if (serie.DropSet != DropSetType.None) { dropSetString = "^" + (int)serie.DropSet; } if (serie.RepetitionsType != SetType.Normalna) { var localier = new EnumLocalizer(StrengthTrainingEntryStrings.ResourceManager); repType = localier.Translate(serie.RepetitionsType); } if (serie.IsSuperSlow) { superSlow = " SS"; } if (serie.IsRestPause) { restPause = " RP"; } string format = serie.ToStringRepetitionsRange(); return(string.Format("{0} {1}{2}{3}{4}", format, repType, dropSetString, superSlow, restPause).Trim()); }
public CurvesEffectConfigDialog() { InitializeComponent(); curveControlValueChangedDelegate = this.curveControl_ValueChanged; curveControlCoordinatesChangedDelegate = this.curveControl_CoordinatesChanged; colorTransferNames = EnumLocalizer.Create(typeof(ColorTransferMode)); this.Text = PdnResources.GetString("CurvesEffectConfigDialog.Text"); this.cancelButton.Text = PdnResources.GetString("Form.CancelButton.Text"); this.okButton.Text = PdnResources.GetString("Form.OkButton.Text"); this.resetButton.Text = PdnResources.GetString("CurvesEffectConfigDialog.ResetButton.Text"); this.transferHeader.Text = PdnResources.GetString("CurvesEffectConfigDialog.TransferHeader.Text"); this.labelHelpText.Text = PdnResources.GetString("CurvesEffectConfigDialog.HelpText.Text"); this.modeComboBox.Items.Clear(); this.modeComboBox.Items.AddRange(colorTransferNames.GetLocalizedNames()); this.maskCheckChanged = new EventHandler(MaskCheckChanged); this.curveControls = new Dictionary <ColorTransferMode, CurveControlColor> { { ColorTransferMode.Luminosity, new CurveControlLuminosity() }, { ColorTransferMode.Rgb, new CurveControlRgb() } }; }
public ScheduleItemUserControl(MainWindow parent, Schedule schedule) { Schedule = schedule; _parent = parent; InitializeComponent(); DataContext = this; if (Schedule.Active) { Background = (Brush) new BrushConverter().ConvertFromInvariantString("#7F3F6429"); } var nextEffect = schedule.GetNextTimeTrigger(); if (nextEffect != null) { NextEffectDisplay = string.Format(MainWindows.Resources.NextEffect, EnumLocalizer.GetLocalizedEnum(nextEffect.Item1), nextEffect.Item2.GetActualDateTime().ToString("HH:mm"), nextEffect.Item2.EffectName); } else { NextEffectDisplay = MainWindows.Resources.NextEffectNone; } NumberOfTriggersDisplay = string.Format(MainWindows.Resources.NumberOfTriggers, Schedule.EventTriggers.Count); }
public EventTriggerUserControl(EventUserControl parent, TriggerBase trigger, bool highestPriority, bool lowestPriority) { _trigger = trigger; _parent = parent; InitializeComponent(); TriggerType = EnumLocalizer.GetLocalizedEnum(trigger.GetTriggerType()); Description = trigger.GetDescription(); EffectName = trigger.GetEffectName(); Brightness = trigger.GetBrightness().ToString(); Priority = trigger.Priority; if (highestPriority) { PriorityUpButton.Visibility = System.Windows.Visibility.Hidden; } if (lowestPriority) { PriorityDownButton.Visibility = System.Windows.Visibility.Hidden; } DataContext = this; }
public static Node CreateNode(WorkoutPlanDTO planDto) { string difficultText = new EnumLocalizer(StrengthTrainingEntryStrings.ResourceManager).Translate(planDto.Difficult); Node item = new Node(new[] { planDto.Name, planDto.Author, planDto.TrainingType.ToString(), difficultText, planDto.CreationDate.ToLocalTime().ToShortDateString() }); item.Tag = planDto; return(item); }
public void GetCaptionOfNonExisting() { AssertHelper.Throws <ArgumentException>( () => EnumLocalizer.GetCaption(TestEnum.First) ).Containing(ExceptionTexts .EnumLocalizationNotFound .FormatWith("TestEnum", "First") ); }
private void AddButtons() { foreach (LocalizedEnumValue value2 in from lev in EnumLocalizer.Create(typeof(TEnumType)).GetLocalizedEnumValues() orderby lev.EnumValue select lev) { this.AddButton(value2); } }
public void GetCaption() { string actual = EnumLocalizer.GetCaption(PersonStatus.Dismissed); Assert.AreEqual(EnumLocalizations.PersonStatus_Dismissed, actual); actual = EnumLocalizer.GetCaption(PersonStatus.None); Assert.AreEqual(EnumLocalizations.PersonStatus_None, actual); }
public IEnumLocalizer Create(Type enumType) { Validate.IsNotNull <Type>(enumType, "enumType"); if (!this.allowedEnumTypePredicate(enumType)) { throw new ArgumentException(); } return(new EnumLocalizerWrapper(EnumLocalizer.Create(enumType))); }
private void AddDropDownItems(string resourceSpecialization) { foreach (LocalizedEnumValue value2 in from lev in EnumLocalizer.Create(typeof(TEnumType)).GetLocalizedEnumValues() where base.enumValueFilter((TEnumType)lev.EnumValue) orderby lev.EnumValue select lev) { this.AddMenuItem(value2, resourceSpecialization); } }
public void Setup() { EnumLocalizer.AddLocalizationResource(EnumLocalizations.ResourceManager); _person = new Person(); _person.CurrentStatus = default(PersonStatus); _vm = new PersonVM(); _vm.InitializeFrom(_person); }
private static string GetPluginBlockReasonString(PluginBlockReason reason) { StringBuilder builder = new StringBuilder(); IEnumerable <PluginBlockReason> enumerable2 = from v in Enum.GetValues(typeof(PluginBlockReason)).Cast <PluginBlockReason>() where (reason & v) > PluginBlockReason.NotBlocked select v; EnumLocalizer localizer = EnumLocalizer.Create(typeof(PluginBlockReason)); return((from r in enumerable2 select localizer.GetLocalizedEnumValue(r).LocalizedName).Aggregate <string, string>(string.Empty, (sa, s) => (sa + ((sa.Length > 0) ? Environment.NewLine : string.Empty) + s))); }
protected override void Drop() { RestoreSavedRegion(); PdnRegion regionCopy = Selection.CreateRegion(); using (PdnRegion simplifiedRegion = Utility.SimplifyAndInflateRegion(regionCopy, Utility.DefaultSimplificationFactor, 2)) { HistoryMemento bitmapAction2 = new BitmapHistoryMemento(Name, Image, DocumentWorkspace, ActiveLayerIndex, simplifiedRegion); bool oldHQ = this.fullQuality; this.fullQuality = true; Render(this.context.offset, true); this.fullQuality = oldHQ; this.currentHistoryMementos.Add(bitmapAction2); activeLayer.Invalidate(simplifiedRegion); Update(); } regionCopy.Dispose(); regionCopy = null; ContextHistoryMemento cha = new ContextHistoryMemento(this.DocumentWorkspace, this.ourContext, this.Name, this.Image); this.currentHistoryMementos.Add(cha); string name; ImageResource image; if (didPaste) { name = EnumLocalizer.EnumValueToLocalizedName(typeof(CommonAction), CommonAction.Paste); image = PdnResources.GetImageResource("Icons.MenuEditPasteIcon.png"); } else { name = this.Name; image = this.Image; } didPaste = false; SelectionHistoryMemento sha = new SelectionHistoryMemento(this.Name, this.Image, this.DocumentWorkspace); this.currentHistoryMementos.Add(sha); this.context.Dispose(); this.context = new MoveToolContext(); this.FlushHistoryMementos(PdnResources.GetString("MoveTool.HistoryMemento.DropPixels")); }
public UserGroupDataController(SiteContext siteContext, UserGroupManager userGroupManager, UserManager userManager, EnumLocalizer enumLocalizer, ILogger <UserGroupDataController> logger, IEnumerable <ISecurityGroupProvider> groupProviders ) : base(logger) { _userGroupManager = userGroupManager; _userManager = userManager; _enumLocalizer = enumLocalizer; _groupProviders = groupProviders; }
public TimeTriggerUserControl(DayUserControl parent, TimeTrigger trigger) { _trigger = trigger; _parent = parent; InitializeComponent(); Description = $"{EnumLocalizer.GetLocalizedEnum(trigger.GetTriggerType())}: {trigger.GetDescription()}"; EffectName = trigger.Effect; Brightness = trigger.Brightness.ToString(); DataContext = this; }
public EventTriggerUserControl(EventUserControl parent, TriggerBase trigger) { _trigger = trigger; _parent = parent; InitializeComponent(); TriggerType = EnumLocalizer.GetLocalizedEnum(trigger.GetTriggerType()); Description = trigger.GetDescription(); EffectName = trigger.GetEffectName(); Brightness = trigger.GetBrightness().ToString(); DataContext = this; }
public static string GetDisplayText(this TrainingPlanSerie serie) { string dropSetString = ""; string repType = ""; if (serie.DropSet != DropSetType.None) { dropSetString = "^" + (int)serie.DropSet; } if (serie.RepetitionsType != TrainingPlanSerieRepetitions.Normalna) { var localier = new EnumLocalizer(LocalizedPropertyGridStrings.ResourceManager); repType = localier.Translate(serie.RepetitionsType); } string format = serie.ToStringRepetitionsRange(); return(string.Format("{0} {1}{2}", format, repType, dropSetString)); }
protected override void BuildInfo(StringBuilder builder) { addGroupTable(builder, StrengthTrainingEntryStrings.TrainingPlanHtml_Information, delegate(StringBuilder stringBuilder) { stringBuilder.AppendFormat("<tr><td>{0}</td><td>{1}</td></tr>", StrengthTrainingEntryStrings.TrainingPlanHtml_InfoAuthor, TrainingPlan.Author); stringBuilder.AppendFormat("<tr><td>{0}</td><td>{1}</td></tr>", StrengthTrainingEntryStrings.TrainingPlanHtml_InfoCreationDate, TrainingPlan.CreationDate.ToLocalTime().ToShortDateString()); string difficultText = new EnumLocalizer(StrengthTrainingEntryStrings.ResourceManager).Translate(TrainingPlan.Difficult); stringBuilder.AppendFormat("<tr><td>{0}</td><td>{1}</td></tr>", StrengthTrainingEntryStrings.TrainingPlanHtml_InfoDifficult, difficultText); stringBuilder.AppendFormat("<tr><td>{0}</td><td>{1}</td></tr>", StrengthTrainingEntryStrings.TrainingPlanHtml_InfoTrainingType, TrainingPlan.TrainingType); stringBuilder.AppendFormat("<tr><td>{0}</td><td>{1}</td></tr>", StrengthTrainingEntryStrings.TrainingPlanHtml_InfoRestTime, string.Format(StrengthTrainingEntryStrings.TrainingPlanHtml_RestTimeValue, TrainingPlan.RestSeconds)); stringBuilder.AppendFormat("<tr><td>{0}</td><td><a href='{1}'>{1}</a></td></tr>", StrengthTrainingEntryStrings.TrainingPlanHtml_InfoUrl, TrainingPlan.Url); var language = Service.V2.Model.Language.GetLanguage(TrainingPlan.Language); if (language != null) { stringBuilder.AppendFormat("<tr><td>{0}</td><td>{1}</td></tr>", StrengthTrainingEntryStrings.TrainingPlanHtml_Language, language.DisplayName); } }); }
public AddTimeTriggerWindow(DayUserControl parent) { _parent = parent; Effects = new List <Effect>(UserSettings.Settings.ActiveDevice.Effects); Effects.InsertRange(0, OrchestratorCollection.GetOrchestratorForDevice(UserSettings.Settings.ActiveDevice).GetCustomEffectAsEffects()); _triggerTypeMapping = new Dictionary <string, TriggerType>() { { EnumLocalizer.GetLocalizedEnum(TriggerType.Time), TriggerType.Time }, { EnumLocalizer.GetLocalizedEnum(TriggerType.Sunrise), TriggerType.Sunrise }, { EnumLocalizer.GetLocalizedEnum(TriggerType.Sunset), TriggerType.Sunset } }; DataContext = this; InitializeComponent(); SelectedTriggerType = EnumLocalizer.GetLocalizedEnum(TriggerType.Time); }
public AddTimeTriggerWindow(DayUserControl parent) { _parent = parent; _triggerTypeMapping = new Dictionary <string, TriggerType>() { { EnumLocalizer.GetLocalizedEnum(TriggerType.Time), TriggerType.Time }, { EnumLocalizer.GetLocalizedEnum(TriggerType.Sunrise), TriggerType.Sunrise }, { EnumLocalizer.GetLocalizedEnum(TriggerType.Sunset), TriggerType.Sunset } }; DataContext = this; InitializeComponent(); SelectedTriggerType = EnumLocalizer.GetLocalizedEnum(TriggerType.Time); EffectComboBox.InitializeEffects(); EffectComboBox.ParentUserControl = this; }
public BrushStyleComboBox(EnumSetting <PaintDotNet.BrushType> brushTypeSetting, EnumSetting <System.Drawing.Drawing2D.HatchStyle> hatchStyleSetting) : base(false) { this.penBrushCache = PenBrushCache.ThreadInstance; this.hatchStyleNames = EnumLocalizer.Create(typeof(System.Drawing.Drawing2D.HatchStyle)); Validate.Begin().IsNotNull <EnumSetting <PaintDotNet.BrushType> >(brushTypeSetting, "brushTypeSetting").IsNotNull <EnumSetting <System.Drawing.Drawing2D.HatchStyle> >(hatchStyleSetting, "hatchStyleSetting").Check(); this.brushTypeSetting = brushTypeSetting; this.hatchStyleSetting = hatchStyleSetting; base.Name = "brushStyleComboBox"; base.DropDownStyle = ComboBoxStyle.DropDownList; base.DropDownWidth = 0xea; base.DropDownHeight *= 2; base.AutoSize = true; base.AutoToolTip = true; this.Size = new Size(UIUtil.ScaleWidth(base.Width), base.Height); base.DropDownWidth = UIUtil.ScaleWidth(base.DropDownWidth); base.DropDownHeight = UIUtil.ScaleHeight(base.DropDownHeight); base.ComboBox.SelectedValueChanged += new EventHandler(this.OnComboBoxSelectedValueChanged); this.brushTypeSetting.ValueChangedT += new ValueChangedEventHandler <PaintDotNet.BrushType>(this.OnBrushTypeSettingValueChanged); this.hatchStyleSetting.ValueChangedT += new ValueChangedEventHandler <System.Drawing.Drawing2D.HatchStyle>(this.OnHatchStyleSettingValueChanged); }
public PdnStatusBar(AppWorkspace appWorkspace) { this.appWorkspace = appWorkspace; this.PopulateLocalizedUnitsArray(); this.zoomToWindowImage = UIUtil.GetScaledImage(PdnResources.GetImageResource("Icons.MenuViewZoomToWindowIcon.png").Reference); this.zoomActualSizeImage = UIUtil.GetScaledImage(PdnResources.GetImageResource("Icons.MenuViewActualSizeIcon.png").Reference); this.windowText = EnumLocalizer.GetLocalizedEnumValue(typeof(PaintDotNet.ZoomBasis), PaintDotNet.ZoomBasis.FitToWindow).LocalizedName; this.percentageFormat = PdnResources.GetString("ZoomConfigWidget.Percentage.Format"); this.InitializeComponent(); this.imageInfoStatusLabel.Image = UIUtil.GetScaledImage(PdnResources.GetImageResource("Icons.ImageSizeIcon.png").Reference); this.cursorInfoStatusLabel.Image = UIUtil.GetScaledImage(PdnResources.GetImageResource("Icons.CursorXYIcon.png").Reference); this.zoomToWindowToggleButton.Image = this.zoomToWindowImage; this.zoomOutButton.Image = UIUtil.GetScaledImage(PdnResources.GetImageResource("Icons.MenuViewZoomOutIcon.png").Reference); this.zoomInButton.Image = UIUtil.GetScaledImage(PdnResources.GetImageResource("Icons.MenuViewZoomInIcon.png").Reference); this.zoomOutButton.ToolTipText = PdnResources.GetString("ZoomConfigWidget.ZoomOutButton.ToolTipText"); this.zoomInButton.ToolTipText = PdnResources.GetString("ZoomConfigWidget.ZoomInButton.ToolTipText"); this.zoomBasis = PaintDotNet.ZoomBasis.FitToWindow; this.scaleFactor = PaintDotNet.ScaleFactor.OneToOne; this.OnZoomBasisChanged(); }
public CurvesEffectConfigDialog() { InitializeComponent(); curveControlValueChangedDelegate = this.curveControl_ValueChanged; curveControlCoordinatesChangedDelegate = this.curveControl_CoordinatesChanged; colorTransferNames = EnumLocalizer.Create(typeof(ColorTransferMode)); this.Text = PdnResources.GetString("CurvesEffectConfigDialog.Text"); this.cancelButton.Text = PdnResources.GetString("Form.CancelButton.Text"); this.okButton.Text = PdnResources.GetString("Form.OkButton.Text"); this.resetButton.Text = PdnResources.GetString("CurvesEffectConfigDialog.ResetButton.Text"); this.transferHeader.Text = PdnResources.GetString("CurvesEffectConfigDialog.TransferHeader.Text"); this.labelHelpText.Text = PdnResources.GetString("CurvesEffectConfigDialog.HelpText.Text"); this.modeComboBox.Items.Clear(); this.modeComboBox.Items.AddRange(colorTransferNames.GetLocalizedNames()); this.maskCheckChanged = new EventHandler(MaskCheckChanged); this.curveControls = new Dictionary<ColorTransferMode, CurveControl>(); this.curveControls.Add(ColorTransferMode.Luminosity, new CurveControlLuminosity()); this.curveControls.Add(ColorTransferMode.Rgb, new CurveControlRgb()); }
public EnumLocalizerTest() { _target = new EnumLocalizer(_localizer); }
public UserGroupMemberEdit(UserGroupManager userGroupManager, UserManager userManager, EnumLocalizer enumLocalizer) { _userGroupManager = userGroupManager; _userManager = userManager; _enumLocalizer = enumLocalizer; }
public EnumLocalizerWrapper(EnumLocalizer enumLocalizer) { Validate.IsNotNull <EnumLocalizer>(enumLocalizer, "enumLocalizer"); this.enumLocalizer = enumLocalizer; }
public UserGroupMemberCreate(UserGroupManager userGroupManager, EnumLocalizer enumLocalizer) { _userGroupManager = userGroupManager; _enumLocalizer = enumLocalizer; }
public void Setup() { EnumLocalizer.AddLocalizationResource(EnumLocalizations.ResourceManager); }