public App() { Instance = this; this.InitializeComponent(); this.Suspending += OnSuspending; Players = new List<Player>(); Players.Add(new Player("anders")); Players.Add(new Player("SindreKING")); //Players.Add(new Player("MarkuScrub")); //Players.Add(new Player("LeftEye")); if (NetworkInterface.GetIsNetworkAvailable()) { GenerateLeague(); } }
/// <summary> /// Strings to pin. /// </summary> /// <returns>The to pin.</returns> /// <param name="str">String.</param> public static List<int> StringToPin(string str) { var pairs = str.Split (new char[]{ ',' }, StringSplitOptions.RemoveEmptyEntries); var dict = new List<int> (); foreach (string s in pairs) { dict.Add (Convert.ToInt32 (s)); } return dict; }
private void AIRankForm_Load(object sender, EventArgs e) { nodes = new List<NodeInstance>(); nodes.Add(new NodeInstance("James", 0, @"C:\Users\james\Documents", 5368709120, 2952790016)); nodes.Add(new NodeInstance("Alan", 3, @"C:\Users\alan\Documents", 7516192768, 4831838208)); nodes.Add(new NodeInstance("Tom", 7, @"C:\Users\tom\Documents", 2147483648, 2000083648)); nodes.Add(new NodeInstance("Patrick", 5, @"C:\Users\patrick\Documents", 4294967296, 3221225472)); nodes.Add(new NodeInstance("Shane", 2, @"C:\Users\shane\Documents", 21474836480, 16106127360)); Dictionary<NodeInstance, double> rankedNodesDict = NodePrioritizer.PrioritizeNodes(nodes); foreach(KeyValuePair<NodeInstance, double> nodeRanking in rankedNodesDict) { lstNodes.Items.Add(nodeRanking.Key.Name + " - rank: " + Math.Round(nodeRanking.Value, 2).ToString()); } rand = new Random((int)DateTime.Now.Ticks); timer1.Start(); }
private void SearchBar_Completed(object sender, EventArgs e) { var searchedList = new List<FrontFriends>(); for (int i = 0; i < friendsList.Count; i++) { if (friendsList[i].Username.Contains(searchBar.Text)) { searchedList.Add(friendsList[i]); } } displayedFriends = searchedList; }
//NOTE: make sure that I'm delete member junction when deleting club ///Returns a list of the users clubs arranged by most recent activity public async Task<List<Club>> GetActiveClubs() { var memberList = await memberJuncTable.Where(item => item.AccountId == User.Id).ToListAsync(); List<Club> clubList = new List<Club>(); for (int i = 0; i < memberList.Count; i++) { string clubId = memberList[i].ClubId; Club club = (await clubTable.Where(item => item.Id == clubId).ToListAsync())[0]; clubList.Add(club); } //remove clubs not in current cloud clubList = clubList.Where(item => item.CloudId == User.CurrentCloudId).ToList(); clubList.OrderByDescending(item => item.LatestActivity); return clubList; }
///returns a list of clubs a given account is member of public async Task<List<Club>> GetAccountClubs(string accountId) { var clubMemberships = await memberJuncTable.Where(item=>item.AccountId==accountId).ToListAsync(); List<Club> accountsClubs = new List<Club>(); for (int i = 0; i < clubMemberships.Count;i++ ) { accountsClubs.Add(await clubTable.LookupAsync(clubMemberships[i].ClubId)); } return accountsClubs; }
private void BAddTags_Clicked(object sender, EventArgs e) { Navigation.PushAsync(tagPage); var frontTagList = tagPage.addedTags; tagList = new List<string>(); for (int i = 0; i < frontTagList.Count; i++) { tagList.Add(frontTagList[i].Tag); } bAddTags.Text = tagList.Count.ToString(); }
public ActionResult Start(List<RoundAndWinner> model) { if (ModelState.IsValid) { var history = new List<History>(model.Count); foreach (var item in model) { history.Add(new History() { Round = item.Round, Winners = item.Winners }); } var result = Unit.AdminSrvc.InitGameHistory(history); if (result != -1) { Unit.PokerBetSrvc.ChangeGameState(result); MvcApplication.DoGeneralActions(0); MvcApplication.timer.Start(); return Redirect("/"); } } return View(model); }
private List<Button> generateColorButtons() { var colorButtons = new List<Button>(); for (int i = 0; i < ch.colorList.Count; i++) { Button bcolor = new Button { BackgroundColor = ch.colorList[i], ClassId = BackgroundColor.ToString(), BorderRadius = 5, VerticalOptions = LayoutOptions.Center }; bcolor.Clicked += Bcolor_Clicked; colorButtons.Add(bcolor); } return colorButtons; }
private async void FriendsImagetgr_Tapped(object sender, EventArgs e) { var friendsList = await App.dbWrapper.GetFriends(App.dbWrapper.GetUser().Id); List<FrontFriends> frontFriendsList = new List<FrontFriends>(); for (int i = 0; i < friendsList.Count; i++) { frontFriendsList.Add(new FrontFriends(friendsList[i], await App.dbWrapper.InSameClub(friendsList[i].Id))); } await Navigation.PushAsync(new FriendsPage(frontFriendsList)); }
protected override async void OnStart() { ch = new ColorHandler(); var saveFileKey = new SaveFileDictionary(); System.Diagnostics.Debug.WriteLine(FileSystem.Current.LocalStorage.Path); var fileSystem = FileSystem.Current.LocalStorage; var fileExists = await fileSystem.CheckExistsAsync("PhoneData.txt"); // createCleanFileSystem(fileSystem); if (fileExists.Equals(ExistenceCheckResult.FileExists)) { IFile file = await fileSystem.GetFileAsync("PhoneData.txt"); var data = await file.ReadAllTextAsync(); var dataLines = data.Split('\n'); // var idLoc = dataLines[saveFileKey.dict["USERID"]].Split(':'); // string id = idLoc[1]; string id = dataLines[saveFileKey.dict["USERID"]]; // if (id[id.Length - 1] == ';') id = id.Substring(0, id.Length - 2); System.Diagnostics.Debug.WriteLine(id); if (!id.Equals("a")) { var userAccount = await dbWrapper.GetAccount(id); await App.dbWrapper.LoginAccount(userAccount.Username, userAccount.Password); var clubs = await App.dbWrapper.GetClubs(); var popularClubs = await App.dbWrapper.GetPopularClubs(); var newestClubs = await App.dbWrapper.GetNewestClubs(); var memberClubsList = await App.dbWrapper.GetAccountClubs(App.dbWrapper.GetUser().Id); var pendingClubList = new List<string>(); //TODO check if get clubs returns all clubs for (int i = 0; i < clubs.Count; i++) { if (await App.dbWrapper.IsPendingClubRequest(clubs[i].Id)) { pendingClubList.Add(clubs[i].Id); } } var firstLineCommentList = await App.getMostRecentComment(memberClubsList); var navPage = new NavigationPage(new TabbedMainClubPages(clubs, memberClubsList, popularClubs, newestClubs, pendingClubList, firstLineCommentList)); navPage.BarBackgroundColor = ch.fromStringToColor("purple"); MainPage = navPage; } else { createCleanFileSystem(fileSystem); } } else { createFileSystem(fileSystem); } // Handle when your app starts }
private void generateDisplayList(List<Club> clubList, List<string> commentList) { frontMyClubList = new List<FrontMyClub>(); for (int i = 0; i < clubList.Count; i++) { frontMyClubList.Add(new FrontMyClub(clubList[i], commentList[i])); } }
private async void ListView_ItemSelected(object sender, SelectedItemChangedEventArgs e) { var club = (FrontMyClub)e.SelectedItem; var chatList = await App.dbWrapper.GetChat(club.Id, "",""); List<Account> requestUsersList = new List<Account>(); List<Account> commentUsersList = new List<Account>(); for (int i = 0; i < chatList.Count; i++) { if (chatList[i].GetType() == typeof(Comment)) { var comment = (Comment)chatList[i]; commentUsersList.Add(await App.dbWrapper.GetAccount(comment.AuthorId)); } else if (chatList[i].GetType() == typeof(ClubRequest)) { var request = (ClubRequest)chatList[i]; requestUsersList.Add(await App.dbWrapper.GetAccount(request.AccountId)); } } var memberClubList = await App.dbWrapper.GetAccountClubs(App.dbWrapper.GetUser().Id); var isMember = await App.dbWrapper.IsMember(club.Id); await Navigation.PushAsync(new ClubChatPage(club, chatList, commentUsersList, requestUsersList, isMember)); generateDisplayList(await App.dbWrapper.GetAccountClubs(App.dbWrapper.GetUser().Id), await App.getMostRecentComment(memberClubList)); updatePage(); }
private async void btnMatch_Click(object sender, RoutedEventArgs e) { if (finals) { String winner; if (bracket.Matches[bracket.Matches.Count - 1].Club1Goals > bracket.Matches[bracket.Matches.Count - 1].Club2Goals) { winner = bracket.Matches[bracket.Matches.Count - 1].club1; } else { winner = bracket.Matches[bracket.Matches.Count - 1].club2; } var md = new MessageDialog(winner + " are champions!"); md.Commands.Add(new UICommand("Exit", (UICommandInvokedHandler) => { App.Current.Exit(); })); await md.ShowAsync(); } if (bracket.CurrentMatch < bracket.MatchCount - 1 && !swapped) { UpdatePlayerStats(); MatchList.Items.RemoveAt(0); bracket.CurrentMatch++; if (bracket.CurrentMatch == bracket.MatchCount - 1) { btn_Match.Content = "End match"; } } else if (MatchList.Items.Count > 0 && !swapped) { UpdatePlayerStats(); MatchList.Items.RemoveAt(0); bracket.CurrentMatch++; //Final List<Player> temp = new List<Player>(); temp.Add(bracket.Players[0]); temp.Add(bracket.Players[1]); if (bracket.Players[1].Points == bracket.Players[2].Points) { temp.Add(bracket.Players[2]); if (temp[0].Points == temp[2].Points) { temp.Sort(delegate(Player p1, Player p2) { return p2.GoalDifference.CompareTo(p1.GoalDifference); }); } } bracket.Matches.Add(new Match(temp[0], temp[1])); txbMatches.Text = "League final!"; ListViewItem lwi = new ListViewItem(); lwi.FontFamily = font; lwi.Content = bracket.Matches[bracket.Matches.Count - 1].ToString(); MatchList.Items.Clear(); MatchList.Items.Add(lwi); finals = true; } }
/// <summary> /// Splits a string mit comatas as devider into a list of strings /// </summary> /// <returns>The to string list.</returns> /// <param name="s">S.</param> public static List<string> StringToStringList(string s) { var stra = s.Split (new char[]{ ',' }, StringSplitOptions.RemoveEmptyEntries); var list = new List<string> (); foreach (string str in stra) { list.Add (str); } return list; }
private async void BSkip_Clicked(object sender, EventArgs e) { await App.dbWrapper.SetUserColor("default"); await App.dbWrapper.SetUserEmoji("default"); var popularClubs = await App.dbWrapper.GetPopularClubs(); var newestClubs = await App.dbWrapper.GetNewestClubs(); var memberClubsList = await App.dbWrapper.GetAccountClubs(App.dbWrapper.GetUser().Id); var clubs = await App.dbWrapper.GetClubs(); List<string> pendingInviteList = new List<string>(); for (int i = 0; i < clubs.Count; i++) { if (await App.dbWrapper.IsPendingClubRequest(clubs[i].Id)) { pendingInviteList.Add(clubs[i].Id); } } List<string> firstLineCommentList = new List<string>(); for (int i = 0; i < memberClubsList.Count; i++) { var comment = await App.dbWrapper.GetRecentComment(memberClubsList[i].Id); firstLineCommentList.Add(comment.Text); } var navPage = new NavigationPage(new TabbedMainClubPages(clubs, memberClubsList, popularClubs, newestClubs, pendingInviteList, firstLineCommentList)); navPage.BarBackgroundColor = ch.fromStringToColor("purple"); Application.Current.MainPage = navPage; }
private List<Image> generateCharacterButtons() { characterNames = new List<string>(); characterNames.Add("AF1.png"); characterNames.Add("AF33.png"); characterNames.Add("AF32.png"); characterNames.Add("AF30.png"); characterNames.Add("AF38.png"); characterNames.Add("AF3.png"); characterNames.Add("AF40.png"); characterNames.Add("AF15.png"); characterNames.Add("AN11.png"); characterNames.Add("AN13.png"); characterNames.Add("AN20.png"); characterNames.Add("AN19.png"); characterNames.Add("AN31.png"); characterNames.Add("AN28.png"); characterNames.Add("AN33.png"); characterNames.Add("AN5.png"); characterNames.Add("AA10.png"); characterNames.Add("AA11.png"); characterNames.Add("AA12.png"); characterNames.Add("AA13.png"); characterNames.Add("AA31.png"); characterNames.Add("AA30.png"); characterNames.Add("AA1.png"); characterNames.Add("AA17.png"); characterNames.Add("AA17.png"); characterNames.Add("AA17.png"); var imageButtons = new List<Image>(); for (int i = 0; i < characterNames.Count; i++) { var img = new Image { Source = FileImageSource.FromFile(characterNames[i]), Aspect = Aspect.AspectFit, HeightRequest = 60, WidthRequest = 60 }; if (i == characterNames.Count - 1) { img.GestureRecognizers.Add(lastInitialImageTgr); } img.GestureRecognizers.Add(tgr); imageButtons.Add(img); } return imageButtons; // return characterButtons; }
void GenerateStarRating() { double score = App.Instance.Leagues[LeagueList.SelectedIndex].clubs[ClubList.SelectedIndex].score; BitmapImage star = new BitmapImage(new Uri("ms-appx:///star.png")); BitmapImage emptyStar = new BitmapImage(new Uri("ms-appx:///starEmpty.png")); BitmapImage halfStar = new BitmapImage(new Uri("ms-appx:///Assets/half_str.png")); List<Image> foo = new List<Image>(); for (int i = 1; i <= 5; i++) { foo.Add(new Image()); if (score >= i) { foo[i-1].Source = star; } else if (score < i && score > (i - 1)) { foo[i - 1].Source = halfStar; } else { foo[i-1].Source = emptyStar; } } Star1.Source = foo[0].Source; Star2.Source = foo[1].Source; Star3.Source = foo[2].Source; Star4.Source = foo[3].Source; Star5.Source = foo[4].Source; }
void GenerateLeague() { Leagues = new List<league>(); for (int i = 1; i <= 32; i++) { league temp = ObjectSerializer.FromXML<league>("http://fifaapi.com/league/" + i + ".xml"); Leagues.Add(temp); } }
public async void updateData() { popularClubs = await App.dbWrapper.GetPopularClubs(); newestClubs = await App.dbWrapper.GetNewestClubs(); clubMemberList = await App.dbWrapper.GetAccountClubs(App.dbWrapper.GetUser().Id); clubList = await App.dbWrapper.GetClubs(); pendingInviteList = new List<string>(); firstLineCommentList = await App.getMostRecentComment(clubMemberList); for (int i = 0; i < clubList.Count; i++) { if (await App.dbWrapper.IsPendingClubRequest(clubList[i].Id)) { pendingInviteList.Add(clubList[i].Id); } } }
public static async Task<List<string>> getMostRecentComment(List<Club> mememberClubs) { var commentTextList = new List<string>(); for (int i =0; i<mememberClubs.Count; i++) { var comments = await App.dbWrapper.GetComments(mememberClubs[i].Id); if (comments.Count > 0) { var authAccount = await App.dbWrapper.GetAccount(comments[comments.Count-1].AuthorId); string commentText = comments[comments.Count - 1].Text; if(commentText.Length > 30) { commentText = commentText.Substring(0, 30) + "..."; } string comment = authAccount.Username + " said: " + commentText; commentTextList.Add(comment); } else { commentTextList.Add("Most Recent Comment..."); } } return commentTextList; }
/// <summary> /// Gets the tree roots. /// </summary> /// <returns>List of roots</returns> /// <param name="cls">Project details</param> private List<TreeNode> GetTreeRoots(UMLClass cls) { // Map every class node. // Namespace - Treenode foreach(var cnode in cls.ClassNodes){ TreeNode tn = new TreeNode(cnode.Namespace); tn.Node = cnode; TreeNodes.Add(tn); if(!map.ContainsKey(tn.Name)) map.Add(tn.Name,tn); } //Create all parent child links foreach(var cnode in cls.ClassNodes) { foreach(var parent in cnode.Links) { var parentnode = GetTreeNode(parent); var childnode = GetTreeNode(cnode.Namespace); if(parentnode == null){ //If inherits class outside project continue; } parentnode.AddChild(childnode); childnode.Parent = parentnode; } } //At this point, we have a forest. Every tree in the //forest wil be drawn separately List<TreeNode> Roots = new List<TreeNode>(); // Add all roots to a list foreach(TreeNode tn in TreeNodes) { var temp = tn; while(temp.Parent !=null){ temp = temp.Parent; } if(!Roots.Contains(temp)) { Roots.Add(temp); } } return Roots; }
public ChatInfoPage(List<Tag> tagsList, ParentFrontClub club, List<FrontClubMember> usersList, bool isMember, string founderUsername, int previousRating) { this.previousRating = previousRating; starTap = new TapGestureRecognizer(); starTap.Tapped += StarTap_Tapped; this.tagsList = tagsList; this.founderUsername = founderUsername; this.isMember = isMember; this.club = club; this.usersList = usersList; currentPage = "tags"; ch = new ColorHandler(); Title = "Info"; bottomButton = new Button(); BackgroundColor = ch.fromStringToColor("white"); starImages = new List<Image>(); for (int i = 0; i < 5; i++) { Image star = new Image { Aspect = Aspect.AspectFit, HeightRequest = 60, BackgroundColor = ch.fromStringToColor("white"), HorizontalOptions = LayoutOptions.FillAndExpand }; if (i <= previousRating) { star.Source = ImageSource.FromFile(ch.getStarColorString(club.clubColor)); } else { star.Source = ImageSource.FromFile(ch.getStarColorString("gray")); } if (isMember) { star.GestureRecognizers.Add(starTap); } starImages.Add(star); } bSubscribe = new Button { HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.Center, Text = "Subscribe", FontAttributes = FontAttributes.Bold, BackgroundColor = ch.fromStringToColor("green"), BorderRadius = 15, HeightRequest = 40 }; bSubscribe.Clicked += BSubscribe_Clicked; bUnsubscribe = new Button { HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.Center, Text = "Unsubscribe", FontAttributes = FontAttributes.Bold, TextColor = ch.fromStringToColor("white"), BackgroundColor = ch.fromStringToColor("gray"), BorderRadius = 15, HeightRequest = 40 }; bUnsubscribe.Clicked += BUnsubscribe_Clicked; if (isMember) { this.bottomButton = bUnsubscribe; } else bottomButton = bSubscribe; bTags = new Button { Text = "Tags", TextColor = ch.fromStringToColor("red"), BackgroundColor = ch.fromStringToColor("white"), HorizontalOptions = LayoutOptions.FillAndExpand, BorderRadius = 0, BorderColor = ch.fromStringToColor("gray") }; bTags.Clicked += BTags_Clicked; bRating = new Button { Text = "Rating", TextColor = ch.fromStringToColor("gray"), BackgroundColor = ch.fromStringToColor("white"), BorderRadius = 0, BorderColor = ch.fromStringToColor("gray"), HorizontalOptions = LayoutOptions.FillAndExpand }; bRating.Clicked += BRating_Clicked; MessagingCenter.Subscribe<ClubMemberViewCell, FrontClubMember>(this, "friendsProfilePage", async (sender, args) => { var acc = (FrontClubMember)args; var account = await App.dbWrapper.GetAccount(acc.Id); int friendship = await App.dbWrapper.GetFriendship(acc.Id); var friendRequests = await App.dbWrapper.GetFriendRequests(); for (int i = 0; i < friendRequests.Count; i++) { if (friendship == 1) { if (friendRequests[i].AuthorId != acc.Id) { friendship = 1; } else { friendship = 3; } } } var accountPage = new FriendProfilePage(account, friendship); await Navigation.PushAsync(accountPage); }); updatePage(); }
private List<Image> generateExtendedCharacterButtons() { var characterNames = new List<string>(); characterNames.Add("AF1.png"); characterNames.Add("AF33.png"); characterNames.Add("AF32.png"); characterNames.Add("AF30.png"); characterNames.Add("AF38.png"); characterNames.Add("AF3.png"); characterNames.Add("AF40.png"); characterNames.Add("AF15.png"); characterNames.Add("AN11.png"); characterNames.Add("AN13.png"); characterNames.Add("AN20.png"); characterNames.Add("AN19.png"); characterNames.Add("AN31.png"); characterNames.Add("AN28.png"); characterNames.Add("AN33.png"); characterNames.Add("AN5.png"); characterNames.Add("AA10.png"); characterNames.Add("AA11.png"); characterNames.Add("AA12.png"); characterNames.Add("AA13.png"); characterNames.Add("AA31.png"); characterNames.Add("AA30.png"); characterNames.Add("AA1.png"); characterNames.Add("AA17.png"); characterNames.Add("AA17.png"); characterNames.Add("AA17.png"); characterNames.Add("AF1.png"); characterNames.Add("AF2.png"); characterNames.Add("AF3.png"); characterNames.Add("AF4.png"); characterNames.Add("AF5.png"); characterNames.Add("AF6.png"); characterNames.Add("AF7.png"); characterNames.Add("AF8.png"); characterNames.Add("AF9.png"); characterNames.Add("AF10.png"); characterNames.Add("AF11.png"); characterNames.Add("AF12.png"); characterNames.Add("AF13.png"); characterNames.Add("AF14.png"); characterNames.Add("AF15.png"); characterNames.Add("AF16.png"); characterNames.Add("AF17.png"); characterNames.Add("AF18.png"); characterNames.Add("AF19.png"); characterNames.Add("AF20.png"); characterNames.Add("AF21.png"); characterNames.Add("AF22.png"); characterNames.Add("AF23.png"); characterNames.Add("AF24.png"); characterNames.Add("AF25.png"); characterNames.Add("AF26.png"); characterNames.Add("AF27.png"); characterNames.Add("AF28.png"); characterNames.Add("AF29.png"); characterNames.Add("AF30.png"); characterNames.Add("AF31.png"); characterNames.Add("AF32.png"); characterNames.Add("AF33.png"); characterNames.Add("AF34.png"); characterNames.Add("AF35.png"); characterNames.Add("AF36.png"); characterNames.Add("AF37.png"); characterNames.Add("AF38.png"); characterNames.Add("AF39.png"); characterNames.Add("AF40.png"); characterNames.Add("Nature"); characterNames.Add("AN1.png"); characterNames.Add("AN2.png"); characterNames.Add("AN3.png"); characterNames.Add("AN4.png"); characterNames.Add("AN5.png"); characterNames.Add("AN6.png"); characterNames.Add("AN7.png"); characterNames.Add("AN8.png"); characterNames.Add("AN9.png"); characterNames.Add("AN10.png"); characterNames.Add("AN11.png"); characterNames.Add("AN12.png"); characterNames.Add("AN13.png"); characterNames.Add("AN14.png"); characterNames.Add("AN15.png"); characterNames.Add("AN16.png"); characterNames.Add("AN17.png"); characterNames.Add("AN18.png"); characterNames.Add("AN19.png"); characterNames.Add("AN20.png"); characterNames.Add("AN21.png"); characterNames.Add("AN22.png"); characterNames.Add("AN23.png"); characterNames.Add("AN24.png"); characterNames.Add("AN25.png"); characterNames.Add("AN26.png"); characterNames.Add("AN27.png"); characterNames.Add("AN28.png"); characterNames.Add("AN29.png"); characterNames.Add("AN30.png"); characterNames.Add("AN31.png"); characterNames.Add("AN32.png"); characterNames.Add("AN33.png"); characterNames.Add("AN34.png"); characterNames.Add("AN35.png"); characterNames.Add("AN36.png"); characterNames.Add("AN37.png"); characterNames.Add("AN38.png"); characterNames.Add("AN39.png"); characterNames.Add("AN40.png"); characterNames.Add("Interests"); characterNames.Add("AA1.png"); characterNames.Add("AA2.png"); characterNames.Add("AA3.png"); characterNames.Add("AA4.png"); characterNames.Add("AA5.png"); characterNames.Add("AA6.png"); characterNames.Add("AA7.png"); characterNames.Add("AA8.png"); characterNames.Add("AA9.png"); characterNames.Add("AA10.png"); characterNames.Add("AA11.png"); characterNames.Add("AA12.png"); characterNames.Add("AA13.png"); characterNames.Add("AA14.png"); characterNames.Add("AA15.png"); characterNames.Add("AA16.png"); characterNames.Add("AA17.png"); characterNames.Add("AA18.png"); characterNames.Add("AA19.png"); characterNames.Add("AA20.png"); characterNames.Add("AA21.png"); characterNames.Add("AA22.png"); characterNames.Add("AA23.png"); characterNames.Add("AA24.png"); characterNames.Add("AA25.png"); characterNames.Add("AA26.png"); characterNames.Add("AA27.png"); characterNames.Add("AA28.png"); characterNames.Add("AA29.png"); characterNames.Add("AA30.png"); characterNames.Add("AA31.png"); characterNames.Add("AA32.png"); characterNames.Add("AA33.png"); characterNames.Add("AA34.png"); characterNames.Add("AA35.png"); characterNames.Add("AA36.png"); characterNames.Add("AA37.png"); characterNames.Add("AA38.png"); characterNames.Add("AA39.png"); characterNames.Add("AA40.png"); var imageButtons = new List<Image>(); for (int i = 0; i < characterNames.Count; i++) { var img = new Image { Source = FileImageSource.FromFile(characterNames[i]), Aspect = Aspect.AspectFit, HeightRequest =60, WidthRequest = 60 }; img.GestureRecognizers.Add(extendedImagesTgr); imageButtons.Add(img); } return imageButtons; }
private async void ListView_ItemSelected(object sender, SelectedItemChangedEventArgs e) { var club = (FrontClub)e.SelectedItem; var chatList = await App.dbWrapper.GetChat(club.Id, "",""); List<Account> requestUsersList = new List<Account>(); List<Account> commentUsersList = new List<Account>(); for (int i = 0; i < chatList.Count; i++) { if (chatList[i].GetType() == typeof(Comment)) { var comment = (Comment)chatList[i]; commentUsersList.Add(await App.dbWrapper.GetAccount(comment.AuthorId)); } else if (chatList[i].GetType() == typeof(ClubRequest)) { var request = (ClubRequest)chatList[i]; requestUsersList.Add(await App.dbWrapper.GetAccount(request.AccountId)); } } bool isMember = await App.dbWrapper.IsMember(club.Id); await Navigation.PushAsync(new ClubChatPage(club, chatList, commentUsersList, requestUsersList, isMember)); updateData(); switch (currentPage) { case "Popular": this.Content = generatePopularPage(); break; case "Newest": this.Content = generateNewestPage(); break; case "Search": this.Content = generateSearchPage(); break; default: this.Content = generatePopularPage(); break; } }
private void InstantiateHandles() { _handles = new List <IHandle> (); _handles.Add (new SouthEastHandle (this)); _handles.Add (new SouthWestHandle (this)); _handles.Add (new NorthWestHandle (this)); _handles.Add (new NorthEastHandle (this)); _handles.Add (new NorthHandle (this)); _handles.Add (new EastHandle (this)); _handles.Add (new SouthHandle (this)); _handles.Add (new WestHandle (this)); }
public ActionResult Start() { var rand = new Random(); var model = new List<RoundAndWinner>(8); for (int i = 0; i < 8; i++) { model.Add(new RoundAndWinner() { Winners = rand.Next(10, 14) + "," + rand.Next(20, 26) + "," + rand.Next(30, 38) }); } return View(model); }
///Returns a list of accounts that are the user's friends public async Task<List<Account>> GetFriends(string accountId) { var friendsJunc = await friendsTable.Where(item=>(item.AuthorId==accountId || item.RecipientId==accountId)).ToListAsync(); List<Account> friends = new List<Account>(); for (int i = 0; i < friendsJunc.Count;i++ ) { Account friend; //loop through and make sure to add the friend, not the user, to the friendlist if(friendsJunc[i].AuthorId==User.Id){ friend = await GetAccount(friendsJunc[i].RecipientId); }else{ friend = await GetAccount(friendsJunc[i].AuthorId); } friends.Add(friend); } return friends; }
List<string> GetAllPossibleCombinations(short x) { List<string> result=new List<String>(); int number = Convert.ToInt32(Math.Pow(2, x)); for (int i = 1; i < number; i++) { string str = ""; for (int j = 0; j < x; j++) { bool bit = (i & (1 << j)) != 0; if (bit) str += (j + 1).ToString() + ","; } result.Add(str.TrimEnd(',')); } return result.OrderBy(p=>p.Length).ToList(); }
///returns a list of accounts that are members of a given club public async Task<List<Account>> GetClubMembers(string clubId) { var memberJuncs = await memberJuncTable.Where(item=>item.ClubId==clubId).ToListAsync(); List<Account> memberAccounts = new List<Account>(); for (int i = 0; i < memberJuncs.Count;i++ ) { memberAccounts.Add(await accountTable.LookupAsync(memberJuncs[i].AccountId)); } return memberAccounts; }