示例#1
0
        /// <summary>
        /// 准备数据
        /// </summary>
        private void InitData()
        {
            ExecuteCommon execute = new ExecuteCommon();

            if (!(bool)execute.doMethod(Key_XmlCore.InitSystemXml.ToString(), null))
            {
                MessageBox.Show("初始化数据失败!");
                return;
            }
            SetToolTip();
            FormEffect.animate(this.Handle, 1000, MemoryAddress.AW_BLEND);
        }
示例#2
0
        /// <summary>
        /// 打开文件
        /// </summary>
        /// <param name="sender"></param>
        private void OpenFile(object sender)
        {
            ListViewEx list = sender as ListViewEx;

            list = SelectListView(list);
            ExecuteCommon execute = new ExecuteCommon();

            if (!(bool)execute.doMethod(Key_LogicCore.OpenApp.ToString(), new object[] { list }))
            {
                MessageBox.Show("打开应用程序失败!");
            }
        }
示例#3
0
        /// <summary>
        /// 删除应用
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void removeMenu_Click(object sender, EventArgs e)
        {
            ListViewEx list = sender as ListViewEx;

            list = SelectListView(list);

            ExecuteCommon execute = new ExecuteCommon();

            if (!(bool)execute.doMethod(Key_LogicCore.RomoveApp.ToString(), new object[] { list }))
            {
                MessageBox.Show("删除应用失败!");
            }
        }
示例#4
0
        /// <summary>
        /// 修改名字结束
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void lvOneSelf_AfterLabelEdit(object sender, LabelEditEventArgs e)
        {
            ExecuteCommon execute = new ExecuteCommon();
            string        name    = lvOneSelf.SelectedItems[0].Text;

            if ((bool)execute.doMethod(Key_LogicCore.EditName.ToString(), lvOneSelf, e.Label))
            {
                lvOneSelf.LabelEdit = false;
            }
            else
            {
                lvOneSelf.SelectedItems[0].Text = name;
            }
        }
示例#5
0
        /// <summary>
        /// 添加应用事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void picBoxAdd_Click(object sender, EventArgs e)
        {
            OpenFileDialog fileDialog = new OpenFileDialog();

            fileDialog.Filter           = "所有文件(*.*)|*.*";
            fileDialog.DereferenceLinks = true;
            if (fileDialog.ShowDialog() == DialogResult.OK)
            {
                Icon   icon;
                string fullPath  = fileDialog.FileName;
                string extension = Path.GetExtension(fullPath);
                string appName   = Path.GetFileName(fullPath);

                ExecuteCommon execute = new ExecuteCommon();
                /* 读取xml */
                if (!(bool)execute.doMethod(Key_XmlCore.GetSameApp.ToString(), new object[] { appName }))
                {
                    MessageBox.Show("已存在" + appName + "的应用程序!");
                    return;
                }

                /* 获取图标 */
                if (!(bool)execute.doMethod(Key_XmlCore.GetIcon.ToString(), new object[] { fullPath }))
                {
                    MessageBox.Show("添加应用程序失败!");
                    return;
                }
                else
                {
                    icon = XmlCore.listIcon[0];
                }

                /* 绑定listview 写入XML */
                if (!(bool)execute.doMethod(Key_LogicCore.LoadOneLvOneSelf.ToString(), new object[] { mImgListOneSelf, appName, mAddCount.ToString(), icon, lvOneSelf }) || !(bool)execute.doMethod(Key_XmlCore.SaveOneSelfXml.ToString(), new object[] { new Dictionary <string, string>()
                                                                                                                                                                                                                                                          {
                                                                                                                                                                                                                                                              { "fullpath", fullPath }, { "InnerText", appName }
                                                                                                                                                                                                                                                          } }))
                {
                    MessageBox.Show("添加应用程序失败!");
                    return;
                }

                mListOneSelfPath.Add(fullPath);
                lvOneSelf.Tag   = mListOneSelfPath;
                mListOneSelfApp = lvOneSelf.Items.ToList();
                mAddCount++;
            }
        }
示例#6
0
        /// <summary>
        /// 初始化系统功能
        /// </summary>
        /// <param name="dosKey"></param>
        /// <param name="icoNameKey"></param>
        /// <param name="dicSystem"></param>
        private bool initSystemAbility()
        {
            if (!File.Exists(Global.mXMLFilePath))
            {
                if (!mXMLHelper.CreateXmlDocument("app", "UTF-8"))
                {
                    return(false);
                }
                if (!mXMLHelper.InsertNode("app", "system", new string[] { "dos", "iconname" }, SystemApp.GetSystemDic()))
                {
                    return(false);
                }
                DialogResult res = MessageBox.Show("是否扫描除C盘外所有已安装应用?", "扫描程序", MessageBoxButtons.OKCancel);
                if (res == DialogResult.OK)
                {
                    List <SelectItem> dics = Global.GetApp();
                    foreach (SelectItem item in dics)
                    {
                        Icon   icon;
                        string fullPath = item.Value;
                        string appName  = item.Name;

                        ExecuteCommon execute = new ExecuteCommon();
                        /* 读取xml */
                        if (!GetSameApp(appName))
                        {
                            MessageBox.Show("已存在" + appName + "的应用程序!");
                            continue;
                        }

                        /* 绑定listview 写入XML */
                        if (!SaveOneSelfXml(new Dictionary <string, string>()
                        {
                            { "fullpath", fullPath }, { "InnerText", appName }
                        }))
                        {
                            MessageBox.Show("添加应用程序失败!");
                            continue;
                        }
                    }
                }
            }
            return(true);
        }
