internal static async Task MessageDialog(string message) { var messageDialog = new MessageDialog(message); messageDialog.Commands.Add(new UICommand { Label = ResMan.GetString("OKCaption"), Id = 0 }); messageDialog.DefaultCommandIndex = 0; await messageDialog.ShowAsync(); }
private static string ApiOrdinalToLocalOrdinal(string index) { switch (index.ToLower()) { case OData.First: return(ResMan.GetString("First")); case OData.Second: return(ResMan.GetString("Second")); case OData.Third: return(ResMan.GetString("Third")); case OData.Fourth: return(ResMan.GetString("Fourth")); case OData.Last: return(ResMan.GetString("Last")); } return("???"); }
internal static async Task <bool> YesNoDialog(string message) { var messageDialog = new MessageDialog(message); messageDialog.Commands.Add(new UICommand { Label = ResMan.GetString("YesCaption"), Id = 0 }); messageDialog.Commands.Add(new UICommand { Label = ResMan.GetString("NoCaption"), Id = 1 }); messageDialog.DefaultCommandIndex = 0; messageDialog.CancelCommandIndex = 1; var result = await messageDialog.ShowAsync(); return((int)result.Id == 0); }
public static string BuildRecurrentDate(Meeting.EventRecurrence recurrence) { var pattern = recurrence.Pattern; string date = ResMan.GetString("OccursPart"); switch (pattern.Type.ToLower()) { case OData.Daily: date += string.Format(ResMan.GetString("DailyPart"), pattern.Interval); break; case OData.Weekly: date += ResMan.GetString("EveryPart"); string dayFmt = ResMan.GetString("WeeklyPartFirst"); var localDayNames = CultureInfo.CurrentCulture.DateTimeFormat.DayNames; var daysOfWeek = pattern.DaysOfWeek; int numDays = daysOfWeek.Count; for (int i = 0; i < numDays; ++i) { if (i > 0) { dayFmt = (i == numDays - 1) ? ResMan.GetString("WeeklyPartLast") : ResMan.GetString("WeeklyPartNext"); } int dayIndex = GetDayOfWeekIndexInternal(daysOfWeek[i]); date += string.Format(dayFmt, localDayNames[dayIndex]); } break; case OData.AbsoluteMonthly: date += string.Format(ResMan.GetString("AbsMonthlyPart"), pattern.DayOfMonth, pattern.Interval); break; case OData.RelativeMonthly: date += string.Format(ResMan.GetString("RelMonthlyPart"), ApiOrdinalToLocalOrdinal(pattern.Index), GetDayOfWeekLocalized(pattern.DaysOfWeek[0]), pattern.Interval); break; case OData.AbsoluteYearly: { var localMonths = CultureInfo.CurrentCulture.DateTimeFormat.MonthNames; date += string.Format(ResMan.GetString("AbsYearlyPart"), pattern.Interval, localMonths[pattern.Month - 1], pattern.DayOfMonth); } break; case OData.RelativeYearly: { var localMonths = CultureInfo.CurrentCulture.DateTimeFormat.MonthNames; date += string.Format(ResMan.GetString("RelYearlyPart"), pattern.Interval, ApiOrdinalToLocalOrdinal(pattern.Index), GetDayOfWeekLocalized(pattern.DaysOfWeek[0]), localMonths[pattern.Month - 1]); } break; } date += string.Format(ResMan.GetString("EffectivePart"), ToDateOnlyString(recurrence.Range.StartDate)); switch (recurrence.Range.Type.ToLower()) { case OData.NoEnd: break; case OData.EndDate: date += string.Format(ResMan.GetString("UntilPart"), ToDateOnlyString(recurrence.Range.EndDate)); break; case OData.Numbered: DateTimeOffset endDate = CalculateEndDate(recurrence); date += string.Format(ResMan.GetString("UntilPart"), ToDateOnlyString(endDate)); break; } return(date); }