Exemple #1
0
        protected override void OnStartup(StartupEventArgs e)
        {
            //Theme Init
            AppearanceManager.Current.AccentColor = Color.FromRgb(0x76, 0x60, 0x8a);

            AppDomain.CurrentDomain.UnhandledException += (obj, evt) => GlobalExceptionHandler(evt.ExceptionObject as Exception);

            //Judge cores init
            int count = 0;

            try
            {
                foreach (var item in new System.Management.ManagementObjectSearcher("Select * from Win32_Processor").Get())
                {
                    count += int.Parse(item["NumberOfCores"].ToString());
                }
            }
            catch
            {
                count = 1;
            }
            for (int i = 0; i < count; i++)
            {
                Judge.Core c = new Judge.Core();
                c.Index       = i;
                c.CurrentTask = null;
                Judge.Env.Cores.Add(c);
            }
        }
Exemple #2
0
        protected override void OnStartup(StartupEventArgs e)
        {
            //Theme Init
            AppearanceManager.Current.AccentColor = Color.FromRgb(0x76, 0x60, 0x8a);

            AppDomain.CurrentDomain.UnhandledException += (obj, evt) => GlobalExceptionHandler(evt.ExceptionObject as Exception);

            //Judge cores init
            int count = 0;
            try
            {
                foreach (var item in new System.Management.ManagementObjectSearcher("Select * from Win32_Processor").Get())
                {
                    count += int.Parse(item["NumberOfCores"].ToString());
                }
            }
            catch
            {
                count = 1;
            }
            for (int i = 0; i < count; i++)
            {
                Judge.Core c = new Judge.Core();
                c.Index = i;
                c.CurrentTask = null;
                Judge.Env.Cores.Add(c);
            }
        }