MinuteAsPaddedString() public method

public MinuteAsPaddedString ( [ minDigits ) : string
minDigits [
return string
コード例 #1
0
        private void ValidateFormat(
            string culture,
            string calendar,
            string clock,
            DateTimeOffset date,
            string yearAsPaddedString,
            string yearAsString,
            string monthAsPaddedNumericString,
            string monthAsSoloString,
            string monthAsString,
            string monthAsNumericString,
            string dayAsPaddedString,
            string dayAsString,
            string hourAsPaddedString,
            string hourAsString,
            string minuteAsPaddedString,
            string minuteAsString,
            string secondAsPaddedString,
            string secondAsString,
            string nanosecondAsPaddedString,
            string nanosecondAsString,
            string dayOfWeekAsSoloString,
            string dayOfWeekAsString
            )
        {
            var SUT = new WG.Calendar(new[] { culture }, calendar, clock);

            SUT.SetDateTime(date);

            using (new AssertionScope("Calendar Format"))
            {
                SUT.YearAsPaddedString(2).Should().Be(yearAsPaddedString, nameof(yearAsPaddedString));
                SUT.YearAsString().Should().Be(yearAsString, nameof(yearAsString));
                SUT.MonthAsPaddedNumericString(2).Should().Be(monthAsPaddedNumericString, nameof(monthAsPaddedNumericString));
                SUT.MonthAsSoloString().Should().Be(monthAsSoloString, nameof(monthAsSoloString));
                SUT.MonthAsString().Should().Be(monthAsString, nameof(monthAsString));
                SUT.MonthAsNumericString().Should().Be(monthAsNumericString, nameof(monthAsNumericString));
                SUT.DayAsPaddedString(2).Should().Be(dayAsPaddedString, nameof(dayAsPaddedString));
                SUT.DayAsString().Should().Be(dayAsString, nameof(dayAsString));
                SUT.HourAsPaddedString(2).Should().Be(hourAsPaddedString, nameof(hourAsPaddedString));
                SUT.HourAsString().Should().Be(hourAsString, nameof(hourAsString));
                SUT.MinuteAsPaddedString(2).Should().Be(minuteAsPaddedString, nameof(minuteAsPaddedString));
                SUT.MinuteAsString().Should().Be(minuteAsString, nameof(minuteAsString));
                SUT.SecondAsPaddedString(2).Should().Be(secondAsPaddedString, nameof(secondAsPaddedString));
                SUT.SecondAsString().Should().Be(secondAsString, nameof(secondAsString));
                SUT.NanosecondAsPaddedString(2).Should().Be(nanosecondAsPaddedString, nameof(nanosecondAsPaddedString));
                SUT.NanosecondAsString().Should().Be(nanosecondAsString, nameof(nanosecondAsString));
                SUT.DayOfWeekAsSoloString().Should().Be(dayOfWeekAsSoloString, nameof(dayOfWeekAsSoloString));
                SUT.DayOfWeekAsString().Should().Be(dayOfWeekAsString, nameof(dayOfWeekAsString));
            }
        }
コード例 #2
0
 private string ReportCalendarData(Calendar calendar)
 {
     // Display individual date/time elements.
     return string.Format("In {0} time zone:   {1}   {2} {3}, {4}   {5}:{6}:{7} {8}  {9}",
                          calendar.GetTimeZone(),
                          calendar.DayOfWeekAsSoloString(),
                          calendar.MonthAsSoloString(),
                          calendar.DayAsPaddedString(2),
                          calendar.YearAsString(),
                          calendar.HourAsPaddedString(2),
                          calendar.MinuteAsPaddedString(2),
                          calendar.SecondAsPaddedString(2),
                          calendar.PeriodAsString(),
                          calendar.TimeZoneAsString(3));
 }
コード例 #3
0
        private void UpdateText(Windows.Globalization.Calendar calendar)
        {
            switch (this.owner.ComponentType)
            {
            case DateTimeComponentType.Day:
                this.headerText  = calendar.DayAsPaddedString(2);
                this.contentText = calendar.DayOfWeekAsSoloString();
                break;

            case DateTimeComponentType.Month:
                this.headerText  = calendar.MonthAsPaddedNumericString(2);
                this.contentText = calendar.MonthAsSoloString();
                break;

            case DateTimeComponentType.Year:
                this.headerText = calendar.YearAsPaddedString(4);
                if (calendar.GetCalendarSystem() == Windows.Globalization.CalendarIdentifiers.Gregorian &&
                    DateTime.IsLeapYear(calendar.GetUtcDateTime().Year))
                {
                    this.contentText = InputLocalizationManager.Instance.GetString("LeapYear");
                }
                else
                {
                    this.contentText = " ";
                }
                break;

            case DateTimeComponentType.Hour:
                this.headerText  = calendar.HourAsString();
                this.contentText = string.Empty;
                break;

            case DateTimeComponentType.Minute:
                this.headerText  = calendar.MinuteAsPaddedString(2);
                this.contentText = string.Empty;
                break;

            case DateTimeComponentType.AMPM:
                this.headerText  = calendar.PeriodAsString();
                this.contentText = string.Empty;
                break;
            }

            this.OnPropertyChanged(nameof(this.HeaderText));
            this.OnPropertyChanged(nameof(this.ContentText));
        }
コード例 #4
0
        /// <summary>
        /// Invoked when this page is about to be displayed in a Frame.
        /// </summary>
        /// <param name="e">Event data that describes how this page was reached.
        /// This parameter is typically used to configure the page.</param>
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            // TODO: Prepare page for display here.

            // TODO: If your application contains multiple pages, ensure that 
            // you are handling the hardware Back button by registering for the
            // Windows.Phone.UI.Input.HardwareButtons.BackPressed event.
            // If you are using the NavigationHelper provided by some templates,
            // this event is handled for you.
            FBSession sess = FBSession.ActiveSession;

            if (sess.LoggedIn)
            {
                LoginButton.Content = "Logout";
                Calendar cal = new Calendar();
                cal.SetDateTime(sess.AccessTokenData.ExpirationDate);

                ResponseText.Text = sess.AccessTokenData.AccessToken;

                ExpirationDate.Text = cal.DayOfWeekAsString() + "," + 
                    cal.YearAsString() + "/" + cal.MonthAsNumericString() + 
                    "/" + cal.DayAsString() + ", " + cal.HourAsPaddedString(2) + 
                    ":" + cal.MinuteAsPaddedString(2) + ":" + 
                    cal.SecondAsPaddedString(2);
            }
        }
コード例 #5
0
        internal override string GetValueStringForNonGregorianCalendars(Windows.Globalization.Calendar calendar)
        {
            var valueString = string.Format("{0}:{1}", calendar.HourAsPaddedString(2), calendar.MinuteAsPaddedString(2));

            if (calendar.GetClock() == Windows.Globalization.ClockIdentifiers.TwelveHour)
            {
                valueString = string.Format("{0}{1}", valueString, calendar.PeriodAsString());
            }

            return(valueString);
        }