示例#1
0
 private void nameBox_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.KeyCode == Keys.Enter || e.KeyCode == Keys.Return)
     {
         bool dupe = false;
         foreach (FavouriteAddress add in Favourites)
         {
             if (add.getName().Equals(nameBox.Text))
             {
                 nameBox.Text = "That name is already taken, please try again.";
                 nameBox.SelectAll();
                 dupe = true;
                 break;
             }
         }
         if (!dupe)
         {
             Favourites.Add(new FavouriteAddress(currentTab.getUri(), nameBox.Text));
             nameBox.Text = "";
             addFaveMenu.Hide();
         }
     }
 }
示例#2
0
 //handles tab switching
 private void tabsContainer_Selected(object sender, TabControlEventArgs e)
 {
     currentTab  = tabs.ElementAt(tabsContainer.SelectedIndex);      //set current tab to correct object
     urlBox.Text = currentTab.getUri();                              //update url box
 }