Esempio n. 1
0
        public MainWindow()
        {


            InitializeComponent();
            sl = (StationList)StationList.LoadXML("saved.xml");
            sl.Sortuj();                    
            lista = new ObservableCollection<WeatherStation>(sl.list);
            foreach(WeatherStation x in lista)
            {
                if (x.Hygro != null) x.loc = x.Hygro.location;
                if (x.Anemo != null) x.loc = x.Anemo.location;
                if (x.Bar != null) x.loc = x.Bar.location;
                if (x.Thermo != null) x.loc = x.Thermo.location;

                if (x.Hygro != null) x.Hygro.location=x.loc;
                if (x.Anemo != null) x.Anemo.location=x.loc;
                if (x.Bar != null)   x.Bar.location= x.loc;
                if (x.Thermo != null) x.Thermo.location = x.loc;
            }
            
            current = new WeatherStation("Empty", new Location(0, 0, 0, "Empty"));
            listBox.ItemsSource = lista;

            TemperatureBox.Text = "---";
            HumidityBox.Text = "---";
            WindStrengthBox.Text = "---";
            WindDirectionBox.Text = "---";
            PressureBox.Text = "---";
            NameBox.Text = "---";
            LongitudeBox.Text = "---";
            LatitudeBox.Text = "---";
            AltitudeBox.Text = "---";





            // if (lista == null) MessageBox.Show("IS NULL");


            //textBox_nazwa.Text = zespol.Nazwa;
            //textBox_kierownik.Text = zespol.Kierownik.ToString();
        }
Esempio n. 2
0
        public void Sorting()
        {
            StationList    stationList     = new StationList("s");
            WeatherStation weatherStation1 = new WeatherStation("s1", new Location(50, 50, 100));
            WeatherStation weatherStation2 = new WeatherStation("s1", new Location(50, 50, 70));
            WeatherStation weatherStation3 = new WeatherStation("s1", new Location(25, 25, 70));
            WeatherStation weatherStation4 = new WeatherStation("s1", new Location(25, 50, 70));

            stationList.Add(weatherStation1);
            stationList.Add(weatherStation2);
            stationList.Add(weatherStation3);
            stationList.Add(weatherStation4);

            stationList.Sortuj();

            List <WeatherStation> stationsAfterSorting = stationList.list;

            Console.WriteLine(stationsAfterSorting);
            CollectionAssert.AreEqual(new List <WeatherStation> {
                weatherStation3, weatherStation4, weatherStation2, weatherStation1
            }, stationsAfterSorting);
        }