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(); }