// Localise a comma-separated days string. I don't think this is the right way to do it. Really // the data structures should keep the days as an array of bools or list of ints or something and // only translate on input and output, but that would require too much rewriting now. (CA-51612) public static string L10NDays(string days, DaysMode mode) { DaysWeekCheckboxes dwc = new DaysWeekCheckboxes(); dwc.Days = days; return(dwc.DaysToString(mode)); }
internal static string FormatSchedule(Dictionary <string, string> schedule, vmss_frequency backupFrequency, DaysWeekCheckboxes.DaysMode mode) { if (backupFrequency == vmss_frequency.hourly) { return(string.Format(Messages.HOURLY_SCHEDULE_FORMAT, schedule["min"])); } else if (backupFrequency == vmss_frequency.daily) { DateTime value = DateTime.Parse(string.Format("{0}:{1}", schedule["hour"], schedule["min"]), CultureInfo.InvariantCulture); return(string.Format(Messages.DAILY_SCHEDULE_FORMAT, HelpersGUI.DateTimeToString(value, Messages.DATEFORMAT_HM, true))); } else if (backupFrequency == vmss_frequency.weekly) { DateTime value = DateTime.Parse(string.Format("{0}:{1}", schedule["hour"], schedule["min"]), CultureInfo.InvariantCulture); return(string.Format(Messages.WEEKLY_SCHEDULE_FORMAT, HelpersGUI.DateTimeToString(value, Messages.DATEFORMAT_HM, true), DaysWeekCheckboxes.L10NDays(schedule["days"], mode))); } return(""); }
// These two instances of FormatSchedule used to be in the VMPP class. That's probably where // they really belong, but because of the way they're constructed (see DaysWeekCheckboxes.L10NDays()) // they had to move into the View. (CA-51612). internal static string FormatSchedule(Dictionary <string, string> schedule, vmpp_archive_frequency archiveType, DaysWeekCheckboxes.DaysMode mode) { if (archiveType == vmpp_archive_frequency.always_after_backup) { return(Messages.ASAPSNAPSHOTTAKEN); } else if (archiveType == vmpp_archive_frequency.never) { return(Messages.NEVER); } else if (archiveType == vmpp_archive_frequency.daily) { DateTime value = DateTime.Parse(string.Format("{0}:{1}", schedule["hour"], schedule["min"]), CultureInfo.InvariantCulture); return(string.Format(Messages.DAILY_SCHEDULE_FORMAT, HelpersGUI.DateTimeToString(value, Messages.DATEFORMAT_HM, true))); } else if (archiveType == vmpp_archive_frequency.weekly) { DateTime value = DateTime.Parse(string.Format("{0}:{1}", schedule["hour"], schedule["min"]), CultureInfo.InvariantCulture); return(string.Format(Messages.WEEKLY_SCHEDULE_FORMAT, HelpersGUI.DateTimeToString(value, Messages.DATEFORMAT_HM, true), DaysWeekCheckboxes.L10NDays(schedule["days"], mode))); } return(""); }
internal static string FormatSchedule(Dictionary<string, string> schedule, vmpp_backup_frequency backupFrequency, DaysWeekCheckboxes.DaysMode mode) { if (backupFrequency == vmpp_backup_frequency.hourly) { return string.Format(Messages.HOURLY_SCHEDULE_FORMAT, schedule["min"]); } else if (backupFrequency == vmpp_backup_frequency.daily) { DateTime value = DateTime.Parse(string.Format("{0}:{1}", schedule["hour"], schedule["min"]), CultureInfo.InvariantCulture); return string.Format(Messages.DAILY_SCHEDULE_FORMAT, HelpersGUI.DateTimeToString(value, Messages.DATEFORMAT_HM, true)); } else if (backupFrequency == vmpp_backup_frequency.weekly) { DateTime value = DateTime.Parse(string.Format("{0}:{1}", schedule["hour"], schedule["min"]), CultureInfo.InvariantCulture); return string.Format(Messages.WEEKLY_SCHEDULE_FORMAT, HelpersGUI.DateTimeToString(value, Messages.DATEFORMAT_HM, true), DaysWeekCheckboxes.L10NDays(schedule["days"], mode)); } return ""; }
// These two instances of FormatSchedule used to be in the VMPP class. That's probably where // they really belong, but because of the way they're constructed (see DaysWeekCheckboxes.L10NDays()) // they had to move into the View. (CA-51612). internal static string FormatSchedule(Dictionary<string, string> schedule, vmpp_archive_frequency archiveType, DaysWeekCheckboxes.DaysMode mode) { if (archiveType == vmpp_archive_frequency.always_after_backup) { return Messages.ASAPSNAPSHOTTAKEN; } else if (archiveType == vmpp_archive_frequency.never) { return Messages.NEVER; } else if (archiveType == vmpp_archive_frequency.daily) { DateTime value = DateTime.Parse(string.Format("{0}:{1}", schedule["hour"], schedule["min"]), CultureInfo.InvariantCulture); return string.Format(Messages.DAILY_SCHEDULE_FORMAT, HelpersGUI.DateTimeToString(value, Messages.DATEFORMAT_HM, true)); } else if (archiveType == vmpp_archive_frequency.weekly) { DateTime value = DateTime.Parse(string.Format("{0}:{1}", schedule["hour"], schedule["min"]), CultureInfo.InvariantCulture); return string.Format(Messages.WEEKLY_SCHEDULE_FORMAT, HelpersGUI.DateTimeToString(value, Messages.DATEFORMAT_HM, true), DaysWeekCheckboxes.L10NDays(schedule["days"], mode)); } return ""; }
// Localise a comma-separated days string. I don't think this is the right way to do it. Really // the data structures should keep the days as an array of bools or list of ints or something and // only translate on input and output, but that would require too much rewriting now. (CA-51612) public static string L10NDays(string days, DaysMode mode) { DaysWeekCheckboxes dwc = new DaysWeekCheckboxes(); dwc.Days = days; return dwc.DaysToString(mode); }