using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

using Para;
using ParaInt = Para.Para<int>;
using ParaDouble = Para.Para<double>;
using ParaString = Para.Para<string>;

using Para2Int = Para.Para<int, int>;
using Para2Double = Para.Para<double, double>;
using Para2String = Para.Para<string, string>;
using Para2IntDouble = Para.Para<int, double>;


namespace Pary
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            Random r = new Random();

            //int
            Para<int>[] pi = new Para<int>[10];
            for (int i = 0; i < pi.Length; i++)
                pi[i] = new Para<int>(r.Next(10), r.Next(10));
            string si = "";
            foreach (Para<int> para in pi) si += para.ToString() + "\n";
            MessageBox.Show("Para<int>\n" + si);

            Array.Sort(pi);
            si = "";
            foreach (Para<int> para in pi) si += para.ToString() + "\n";
            MessageBox.Show("Para<int> po sortowaniu\n" + si);


            //double
            Para<double>[] pd = new Para<double>[10];
            for (int i = 0; i < pi.Length; i++)
                pd[i] = new Para<double>(r.NextDouble(), r.NextDouble());
            string sd = "";
            foreach (Para<double> para in pd) sd += para.ToString() + "\n";
            MessageBox.Show("Para<double>\n" + sd);

            Array.Sort(pd);
            sd = "";
            foreach (Para<double> para in pd) sd += para.ToString() + "\n";
            MessageBox.Show("Para<double> po sortowaniu\n" + sd);


            //string
            Para<string>[] ps = new Para<string>[12];
            ps[0] = new Para<string>("Bester", "Alfred");
            ps[1] = new Para<string>("Dick", "Philip");
            ps[2] = new Para<string>("Tolkien", "John");
            ps[3] = new Para<string>("Lem", "Stanisław");
            ps[4] = new Para<string>("Anderson", "Poul");
            ps[5] = new Para<string>("Pohl", "Frederik");
            ps[6] = new Para<string>("Le Guin", "Ursula");
            ps[7] = new Para<string>("Card", "Orson");
            ps[8] = new Para<string>("Gibson", "William");
            ps[9] = new Para<string>("Asimov", "Isaac");
            ps[10] = new Para<string>("Niven", "Larry");
            ps[11] = new Para<string>("Herbert", "Frank");
            string ss = "";
            foreach (Para<string> para in ps) ss += para.ToString() + "\n";
            MessageBox.Show("Para<string>\n" + ss);

            Array.Sort(ps);
            ss = "";
            foreach (Para<string> para in ps) ss += para.ToString() + "\n";
            MessageBox.Show("Para<string> po sortowaniu\n" + ss);
        }

        private void button2_Click(object sender, EventArgs e)
        {
            Random r = new Random();

            //int-double
            Para2IntDouble[] p = new Para2IntDouble[10];
            for (int i = 0; i < p.Length; i++)
                p[i] = new Para2IntDouble(r.Next(10), r.NextDouble());
            string s = "";
            foreach (Para2IntDouble para in p) s += para.ToString() + "\n";
            MessageBox.Show("Para<int,double>\n" + s);
            Array.Sort(p);
            s = "";
            foreach (Para2IntDouble para in p) s += para.ToString() + "\n";
            MessageBox.Show("Para<int,double> po sortowaniu\n" + s);
        }
    }
}
