Пример #1
0
        /// <summary>
        /// 执行删除组
        /// </summary>
        private void btnDoDeleteGroupName_Click(object sender, EventArgs e)
        {
            string oldGroupName = this.lbGroupNames.SelectedItem.ToString();

            if (string.IsNullOrEmpty(oldGroupName))
            {
                MessageUtil.ShowWarning("删除失败,请选择要删除的分组名称");
                return;
            }

            IList <BoxGroup> groups = BoxFileData.getBoxGroups();

            if (null == groups.FirstOrDefault(o => o.Name == oldGroupName))
            {
                MessageUtil.ShowWarning("删除失败,旧的分组名称不存在");
                return;
            }

            if (!MessageUtil.ConfirmYesNo("是否删除该选择的分组?"))
            {
                return;
            }

            BoxFileData.deleteBoxGroup(oldGroupName);

            MessageUtil.ShowTips("删除成功");

            //刷新列表
            this.refreshShortcutGroup();

            this.showOperateGroupPanel();
        }
Пример #2
0
        /// <summary>
        /// 执行修改组名称
        /// </summary>
        private void btnDoModifyGroup_Click(object sender, EventArgs e)
        {
            string oldGroupName = this.lbGroupNames.SelectedItem.ToString();
            string newGroupName = this.txtGroupName.Text.Trim();

            if (string.IsNullOrEmpty(newGroupName))
            {
                MessageUtil.ShowWarning("保存失败,新的分组名称为空");
                return;
            }

            IList <BoxGroup> groups = BoxFileData.getBoxGroups();

            if (null == groups.FirstOrDefault(o => o.Name == oldGroupName))
            {
                MessageUtil.ShowWarning("保存失败,旧的分组名称不存在");
                return;
            }

            if (newGroupName == oldGroupName)
            {
                MessageUtil.ShowWarning("保存失败,新的分组名称跟旧的分组名称一致");
                return;
            }

            BoxFileData.updateBoxGroup(oldGroupName, newGroupName);

            MessageUtil.ShowTips("保存成功");

            //刷新列表
            this.refreshShortcutGroup();

            this.showOperateGroupPanel();
        }
Пример #3
0
        /// <summary>
        /// 执行添加组
        /// </summary>
        private void btnDoAddGroup_Click(object sender, EventArgs e)
        {
            string groupName = this.txtGroupName.Text.Trim();

            if (string.IsNullOrEmpty(groupName))
            {
                MessageUtil.ShowWarning("添加失败,新分组名称为空");
                return;
            }

            IList <BoxGroup> groups = BoxFileData.getBoxGroups();

            if (null != groups.FirstOrDefault(o => o.Name == groupName))
            {
                MessageUtil.ShowWarning("添加失败,分组名称已存在");
                return;
            }

            BoxFileData.addBoxGroup(groupName);

            MessageUtil.ShowTips("添加成功");

            this.refreshShortcutGroup();

            this.showOperateGroupPanel();
        }
Пример #4
0
        /// <summary>
        /// 创建组与文件
        /// </summary>
        private void initShortcutStyle()
        {
            ListView          listView;
            TabPage           tabPage;
            ToolStripMenuItem toolStripSubMenu;

            this.tabFileGroup.TabPages.Clear();

            this.lbGroupNames.Items.Clear();

            IList <BoxGroup> groups = BoxFileData.getBoxGroups();

            foreach (BoxGroup group in groups)
            {
                //将图标填充到ListView
                listView                      = new ListView();
                listView.BorderStyle          = BorderStyle.Fixed3D;
                listView.MultiSelect          = true;
                listView.View                 = View.List;
                listView.LabelEdit            = false;
                listView.Scrollable           = true;
                listView.Dock                 = DockStyle.Fill;
                listView.AllowDrop            = true;
                listView.BackgroundImage      = global::QuickBox.Properties.Resources.bg2;
                listView.BackgroundImageTiled = true;

                //ListView事件
                listView.MouseClick       += new MouseEventHandler(listViewFiles_MouseClick);
                listView.MouseDoubleClick += new MouseEventHandler(listViewFiles_MouseDoubleClick);
                listView.DragDrop         += new DragEventHandler(listViewFiles_DragDrop);
                listView.DragEnter        += new DragEventHandler(listViewFiles_DragEnter);

                //创建新的TabPage
                tabPage      = new TabPage();
                tabPage.Text = group.Name;
                tabPage.Tag  = tabPage;
                tabPage.Controls.Add(listView);

                //添加到选项卡
                this.tabFileGroup.TabPages.Add(tabPage);

                //动态创建菜单
                toolStripSubMenu      = new ToolStripMenuItem();
                toolStripSubMenu.Text = group.Name;

                //刷新该分组下的图标
                this.refreshShortcut(group.Name, listView);
            }

            //初始化分组列表
            this.refreshShortcutGroup();
        }
Пример #5
0
        private void InitTrayMenu()
        {
            this.notifyContextMenuStrip.Items.Clear();

            //将快捷的文件添加到托盘右键菜单中
            this.FlushTrayChildMenuInLove();

            //添加分隔符
            toolStripSeparator = new ToolStripSeparator();
            this.notifyContextMenuStrip.Items.Add(toolStripSeparator);

            IList <BoxGroup> groups = BoxFileData.getBoxGroups();

            if (groups != null && groups.Count > 0)
            {
                foreach (BoxGroup group in groups)
                {
                    //创建菜单
                    toolStripSubMenu       = new ToolStripMenuItem();
                    toolStripSubMenu.Text  = group.Name;
                    toolStripSubMenu.Image = QuickBox.Properties.Resources.Group;

                    //添加到托盘菜单
                    this.notifyContextMenuStrip.Items.Add(toolStripSubMenu);

                    //刷新该分组下的图标
                    this.FlushTrayChildMenuInGroup(toolStripSubMenu, group.Name);
                }
                groups = null;
            }

            //添加分隔符
            toolStripSeparator = new ToolStripSeparator();
            this.notifyContextMenuStrip.Items.Add(toolStripSeparator);

            //添加“退出”
            toolStripSubMenu        = new ToolStripMenuItem();
            toolStripSubMenu.Text   = "退出(&E)";
            toolStripSubMenu.Name   = MenuName_Exit;
            toolStripSubMenu.Image  = QuickBox.Properties.Resources.Exit;
            toolStripSubMenu.Click += new EventHandler(toolStripSubMenu_Click);
            this.notifyContextMenuStrip.Items.Add(toolStripSubMenu);

            toolStripSubMenu = null;
        }
Пример #6
0
        /// <summary>
        /// 刷新组
        /// </summary>
        private void refreshShortcutGroup()
        {
            this.lbGroupNames.Items.Clear();

            IList <BoxGroup> groups = BoxFileData.getBoxGroups();

            foreach (BoxGroup group in groups)
            {
                //添加到分组列表
                this.lbGroupNames.Items.Add(group.Name);
            }

            if (groups.Count > 0)
            {
                //分组列表默认选择第一项
                this.lbGroupNames.SelectedIndex = 0;
            }
        }