Esempio n. 1
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. 2
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();
     }
 }