public void CreateDeleteBackupsOlderThanDaysEntry(TextMenu textMenu, bool inGame) { BetterIntSlider item = new BetterIntSlider(DialogId.Options.DeleteBackupsOlderThanDays.DialogClean(), i => i == -1 ? DialogId.OptionValues.Disabled.DialogClean() : string.Format(DialogId.OptionValues.Days.DialogGet(), i), -1, 100, DeleteBackupsOlderThanDays); item.Change(value => { // skip 0 days if (value > -1 && value < 1) { item.Index = item.LastDir > 0 ? 1 : -1; value = item.Index; } DeleteBackupsOlderThanDays = value; }); item.ValueWidthFunc = () => { float width = 0; width = Math.Max(width, ActiveFont.Measure(item.ValuesFunc(item.Min)).X); width = Math.Max(width, ActiveFont.Measure(item.ValuesFunc(item.Max)).X); return(width); }; textMenu.Add(item); menuItems.Add(DialogId.Options.DeleteBackupsOlderThanDays, item); }
public void CreateDeleteBackupsAfterAmountEntry(TextMenu textMenu, bool inGame) { BetterIntSlider item = new BetterIntSlider(DialogId.Options.DeleteBackupsAfterAmount.DialogClean(), i => i == -1 ? DialogId.OptionValues.Disabled.DialogClean() : $"{i}", -1, 500, DeleteBackupsAfterAmount); item.Change(value => { // skip 0 if (value > -1 && value < 1) { item.Index = item.LastDir > 0 ? 1 : -1; value = item.Index; } DeleteBackupsAfterAmount = value; }); item.ValueWidthFunc = () => { float width = 0; width = Math.Max(width, ActiveFont.Measure(item.ValuesFunc(item.Min)).X); width = Math.Max(width, ActiveFont.Measure(item.ValuesFunc(item.Max)).X); return(width); }; textMenu.Add(item); menuItems.Add(DialogId.Options.DeleteBackupsAfterAmount, item); }