Beispiel #1
0
        private void 系统设置ToolStripMenuItem2_Click(object sender, EventArgs e)
        {
            this.Enabled = false;
            this.contextMenuStrip1.Enabled = false;
            Menu  m = (Menu)(this.contextMenuStrip2.Tag);
            Popup p = new Popup(this);

            p.LoadSetting(420, 300, "ForceTer Setting");
            p.LoadButtonManySetting("初始化", "扫描桌面", "还原默认", "应用设置", "取消", false);
            p.Show();
            p.SetSetting(Sqlite.GetSetting());
        }
Beispiel #2
0
        private void LoadForm()//设置窗口首次启动的操作
        {
            this.Name            = this.Name + " 3.0";
            this.FormBorderStyle = FormBorderStyle.None;
            this.Width           = setting.Width;
            this.Height          = setting.Height;
            Rectangle rect = Screen.GetWorkingArea(this);

            this.Left                  = rect.Width / 2 - this.Width / 2;
            this.Top                   = rect.Height / 2 - this.Height / 2;
            this.BackgroundImage       = Sqlite.GetBackgroundImage();
            this.BackgroundImageLayout = ImageLayout.Stretch;
            this.Icon                  = Properties.Resources.ForceTer;
            this.TopMost               = setting.Top ? true : false;
        }
