Example #1
0
        public Cbhk_form()
        {
            InitializeComponent();

            if (SystemInformation.Network)
            {
                #region 初始化登录窗体
                //SignIn signIn = new SignIn();
                //ShowInTaskbar = false;
                //cbhk_notify.Visible = false;
                //WindowState = FormWindowState.Minimized;
                //if (signIn.ShowDialog() == DialogResult.OK)
                //{

                //    #region 绑定头像框点击事件
                //    link_tip.SetToolTip(user_head_box, signIn.user_name_string + "的主页");
                //    user_head_box.Click += (a, b) =>
                //    {
                //        Process.Start("https://mc.metamo.cn/u/" + signIn.user_id + "/");
                //    };
                //    signIn.Dispose();
                //    #endregion
                //}
                //else
                //    Environment.Exit(0);
                #endregion
            }

            #region 开启欢迎窗体
            WelcomeForm welcome = new WelcomeForm();
            if (welcome.ShowDialog() == DialogResult.OK)
            {
                #region 引用所提供的TreeView
                foreach (TreeNode item in welcome.register.Nodes[0].Nodes)
                {
                    register.Nodes.Add(item);
                }
                foreach (TreeNode item in welcome.command.Nodes[0].Nodes)
                {
                    Commands.Nodes.Add(item);
                }
                foreach (TreeNode item in welcome.block.Nodes[0].Nodes)
                {
                    Blocks.Nodes.Add(item);
                }
                foreach (TreeNode item in welcome.EntityNBT.Nodes[0].Nodes)
                {
                    EntityNBTs.Nodes.Add(item);
                }

                #endregion

                #region 开启主窗体窗体
                ShowInTaskbar       = true;
                cbhk_notify.Visible = true;
                WindowState         = FormWindowState.Normal;
                TopMost             = true;
                Show();
                TopMost = false;
                #endregion

                #region 自动解析msi包
                //string strInput = @"msiexec /i " + Application.StartupPath + "\\cbhk.setup.msi" + " /qn";
                //Process p = new Process();
                //p.StartInfo.FileName = "cmd.exe";
                //p.StartInfo.UseShellExecute = false;
                //p.StartInfo.RedirectStandardInput = true;
                //p.StartInfo.RedirectStandardOutput = true;
                //p.StartInfo.RedirectStandardError = true;
                //p.StartInfo.CreateNoWindow = true;
                //p.Start();
                //p.StandardInput.WriteLine(strInput + "&exit");
                //p.StandardInput.AutoFlush = true;
                //p.WaitForExit();
                //p.Close();
                #endregion

                #region 自动提取下载直链
                //该网址为自动解析直链API
                //UpdateForm uf = new UpdateForm("https://api.xinac.net/lanzous?url=", Application.StartupPath+"\\downloadurl.txt");
                //if(uf.ShowDialog() == DialogResult.OK)
                //{
                //    MessageBox.Show("success");
                //}
                #endregion
            }
            #endregion

            //初始化命令管家UI
            InitUISettings();
            //初始化命令管家启动项
            InitStartUpSetting();

            #region 开机自启
            AutoStart.SetMeStart(cbhk_properties.AutoStart);
            #endregion

            #region 自动更新
            #endregion
        }