Exemplo n.º 1
0
        private void ListView1_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.F2)
            {
                if (listView1.SelectedItems.Count == 0)
                {
                    return;
                }
                var          bm = listView1.SelectedItems[0].Tag as UrlBookmark;
                RenameDialog rd = new RenameDialog();
                rd.Value = bm.Info;
                if (rd.ShowDialog() == DialogResult.OK)
                {
                    bm.Info = rd.Value;
                    listView1.SelectedItems[0].SubItems[1].Text = bm.Info;
                    Stuff.IsDirty = true;
                }
            }
            if (e.KeyCode == Keys.Delete)
            {
                DeleteSelected();
            }
            if (e.Modifiers == Keys.Control && e.KeyCode == Keys.V)
            {
                var txt = Clipboard.GetText();
                if (Stuff.UrlBookmarks.Any(z => z.OriginalUrl == txt))
                {
                    Stuff.Warning("same url already exist.");
                    return;
                }
                if (hash.Add(txt))
                {
                    var dec = HttpUtility.UrlDecode(txt);

                    var b = new UrlBookmark()
                    {
                        Uri = new Uri(txt), OriginalUrl = dec
                    };
                    if (dec.ToLower().Contains(watermark1.Text))
                    {
                        listView1.Items.Add(new ListViewItem(new string[] { dec, "" })
                        {
                            Tag = b
                        });
                    }
                    Stuff.AddUrlBookmark(b);
                }
            }
        }
Exemplo n.º 2
0
        private void RenameToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (contextMenuStrip1.Tag == null)
            {
                return;
            }
            var          mtb = (contextMenuStrip1.Tag as MyToolStripButton);
            var          s   = mtb.Tag as ShortcutInfo;
            RenameDialog rnd = new RenameDialog();

            rnd.Value = s.Name;
            if (rnd.ShowDialog() == DialogResult.OK)
            {
                s.Name        = rnd.Value;
                mtb.Text      = rnd.Value;
                Stuff.IsDirty = true;
            }
        }
Exemplo n.º 3
0
        private void InsertClipboardAsFileToolStripMenuItem_Click(object sender, EventArgs e)
        {
            RenameDialog rdl = new RenameDialog();

            rdl.StartPosition = FormStartPosition.CenterParent;

            if (rdl.ShowDialog() == DialogResult.OK)
            {
                FileListControl flc = fileListControl1;
                if (fileListControl2.ContainsFocus)
                {
                    flc = fileListControl2;
                }

                var img = Clipboard.GetImage();
                img.Save(Path.Combine(flc.CurrentDirectory.FullName, rdl.Value));
            }
        }
Exemplo n.º 4
0
        public void Rename()
        {
            if (SelectedTagCover != null)
            {
                RenameDialog rd = new RenameDialog();
                rd.Validation = (x) =>
                {
                    if (Stuff.IsTagCoverExist(x, SelectedTagCover.Name))
                    {
                        return(new Tuple <bool, string>(false, "Same tag name already exist!"));
                    }
                    return(new Tuple <bool, string>(true, null));
                };
                rd.Value = SelectedTagCover.Name;
                if (rd.ShowDialog() == DialogResult.OK)
                {
                    Stuff.RenameTag(SelectedTagCover, rd.Value);
                    UpdateList(null);
                }
                return;
            }
            {
                if (SelectedTag == null)
                {
                    return;
                }

                RenameDialog rd = new RenameDialog();
                rd.Validation = (x) =>
                {
                    if (Stuff.IsTagExist(x, SelectedTag))
                    {
                        return(new Tuple <bool, string>(false, "Same tag name already exist!"));
                    }
                    return(new Tuple <bool, string>(true, null));
                };
                rd.Value = SelectedTag.Name;
                if (rd.ShowDialog() == DialogResult.OK)
                {
                    Stuff.RenameTag(SelectedTag, rd.Value);
                    UpdateList(null);
                }
            }
        }