示例#7
0
 /// <summary>
 /// Tab选择事件
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void tabControl_Selected(object sender, TabControlEventArgs e)
 {
     if (e.TabPage == tabTwo)
     {
         ExecuteCommon execute = new ExecuteCommon();
         /* 绑定系统功能 */
         if (!(bool)execute.doMethod(Key_XmlCore.GetSystemXml.ToString(), new object[] { lvSystem.Items.Count }) || !(bool)execute.doMethod(Key_LogicCore.LoadLvSystem.ToString(), new object[] { mImgListSystem, XmlCore.listSystemPath, XmlCore.listIconName, lvSystem }))
         {
             MessageBox.Show("启动系统功能失败!");
             return;
         }
         Global.IsOneSelf = false;
     }
     else if (e.TabPage == tabOne)
     {
         Global.IsOneSelf = true;
     }
     else
     {
         Global.IsOneSelf = false;
     }
 }
示例#8
0
        /// <summary>
        /// 清理
        /// </summary>
        private void Clear()
        {
            double count = (double)numTxt.Value;
            Dictionary <string, string> dic = XMLHelper.GetApps();
            ExecuteCommon execute           = new ExecuteCommon();

            foreach (KeyValuePair <string, string> item in dic)
            {
                string[] strs = item.Value.Split(new char[] { '|' }, StringSplitOptions.RemoveEmptyEntries);
                int      num  = int.Parse(strs[0]);
                DateTime dt   = DateTime.Parse(strs[1]);
                TimeSpan ts   = DateTime.Now.Subtract(dt);
                int      day  = ts.Days + 1;
                double   n    = (num * 1.0) / (day * 1.0);
                if (n < count)
                {
                    if (!(bool)execute.doMethod(Key_LogicCore.ClearApp.ToString(), new object[] { item.Key }))
                    {
                        MessageBox.Show("清理应用失败!");
                    }
                }
            }
            XMLHelper.SetRootValue("NearClear", DateTime.Now.ToShortDateString());
        }
示例#9
0
        private void easyOpen_Load(object sender, EventArgs e)
        {
            if (CheckWindows())
            {
                this.Close();
                Application.Exit();
                return;
            }
            _clear_Ch.Checked     = XMLHelper.GetRootValue("Clear") == "1" ? true : false;
            _close_Ch.Checked     = XMLHelper.GetRootValue("Close") == "1" ? true : false;
            _top_Ch.Checked       = XMLHelper.GetRootValue("IsTop") == "1" ? true : false;
            _startOpen_Ch.Checked = XMLHelper.GetRootValue("AutoRun") == "1" ? true : false;
            //是否置顶
            if (_top_Ch.Checked)
            {
                //置顶
                FileIsOpen.SetWindowPos(this.Handle, -1, 0, 0, 0, 0, 1 | 2);
            }
            else
            {
                FileIsOpen.SetWindowPos(this.Handle, -2, 0, 0, 0, 0, 1 | 2);// 1 | 2);
            }
            if (_clear_Ch.Checked)
            {
                numTxt.Visible = true;
                numTxt.Value   = decimal.Parse(XMLHelper.GetRootValue("DayCount"));
                ClearApp();
            }

            ExecuteCommon execute = new ExecuteCommon();

            /* 获取路径 */
            if (!(bool)execute.doMethod(Key_XmlCore.GetFullPath.ToString(), null))
            {
                return;
            }

            /* 获取图标 */
            if (!(bool)execute.doMethod(Key_XmlCore.GetIcon.ToString()))
            {
                return;
            }

            /* 绑定数据 */
            if (!(bool)execute.doMethod(Key_LogicCore.LoadLvOneSelf.ToString(), new object[] { mImgListOneSelf, XmlCore.listOneSelfPath, XmlCore.listIcon, lvOneSelf }))
            {
                return;
            }

            //设置图标
            if (File.Exists(System.AppDomain.CurrentDomain.BaseDirectory + @"img\Title.png"))
            {
                Bitmap ico = new Bitmap(System.AppDomain.CurrentDomain.BaseDirectory + @"img\Title.png");
                pictureBox2.Image = ico;
            }
            if (File.Exists(System.AppDomain.CurrentDomain.BaseDirectory + @"img\Superbar.ico"))
            {
                Icon ico = new Icon(System.AppDomain.CurrentDomain.BaseDirectory + @"img\Superbar.ico");
                notifyIcon.Icon = ico;
            }


            Global.IsOneSelf = true;
            mAddCount++;
        }