/// <summary> /// Handles the EditFavorite event of the ctrlFavorites1 control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param> 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(); } } }
/// <summary> /// Adds the favorite. /// </summary> private void AddFavorite() { if (ctrMdiMain.Pages.Count == 0) return; XtraFormPL form = (XtraFormPL)ctrMdiMain.SelectedPage.MdiChild; //frmAddFavorites f = new frmAddFavorites(form.Text, form.Tag.ToString(), imageList1.Images[2]); string Favorite = TagPropertyMan.Get(form.Tag, "FAVORITE").ToString(); frmAddFavorites f = new frmAddFavorites(form.Text, Favorite, 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( "Tên chỉ định đã tồn tại trong danh sách Favorites. Bạn có muốn thay thế nó?", Text, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) item.Tag = f.LocationURL; add = false; break; } } if (add) AddFavoriteItem(f.LocationName, f.LocationURL); } }
private void AddFavorite() { frmAddFavorites f = new frmAddFavorites(_Browser.DocumentTitle, _Browser.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); } }