Exemplo n.º 1
0
        public ProfileView(PockeTwit.Library.User User)
        {
            
            if (User.needsFetching)
            {
                User = FetchTheUser(User);
            }
            _User = User;
            InitializeComponent();
            PockeTwit.Themes.FormColors.SetColors(this);
            if (ClientSettings.IsMaximized)
            {
                this.WindowState = FormWindowState.Maximized;
            }
            avatarBox.Width = ClientSettings.SmallArtSize;
            avatarBox.Height = ClientSettings.SmallArtSize;

            avatarBox.Image = PockeTwit.ThrottledArtGrabber.GetArt(User.profile_image_url);
            
            lblUserName.Text = User.screen_name;
            
            if (string.IsNullOrEmpty(User.name)) { lblFullName.Visible = false; }
            else
            {
                lblFullName.Text = User.name;
            }
            if (string.IsNullOrEmpty(User.location)) { lblPosition.Visible = false; }
            else
            {
                _User.location = User.location.Replace("iPhone: ", "");
                Yedda.GoogleGeocoder.Coordinate c = new Yedda.GoogleGeocoder.Coordinate();
                if (Yedda.GoogleGeocoder.Coordinate.tryParse(_User.location, out c))
                {
                    lblPosition.Text = Yedda.GoogleGeocoder.Geocode.GetAddress(_User.location);
                }
                else
                {
                    lblPosition.Text = _User.location;
                }
            }
            if (string.IsNullOrEmpty(User.description))
            {
                lblDescription.Text = "No description available.";
            }
            else
            {
                lblDescription.Text = User.description;
            }
            if (string.IsNullOrEmpty(User.followers_count))
            {
                lblFollowersFollowing.Visible = false;
            }
            else
            {
                lblFollowersFollowing.Text = User.followers_count + " followers";
            }
            PockeTwit.ThrottledArtGrabber.NewArtWasDownloaded += new ThrottledArtGrabber.ArtIsReady(ThrottledArtGrabber_NewArtWasDownloaded);
        }
Exemplo n.º 2
0
        public ProfileViewSmartPhone(PockeTwit.Library.User User)
        {
            if (User.needsFetching)
            {
                User = FetchTheUser(User);
            }
            _User = User;
            InitializeComponent();
            PockeTwit.Themes.FormColors.SetColors(this);
            PockeTwit.Themes.FormColors.SetColors(panelBasicInfo);
            PockeTwit.Themes.FormColors.SetColors(panelDescription);
            PockeTwit.Themes.FormColors.SetColors(panelNumbers);
            PockeTwit.Themes.FormColors.SetColors(panelNumbers2);
            PockeTwit.Themes.FormColors.SetColors(panelJoinedLocation);

            PockeTwit.Localization.XmlBasedResourceManager.LocalizeForm(this);
            if (ClientSettings.IsMaximized)
            {
                this.WindowState = FormWindowState.Maximized;
            }
            avatarBox.Width = ClientSettings.SmallArtSize;
            avatarBox.Height = ClientSettings.SmallArtSize;

            avatarBox.Image = PockeTwit.ThrottledArtGrabber.GetArt(User.profile_image_url);

            lblUserName.Text = User.screen_name;

            if (string.IsNullOrEmpty(User.name)) { lblFullName.Visible = false; }
            else
            {
                lblFullName.Text = User.name;
            }
            if (string.IsNullOrEmpty(User.location)) { lblPosition.Visible = false; }
            else
            {
                _User.location = User.location.Replace("iPhone: ", "");
                Coordinate c = new Coordinate();
                if (Coordinate.tryParse(_User.location, out c))
                {
                    lblPosition.Text = Geocode.GetAddress(_User.location);
                }
                else
                {
                    lblPosition.Text = _User.location;
                }
            }
            if (string.IsNullOrEmpty(User.description))
            {
                lblDescription.Text = PockeTwit.Localization.XmlBasedResourceManager.GetString("No description available.");
            }
            else
            {
                lblDescription.Text = User.description;
            }

            if (!string.IsNullOrEmpty(User.url))
            {
                lblURL.Text = User.url;
            }
            if (!string.IsNullOrEmpty(User.followers_count))
            {
                lblFollowersNumber.Text = User.followers_count;
            }
            if (!string.IsNullOrEmpty(User.friends_count))
            {
                lblFollowingNumber.Text = User.friends_count;
            }
            if (!string.IsNullOrEmpty(User.statuses_count))
            {
                llblTweets.Text = User.statuses_count;
            }
            if (!string.IsNullOrEmpty(User.favourites_count))
            {
                llblFavorites.Text = User.favourites_count;
            }

            if (!string.IsNullOrEmpty(User.created_at))
            {
                DateTime d = getDate(User.created_at);
                lblJoinedOnDate.Text = d.ToShortDateString();
            }

            if (!string.IsNullOrEmpty(User.verified) && User.verified == "true")
            {
                //TODO
            }

            PockeTwit.ThrottledArtGrabber.NewArtWasDownloaded += new ThrottledArtGrabber.ArtIsReady(ThrottledArtGrabber_NewArtWasDownloaded);

            SwitchToPanel(panelBasicInfo);
        }