protected override void OnNavigatedTo(NavigationEventArgs e) { var con = e.Parameter as ContainerClass; cont = con; checkBox_Common_Copy.IsEnabled = false; if (cont.simulationCriteria != null) { Rerun_button.IsEnabled = true; } else { Rerun_button.IsEnabled = false; } if (!(con.getCard() == null)) { cont = con; var cardStat = con.getCard() as CardStats; setCardData(cardStat); } else { CostBox_Copy.Visibility = Visibility.Visible; NameBlock.Visibility = Visibility.Collapsed; thisCard = new CardStats(new Card_User_Defined()); textBlock_Copy10.Text = "UNKNOWN"; textBlock_Copy10.FontSize = 50; textBlock_Copy8.Text = "UNKNOWN"; textBlock_Copy8.FontSize = 50; textBlock_Copy6.Text = "?"; //RANK thisCard.card.setName("NNNNNNNNNNNNAAAAAMMMMMMMME"); comboBoxWithCards.ItemsSource = gennereateCollection(thisCard); } }
public static async Task writeToFile(ContainerClass container) { string path = "C:/Users/Japh/Desktop/" + "hello.txt"; //path = "C:/Users/Sabrina/Dropbox/Emnefiler/Krak/Output.txt"; path = "C:/Users/Japh/Desktop/" + "hello.txt"; var folder = Windows.Storage.ApplicationData.Current.LocalFolder; var file = await folder.CreateFileAsync(path, Windows.Storage.CreationCollisionOption.ReplaceExisting); await Windows.Storage.FileIO.WriteTextAsync(file, "Hello world!"); Task newt = new Task(() => { FileStream fs = new FileStream(path, FileMode.OpenOrCreate, FileAccess.Write); StreamWriter sw = new StreamWriter(fs); sw.WriteLine("Hello World"); sw.WriteLine("Hello World"); sw.WriteLine("Hello World"); sw.WriteLine("Hello World"); sw.Dispose(); fs.Dispose(); }); newt.Start(); }
private void button_Copy2_Click(object sender, RoutedEventArgs e) { if (container == null) { container = new ContainerClass(model, null); } container.rankCriteriaReview = true; this.Frame.Navigate((typeof(NewSimulationPage)), container); }
private void button_Quetion(object sender, RoutedEventArgs e) { if (container == null) { container = new ContainerClass(model, null); container.rankCriteria = null; container.rankCriteriaReview = false; } this.Frame.Navigate((typeof(QuestionPage)), container); }
private void create_button_Click(object sender, RoutedEventArgs e) { if (container == null) { container = new ContainerClass(model, null); } container.model = model; container.card = null; this.Frame.Navigate((typeof(CardExpediton)), container); }
private void button_Click(object sender, RoutedEventArgs e) { var b = sender as Button; var s = b.Content.ToString(); //s = s.Substring(0, s.Length - 7); var index = s.IndexOf('('); s = s.Substring(0, index); //b.Content.ToString().Substring(0, b.Content.ToString().Length - 6); b.Content = s; int i = 0; var cards = model.cardsToDisplay; var card = cards[i]; while (i < cards.Count) { card = cards[i]; if (card.card.GetNameType().Equals(s)) { break; } i++; } //ContainerClass con = new ContainerClass(model, card); if (container == null) { container = new ContainerClass(model, card); } container.model = model; container.card = card; this.Frame.Navigate((typeof(CardExpediton)), container); }
public static SimulationResults runSimulation(ContainerClass container, SetupData setup) { foreach (var card in setup.Cardpool) { (card as ITrackable).Reset(); } var Res = Simulator.RunSimulation(setup); //Get results back List <CardStats> ListWithCards = new List <CardStats>(); //var winRatios = con.model.calculateWinRatio(ICards, Res.Decks); foreach (var card in Res.Cardpool) { var cardStats = new CardStats(card); //var wins = ((winRatios[card.GetNameType()])[0] * 1.0); //var fights = ((winRatios[card.GetNameType()])[1] * 1.0); var win_ratio = (card as ITrackable).GetWinLossRate(); //(wins / fights) * 100;//(card as ITrackable).GetWinLossRate(); var win_ratio_int = Convert.ToInt32(win_ratio); cardStats.win_ratio = win_ratio_int; //cardStats.win_ratio = r.Next(0,100); //Random var dom = (card as ITrackable).GetDominance(card); cardStats.domminance = dom; cardStats.simulated = true; cardStats.changed = false; ListWithCards.Add(cardStats); } List <ICard> ICardsNOT = new List <ICard>(); foreach (var card in container.getModel().cardsToDisplay) { if (!Res.Cardpool.Contains(card.card)) { ICardsNOT.Add(card.card); } } foreach (var card in ICardsNOT) { var cardStats = new CardStats(card); cardStats.win_ratio = -1; cardStats.domminance = -1; cardStats.simulated = false; cardStats.changed = false; ListWithCards.Add(cardStats); } container.getModel().cardsToDisplay = ListWithCards; container.simulated = true; container.simulationCriteria.setup = setup; return(Res); }
protected override void OnNavigatedTo(NavigationEventArgs e) { con = e.Parameter as ContainerClass; var cards = con.getModel().cardsToDisplay; EqualShareBox.IsEnabled = false; cardsToPresent = new ObservableCollection <listBoxExtra>(); listBoxExtra l; foreach (var card in cards) { l = new listBoxExtra(); l.Height = 45; l.Content = card.card.GetNameType(); l.Foreground = new SolidColorBrush(Colors.Black); l.IsEnabled = true; l.SelectedOrNot = true; l.card = card; cardsToPresent.Add(l); } cardsBox.ItemsSource = cardsToPresent; cardsToExamine = cardsToPresent.Count(); textBlock1_Copy13.Text = "Cards to examine: " + cardsToExamine; checkBox.IsChecked = true; EqualShareBox.IsChecked = true; if (!con.rankCriteriaReview) { OR_S.IsChecked = true; OR_S_Copy.IsChecked = true; OR_S_Copy1.IsChecked = true; OR_S_Copy2.IsChecked = true; OR_S_Copy3.IsChecked = true; Win_box_S.IsChecked = true; Win_box_S_Copy.IsChecked = true; Win_box_S_Copy1.IsChecked = true; Win_box_S_Copy2.IsChecked = true; Win_box_S_Copy3.IsChecked = true; Dom_box_S.IsChecked = true; Dom_box_S_Copy.IsChecked = true; Dom_box_S_Copy1.IsChecked = true; Dom_box_S_Copy2.IsChecked = true; Dom_box_S_Copy3.IsChecked = true; checkBox1.IsChecked = true; } else { if (con.simulationCriteria.matchupStrategyType == MatchupStrategyType.All) { checkBox1.IsChecked = true; } else { checkBox1_Copy.IsChecked = true; } con.rankCriteriaReview = false; var rankCriteria = con.rankCriteria; AND_S.IsChecked = rankCriteria.ands[0]; AND_S_Copy.IsChecked = rankCriteria.ands[1]; AND_S_Copy1.IsChecked = rankCriteria.ands[2]; AND_S_Copy2.IsChecked = rankCriteria.ands[3]; AND_S_Copy3.IsChecked = rankCriteria.ands[4]; OR_S.IsChecked = rankCriteria.ors[0]; OR_S_Copy.IsChecked = rankCriteria.ors[1]; OR_S_Copy1.IsChecked = rankCriteria.ors[2]; OR_S_Copy2.IsChecked = rankCriteria.ors[3]; OR_S_Copy3.IsChecked = rankCriteria.ors[4]; Win_box_S.IsChecked = rankCriteria.winRatio_t[0]; Win_box_S_Copy.IsChecked = rankCriteria.winRatio_t[1]; Win_box_S_Copy1.IsChecked = rankCriteria.winRatio_t[2]; Win_box_S_Copy2.IsChecked = rankCriteria.winRatio_t[3]; Win_box_S_Copy3.IsChecked = rankCriteria.winRatio_t[4]; Dom_box_S.IsChecked = rankCriteria.domminance_t[0]; Dom_box_S_Copy.IsChecked = rankCriteria.domminance_t[1]; Dom_box_S_Copy1.IsChecked = rankCriteria.domminance_t[2]; Dom_box_S_Copy2.IsChecked = rankCriteria.domminance_t[3]; Dom_box_S_Copy3.IsChecked = rankCriteria.domminance_t[4]; Run_button.Click -= Run_button_Click; Run_button.Click += run_rank_click; Run_button.Content = "Rerun criteria"; } }
protected override void OnNavigatedTo(NavigationEventArgs e) { if (e.Parameter is ContainerClass) { var database = e.Parameter as ContainerClass; container = database; if (container != null && container.rankCriteria != null) { button_Copy2.IsEnabled = true; } model = database.getModel(); var cards = model.cardsToDisplay; if (database.simulated) { listClear(); foreach (var card in cards) { var cri = database.rankCriteria; var rank = cri.evaluateCard(card); card.rank = rank; } addCardsToCollection(cards); model.cardsToDisplay = cards; container.model = model; database.simulated = false; } else { var data = database.getCard() as CardStats; if (data == null) { } else { int i = 0; //var data = database.getCard() as CardStats; string s = data.card.GetNameType(); var card = cards[i]; while (i < cards.Count) { card = cards[i]; if (card.card.GetNameType().Equals(s)) { cards.Remove(card); cards.Add(data); listClear(); addCardsToCollection(cards); model.cardsToDisplay = cards; break; } i++; } } } } else { } }
protected override void OnNavigatedTo(NavigationEventArgs e) { var database = e.Parameter as ContainerClass; container = database; }