private void DoneButton_Click(object sender, RoutedEventArgs routedEventArgs)
 {
     MainViewModel.AddList(new ArmyList(NameTextBox.Text, (Army)ArmyComboBox.SelectedItem, int.Parse(PointsTextBox.Text)));
     ListCreated?.Invoke(this, new EventArgs());
     ArmyComboBox.SelectedIndex = -1;
     PointsTextBox.Text         = string.Empty;
     NameTextBox.Text           = string.Empty;
 }
Esempio n. 2
0
        public async void OnGetResultButtonClicked(object sender, MouseEventArgs e, bool isAsync)
        {
            var iterationsTimeList = new List <long>();

            for (var i = 0; i < _amountOfIterations; ++i)
            {
                var timer = Stopwatch.StartNew();
                if (isAsync)
                {
                    await _data.WriteDataFromUrlAsync();
                }
                else
                {
                    var thread = new Thread(_data.WriteDataFromUrlSync);
                    thread.Start();
                    thread.Join();
                }

                timer.Stop();
                iterationsTimeList.Add(timer.ElapsedMilliseconds);
            }

            ListCreated?.Invoke(iterationsTimeList, isAsync);
        }