/// <summary>
        /// 根据当前焦点获取Bar条
        /// </summary>
        /// <returns></returns>
        public VScrollBar getFBar()
        {
            var          focus = LoacationHelper.GetFocusedControl();
            TTVScrollBar sb    = null;

            if (focus != null)
            {
                foreach (Control gbox in PubulicData.GCFN("appan").Controls)
                {
                    if (gbox.Name == focus.Name)
                    {
                        sb = (TTVScrollBar)PubulicData.GCFN("AppSB");
                    }
                }
                foreach (Control gbox in PubulicData.GCFN("weban").Controls)
                {
                    if (gbox.Name == focus.Name)
                    {
                        sb = (TTVScrollBar)PubulicData.GCFN("WebSB");
                    }
                }
                foreach (Control gbox in PubulicData.GCFN("hfan").Controls)
                {
                    if (gbox.Name == focus.Name)
                    {
                        sb = (TTVScrollBar)PubulicData.GCFN("HfSB");
                    }
                }
            }
            return(sb);
        }
 /// <summary>
 /// 右击选中浏览器按钮
 /// </summary>
 /// <param name="bd"></param>
 public void SelectWebShow(ButtonDate bd)
 {
     PubulicData.GCFN("webbtn").Text = bd.Name;
     PubulicData.GCFN("webllq").Text = bd.Browser;
     PubulicData.GCFN("weburl").Text = bd.Url;
     id = bd.ID;
 }
 public void setButtonClick(string[] btnName)
 {
     foreach (string item in btnName)
     {
         PubulicData.GCFN(item).Click += onClick;
     }
 }
Exemple #4
0
        public void MainInit()
        {
            ClearBuntton();
            List <ButtonDate> allbtn = new List <ButtonDate>();
            List <ButtonDate> hfbtn  = new List <ButtonDate>();
            List <ButtonDate> list   = PubulicData.sourceData[PubulicData.ClassName.ButtonDate.ToString()] as List <ButtonDate>;

            allbtn = list.Where(c => c.State == "show").OrderBy(c => c.Index).ToList();
            hfbtn  = list.Where(c => c.State == "hiden").ToList();
            int i = 0;
            int j = 0;
            int z = 0;

            foreach (ButtonDate item in allbtn)
            {
                TTButton modle = new TTButton();
                modle.Size     = new System.Drawing.Size(120, 30);
                modle.TabIndex = (int)item.Index + 1;
                modle.UseVisualStyleBackColor = true;
                modle.Text       = item.Name;
                modle.MouseDown += _formHelper.ClikeButton;
                if (item.Type == "网站")
                {
                    modle.Name     = "wbe" + item.ID;
                    modle.Location = new System.Drawing.Point(21, 20 + i * 40);
                    PubulicData.GCFN("panWeb").Controls.Add(modle);
                    i++;
                }
                else
                {
                    if (item.CreateMac == LoacationHelper.GetMac())
                    {
                        modle.Name     = "app" + item.ID;
                        modle.Location = new System.Drawing.Point(21, 20 + j * 40);
                        PubulicData.GCFN("panApp").Controls.Add(modle);
                        j++;
                    }
                }
            }
            foreach (ButtonDate item in hfbtn)
            {
                TTButton modle = new TTButton();
                modle.Name     = "hf" + item.ID;
                modle.Location = new System.Drawing.Point(21, 20 + z * 40);
                modle.Size     = new System.Drawing.Size(120, 30);
                modle.TabIndex = (int)item.Index + 1;
                modle.UseVisualStyleBackColor = true;
                modle.Text       = item.Name;
                modle.MouseDown += _formHelper.hfClike;
                PubulicData.GCFN("panHF").Controls.Add(modle);
                z++;
            }
        }
        public void ResetForm()
        {
            VScrollBar vba = PubulicData.GCFN("panApp").Controls.Find("AppSB", true)[0] as VScrollBar;
            VScrollBar vbw = PubulicData.GCFN("panWeb").Controls.Find("WebSB", true)[0] as VScrollBar;
            VScrollBar vbh = PubulicData.GCFN("panHF").Controls.Find("HfSB", true)[0] as VScrollBar;

            PubulicData.GCFN("panApp").Controls.Clear();
            PubulicData.GCFN("panWeb").Controls.Clear();
            PubulicData.GCFN("panHF").Controls.Clear();
            PubulicData.GCFN("panApp").Controls.Add(vba);
            PubulicData.GCFN("panWeb").Controls.Add(vbw);
            PubulicData.GCFN("panHF").Controls.Add(vbh);
        }
 /// <summary>
 /// 隐藏显示添加按钮页面
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 public void ycxs_Click()
 {
     PubulicData.GCFN("hfan").Visible = false;
     if (PubulicData.GCFN("scan").Visible == true)
     {
         PubulicData.GCFN("scan").Visible = false;
         fm.Width = 520;
     }
     else
     {
         PubulicData.GCFN("scan").Visible = true;
         fm.Width = 1100;
     }
 }
 /// <summary>
 /// 隐藏显示恢复按钮页面
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 public void RestoreButton()
 {
     PubulicData.GCFN("scan").Visible = false;
     if (PubulicData.GCFN("hfan").Visible == true)
     {
         PubulicData.GCFN("hfan").Visible = false;
         fm.Width = 520;
     }
     else
     {
         PubulicData.GCFN("hfan").Visible = true;
         fm.Width = 780;
     }
 }
