void gps_LocationChanged(object sender, PockeTwit.GPS.LocationChangedEventArgs args)
        {
            IFormatProvider format = new System.Globalization.CultureInfo(1033);
            if (gps.Opened)
            {
                try
                {
                    if (args.Position == null) { return; }
                    if (args.Position.LatitudeValid && args.Position.LongitudeValid)
                    {
                        if (!Double.IsNaN(args.Position.Longitude) && !Double.IsNaN(args.Position.Latitude))
                        {
                            position = args.Position;
                            if (LocationReady != null)
                            {
                                LocationReady(position.Latitude.ToString(format) + "," + position.Longitude.ToString(format));
                            }
                        }
                    }
                }
                catch (DivideByZeroException)
                {
                }

            }

        }
Example #2
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);
        }
Example #3
0
 void p_ErrorOccured(object sender, PockeTwit.MediaServices.PictureServiceEventArgs eventArgs)
 {
     if (InvokeRequired)
     {
         delPictureDone d = new delPictureDone(p_ErrorOccured);
         this.Invoke(d, sender, eventArgs);
     }
     else
     {
         PockeTwit.MediaServices.IPictureService p = (PockeTwit.MediaServices.IPictureService)sender;
         p.DownloadFinish -= new PockeTwit.MediaServices.DownloadFinishEventHandler(p_DownloadFinish);
         p.ErrorOccured -= new PockeTwit.MediaServices.ErrorOccuredEventHandler(p_ErrorOccured);
         Cursor.Current = Cursors.Default;
         PockeTwit.Localization.LocalizedMessageBox.Show("Unable to fetch picture. You may want to try again.");
     }
 }
Example #4
0
        void p_DownloadFinish(object sender, PockeTwit.MediaServices.PictureServiceEventArgs eventArgs)
        {
            if (InvokeRequired)
            {
                delPictureDone d = new delPictureDone(p_DownloadFinish);
                this.Invoke(d, sender, eventArgs);
            }
            else
            {

                PockeTwit.MediaServices.IPictureService p = (PockeTwit.MediaServices.IPictureService)sender;
                p.DownloadFinish -= new PockeTwit.MediaServices.DownloadFinishEventHandler(p_DownloadFinish);
                p.ErrorOccured -= new PockeTwit.MediaServices.ErrorOccuredEventHandler(p_ErrorOccured);

                Cursor.Current = Cursors.Default;

                using (ImagePreview ip = new ImagePreview(eventArgs.ReturnMessage, eventArgs.PictureFileName))
                {
                    ip.Owner = this;
                    ip.ShowDialog();
                    ip.Dispose();
                }
            }
        }
Example #5
0
        private List<PockeTwit.Library.status> GetConversationFROMTHEFUTURE(PockeTwit.Library.status lastStatus)
        {
            Yedda.Twitter Conn = GetMatchingConnection(lastStatus.Account);
            Library.status[] SearchResults = Manager.SearchTwitter(Conn, "@" + lastStatus.user.screen_name, Yedda.Twitter.PagingMode.None);
            List<Library.status> Results = new List<PockeTwit.Library.status>();
            foreach (Library.status s in SearchResults)
            {
                if (s.in_reply_to_status_id == lastStatus.id)
                {
                    Results.Add(s);
                }
            }

            if (Results.Count == 1)
            {
                Results.AddRange(GetConversationFROMTHEFUTURE(Results[0]));
            }
            return Results;
        }
        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);
        }
 private Library.User FetchTheUser(PockeTwit.Library.User User)
 {
     return Library.User.FromId(User.screen_name, ClientSettings.AccountsList[0]);
 }
Example #8
0
 public void SetFavorite(PockeTwit.Library.status SelectedStatus)
 {
     throw new NotImplementedException();
 }
 public UploadAttachment(string FileName, string Caption, PockeTwit.Position.GeoCoord Position)
 {
     this.SourceFileName = FileName;
     this.Name = this.SourceFileName; //Path.GetFileName(FileName);
     this.UploadedUri = null;
     this.Status = AttachmentStatus.Pending;
     this.Caption = Caption;
     this.Position = Position;
 }
Example #10
0
        void gps_LocationChanged(object sender, PockeTwit.GPS.LocationChangedEventArgs args)
        {
            PositionEventArgs.PositionStatus stat = PositionEventArgs.PositionStatus.Invalid;
            PockeTwit.Position.GeoCoord le = new PockeTwit.Position.GeoCoord(0, 0);

            if (gps.Opened)
            {
                try
                {
                    if (args.Position == null) { stat = PositionEventArgs.PositionStatus.Invalid; }
                    if (args.Position.LatitudeValid && args.Position.LongitudeValid)
                    {
                        if (!Double.IsNaN(args.Position.Longitude) && !Double.IsNaN(args.Position.Latitude))
                        {
                            le = new PockeTwit.Position.GeoCoord(args.Position.Latitude, args.Position.Longitude);
                            stat = PositionEventArgs.PositionStatus.Valid;
                        }
                    }
                }
                catch (DivideByZeroException)
                {
                    stat = PositionEventArgs.PositionStatus.Error;
                }

            }
            // once we know where we are precisely, stop looking
            if (stat == PositionEventArgs.PositionStatus.Valid && ril != null)
                ril.Enabled = false; // turn RIL off immediately
            PositionChanged(sender, new PositionEventArgs(stat, le, DateTime.Now));
            if (stat == PositionEventArgs.PositionStatus.Valid)
                StopGPS(); // and stop GPS
        }