Ejemplo n.º 1
0
        private void Form2_Load(object sender, EventArgs e)
        {
            UtilValues.PublicValue.ProgramRunTime = 0;

            //Thread[] FormsLoad = {
            //    new Thread(new ParameterizedThreadStart(ChildForms.LoadSettingsForm)),
            //    new Thread(new ParameterizedThreadStart(ChildForms.LoadFilterForm))};
            //var waits = new EventWaitHandle[2];
            //int temp = 0;
            //foreach (Thread subThread in FormsLoad)
            //{
            //    var handler = new ManualResetEvent(false);
            //    waits[temp]=handler;
            //    subThread.Start(handler);
            //    subThread.DisableComObjectEagerCleanup();
            //}

            label1.BackColor      = Color.Transparent;
            linkLabel1.BackColor  = Color.Transparent;
            panel2.BackColor      = Color.Transparent;
            menuStrip1.BackColor  = Color.Transparent;
            panel1.BackColor      = Color.Transparent;
            menuStrip1.BackColor  = Color.Transparent;
            gmProgressBar1.XTheme = new Gdu.WinFormUI.ThemeProgressBarGreen();


            dataGridView1.Visible = false;
            string           SupportStatus     = StaticUtilFunctions.JsonGet("https://api.sayobot.cn/support");
            JavaScriptObject SupportStatusJson = (JavaScriptObject)JavaScriptConvert.DeserializeObject(SupportStatus);

            if (!SupportStatusJson.ContainsKey("data"))
            {
                MessageBox.Show("网络错误,请检查网络连接后重启程序", "SayobotBeatmapDownloader",
                                MessageBoxButtons.OK, MessageBoxIcon.Error);
                Environment.Exit(-1);
            }

            JavaScriptObject Data = (JavaScriptObject)SupportStatusJson["data"];

            gmProgressBar1.Percentage = (Int32)(Convert.ToDouble(Data["total"]) / Convert.ToDouble(Data["target"]) * 100.0);
            linkLabel1.Text           = "投喂进度:$" + Data["total"].ToString() + "/$" + Data["target"].ToString();
            linkLabel1.Links.Add(0, linkLabel1.Text.Length, "https://sayobot.cn/home");


            PublicControlers.notifyIcon   = notifyIcon1;
            PublicControlers.mediaPlayer  = axWindowsMediaPlayer1;
            PublicControlers.dataGridView = dataGridView1;
            PublicControlers.mainForm     = this;
            PublicControlers.settingForm  = settingForm;
            PublicControlers.MemoryUsage  = label2;

            StaticUtilFunctions.SetFormMid(settingForm);
            StaticUtilFunctions.SetFormMid(beatmapDetailInfo);
            StaticUtilFunctions.SetFormMid(filter);

            if (File.Exists(ConfigFile.inifilepath))
            {
                ConfigFile.GetAllConfigsApply();
            }
            else
            {
                /*
                 * welcome = new Forms.Welcome();
                 * welcome.Show();
                 */
                FileStream streamtmp = File.Create(ConfigFile.inifilename);
                streamtmp.Close();
                ConfigFile.ResetAllConfigs();
            }
            if (Settings.MainFormImage != "")
            {
                StaticUtilFunctions.LoadingMainFormBackgroundPic();
            }
            StaticUtilFunctions.FindNanoPad();
            if (UtilValues.PublicValue.nanoPads.Length != 0)
            {
                notifyIcon1.ShowBalloonTip(500, "SayobotBeatmapDownloader",
                                           "发现" + UtilValues.PublicValue.nanoPads.Length.ToString() + "个触盘", ToolTipIcon.Info);
            }
            //WaitHandle.WaitAll(waits);
        }