Exemple #8
0
        public void ClearBuntton()
        {
            var Wsb = PubulicData.GCFN("WebSB");
            var Asb = PubulicData.GCFN("AppSB");
            var Hsb = PubulicData.GCFN("HfSB");
            Dictionary <string, Control> str = new Dictionary <string, Control>();

            str.Add("panWeb", Wsb);
            str.Add("panApp", Asb);
            str.Add("panHF", Hsb);
            foreach (string item in str.Keys)
            {
                PubulicData.GCFN(item).Controls.Clear();
                PubulicData.GCFN(item).Controls.Add(str[item]);
            }
        }
        /// <summary>
        /// 显示隐藏页面
        /// </summary>
        /// <param name="bj"></param>
        public void SX()
        {
            bool scan = PubulicData.GCFN("scan").Visible;
            bool hfan = PubulicData.GCFN("hfan").Visible;

            fm.reSetData();
            if (scan)
            {
                PubulicData.GCFN("scan").Visible = true;
                fm.Width = 1100;
            }
            else if (hfan)
            {
                PubulicData.GCFN("hfan").Visible = true;
                fm.Width = 780;
            }
        }
 /// <summary>
 /// 添加按钮
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 public void CreateButton(TTButton nowbt)
 {
     if (nowbt != null)
     {
         string     name    = nowbt.Name;
         string     btnname = "";
         string     btnllq  = "";
         string     btnurl  = "";
         ButtonDate bd      = new ButtonDate();
         bd.ID = id;
         if (name == "btnWebCreate")
         {
             string url = PubulicData.GCFN("weburl").Text;
             url           = url.Trim('"');
             btnname       = PubulicData.GCFN("webbtn").Text;
             btnllq        = PubulicData.GCFN("webllq").Text;
             btnurl        = url;
             bd.Name       = btnname;
             bd.Url        = btnurl;
             bd.Browser    = btnllq;
             bd.Type       = "网站";
             bd.State      = "show";
             bd.CreateDate = DateTime.Now;
             bd.CreateIP   = LoacationHelper.GetLocalIP();
             bd.CreateMac  = LoacationHelper.GetMac();
         }
         if (name == "btnAppCreate")
         {
             string url = PubulicData.GCFN("appurl").Text;
             url           = url.Trim('"');
             btnname       = PubulicData.GCFN("appname").Text;
             btnurl        = url;
             bd.Name       = btnname;
             bd.Url        = btnurl;
             bd.Type       = "链接";
             bd.State      = "show";
             bd.CreateDate = DateTime.Now;
             bd.CreateIP   = LoacationHelper.GetLocalIP();
             bd.CreateMac  = LoacationHelper.GetMac();
         }
         ActionHelper.saveInfo <ButtonDate>(bd);
         SX();
     }
 }
        /// <summary>
        /// 控件的滚动位置
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public void myScroll(object sender, EventArgs e)
        {
            VScrollBar vsb = sender as VScrollBar;

            if (vsb != null)
            {
                switch (vsb.Name.ToLower())
                {
                case "websb":
                    foreach (Control gbox in PubulicData.GCFN("panWeb").Controls)
                    {
                        if (gbox is VScrollBar)
                        {
                            continue;
                        }
                        gbox.Location = new Point(gbox.Location.X, (int)gbox.Tag - vsb.Value);
                    }
                    break;

                case "appsb":
                    foreach (Control gbox in PubulicData.GCFN("panApp").Controls)
                    {
                        if (gbox is VScrollBar)
                        {
                            continue;
                        }
                        gbox.Location = new Point(gbox.Location.X, (int)gbox.Tag - vsb.Value);
                    }
                    break;

                case "hfsb":
                    foreach (Control gbox in PubulicData.GCFN("panHF").Controls)
                    {
                        if (gbox is VScrollBar)
                        {
                            continue;
                        }
                        gbox.Location = new Point(gbox.Location.X, (int)gbox.Tag - vsb.Value);
                    }
                    break;
                }
            }
        }
 /// <summary>
 /// 清空按钮
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 public void EmptButton(TTButton btnow)
 {
     id = 0;
     if (btnow != null)
     {
         string name = btnow.Name;
         if (name == "btnWebClear")
         {
             PubulicData.GCFN("webbtn").Text = "";
             PubulicData.GCFN("webllq").Text = "";
             PubulicData.GCFN("weburl").Text = "";
         }
         if (name == "btnAppClear")
         {
             PubulicData.GCFN("appname").Text = "";
             PubulicData.GCFN("appurl").Text  = "";
         }
     }
     // reSetData();
 }
 public void ReLoad()
 {
     Task.Run(() =>
     {
         reSetIndex();
     });
     fm                               = PubulicData.em;
     Notify                           = PubulicData.icon;
     item                             = PubulicData.item;
     fm.FormClosing                  += frmMain_FormClosing;
     Notify.MouseDown                += ClickIcon;
     item["ItemOne"].MouseDown       += ShowForm;
     item["ItemTwo"].MouseDown       += CloseForm;
     PubulicData.GCFN("hfan").Visible = false;
     PubulicData.GCFN("scan").Visible = false;
     setButtonClick(new string[] { "hf", "sc", "ycxs", "btnWebClear", "btnAppCreate", "btnWebCreate", "btnAppClear", "btnClose", "btnWebTop", "btnAppTop", "btnWebUp", "btnAppUp", "btnWebDown", "btnAppDown", "btnPT" });
     timer          = new Timer();
     timer.Interval = 500;
     timer.Tick    += new EventHandler(timer_Tick);
     timer.Start();
 }
        /// <summary>
        /// 重算页面上滚动条的大小写PubulicData.GCFN("panApp")
        /// </summary>              PubulicData.GCFN("panWeb")
        public void ReVS()
        {
            int webht = 0;
            int appht = 0;
            int hfht  = 0;

            foreach (Control gbox in PubulicData.GCFN("panApp").Controls)
            {
                if (gbox is VScrollBar)
                {
                    continue;
                }
                gbox.Tag = PubulicData.GCFN("AppSB").Location.Y + gbox.Location.Y;
                appht   += gbox.Height;
            }
            foreach (Control gbox in PubulicData.GCFN("panWeb").Controls)
            {
                if (gbox is VScrollBar)
                {
                    continue;
                }
                gbox.Tag = PubulicData.GCFN("WebSB").Location.Y + gbox.Location.Y;
                webht   += gbox.Height;
            }
            foreach (Control gbox in PubulicData.GCFN("panHF").Controls)
            {
                if (gbox is VScrollBar)
                {
                    continue;
                }
                gbox.Tag = PubulicData.GCFN("HfSB").Location.Y + gbox.Location.Y;
                hfht    += gbox.Height;
            }
            ((VScrollBar)PubulicData.GCFN("WebSB")).Minimum = 0;
            ((VScrollBar)PubulicData.GCFN("AppSB")).Minimum = 0;
            ((VScrollBar)PubulicData.GCFN("HfSB")).Minimum  = 0;
            ((VScrollBar)PubulicData.GCFN("WebSB")).Maximum = webht;
            ((VScrollBar)PubulicData.GCFN("AppSB")).Maximum = appht;
            ((VScrollBar)PubulicData.GCFN("HfSB")).Maximum  = hfht;
        }
        /// <summary>
        /// 根据鼠标位置获取Bar条
        /// </summary>
        /// <returns></returns>
        public VScrollBar getPBar()
        {
            Point        Mp = LoacationHelper.GetPoint();
            TTVScrollBar sb = null;

            if (Mp.X > 519)
            {
                sb = (TTVScrollBar)PubulicData.GCFN("HfSB");
            }
            else if (Mp.X > 208)
            {
                sb = (TTVScrollBar)PubulicData.GCFN("AppSB");
            }
            else
            {
                sb = (TTVScrollBar)PubulicData.GCFN("WebSB");
            }
            //if (sb != null) {
            //    sb.Focus();
            //}
            return(sb);
        }
 /// <summary>
 /// 右击选中程序按钮
 /// </summary>
 /// <param name="bd"></param>
 public void SelectAppShow(ButtonDate bd)
 {
     PubulicData.GCFN("appname").Text = bd.Name;
     PubulicData.GCFN("appurl").Text  = bd.Url;
     id = bd.ID;
 }