Ejemplo n.º 1
0
 private void AddFavorite()
 {
     frmAddFavorites f = new frmAddFavorites(webBrowser1.DocumentTitle, webBrowser1.Url.AbsoluteUri, imageList1.Images[2]);
     if(f.ShowDialog() == DialogResult.OK) {
         bool add = true;
         for(int i = 0; i < barManager1.Items.Count; i++) {
             BarItem item = barManager1.Items[i];
             if(item.Category == barManager1.Categories["Favorites"] && item.Caption == f.LocationName)
             {
                 if(DevExpress.XtraEditors.XtraMessageBox.Show("The name specified for the shortcut already exists in your Favorites list. Would you like to overwrite it?", Text, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                     item.Tag = f.LocationURL;
                 add = false;
                 break;
             }
         }
         if(add)
             AddFavoriteItem(f.LocationName, f.LocationURL);
     }
 }
Ejemplo n.º 2
0
 private void ctrlFavorites1_EditFavorite(object sender, System.EventArgs e)
 {
     string s = sender.ToString();
     BarItem item = ItemByName(s);
     if(item != null) {
         frmAddFavorites f = new frmAddFavorites(item.Caption, item.Tag.ToString(), imageList1.Images[1], false);
         if(f.ShowDialog() == DialogResult.OK)
         {
             item.Caption = f.LocationName;
             item.Tag = f.LocationURL;
             ChangeFavorites();
         }
     }
 }