i'm creating windows phone 8.1 app, friend owns bar. i've string array contains 30 shooter names, different flavours. goal of app select randomly item array, clicking on button , displaying selected item in textblock.
this part works.
now want add name of selected shot in list, displayed in listbox, each click on button, , sort list alphabetically.
it easier when ordering (in case of large group of friends).
now code shorthened array (from 30 4 items) :
public string[] shooters = new string[4] {"b52", "baby guinness", "bizu", "jedi"}; public list<string> commande = new list<string>(); public void choixshot_click(object sender, routedeventargs e) { random ran = new random(); string name = null; int ind = 0; ind = ran.next(0, shooters.length); name = shooters[ind]; sanction.datacontext = name; commande.add(name); commande.sort(); listecommande.itemssource = commande; } it displays name selected first click.
thanks considering question, , spending time me :)
this works me:
class program { public string[] shooters = new string[4] { "b52", "baby guinness", "bizu", "jedi" }; public list<string> commande = new list<string>(); static void main(string[] args) { random ran = new random(); program shots = new program(); string name = null; name = convert.tostring(ran.next(0, shots.shooters.length)); sanction.datacontext = name; commande.add(name); commande.sort(); listecommande.itemssource = commande; } }
Comments
Post a Comment