public frmTipDetails(DotNetSquare.NetSquare.FourSquareTip xmlTip)
        {
            InitializeComponent();
            Program.arrForm.Add(this);

            Cursor.Current = Cursors.WaitCursor;

            _strTipID = xmlTip.id;

            string strCreated = xmlTip.createdAt.ToString();
            lblTimestamp.Text = Program.convertAPITimeToCuteTime(strCreated);

            string strDistance = xmlTip.venue.location.Distance;
            if (!String.IsNullOrEmpty(strDistance))
            {
                strDistance = Program.convertDistanceToKM(strDistance);
                strDistance = lblTimestamp.Text + " " + strDistance + " away";
                lblTimestamp.Text = strDistance.Trim();
            }

            int y = lblTimestamp.Location.Y + lblTimestamp.Height + 3;

            DotNetSquare.NetSquare.FourSquareVenue xmlVenue = xmlTip.venue;
            if (xmlVenue != null)
            {
                ucVenueListItem oVenue = new ucVenueListItem(xmlVenue);
                oVenue.Location = new Point(0, 0);
                oVenue.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
                oVenue.Width = pnlVenue.Width;

                pnlVenue.Controls.Add(oVenue);
                pnlVenue.Height = oVenue.Location.Y + oVenue.Height;

                y = pnlVenue.Location.Y + pnlVenue.Height + 3;
            }

            DotNetSquare.NetSquare.FourSquareUser xmlUser = xmlTip.user;
            if (xmlUser != null)
            {
                ucUserListItem oUser = new ucUserListItem(xmlUser);
                oUser.Location = new Point(3, y);
                oUser.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
                oUser.Width = pnlForm.Width - 3 * 2;

                pnlForm.Controls.Add(oUser);

                y = oUser.Location.Y + oUser.Height + 3;
            }

            tbTip.Text = xmlTip.text;

            pnlTip.Location = new Point(3, y);

            y = pnlTip.Location.Y + pnlTip.Height + 3;

            pnlButtons.Location = new Point(3, y + 3);

            Cursor.Current = Cursors.Default;
        }
        private void LoadData()
        {
            string strCriteria = tbSearch.Text.Trim();
            if (!String.IsNullOrEmpty(strCriteria))
            {
                Cursor.Current = Cursors.WaitCursor;

                // build the API URL
                string phone = "";
                string name = "";
                string twitter = "";

                string strSearchType = ddlType.SelectedItem.ToString().ToLower();
                if (strSearchType.Equals("twitter"))
                {
                    twitter = System.Uri.EscapeDataString(strCriteria);
                }
                else if (strSearchType.Equals("phone"))
                {
                    phone = System.Uri.EscapeDataString(strCriteria);
                }
                else
                {
                    name = System.Uri.EscapeDataString(strCriteria);
                }
                DotNetSquare.NetSquare.FourSquareUsers xmlUsers = DotNetSquare.NetSquare.UserSearch(phone, "", twitter, "", "", name,Program.AccessToken);

                if (xmlUsers.count > 0)
                {
                    int y = 0;
                    pnlResults.Controls.Clear();
                    foreach (DotNetSquare.NetSquare.FourSquareUser xmlUser in xmlUsers.Users)
                    {
                        ucUserListItem oUser = new ucUserListItem(xmlUser);
                        oUser.Location = new Point(0, y);
                        oUser.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
                        oUser.Width = pnlResults.Width;

                        pnlResults.Controls.Add(oUser);
                        pnlResults.Height = oUser.Location.Y + oUser.Height;

                        y = oUser.Location.Y + oUser.Height + 3;

                        Panel oLine = new Panel();
                        oLine.Location = new Point(0, y);
                        oLine.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
                        oLine.Width = pnlResults.Width;
                        oLine.Height = 1;
                        oLine.BackColor = Color.Black;

                        pnlResults.Controls.Add(oLine);
                        pnlResults.Height = oLine.Location.Y + oLine.Height;

                        y = oLine.Location.Y + oLine.Height + 3;
                    }

                    if (xmlUsers.count == 1)
                    {
                        lblResults.Text = "1 result";
                    }
                    else
                    {
                        lblResults.Text = xmlUsers.count + " results";
                    }
                }

                Cursor.Current = Cursors.Default;
            }
        }
        private void frmVenueDetails_Load(object sender, EventArgs e)
        {
            Cursor.Current = Cursors.WaitCursor;

            DotNetSquare.NetSquare.FourSquareVenue xmlVenue = DotNetSquare.NetSquare.Venue(_strVenueID, Program.AccessToken);

            if (xmlVenue.id != "")
            {

                //name
                _strVenueName = xmlVenue.name;
                lblName.Text = _strVenueName;

                //primarycategory
                List<DotNetSquare.NetSquare.FourSquareCategory> xmlCategories = xmlVenue.categories;
                lblCategory.Text = "Uncategorized";
                foreach (DotNetSquare.NetSquare.FourSquareCategory xmlCategory in xmlCategories)
                {
                    if (xmlCategory.primary)
                    {
                        ////nodename
                        _strCategory = xmlCategory.name;
                        lblCategory.Text = _strCategory;

                        ////iconurl
                        _strIconURL = xmlCategory.icon;
                        pbIcon.Image = Program.getImageFromURL(_strIconURL);
                    }
                }

                //twitter
                if (xmlVenue.contact != null)
                { _strTwitterID = xmlVenue.contact.twitter; }

                if (String.IsNullOrEmpty(_strTwitterID))
                {
                    pbTwitter.Visible = false;
                }
                else
                {
                    pbTwitter.Visible = true;
                }

                //geolat, geolong
                _strLat = xmlVenue.location.Lat;
                _strLon = xmlVenue.location.Long;
                if ((!String.IsNullOrEmpty(_strLat)) && (!String.IsNullOrEmpty(_strLon)))
                {
                    pbMap.Image = Program.getImageFromURL(GoogleGeoCode.getGoogleMapURL(_strLat, _strLon, pbMap.Size, false));
                }

                // address
                lblAddress.Text = Program.buildAddress(xmlVenue.location);
                if (String.IsNullOrEmpty(lblAddress.Text))
                {
                    lblAddress.Visible = false;
                    lblAddress.Height = 0;
                }

                ///////////////////////////////////////////////////////
                // stats
                DotNetSquare.NetSquare.FourSquareStats xmlStats = xmlVenue.stats;
                if (xmlStats != null)
                {
                    ////checkins
                    int iCheckins = Convert.ToInt32(xmlStats.checkinsCount);
                    if (iCheckins == 1)
                    {
                        lblCheckins.Text = "1 checkin";
                    }
                    else
                    {
                        lblCheckins.Text = iCheckins + " checkins";
                    }
                }

                ////herenow - TO BE COMPLETED
                int iHereNow = xmlVenue.hereNow.count;
                if (iHereNow == 0)
                {
                    btnViewUsers.Enabled = false;
                }
                else
                {
                    //////////////////////////////////////////////////////////////////////
                    // checkins
                    foreach (DotNetSquare.NetSquare.FourSquareHereNowGroup xmlHereNow in xmlVenue.hereNow.groups)
                    {
                        foreach (DotNetSquare.NetSquare.FourSquareCheckin xmlCheckin in xmlHereNow.items)
                        {
                            _xmlCheckins.count += 1;
                            _xmlCheckins.checkins.Add(xmlCheckin);
                        }
                    }
                }

                if (iHereNow == 1)
                {
                    btnViewUsers.Text = "See The 1 User Here Now";
                }
                else
                {
                    btnViewUsers.Text = "See The " + iHereNow + " Users Here Now";
                }

                ////beenhere
                //////me
                if (xmlVenue.beenHere > 0)
                {
                    lblCheckins.Text += ", including yours!";
                }

                ////mayor
                DotNetSquare.NetSquare.FourSquareUser xmlMayorUser = xmlVenue.mayor.User;
                if (xmlMayorUser != null)
                {
                    ucUserListItem oMayor = new ucUserListItem(xmlMayorUser);
                    oMayor.Location = new Point(0, lblMayor.Location.Y + lblMayor.Height + 3);
                    oMayor.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
                    oMayor.Width = pnlMayor.Width;

                    pnlMayor.Controls.Add(oMayor);
                    pnlMayor.Height = oMayor.Location.Y + oMayor.Height;
                }
                else
                {
                    pnlMayor.Height = 0;
                    pnlMayor.Visible = false;
                }

                //////count
                string strCount = xmlVenue.mayor.Checkins;
                if (!String.IsNullOrEmpty(strCount))
                {
                    int iCount = Convert.ToInt32(strCount);
                    if (iCount == 1)
                    {
                        lblMayor.Text = "Mayor (with 1 checkin)";
                    }
                    else
                    {
                        lblMayor.Text = "Mayor (with " + iCount + " checkins)";
                    }
                }
                else
                {
                    pnlMayor.Height = 0;
                    pnlMayor.Visible = false;
                }

                //////////////////////////////////////////////////////////////////////
                //tips
                Dictionary<string, List<DotNetSquare.NetSquare.FourSquareTip>> xmlTips = xmlVenue.tips;
                int yTip = lblTips.Location.Y + lblTips.Height + 3;
                if (xmlTips.Count == 0)
                {
                    pnlTips.Visible = false;
                    pnlTips.Height = 0;
                }
                else
                {
                    foreach (List<DotNetSquare.NetSquare.FourSquareTip> TipList in xmlTips.Values)
                    {
                        foreach (DotNetSquare.NetSquare.FourSquareTip xmlTip in TipList)
                        {
                            //tip
                            xmlTip.venue = xmlVenue;
                            ucTipListItem oTip = new ucTipListItem(xmlTip);
                            oTip.Location = new Point(0, yTip);
                            oTip.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
                            oTip.Width = pnlTips.Width;

                            pnlTips.Controls.Add(oTip);
                            pnlTips.Height = oTip.Location.Y + oTip.Height;

                            yTip = oTip.Location.Y + oTip.Height + 3;

                            Panel oLine = new Panel();
                            oLine.Location = new Point(0, yTip);
                            oLine.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
                            oLine.Width = pnlTips.Width;
                            oLine.Height = 1;
                            oLine.BackColor = Color.Black;

                            pnlTips.Controls.Add(oLine);
                            pnlTips.Height = oLine.Location.Y + oLine.Height;

                            yTip += oLine.Height + 3;
                        }
                    }
                }

                //////////////////////////////////////////////////////////////////////
                //tags - TO BE CONFIRMED
                /*
                String[] xmlTags = xmlVenue.tags;
                int yTag = lblTags.Location.Y + lblTags.Height + 3;
                if (xmlTags.Count == 0)
                {
                    pnlTags.Visible = false;
                    pnlTags.Height = 0;
                }
                else
                {
                    foreach (XmlNode xmlTag in xmlTags)
                    {
                        ////tag
                        Label oLabel = new Label();
                        oLabel.Location = new Point(0, yTag);
                        oLabel.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
                        oLabel.Width = pnlTags.Width;
                        oLabel.Height = 13;
                        oLabel.Font = new System.Drawing.Font("Tahoma", 8F, System.Drawing.FontStyle.Regular);
                        oLabel.Text = xmlTag.InnerText;

                        pnlTags.Controls.Add(oLabel);
                        pnlTags.Height = oLabel.Location.Y + oLabel.Height;

                        yTag = oLabel.Location.Y + oLabel.Height + 3;
                    }
                }
                */
                //////////////////////////////////////////////////////////////////////
                //specials
                List<DotNetSquare.NetSquare.FourSquareSpecial> xmlSpecials = xmlVenue.specials;
                int ySpecial = lblSpecials.Location.Y + lblSpecials.Height + 3;
                if (xmlSpecials.Count == 0)
                {
                    pnlSpecials.Visible = false;
                    pnlSpecials.Height = 0;
                }
                else
                {
                    foreach (DotNetSquare.NetSquare.FourSquareSpecial xmlSpecial in xmlSpecials)
                    {
                        ////special
                        //////id
                        //////type
                        //////kind
                        //////message
                        //////venue
                        ucSpecialListItem oSpecial = new ucSpecialListItem(xmlSpecial);
                        oSpecial.Location = new Point(0, ySpecial);
                        oSpecial.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
                        oSpecial.Width = pnlSpecials.Width;

                        pnlSpecials.Controls.Add(oSpecial);
                        pnlSpecials.Height = oSpecial.Location.Y + oSpecial.Height;

                        ySpecial = oSpecial.Location.Y + oSpecial.Height + 3;

                        Panel oLine = new Panel();
                        oLine.Location = new Point(0, ySpecial);
                        oLine.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
                        oLine.Width = pnlSpecials.Width;
                        oLine.Height = 1;
                        oLine.BackColor = Color.Black;

                        pnlSpecials.Controls.Add(oLine);
                        pnlSpecials.Height = oLine.Location.Y + oLine.Height;

                        ySpecial += oLine.Height + 3;
                    }
                }

                ///////////////////////////////
                // arrange stuff
                int y = pbMap.Location.Y + pbMap.Height + 3;
                lblAddress.Location = new Point(3, y);

                y = lblAddress.Location.Y + lblAddress.Height + 3;
                btnViewUsers.Location = new Point(3, y);

                y = btnViewUsers.Location.Y + btnViewUsers.Height + 3;
                pnlMayor.Location = new Point(3, y);

                y = pnlMayor.Location.Y + pnlMayor.Height + 3;
                pnlTips.Location = new Point(3, y);

                y = pnlTips.Location.Y + pnlTips.Height + 3;
                pnlTags.Location = new Point(3, y);

                y = pnlTags.Location.Y + pnlTags.Height + 3;
                pnlSpecials.Location = new Point(3, y);
            }

            pnlForm.Focus();
            Cursor.Current = Cursors.Default;
        }
        private void LoadData()
        {
            Cursor.Current = Cursors.WaitCursor;

            DotNetSquare.NetSquare.FourSquareUsers xmlUsers = null;
            Int16 Limit = 100;
            Int16 Offset = 0;

            lblTitle.Text = _strTitle;

            if (_strFormType.Equals("friendrequest"))
            {
                xmlUsers = DotNetSquare.NetSquare.UserRequests(Program.AccessToken);
            }
            else
            {
                if (!String.IsNullOrEmpty(_strCriteria))
                {
                    xmlUsers = DotNetSquare.NetSquare.UserSearch("","","","","",_strCriteria, Program.AccessToken);
                }
                else
                {
                    xmlUsers = DotNetSquare.NetSquare.UserFriends("self", Limit, Offset,Program.AccessToken);
                }
            }

            if (xmlUsers.count > 0)
            {
                int y = 0;
                pnlList.Controls.Clear();
                foreach (DotNetSquare.NetSquare.FourSquareUser xmlUser in xmlUsers.Users)
                {
                    ucUserListItem oUser = new ucUserListItem(xmlUser);
                    oUser.Location = new Point(0, y);
                    oUser.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
                    oUser.Width = pnlList.Width;

                    pnlList.Controls.Add(oUser);
                    pnlList.Height = oUser.Location.Y + oUser.Height;

                    y = oUser.Location.Y + oUser.Height + 3;

                    Panel oLine = new Panel();
                    oLine.Location = new Point(0, y);
                    oLine.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
                    oLine.Width = pnlList.Width;
                    oLine.Height = 1;
                    oLine.BackColor = Color.Black;

                    pnlList.Controls.Add(oLine);
                    pnlList.Height = oLine.Location.Y + oLine.Height;

                    y += oLine.Height + 3;
                }
            }

            Cursor.Current = Cursors.Default;
        }
        public frmCheckinDetails(DotNetSquare.NetSquare.FourSquareCheckin  xmlCheckin)
        {
            InitializeComponent();
            Program.arrForm.Add(this);

            Cursor.Current = Cursors.WaitCursor;

            /////////////////////////////////////////////////////////////
            //timestamp
            string strCreated = xmlCheckin.createdAt.ToString();
            lblTimestamp.Text = Program.convertAPITimeToLocalTime(strCreated);

            // distance
            string strDistance = xmlCheckin.venue.location.Distance;
            strDistance = lblTimestamp.Text + " " + Program.convertDistanceToKM(strDistance) + " away";
            lblTimestamp.Text = strDistance.Trim();

            int y = lblTimestamp.Location.Y + lblTimestamp.Height + 3;

            /////////////////////////////////////////////////////////
            // venue
            DotNetSquare.NetSquare.FourSquareVenue xmlVenue = xmlCheckin.venue;
            if (xmlVenue != null)
            {
                _strVenueID = xmlVenue.id;

                ucVenueListItem oVenue = new ucVenueListItem(xmlVenue);
                oVenue.Location = new Point(3, y);
                oVenue.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
                oVenue.Width = pnlForm.Width - 3 * 2;

                pnlForm.Controls.Add(oVenue);

                y = oVenue.Location.Y + oVenue.Height + 3;
            }

            /////////////////////////////////////////////////////////////
            // user
            DotNetSquare.NetSquare.FourSquareUser xmlUser = xmlCheckin.user;
            if (xmlUser != null)
            {
                _strUserID = xmlUser.id;

                ucUserListItem oUser = new ucUserListItem(xmlUser);
                oUser.Location = new Point(3, y);
                oUser.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
                oUser.Width = pnlForm.Width - 3 * 2;

                pnlForm.Controls.Add(oUser);

                y = oUser.Location.Y + oUser.Height + 3;
            }

            ////////////////////////////////////////////////
            // shout
            pnlShout.Location = new Point(3, y);

            string strShout = xmlCheckin.shout;
            tbShout.Text = strShout;

            if (String.IsNullOrEmpty(strShout))
            {
                pnlShout.Visible = false;
                pnlShout.Height = 0;
            }
            else
            {
                y = pnlShout.Location.Y + pnlShout.Height + 3;
            }

            Cursor.Current = Cursors.Default;
        }