private async void btnControlsConfigure_Click(object sender, RoutedEventArgs e) { // get button name Button button = (Button)sender; string name = button.Name; // remove beginning and end name = name.Replace("btn", "").Replace("Configure", ""); // get the relevant combox //ComboBox cb = (ComboBox)this.FindName("cmb" + name); // get the virtual port number //ComboBoxItem typeItem = (ComboBoxItem)cb.SelectedItem; //string selectedString = cb.SelectionBoxItem.ToString(); //int portNum = Convert.ToInt32(selectedString.Replace("Virtual Port ", "")); // Get device definition for this controller DeviceDefinition dev = Lynx.GamePad(0); mw.ControllerDefinition = dev; // launch controller configuration window Grid RootGrid = (Grid)mw.FindName("RootGrid"); await mw.ShowChildWindowAsync(new ConfigureController() { IsModal = true, AllowMove = false, Title = "Controller Configuration", CloseOnOverlay = false, CloseByEscape = false, ShowCloseButton = false }, RootGrid); }
static private Arena PrepareArenaHare(Perceptron perceptron) { var arena = new Arena(width, height); var hare = new Hare(arena); var lynx = new Lynx(arena); hare.Other = lynx; lynx.Other = hare; arena.AddAnimal(hare); arena.AddAnimal(lynx); hare.Perceptron = perceptron; return(arena); }