Ejemplo n.º 1
0
        /// <summary>
        /// Handling pressing countButton
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void CountButton_Click(object sender, EventArgs e)
        {
            // Clearing list box
            resultsListBox.Items.Clear();

            if (!Validation.IfInputIsCorrect(this.repeatsTextBox.Text, out inputRepeats))
            {
                string message = "Musisz podać liczbę całkowitą większą od 0.";
                resultsListBox.Items.Add(message);
                message = "Ilość operacji. " + message;
                this.log.SaveLogFile(this.tbErrorLog.Text, (Log.ErrorLogType)EnumUtils.EnumValueOf(errorlogcomboBox.SelectedItem.ToString(), typeof(Log.ErrorLogType)), message);

                return;
            }

            // Getting numbers from XML file
            List <float[]> numbers = XmlReader.ReadXml(xmlFilePath);

            // Creating list of instaces of class Clunt
            List <Count> counts = new List <Count>();

            for (int i = 0; i < numbers.Count(); i++)
            {
                counts.Add(new Count(numbers[i].ElementAt(0), numbers[i].ElementAt(1)));
            }

            // Filling list box
            foreach (Count c in counts)
            {
                foreach (String str in c.CalucaltionsAndReturningThemAsString(c.GetA(), c.GetB(), (Count.Operations)EnumUtils.EnumValueOf(operationsComboBox.Text, typeof(Count.Operations)), inputRepeats))
                {
                    resultsListBox.Items.Add(str);
                }
            }
            resultsListBox.Items.Add("========================================");
            if (MessageBox.Show("Do you want to opent log file?", "Question", MessageBoxButtons.YesNo) == DialogResult.Yes)
            {
                Process.Start(this.tbErrorLog.Text);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Handling pressing countButton
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void CountButton_Click(object sender, EventArgs e)
        {
            // Clearing list box
            resultsListBox.Items.Clear();

            if (!Validation.IfInputIsCorrect(this.repeatsTextBox.Text, out inputRepeats))
            {
                resultsListBox.Items.Add("Musisz podać liczbę całkowitą większą od 0.");
                return;
            }

            // Getting numbers from XML file
            List <float[]> numbers = XmlReader.ReadXml(xmlFilePath);

            // Creating list of instaces of class Clunt
            List <Count> counts = new List <Count>();

            for (int i = 0; i < numbers.Count(); i++)
            {
                counts.Add(new Count(numbers[i].ElementAt(0), numbers[i].ElementAt(1)));
            }

            // Filling list box
            foreach (Count c in counts)
            {
                foreach (String str in c.CalucaltionsAndReturningThemAsString(c.GetA(), c.GetB(), (Count.Operations)EnumUtils.EnumValueOf(operationsComboBox.Text, typeof(Count.Operations)), inputRepeats))
                {
                    resultsListBox.Items.Add(str);
                }
            }
            resultsListBox.Items.Add("========================================");
        }