示例#1
0
        private void EditFavorite()
        {
            if (trvFavorite.SelectedNode == null)
            {
                return;
            }
            var favorite = trvFavorite.SelectedNode.Tag as Favorite;

            if (favorite == null)
            {
                return;
            }

            if (favorite.IsFolder)
            {
                trvFavorite.SelectedNode.BeginEdit();
            }
            else
            {
                frmManageFavorite frm = new frmManageFavorite();
                frm.Init(favorite);
                if (frm.ShowDialog() == DialogResult.OK)
                {
                    trvFavorite.SelectedNode.Text = favorite.Name;
                    SaveFavorite();
                }
            }
        }
示例#2
0
        private void btnAddFavorite_Click(object sender, EventArgs e)
        {
            Favorite favorite = new Favorite();

            favorite.Name = "New";
            favorite.Url  = cmboURI.Text;
            favorite.Body = txtJsonBody.Text;

            frmManageFavorite frm = new frmManageFavorite();

            frm.Init(favorite);
            if (frm.ShowDialog() == DialogResult.OK)
            {
                AddNewFavorite(favorite);
                SaveFavorite();
            }
        }