Esempio n. 1
0
        public async Task UpdateInfoAsync()
        {
            Debug.WriteLine("AlphaMainPage::UpdateInfoAsync");
            var User = Settings.UserName;

            if (!String.IsNullOrWhiteSpace(User))
            {
                if (UserLabel.Text != User)
                {
                    UserLabel.ImageSource = GitHub.GetIconUrl(User);
                    UserLabel.Text        = User;
                    UserLabel.TextColor   = Color.Default;
                    ClearActiveInfo();
                    await Domain.ManualUpdateLastPublicActivityAsync();
                }
                else
                {
                    StartUpdateLeftTimeTask();
                }
            }
            else
            {
                UserLabel.ImageSource = null;
                UserLabel.Text        = L["unspecified"];
                UserLabel.TextColor   = Color.Gray;
                ClearActiveInfo();
            }
        }
Esempio n. 2
0
 public static object Make(string User)
 {
     return(new
     {
         ImageSourceUrl = GitHub.GetIconUrl(User),
         Text = User,
     });
 }
Esempio n. 3
0
 public static ListItem Make(string User)
 {
     return(new ListItem
     {
         ImageSource = GitHub.GetIconUrl(User),
         Text = User,
     });
 }
Esempio n. 4
0
 public static object Make(GitHub.SearchUser User)
 {
     return(new
     {
         //ImageSourceUrl = User.AvatarUrl, 本来こちらのコードであるべきだが、こちらのURLだと他の箇所とキャッシュが分断されてよろしくない。
         ImageSourceUrl = GitHub.GetIconUrl(User.Login),
         Text = User.Login,
     });
 }
Esempio n. 5
0
        private async Task UpdateIconAsync(string User)
        {
            var IconUrl = GitHub.GetIconUrl(User);

            if (!(AlphaImageProxy.GetFromCache(IconUrl)?.Any() ?? false))
            {
                var Binary = await AlphaImageProxy.Get(IconUrl);

                if (Binary?.Any() ?? false)
                {
                    OnUpdateIcon(User, Binary);
                }
            }
        }
Esempio n. 6
0
 public void UpdateInfoAsync()
 {
     Debug.WriteLine("AlphaDetailPage::UpdateInfoAsync");
     if (!String.IsNullOrWhiteSpace(User))
     {
         if (UserLabel.Text != User)
         {
             AlphaFactory.MakeImageSourceFromUrl(GitHub.GetIconUrl(User))
             .ContinueWith(t => Xamarin.Forms.Device.BeginInvokeOnMainThread(() => UserLabel.ImageSource = t.Result));
             UserLabel.Text      = User;
             UserLabel.TextColor = Theme.ForegroundColor;
             UserLabel.Command   = new Command
                                   (
                 o =>
             {
                 Analytics.TrackEvent(
                     name: "[Clicked] User",
                     properties: new Dictionary <string, string> {
                     { "Category", "ColumnClick" }, { "Screen", "DetailPage" }
                 }
                     );
                 Xamarin.Forms.Device.OpenUri
                 (
                     new Uri(GitHub.GetProfileUrl(User))
                 );
             }
                                   );
             UserLabel.OptionImageSource = Root.GetExportImageSource();
             if (default(DateTime) == Domain.GetLastPublicActivity(User))
             {
                 ClearActiveInfo();
                 Task.Run(() => Domain.ManualUpdateLastPublicActivityAsync());
             }
         }
     }
     else
     {
         UserLabel.ImageSource       = null;
         UserLabel.Text              = L["unspecified"];
         UserLabel.TextColor         = Color.Gray;
         UserLabel.Command           = null;
         UserLabel.OptionImageSource = null;
         ClearActiveInfo();
     }
 }
Esempio n. 7
0
 public void ApplyUser(string User)
 {
     if (!String.IsNullOrWhiteSpace(User))
     {
         if (UserLabel.Text != User || null == UserLabel.ImageSource)
         {
             AlphaFactory.MakeImageSourceFromUrl(GitHub.GetIconUrl(User))
             .ContinueWith(t => Device.BeginInvokeOnMainThread(() => UserLabel.ImageSource = t.Result));
             UserLabel.Text = User;
             //UserLabel.TextColor = Color.Default;
         }
     }
     else
     {
         UserLabel.ImageSource = null;
         UserLabel.Text        = L["unspecified"];
     }
     ApplyUserLabelTheme(User);
 }
Esempio n. 8
0
 public void UpdateInfoAsync()
 {
     Debug.WriteLine("AlphaDetailPage::UpdateInfoAsync");
     if (!String.IsNullOrWhiteSpace(User))
     {
         if (UserLabel.Text != User)
         {
             AlphaFactory.MakeImageSourceFromUrl(GitHub.GetIconUrl(User))
             .ContinueWith(t => Device.BeginInvokeOnMainThread(() => UserLabel.ImageSource = t.Result));
             UserLabel.Text      = User;
             UserLabel.TextColor = Color.Default;
             UserLabel.Command   = new Command
                                   (
                 o => Device.OpenUri
                 (
                     new Uri(GitHub.GetProfileUrl(User))
                 )
                                   );
             UserLabel.OptionImageSource = Root.GetExportImageSource();
             if (!Settings.GetIsValidUserName(User))
             {
                 ClearActiveInfo();
             }
             if (default(DateTime) == Domain.GetLastPublicActivity(User))
             {
                 Task.Run(() => Domain.ManualUpdateLastPublicActivityAsync());
             }
         }
     }
     else
     {
         UserLabel.ImageSource       = null;
         UserLabel.Text              = L["unspecified"];
         UserLabel.TextColor         = Color.Gray;
         UserLabel.Command           = null;
         UserLabel.OptionImageSource = null;
         ClearActiveInfo();
     }
 }