static void Debug()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            MainForm mainForm = new MainForm();

            StaticUtilFunctions.SetFormMid(mainForm);
            Application.Run(mainForm);
        }
 public Filter()
 {
     InitializeComponent();
     FilterCheckBox.SearchType = skinPanel1.Controls;
     FilterCheckBox.Mode       = skinPanel2.Controls;
     FilterCheckBox.MapStatus  = skinPanel3.Controls;
     FilterCheckBox.Genre      = skinPanel4.Controls;
     FilterCheckBox.Language   = skinPanel5.Controls;
     StaticUtilFunctions.SetFormMid(this);
 }
        static void Release()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            MainForm mainForm = new MainForm();

            StaticUtilFunctions.SetFormMid(mainForm);
            SystemInfo.OSVersion        = Environment.OSVersion.VersionString;
            SystemInfo.DeviceUniqueCode = StaticUtilFunctions.GetPCUniqueCode();
            try
            {
                Application.Run(mainForm);
            }
            catch (Exception ex)
            {
                string osVersion  = "OSVersion: " + Environment.OSVersion.VersionString;
                string AppVersion = "AppVersion: " + Application.ProductVersion.ToString();

                var str = osVersion + "\r\n\r\n" + AppVersion + "\r\n\r\n"
                          + string.Format("Type: {0}\r\n\r\nMessage: {1}\r\n\r\nInformation: \r\n{2}",
                                          ex.GetType().Name, ex.Message, ex.StackTrace);
                if (!Directory.Exists(Environment.CurrentDirectory + "\\ErrorLog"))
                {
                    Directory.CreateDirectory(Environment.CurrentDirectory + "\\ErrorLog");
                }
                var LogFileName = Environment.CurrentDirectory + "\\ErrorLog\\" + SystemInfo.DeviceUniqueCode
                                  + " " + DateTime.Now.ToString("yyyy-MM-dd HHmmss") + ".log";
                using (var sw = new StreamWriter(LogFileName, true))
                {
                    sw.Write(str);
                    sw.Close();
                }
                ErrorReport errorReporter = new ErrorReport();
                StaticUtilFunctions.SetFormMid(errorReporter);
                errorReporter.ErrorLogFilePath    = LogFileName;
                errorReporter.ErrorLogInformation = str;
                errorReporter.ShowDialog();
            }
        }
 public BeatmapDetailInfo()
 {
     InitializeComponent();
     StaticUtilFunctions.SetFormMid(this);
 }
Esempio n. 5
0
 public SettingForm()
 {
     InitializeComponent();
     StaticUtilFunctions.SetFormMid(this);
 }
Esempio n. 6
0
 private void ErrorReport_Load(object sender, EventArgs e)
 {
     StaticUtilFunctions.SetFormMid(this);
     textBox1.Text     = ErrorLogInformation;
     pictureBox1.Image = Image.FromFile(Environment.CurrentDirectory + "\\Resources\\Pics\\error.png");
 }
        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);
        }
 public MainForm()
 {
     StaticUtilFunctions.SetFormMid(this);
     InitializeComponent();
 }