Beispiel #1
0
        void UpdateUITime(DateTime?date = null)
        {
            var dt = date.HasValue ? date.Value : DateTime.UtcNow.ToLocalTime();

            wheelSeconds.SetProgress(dt.Second);

            //var fmt = "h:mm tt";
            var fmt = "h:mm";

            if (WearListenerService.Settings.Use24Clock)
            {
                fmt = "H:mm";
            }

            var str = dt.ToString(fmt).ToUpperInvariant();

            var ss = new SpannableString(str);

            ss.SetSpan(new StyleSpan(Android.Graphics.TypefaceStyle.Bold), 0, str.IndexOf(':'), SpanTypes.ExclusiveExclusive);

            if (fmt.Contains(" "))
            {
                var ttIndex = str.LastIndexOf(' ') + 1;

                ss.SetSpan(new ForegroundColorSpan(Android.Graphics.Color.Gray), ttIndex, ttIndex + 2, SpanTypes.ExclusiveExclusive);
                ss.SetSpan(new RelativeSizeSpan(0.8f), ttIndex, ttIndex + 2, SpanTypes.ExclusiveExclusive);
            }

            time.TextFormatted = ss;
        }
Beispiel #2
0
        void UpdateUI()
        {
            Console.WriteLine("UpdateUI");

            var s = WearListenerService.Settings;

            if (s.ShowXamarinLogo != (xamarinLogo.Visibility == ViewStates.Visible))
            {
                xamarinLogo.Visibility = s.ShowXamarinLogo ? ViewStates.Visible : ViewStates.Invisible;
            }

            if (s.ShowDayOfWeek != (day.Visibility == ViewStates.Visible))
            {
                day.Visibility = s.ShowDayOfWeek ? ViewStates.Visible : ViewStates.Invisible;
            }

            if (s.ShowDate != (date.Visibility == ViewStates.Visible))
            {
                date.Visibility = s.ShowDate ? ViewStates.Visible : ViewStates.Invisible;
            }



            var dt = DateTime.UtcNow.ToLocalTime();

            UpdateUITime(dt);

            date.Text = dt.ToString("MMM d").ToUpperInvariant();
            day.Text  = dt.ToString("dddd").ToUpperInvariant();

            wheelMinutes.SetProgress(dt.Minute);
            wheelHours.SetProgress(dt.Hour);
        }