Beispiel #3
0
 private void Lb_MouseClick4(object sender, MouseEventArgs e)//还原默认
 {
     SetSetting(new Setting(false, true, true, false, false, "1024×768(推荐)", 1024, 768));
     if (names != "ForceTer Setting")
     {
         if (MessageBox.Show("是否将背景图还原为初始图像 ?", "ForceTer 3.0", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK)
         {
             Sqlite.SetBackgroundImage("\\localhost");
             ft.BackgroundImage           = Sqlite.GetBackgroundImage();
             ft.Enabled                   = true;
             ft.contextMenuStrip1.Enabled = true;
             ft.Show();
             this.Close();
         }
     }
 }
Beispiel #4
0
        private void Lb_MouseClick3(object sender, MouseEventArgs e)//应用设置里边的修改内容
        {
            Setting s       = new Setting();
            Setting setting = Sqlite.GetSetting();

            foreach (Control ctrl in this.Controls)
            {
                if ((string)ctrl.Tag == "开机启动")
                {
                    Boolean strat = (((CheckBox)ctrl).CheckState == CheckState.Checked);
                    if (setting.Start != strat)
                    {
                        if (!AddStart(strat))
                        {
                            ((CheckBox)ctrl).CheckState = setting.Start?CheckState.Checked:CheckState.Unchecked;
                            MessageBox.Show(" 提醒 : \r\n\t未同意管理员请求,设置失败! ", "ForceTer");
                            return;
                        }
                    }
                    s.Start = ((CheckBox)ctrl).CheckState == CheckState.Checked ? true : false;
                }
                else if ((string)ctrl.Tag == "前台显示")
                {
                    s.Top = ((CheckBox)ctrl).CheckState == CheckState.Checked ? true : false;
                }
                else if ((string)ctrl.Tag == "退出时提示")
                {
                    s.Exit = ((CheckBox)ctrl).CheckState == CheckState.Checked ? true : false;
                }
                else if ((string)ctrl.Tag == "打开程序后隐藏")
                {
                    s.Openfile = ((CheckBox)ctrl).CheckState == CheckState.Checked ? true : false;
                }
                else if ((string)ctrl.Tag == "打开文件位置后隐藏")
                {
                    s.Openfoder = ((CheckBox)ctrl).CheckState == CheckState.Checked ? true : false;
                }
                else if ((string)ctrl.Tag == "type")
                {
                    s.Desktop = ((ComboBox)ctrl).Text;
                }
            }
            Sqlite.SetSetting(s);
            ft.ReloadForm();
            Pb_MouseClick4(sender, e);
        }
Beispiel #5
0
        public void ReloadForm()//重置窗口大小
        {
            setting     = Sqlite.GetSetting();
            this.Width  = setting.Width;
            this.Height = setting.Height;
            Rectangle rect = Screen.GetWorkingArea(this);

            this.Left     = rect.Width / 2 - this.Width / 2;
            this.Top      = rect.Height / 2 - this.Height / 2;
            lv.Width      = this.Width - 16;
            lv.Height     = this.Height - 128;
            selectpb.Left = setting.Width - 224;
            selecttb.Left = setting.Width - 216;
            this.TopMost  = setting.Top ? true : false;
            foreach (Control ctrl in this.Controls)
            {
                if (ctrl is PictureBox)
                {
                    if (ctrl.Width == 35 || ctrl.Width == 45)
                    {
                        switch ((string)ctrl.Tag)
                        {
                        case "设置":
                            ctrl.Left = this.Width - 45 - 4 - 35 - 35 - 35;
                            break;

                        case "更换皮肤":
                            ctrl.Left = this.Width - 45 - 4 - 35 - 35;
                            break;

                        case "隐藏到托盘":
                            ctrl.Left = this.Width - 45 - 4 - 35;
                            break;

                        case "关闭":
                            ctrl.Left = this.Width - 45 - 4;
                            break;

                        default:
                            break;
                        }
                    }
                }
            }
        }
Beispiel #6
0
 public void LoadMenu(string name, Boolean type) //加载更新的菜单文件
 {
     lv.BeginUpdate();                           //数据更新锁
     if (name != "优化清理")
     {
         List <Menu> lm = type ? Sqlite.GetMenu(name) : Sqlite.FindByName(name);
         this.imageList1.ImageSize = new Size(40, 40);//出现的图标比较少的时候没有问题
         this.imageList1.Images.Clear();
         lv.Clear();
         lv.Items.Clear();
         if (lm.Count > 84)
         {
             this.imageList1.ImageSize = new Size(38, 38);
         }
         int i = 0;
         foreach (Menu m in lm)
         {
             this.imageList1.Images.Add(Files.ReadImageFile("image\\" + m.Icon));
             ListViewItem lvi = new ListViewItem();
             lvi.ImageIndex = i;
             lvi.Text       = m.Name;
             lvi.Tag        = m;
             i++;
             lv.Items.Add(lvi);
         }
         lv.ContextMenuStrip        = this.contextMenuStrip3;
         this.contextMenuStrip2.Tag = null;
     }
     else//如果点击的是(优化清理)这个选项
     {
         this.imageList1.Images.Clear();
         lv.Clear();
         lv.Items.Clear();
         lv.ContextMenuStrip       = null;
         this.imageList1.ImageSize = new Size(200, 200);
         this.imageList1.Images.Add(Properties.Resources.clean);
         ListViewItem lvi = new ListViewItem();
         lvi.ImageIndex = 0;
         lvi.Text       = "清理系统垃圾文件";
         lvi.Tag        = "clean";
         lv.Items.Add(lvi);
     }
     lv.EndUpdate();//数据更新完毕加载
 }
Beispiel #7
0
 private void Lb_MouseClick1(object sender, MouseEventArgs e)//点击了确定程序按钮
 {
     foreach (Control ctrl in this.Controls)
     {
         if ((string)ctrl.Tag == "name")
         {
             string name = ((TextBox)ctrl).Text;
             if (name.Trim() != "")
             {
                 Sqlite.RemMenuName(this.Tag.ToString(), name);
             }
             Pb_MouseClick4(sender, e);
             ft.LoadMenu(ft.JudgeType(), true);
             return;
         }
         if ((string)ctrl.Tag == "icon")
         {
             if (icoAddress == null)
             {
                 return;
             }
             Image i = System.IO.File.Exists(icoAddress) ? Icon.ExtractAssociatedIcon(icoAddress).ToBitmap() : Properties.Resources.Project;
             Files.DeleteFile(this.Tag.ToString() + ".png");
             Files.SaveImageFile(this.Tag.ToString() + ".png", i);
             ft.LoadMenu(ft.JudgeType(), true);
             Pb_MouseClick4(sender, e);
         }
         if ((string)ctrl.Tag == "png")
         {
             if (icoAddress == null)
             {
                 return;
             }
             System.IO.File.Copy(icoAddress, "image\\backgroud." + this.Tag.ToString(), true);
             Sqlite.SetBackgroundImage("backgroud." + this.Tag.ToString());
             ft.BackgroundImage = Sqlite.GetBackgroundImage();
             Pb_MouseClick4(sender, e);
         }
     }
 }
Beispiel #8
0
 private void LoadFile()//判断这个文件夹是否存在,不存在则创建
 {
     try
     {
         if (!File.Exists("SQLite.Interop.dll") || !File.Exists("System.Data.SQLite.dll") || !File.Exists("databases.db") || !File.Exists("Advauthority.exe"))
         {
             MessageBox.Show(" Error : \r\n\t文件丢失,请重新下载! ", "ForceTer");
             exit();
             return;
         }
         else
         {
             justFileAuth();
             if (!Directory.Exists("image"))
             {
                 Directory.CreateDirectory("image");
             }
             setting = Sqlite.GetSetting();//加载设置信息
             LoadForm();
             this.Show();
             this.Activate();
             SetTitle(this.Name);
             LoadListView();
             SetNotify();
             LoadImages();
             LoadMenu("热门应用", true);
             LoadSelect();
         }
     }
     catch
     {
         MessageBox.Show(" Error : \r\n\t没有权限,或文件损坏,请重新下载,或给予操作权限! ", "ForceTer");
         exit();
         return;
     }
 }
Beispiel #9
0
        private void Lb_MouseClick(object sender, MouseEventArgs e)//点击了添加程序按钮
        {
            Menu m = new Menu();

            m.Id       = Guid.NewGuid().ToString();
            m.Filetype = this.Tag.ToString().ToLower();
            m.Icon     = m.Id + ".png";
            foreach (Control ctrl in this.Controls)
            {
                if ((string)ctrl.Tag == "address")
                {
                    if (ctrl.Text.Trim() != "")
                    {
                        m.Address = ctrl.Text;
                    }
                    else
                    {
                        return;
                    }
                }
                else if ((string)ctrl.Tag == "name")
                {
                    if (ctrl.Text.Trim() != "")
                    {
                        m.Name = ctrl.Text;
                    }
                    else
                    {
                        MessageBox.Show(" Error : \r\n\tEnter your project NAME !!!   名称为空! ", "ForceTer");
                        return;
                    }
                }
                else if ((string)ctrl.Tag == "type")
                {
                    int num = ((ComboBox)ctrl).SelectedIndex;
                    if (num != 0)
                    {
                        m.Type = ((ComboBox)ctrl).SelectedIndex;
                    }
                    else
                    {
                        MessageBox.Show(" Error : \r\n\tTYPE cannot be null !!!   分类选择错误! ", "ForceTer");
                        return;
                    }
                }
                else if ((string)ctrl.Tag == "hot")
                {
                    m.Hot = ((CheckBox)ctrl).CheckState == CheckState.Checked ? 1 : 0;
                }
            }
            if (Sqlite.SelectMenuName(m.Name))
            {
                MessageBox.Show(" Error : \r\n\tThe NAME already exists !!!   名字已经存在了! ", "ForceTer");
                return;
            }
            else
            {
                Files.SaveImageFile(m.Id + ".png", System.IO.File.Exists(icoAddress) ? Icon.ExtractAssociatedIcon(icoAddress).ToBitmap() : Properties.Resources.Project);
                Sqlite.AddMenu(m);
                RemoveLoad();
                if (MessageBox.Show(" Success : \r\n\t项目添加成功,点击确认按钮返回 ForceTer 3.0 ! ", "ForceTer", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK)
                {
                    ft.Show();
                    this.Close();
                    ft.LoadMenu("热门应用", true);
                    ft.ResetKey();
                }
            }
        }
Beispiel #10
0
        public void LoadBackgroud(int width, int height, string name)//加载修改图标的界面
        {
            this.FormBorderStyle = FormBorderStyle.None;
            SetLabel(name, 12, 10, "微软雅黑", 10);
            this.Width  = width;
            this.Height = height;
            Rectangle rect = Screen.GetWorkingArea(this);

            this.Left = rect.Width / 2 - this.Width / 2;
            this.Top  = rect.Height / 2 - this.Height / 2;
            SetLabel("当前系统皮肤", this.Width / 4 - 47, 55, "微软雅黑", 10);
            SetLabel("请在下方拖入新的皮肤图片", this.Width / 4 * 3 - 83, 55, "微软雅黑", 10);
            SetPictureBoxBackgroud(this.Width / 4 - 120, this.Height / 2 - 90, 240, 180, false, Sqlite.GetBackgroundImage());
            SetPictureBox(this.Width / 2 - 25, this.Height / 2 - 10, 50, 20, false, false, Properties.Resources._goto, true);
            SetPictureBoxBackgroud(this.Width / 4 * 3 - 120, this.Height / 2 - 90, 240, 180, true, null);
        }