public frmSpecialDetails(DotNetSquare.NetSquare.FourSquareSpecial xmlSpecial) { InitializeComponent(); Program.arrForm.Add(this); lblTitle.Text = "Special"; int y = lblTitle.Location.Y + lblTitle.Height + 3; DotNetSquare.NetSquare.FourSquareVenue xmlVenue = xmlSpecial.venue; if (xmlVenue != null) { 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; } pnlSpecial.Location = new Point(3, y); lblType.Text = xmlSpecial.type; lblKind.Text = xmlSpecial.message; tbMessage.Text = xmlSpecial.description; }
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() { Cursor.Current = Cursors.WaitCursor; Int16 Limit = 50; DotNetSquare.NetSquare.FourSquareVenues xmlVenues = DotNetSquare.NetSquare.VenueSearch(_strLat + ","+ _strLon,"","","","", Limit.ToString(),"","","","","",Program.AccessToken); if (xmlVenues.count > 0) { int y = 0; pnlList.Controls.Clear(); foreach (DotNetSquare.NetSquare.FourSquareVenue xmlVenue in xmlVenues.venues) { ucVenueListItem oVenue = new ucVenueListItem(xmlVenue); oVenue.Location = new Point(0, y); oVenue.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right; oVenue.Width = pnlList.Width; pnlList.Controls.Add(oVenue); pnlList.Height = oVenue.Location.Y + oVenue.Height; y = oVenue.Location.Y + oVenue.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; } y = pnlList.Location.Y + pnlList.Height + 3; lblNotWhatYoureLookingFor.Location = new Point(3, y); y += lblNotWhatYoureLookingFor.Height + 3; btnAddVenue.Location = new Point(3, y); pnlList.Height = btnAddVenue.Location.Y + btnAddVenue.Height + 3; int i = xmlVenues.count; if (i == 1) { lblTitle.Text = "1 Venue Near " + _strVenueName; } else { lblTitle.Text = i + " Venues Near " + _strVenueName; } } Cursor.Current = Cursors.Default; }
private void LoadData() { Cursor.Current = Cursors.WaitCursor; Int16 Limit = 20; Int16 offset = 0; DotNetSquare.NetSquare.FourSquareTips xmlTips = DotNetSquare.NetSquare.TipSearch(_strLat + "," + _strLon, Limit.ToString(), offset.ToString(), "", "",Program.AccessToken); if (xmlTips.count > 0) { int y = 0; pnlList.Controls.Clear(); foreach (DotNetSquare.NetSquare.FourSquareTip xmlTip in xmlTips.tips) { DotNetSquare.NetSquare.FourSquareVenue xmlVenue = xmlTip.venue; if (xmlVenue != null) { ucVenueListItem oVenue = new ucVenueListItem(xmlVenue); oVenue.Location = new Point(0, y); oVenue.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right; oVenue.Width = pnlList.Width; pnlList.Controls.Add(oVenue); pnlList.Height = oVenue.Location.Y + oVenue.Height; y += oVenue.Height + 3; } ucTipListItem oTip = new ucTipListItem(xmlTip); oTip.Location = new Point(0, y); oTip.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right; oTip.Width = pnlList.Width; pnlList.Controls.Add(oTip); pnlList.Height = oTip.Location.Y + oTip.Height; y += oTip.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; } pnlList.Height += 3; } Cursor.Current = Cursors.Default; }
private void LoadData() { Cursor.Current = Cursors.WaitCursor; DotNetSquare.NetSquare.FourSquareTodos xmlTodos; if (_strVenueName == "") { xmlTodos = DotNetSquare.NetSquare.UserTodos("self", "recent", "", Program.AccessToken); } else { xmlTodos = DotNetSquare.NetSquare.UserTodos("self", "nearby", _strLat + "," + _strLon, Program.AccessToken); } if (xmlTodos.count > 0) { int y = 0; pnlList.Controls.Clear(); foreach (DotNetSquare.NetSquare.FourSquareTodo xmlTodo in xmlTodos.todos) { if (xmlTodo.tip != null) { DotNetSquare.NetSquare.FourSquareVenue xmlVenue = xmlTodo.tip.venue; if (xmlVenue != null) { ucVenueListItem oVenue = new ucVenueListItem(xmlVenue); oVenue.Location = new Point(0, y); oVenue.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right; oVenue.Width = pnlList.Width; pnlList.Controls.Add(oVenue); pnlList.Height = oVenue.Location.Y + oVenue.Height; y += oVenue.Height + 3; } if (xmlTodo.tip.user != null) { ucTipListItem oTip = new ucTipListItem(xmlTodo.tip); oTip.Location = new Point(0, y); oTip.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right; oTip.Width = pnlList.Width; pnlList.Controls.Add(oTip); pnlList.Height = oTip.Location.Y + oTip.Height; y += oTip.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; } } } pnlList.Height += 3; } Cursor.Current = Cursors.Default; }
private void frmDashboard_Load(object sender, EventArgs e) { DotNetSquare.NetSquare.FourSquareUser SelfUser = null; Cursor.Current = Cursors.WaitCursor; if (_strLoggedInUserDetailXML.Equals(SelfUser)) { SelfUser = DotNetSquare.NetSquare.User(Program.AccessToken); } else { SelfUser = _strLoggedInUserDetailXML; } // userid _strUserID = "self" ; // get the no of pending friend requests if (Convert.ToInt16(SelfUser.requests) == 0) { btnPending.Enabled = false; } else if (Convert.ToInt16(SelfUser.requests) == 1) { btnPending.Text = "1 Pending Request"; } else { btnPending.Text = SelfUser.requests + " Pending Requests"; } // lblName string strName = SelfUser.firstName + " " + SelfUser.lastName; lblName.Text = strName.Trim(); //gender string strGender = SelfUser.gender; Color colorGender = Color.Black; switch (strGender) { case "female": colorGender = Color.PaleVioletRed; break; case "male": colorGender = Color.SteelBlue; break; } pnlGender.BackColor = colorGender; // pbUser string strURL = SelfUser.photo; pbUser.Image = Program.getImageFromURL(strURL); ////////////////////////////////////////////////////////////////////////////// // Get Venue History Last 7 Days long SevenDays = Program.ToUnixTime(Program.SevenDaysAgo()); DotNetSquare.NetSquare.FourSquareCheckins ListCheckins = DotNetSquare.NetSquare.UserCheckins("self",50,0,SevenDays,0,Program.AccessToken); if (ListCheckins.count != 0) { Program.strGlobalLat = ""; Program.strGlobalLon = ""; pnlHistory.Controls.Clear(); int iHistoryY = 0; for (int i = 0; i < ListCheckins.checkins.Count; i++) { DotNetSquare.NetSquare.FourSquareCheckin xmlCheckin = ListCheckins.checkins[i]; string strCreated = Program.convertAPITimeToCuteTime(xmlCheckin.createdAt.ToString()); DotNetSquare.NetSquare.FourSquareVenue xmlVenue = xmlCheckin.venue; if (xmlVenue != null) { if ((String.IsNullOrEmpty(Program.strGlobalLat)) || (String.IsNullOrEmpty(Program.strGlobalLon))) { Program.strGlobalLat = xmlVenue.location.Lat; Program.strGlobalLon = xmlVenue.location.Long; } ucVenueListItem oVenue = new ucVenueListItem(xmlVenue, strCreated); oVenue.Location = new Point(0, iHistoryY); oVenue.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right; oVenue.Width = pnlHistory.Width; pnlHistory.Controls.Add(oVenue); pnlHistory.Height = oVenue.Location.Y + oVenue.Height; iHistoryY += oVenue.Height + 3; Panel oLine = new Panel(); oLine.Location = new Point(0, iHistoryY); oLine.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right; oLine.Width = pnlHistory.Width; oLine.Height = 1; oLine.BackColor = Color.Black; pnlHistory.Controls.Add(oLine); pnlHistory.Height = oLine.Location.Y + oLine.Height; iHistoryY += oLine.Height + 3; } } } Cursor.Current = Cursors.Default; }
private void miSearch_Click(object sender, EventArgs e) { string strSearch = tbSearch.Text.Trim(); string strCity = tbCity.Text.Trim(); string strLat = Program.strGlobalLat; string strLon = Program.strGlobalLon; if (!String.IsNullOrEmpty(strSearch)) { if (!String.IsNullOrEmpty(strCity)) { //geocode the city to get the latlon GoogleGeoCode.GeoCode geoResult = GoogleGeoCode.GetGeoCode(System.Uri.EscapeDataString(strCity)); strLat = geoResult.Latitude; strLon = geoResult.Longitude; } if ((String.IsNullOrEmpty(strLat)) || (String.IsNullOrEmpty(strLon))) { MessageBox.Show("Oops! We're unable to determine your last known position. Please enter the nearest city / area.", Program.strProgramName, MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1); btnMore_Click(sender, e); } else { Cursor.Current = Cursors.WaitCursor; this.SuspendLayout(); Int16 Limit = 50; DotNetSquare.NetSquare.FourSquareVenues xmlVenues = DotNetSquare.NetSquare.VenueSearch(strLat + "," + strLon,"","","",System.Uri.EscapeDataString(strSearch),Limit.ToString(),"checkin","","","","",Program.AccessToken); if (xmlVenues.count > 0) { int y = 0; pnlResults.Controls.Clear(); foreach (DotNetSquare.NetSquare.FourSquareVenue xmlVenue in xmlVenues.venues) { ucVenueListItem oVenue = new ucVenueListItem(xmlVenue); oVenue.Location = new Point(0, y); oVenue.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right; oVenue.Width = pnlResults.Width; pnlResults.Controls.Add(oVenue); pnlResults.Height = oVenue.Location.Y + oVenue.Height; y += oVenue.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 + 3; y += oLine.Height + 3; } lblNotWhatYoureLookingFor.Location = new Point(3, pnlResults.Location.Y + pnlResults.Height + 3); btnAddVenue.Location = new Point(3, lblNotWhatYoureLookingFor.Location.Y + lblNotWhatYoureLookingFor.Height + 3); pnlResults.Visible = true; lblResults.Visible = true; lblNotWhatYoureLookingFor.Visible = true; btnAddVenue.Visible = true; int i = xmlVenues.count; if (i == 1) { lblResults.Text = "1 result"; } else { lblResults.Text = i + " results"; } } this.ResumeLayout(); 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; }
void LoadData() { Cursor.Current = Cursors.WaitCursor; bool bIsSelf = false; DotNetSquare.NetSquare.FourSquareUser xmlUser = DotNetSquare.NetSquare.User(_strUserID,Program.AccessToken); if (xmlUser != null) { ////////////////////////////////// // user //name _strName = xmlUser.firstName + " "; _strName += xmlUser.lastName; _strName = _strName.Trim(); lblName.Text = _strName; //gender string strGender = xmlUser.gender; Color colorGender = Color.Black; switch (strGender) { case "female": colorGender = Color.PaleVioletRed; break; case "male": colorGender = Color.SteelBlue; break; } pnlGender.BackColor = colorGender; //photo string strPictureURL = xmlUser.photo; if (!String.IsNullOrEmpty(strPictureURL)) { pbUser.Image = Program.getImageFromURL(strPictureURL); } lblEmail.Text = xmlUser.contact.email; lblPhone.Text = xmlUser.contact.phone; _strFacebookID = xmlUser.contact.facebook; if (String.IsNullOrEmpty(_strFacebookID)) { pbFacebook.Visible = false; } _strTwitterID = xmlUser.contact.twitter; if (String.IsNullOrEmpty(_strTwitterID)) { pbTwitter.Visible = false; } /////////////////////////////////////////////////////////////////////// //settings block if (xmlUser.relationship == "self") { bIsSelf = true; } //////////////////////////////////////////////////////////////////////// //friendstatus string strFriendStatus = xmlUser.relationship; switch (strFriendStatus) { case "friend": //the requested user is your friend pnlAcceptReject.Visible = false; btnSendRequest.Visible = false; break; case "pendingMe": //the requested user sent you a friend request that you have not accepted pnlAcceptReject.Visible = true; btnSendRequest.Visible = false; break; case "pendingthem": //you have sent a friend request to the requested user but they have not accepted pnlAcceptReject.Visible = false; btnSendRequest.Visible = true; btnSendRequest.Enabled = false; btnSendRequest.Text = "Friend Request Sent!"; break; default: //node absent - the requested user is not your friend (and neither party has made an attempt at connecting) pnlAcceptReject.Visible = false; btnSendRequest.Visible = true; break; } /////////////////////////////////////////////////////////////////////// //badges DotNetSquare.NetSquare.FourSquareBadgesAndSets xmlBadges = DotNetSquare.NetSquare.UserBadges(xmlUser.id,Program.AccessToken); if (xmlBadges.Badges.Count > 0) { int y = lblBadge.Location.Y + lblBadge.Height + 3; if (xmlBadges.Badges.Count == 1) { lblBadge.Text = "1 Badge"; } else { lblBadge.Text = xmlBadges.Badges.Count + " Badges"; } foreach (DotNetSquare.NetSquare.FourSquareBadge xmlBadge in xmlBadges.Badges) { //badge ucBadgeListItem oBadge = new ucBadgeListItem(xmlBadge); oBadge.Location = new Point(0, y); oBadge.Width = pnlBadge.Width; pnlBadge.Controls.Add(oBadge); pnlBadge.Height = oBadge.Location.Y + oBadge.Height; y = oBadge.Location.Y + oBadge.Height + 3; Panel oLine = new Panel(); oLine.Location = new Point(0, y); oLine.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right; oLine.Width = pnlBadge.Width; oLine.Height = 1; oLine.BackColor = Color.Black; pnlBadge.Controls.Add(oLine); pnlBadge.Height = oLine.Location.Y + oLine.Height; y += oLine.Height + 3; } } else { pnlBadge.Visible = false; pnlBadge.Height = 0; } //////////////////////////////////////////////////////////////////// //mayor List<DotNetSquare.NetSquare.FourSquareVenue> xmlVenues = xmlUser.mayorshipItems; if (xmlVenues.Count > 0) { int y = lblMayor.Location.Y + lblMayor.Height + 3; if (xmlVenues.Count == 1) { lblMayor.Text = "1 Mayorship"; } else { lblMayor.Text = xmlVenues.Count + " Mayorships"; } foreach (DotNetSquare.NetSquare.FourSquareVenue xmlVenue in xmlVenues) { //venue ucVenueListItem oVenue = new ucVenueListItem(xmlVenue); oVenue.Location = new Point(0, y); oVenue.Width = pnlMayor.Width; pnlMayor.Controls.Add(oVenue); pnlMayor.Height = oVenue.Location.Y + oVenue.Height + 3; y = oVenue.Location.Y + oVenue.Height + 3; Panel oLine = new Panel(); oLine.Location = new Point(0, y); oLine.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right; oLine.Width = pnlMayor.Width; oLine.Height = 1; oLine.BackColor = Color.Black; pnlMayor.Controls.Add(oLine); pnlMayor.Height = oLine.Location.Y + oLine.Height; y += oLine.Height + 3; } } else { pnlMayor.Visible = false; pnlMayor.Height = 0; } //////////////////////////////////////////////////////// //recalculate positions int iFormY = pnlGender.Location.Y + pnlGender.Height + 3; btnViewFriends.Location = new Point(3, iFormY); iFormY = btnViewFriends.Location.Y + btnViewFriends.Height + 3; pnlBadge.Location = new Point(3, iFormY); iFormY = pnlBadge.Location.Y + pnlBadge.Height + 3; pnlMayor.Location = new Point(3, iFormY); iFormY = pnlMayor.Location.Y + pnlMayor.Height + 3; pnlAcceptReject.Location = new Point(3, iFormY); iFormY = pnlAcceptReject.Location.Y + pnlAcceptReject.Height + 3; btnSendRequest.Location = new Point(3, iFormY); if (pnlAcceptReject.Visible == false) { btnSendRequest.Location = pnlAcceptReject.Location; } if (bIsSelf) { btnSendRequest.Visible = false; } } Cursor.Current = Cursors.Default; }