public void AddTabPage(string key, int index) { string[] temp = key.Split(' '); if (temp[0] == "SERIES") { VariableTabPage seriesTabPage = new VariableTabPage(); int listIndex = VariableFinder.FindVariableIndex(data.SeriesVariables, temp[1]); seriesTabPage.SetData(data.SeriesVariables[listIndex], data); seriesTabPage.ShowDataGrid(); this.variableViewCollection.TabPages.Insert(index, seriesTabPage); this.variableViewCollection.SelectedIndex = this.variableViewCollection.TabPages.Count - 1; } else if (temp[0] == "GROUP") { GroupTabPage groupTabPage = new GroupTabPage(); int listIndex = GroupFinder.FindGroupIndex(data.SeriesGroups, temp[1]); groupTabPage.SetData(data.SeriesGroups[listIndex], data); groupTabPage.ShowDataGrid(); this.variableViewCollection.TabPages.Insert(index, groupTabPage); this.variableViewCollection.SelectedIndex = this.variableViewCollection.TabPages.Count - 1; } else if (temp[0] == "STOCK") { StockTabPage stockTabPage = new StockTabPage(); int listIndex = StockFinder.FindStockIndex(data.SeriesStocks, temp[1]); stockTabPage.SetData(data.SeriesStocks[listIndex], data); stockTabPage.ShowDataGrid(); this.variableViewCollection.TabPages.Insert(index, stockTabPage); this.variableViewCollection.SelectedIndex = this.variableViewCollection.TabPages.Count - 1; } }
void GetAdditionalGroups( ) { if (RetrievingGroups == false) { RetrievingGroups = true; BlockerView.Show(delegate { GroupFinder.GetGroups(GroupTypeId, StreetValue, CityValue, StateValue, ZipValue, CurrGroupIndex, NumRequestedGroups, delegate(MobileAppApi.GroupSearchResult sourceLocation, List <MobileAppApi.GroupSearchResult> groupEntries, bool result) { BlockerView.Hide(delegate { RetrievingGroups = false; // for additional groups, only take action if we got something back. if (result) { // increment our index to the next set, or the end of the list, whichever is less // this will ensure when we hit the end of the list, CurrGroupIndex reflects that. CurrGroupIndex += Math.Min(groupEntries.Count, NumRequestedGroups); GroupEntries.AddRange(groupEntries); UpdateMap(true); } }); }); }); } }
private List <User> FindInPersonGroups(GroupFinder queue) { foreach (var user in queue.Queue) { //Find people within the users willing to travel radius var nearMe = queue .Queue .Where(x => x.Location.Distance(user.Location) <= 15 * 1069).ToList(); return(nearMe); Debug.Print(string.Join(',', nearMe)); //Any actively looking for the same games? //Any at the right skill levels? //Any groups already exist for any of our games? ////Yes - join existing group /// No Continue //Any of these available the same time we are? //Matchy match } return(null); }
public override void OnClick(Fragment source, int buttonId, object context) { base.OnClick(source, buttonId, context); // only handle input if the springboard is closed if (NavbarFragment.ShouldTaskAllowInput( )) { // decide what to do. if (source == MainPage) { ConnectLink linkEntry = (ConnectLink)context; // group finder is the only connect link that doesn't use an embedded webView. if (linkEntry.Title == ConnectStrings.Main_Connect_GroupFinder) { // launch group finder (and have it auto-show the search) GroupFinder.ShowSearchOnAppear = true; // if we're logged in, give it a starting address if (MobileApp.Shared.Network.RockMobileUser.Instance.LoggedIn == true && MobileApp.Shared.Network.RockMobileUser.Instance.HasFullAddress( )) { GroupFinder.SetSearchAddress(MobileApp.Shared.Network.RockMobileUser.Instance.Street1( ), MobileApp.Shared.Network.RockMobileUser.Instance.City( ), MobileApp.Shared.Network.RockMobileUser.Instance.State( ), MobileApp.Shared.Network.RockMobileUser.Instance.Zip( )); } PresentFragment(GroupFinder, true); } else { // launch the ConnectWebFragment. TaskWebFragment.HandleUrl(false, true, linkEntry.Url, this, WebFragment); } } else if (source == GroupFinder) { // turn off auto-show search so that if the user presses 'back', we don't pop it up again. GroupFinder.ShowSearchOnAppear = false; MobileAppApi.GroupSearchResult entry = (MobileAppApi.GroupSearchResult)context; GroupInfo.GroupEntry = entry; PresentFragment(GroupInfo, true); } else if (source == GroupInfo) { MobileAppApi.GroupSearchResult entry = (MobileAppApi.GroupSearchResult)context; JoinGroup.GroupTitle = entry.Name; JoinGroup.Distance = string.Format("{0:##.0} {1}", entry.DistanceFromSource, ConnectStrings.GroupFinder_MilesSuffix); JoinGroup.GroupID = entry.Id; JoinGroup.MeetingTime = string.IsNullOrEmpty(entry.MeetingTime) == false ? entry.MeetingTime : ConnectStrings.GroupFinder_ContactForTime; PresentFragment(JoinGroup, true); } } }
private void FindOnlineGroups(GroupFinder queue) { //Any actively looking for the same games? //Any at the right skill levels? //Any of these available the same time we are? //Matchy match }
void GetInitialGroups(int groupTypeId, string streetValue, string cityValue, string stateValue, string zipValue) { if (RetrievingGroups == false) { // since this is the first search for the new address, get initial values // so that if they leave the page and return, we can re-populate them. StreetValue = SearchPage.Street.Text; CityValue = SearchPage.City.Text; StateValue = SearchPage.State.Text; ZipValue = SearchPage.ZipCode.Text; RetrievingGroups = true; BlockerView.Show(delegate { GroupTypeId = groupTypeId; CurrGroupIndex = 0; GroupFinder.GetGroups(groupTypeId, streetValue, cityValue, stateValue, zipValue, CurrGroupIndex, NumRequestedGroups, delegate(MobileAppApi.GroupSearchResult sourceLocation, List <MobileAppApi.GroupSearchResult> groupEntries, bool result) { BlockerView.Hide(delegate { RetrievingGroups = false; SourceLocation = sourceLocation; GroupEntries = groupEntries; UpdateMap(result); // if the result was valid string address = StreetValue + " " + CityValue + ", " + StateValue + ", " + ZipValue; if (result) { // take the lesser of the two. The number we requested, or the amount returned, because // it's possible there weren't as many as we requested. CurrGroupIndex = Math.Min(NumRequestedGroups, groupEntries.Count); // record an analytic that they searched GroupFinderAnalytic.Instance.Trigger(GroupFinderAnalytic.Location, address); //GroupFinderAnalytic.Instance.Trigger( GroupFinderAnalytic.Neighborhood, GroupEntries[ 0 ].NeighborhoodArea ); } else { // record an analytic that this address failed GroupFinderAnalytic.Instance.Trigger(GroupFinderAnalytic.OutOfBounds, address); } }); }); }); } }
private void textUrl_TextChanged(object sender, EventArgs e) { var url = textUrl.Text; string title = ""; Byte[] pageData, originString = null; WebClient MyWebClient = new WebClient(); MyWebClient.Credentials = CredentialCache.DefaultCredentials; try { pageData = MyWebClient.DownloadData(url); string pageHtml = Encoding.Default.GetString(pageData); if (pageHtml == "") { return; } originString = Convert.FromBase64String(pageHtml); } catch { return; } string ssUrl = System.Text.Encoding.UTF8.GetString(originString); var match = UrlFinderR.Match(ssUrl); if (match.Success) { var ssrLink = controller.Base64UrlDecode(match.Groups["base64"].Value); var GroupMatch = GroupFinder.Match(ssrLink); if (GroupMatch.Success) { title = controller.Base64UrlDecode(GroupMatch.Groups["base64"].Value); textGroup.Text = title; var index = SubscribeListBox.SelectedIndex; if (index != -1) { SubscribeListBox.Items.RemoveAt(index); SubscribeListBox.Items.Insert(index, title + " - " + url); SubscribeList[index].title = title; SubscribeList[index].url = url; SubscribeListBox.SelectedIndex = index; } } } }
void GetAdditionalGroups( ) { if (Searching == false) { Searching = true; BlockerView.Show(delegate { GroupFinder.GetGroups(GroupTypeId, StreetValue, CityValue, StateValue, ZipValue, CurrGroupIndex, NumRequestedGroups, delegate(MobileAppApi.GroupSearchResult sourceLocation, List <MobileAppApi.GroupSearchResult> groupEntries, bool result) { BlockerView.Hide(delegate { Searching = false; if (result) { // increment our index to the next set, or the end of the list, whichever is less // this will ensure when we hit the end of the list, CurrGroupIndex reflects that. CurrGroupIndex += Math.Min(groupEntries.Count, NumRequestedGroups); // add in the new results GroupEntries.AddRange(groupEntries); // update the map UpdateMap(result); // and reload the table GroupFinderTableView.ReloadData( ); // since we're only loading additional groups, don't flag the // list as updated. We don't want it to reset to the top. GroupListUpdated = false; } }); }); }); } }
void GetInitialGroups(int groupTypeId, string street, string city, string state, string zip) { if (Searching == false) { // since this is the first search for the new address, get initial values // so that if they leave the page and return, we can re-populate them. StreetValue = SearchPage.Street.Text; CityValue = SearchPage.City.Text; StateValue = SearchPage.State.Text; ZipValue = SearchPage.ZipCode.Text; Searching = true; BlockerView.Show(delegate { // set the group index we'll begin with CurrGroupIndex = 0; GroupTypeId = groupTypeId; // request groups from CurrGroupIndex thru CurrGroupIndex + NumRequestedGroups GroupFinder.GetGroups(groupTypeId, StreetValue, CityValue, StateValue, ZipValue, CurrGroupIndex, NumRequestedGroups, delegate(MobileAppApi.GroupSearchResult sourceLocation, List <MobileAppApi.GroupSearchResult> groupEntries, bool result) { BlockerView.Hide(delegate { Searching = false; // store the source location SourceLocation = sourceLocation; // take the initial group entries GroupEntries = groupEntries; // update the map UpdateMap(result); // reload the table. GroupFinderTableView.ReloadData( ); // flag that our group list was updated so that // on the region updated callback from the map, we // can select the appropriate group GroupListUpdated = true; // and record an analytic for the neighborhood that this location was apart of. This helps us know // which neighborhoods get the most hits. string address = StreetValue + " " + CityValue + ", " + StateValue + ", " + ZipValue; // send an analytic if the request went thru ok if (result) { if (groupEntries.Count > 0) { // increment our index to the next set, or the final amount available, whichever is less. // this will ensure when we hit the end of the list, CurrGroupIndex reflects that. CurrGroupIndex = CurrGroupIndex + Math.Min(groupEntries.Count, NumRequestedGroups); // record an analytic that they searched GroupFinderAnalytic.Instance.Trigger(GroupFinderAnalytic.Location, address); //GroupFinderAnalytic.Instance.Trigger( GroupFinderAnalytic.Neighborhood, groupEntries[ 0 ].NeighborhoodArea ); } else { // record that this address failed GroupFinderAnalytic.Instance.Trigger(GroupFinderAnalytic.OutOfBounds, address); } } }); }); }); } }