Exemplo n.º 1
0
 public Form1()
 {
     InitializeComponent();
     alleHytter = new Hytte[] { hGjendesheim, hGlitterheim, hMemurubu, hGjendebu, hSpiterstulen, hLeirvassbu, hOlavsbu };
     foreach (Hytte h in alleHytter)
     {
         comboBoxHytte1.Items.Add(h.Navn);
     }
 }
Exemplo n.º 2
0
 private int FinnDistanse(Hytte h1, Hytte h2)
 {
     foreach (Sti s in h1.TilgjengeligeStier)
     {
         if (s.HytteTil == h2.Navn)
         {
             return(s.Lengde);
         }
     }
     return(-1);
 }
Exemplo n.º 3
0
 private Boolean HytteInneholderSti(Hytte h, string hytteTil)
 {
     foreach (Sti s in h.TilgjengeligeStier)
     {
         if (s.HytteTil == hytteTil)
         {
             return(true);
         }
     }
     Console.WriteLine("Hytte inneholder ikke sti til " + hytteTil);
     return(false);
 }
Exemplo n.º 4
0
        private void comboBoxHytte2_SelectedIndexChanged(object sender, EventArgs e)
        {
            ComboBox comboBox = (ComboBox)sender;

            hytte2 = FinnHytteMedString(comboBox.SelectedItem.ToString(), alleHytter);
            comboBoxHytte3.Items.Clear();
            if (hytte3 != null && !HytteInneholderSti(hytte2, hytte3.Navn))
            {
                ResetComboBox(comboBoxHytte3);
                hytte3 = null;
            }
            foreach (Sti s in hytte2.TilgjengeligeStier)
            {
                comboBoxHytte3.Items.Add(s.HytteTil);
            }
        }
Exemplo n.º 5
0
        private void comboBoxHytte1_SelectedIndexChanged(object sender, EventArgs e)
        {
            ComboBox comboBox = (ComboBox)sender;

            hytte1 = FinnHytteMedString(comboBox.SelectedItem.ToString(), alleHytter);
            // Må resette alle items
            comboBoxHytte2.Items.Clear();
            // Må resette text og selected item
            if (hytte2 != null && !HytteInneholderSti(hytte1, hytte2.Navn))
            {
                ResetComboBox(comboBoxHytte2);
                ResetComboBox(comboBoxHytte3);
                hytte2 = null;
                hytte3 = null;
            }

            foreach (Sti s in hytte1.TilgjengeligeStier)
            {
                comboBoxHytte2.Items.Add(s.HytteTil);
            }
        }
Exemplo n.º 6
0
        private void comboBoxHytte3_SelectedIndexChanged(object sender, EventArgs e)
        {
            ComboBox comboBox = (ComboBox)sender;

            hytte3 = FinnHytteMedString(comboBox.SelectedItem.ToString(), alleHytter);
        }