예제 #1
0
        /// <summary>
        /// 返回到管理界面
        /// </summary>
        private void btnReturn_Click(object sender, EventArgs e)
        {
            //前置列表
            this.tabFileGroup.BringToFront();
            //后置配置分组
            this.gbConfigGroupName.SendToBack();

            this.tabFileGroup.Visible = false;
            //刷新图标列表
            this.initShortcutStyle();
            this.tabFileGroup.Visible = true;

            //刷新托盘菜单
            FrmTray.DoInitMenu();
        }
예제 #2
0
        /// <summary>
        /// 快捷ListView的右键菜单事件
        /// </summary>
        private void loveToolStripItem_Click(object sender, EventArgs e)
        {
            ToolStripMenuItem menuItem = sender as ToolStripMenuItem;

            BoxFile selectBoxFileItem;

            if (menuItem.Name == MenuName_RemoveFileItemInLove)      //移除选定项
            {
                if (listViewLove.SelectedItems.Count > 0)
                {
                    for (int i = 0; i < listViewLove.SelectedItems.Count; i++)
                    {
                        selectBoxFileItem = listViewLove.SelectedItems[i].Tag as BoxFile;
                        BoxFileData.deleteLikeShortcut(selectBoxFileItem);
                    }

                    //刷新该分组下的图标
                    this.refreshLikeShortcut();

                    //刷新托盘菜单
                    FrmTray.DoInitMenu();
                }
            }
        }
예제 #3
0
        /// <summary>
        /// ListView的右键菜单事件
        /// </summary>
        private void toolStripItem_Click(object sender, EventArgs e)
        {
            ToolStripMenuItem menuItem = sender as ToolStripMenuItem;

            if (menuItem.Name == MenuName_MoveToNewGroup)
            {
                return;
            }

            TabPage  selectTabPage  = this.tabFileGroup.SelectedTab;
            ListView selectListView = selectTabPage.Controls[0] as ListView;
            BoxFile  selectBoxFileItem;

            string groupName = selectTabPage.Text;

            if (menuItem.Name == MenuName_LoveFileItem)             //标记此项
            {
                if (selectListView.SelectedItems.Count > 0)
                {
                    for (int i = 0; i < selectListView.SelectedItems.Count; i++)
                    {
                        selectBoxFileItem = selectListView.SelectedItems[i].Tag as BoxFile;

                        BoxFileData.addLikeShortcut(selectBoxFileItem);
                    }

                    // 刷新快捷位置的图标
                    this.refreshLikeShortcut();

                    //刷新托盘菜单
                    FrmTray.DoInitMenu();
                }
            }
            else if (menuItem.Name == MenuName_RemoveFileItem)      //移除选定项
            {
                if (selectListView.SelectedItems.Count > 0)
                {
                    for (int i = 0; i < selectListView.SelectedItems.Count; i++)
                    {
                        selectBoxFileItem = selectListView.SelectedItems[i].Tag as BoxFile;

                        //删除文件
                        BoxFileData.deleteShortcut(selectBoxFileItem, groupName);
                    }

                    //刷新该分组下的图标
                    this.refreshShortcut(groupName, selectListView);

                    //更新托盘窗体对应分组下面的图标
                    FrmTray.DoUpdateMenuByGroupName(groupName);
                }
            }
            else if (menuItem.Name == MenuName_ModifyFileItemName)  //重命名
            {
                if (selectListView.SelectedItems.Count > 0)
                {
                    selectBoxFileItem = selectListView.SelectedItems[0].Tag as BoxFile;

                    string value = selectBoxFileItem.Name;
                    if (MessageUtil.ShowPrompt("重命名", "请输入文件名称:", ref value) == DialogResult.OK)
                    {
                        //修改文件名称
                        BoxFileData.updateShortcut(selectBoxFileItem.Key, value, groupName);

                        //刷新该分组下的图标
                        this.refreshShortcut(groupName, selectListView);

                        //更新托盘窗体对应分组下面的图标
                        FrmTray.DoUpdateMenuByGroupName(groupName);
                    }
                }
            }
            else if (menuItem.Name == MenuName_ModifyFileItemIcon)  //修改文件图标
            {
                if (selectListView.SelectedItems.Count > 0)
                {
                    for (int i = 0; i < selectListView.SelectedItems.Count; i++)
                    {
                        selectBoxFileItem = selectListView.SelectedItems[i].Tag as BoxFile;
                        Bitmap fileLargeIcon = Utils.GetFileIcon(selectBoxFileItem.Path, false).ToBitmap();
                        Bitmap fileSmallIcon = Utils.GetFileIcon(selectBoxFileItem.Path, true).ToBitmap();

                        BoxFileData.updateShortcut(selectBoxFileItem.Key, fileLargeIcon, fileSmallIcon, selectTabPage.Text);
                    }

                    //刷新该分组下的图标
                    this.refreshShortcut(groupName, selectListView);

                    //更新托盘窗体对应分组下面的图标
                    FrmTray.DoUpdateMenuByGroupName(groupName);
                }
            }
            else if (menuItem.Name == MenuName_OpenWorkingDirectory)  //打开文件位置
            {
                if (selectListView.SelectedItems.Count > 0)
                {
                    selectBoxFileItem = selectListView.SelectedItems[0].Tag as BoxFile;

                    //打开文件位置
                    Utils.OpenFolder(selectBoxFileItem.Path);
                }
            }
            else if (menuItem.Name == MenuName_SetGroup)            //设置分组
            {
                //设置分组

                //前置配置分组
                this.tabFileGroup.SendToBack();
                //后置列表
                this.gbConfigGroupName.BringToFront();
            }
            else if (menuItem.Name.StartsWith("MoveToGroup_"))       //移动分组
            {
                if (selectListView.SelectedItems.Count > 0)
                {
                    string newGroupName = menuItem.Name.Split('_')[1];

                    for (int i = 0; i < selectListView.SelectedItems.Count; i++)
                    {
                        selectBoxFileItem = selectListView.SelectedItems[i].Tag as BoxFile;

                        BoxFileData.moveShortcut(selectBoxFileItem, groupName, newGroupName);
                    }

                    //刷新该分组下的图标
                    this.refreshShortcut(groupName, selectListView);

                    //更新托盘窗体对应分组下面的图标
                    FrmTray.DoUpdateMenuByGroupName(groupName);

                    //刷新新分组下的图标
                    this.refreshShortcut(newGroupName);

                    //更新托盘窗体对应新分组下面的图标
                    FrmTray.DoUpdateMenuByGroupName(newGroupName);
                }
            }
        }