Пример #1
0
        //private Computer computer;

        public MainWindow()
        {
            try
            {
                SplashWindow.Loading("CPU");
                cpu = new Cpu();

                if (cpu.info.family.Equals(Cpu.Family.UNSUPPORTED))
                {
                    throw new ApplicationException("CPU is not supported.");
                }
                else if (cpu.info.codeName.Equals(Cpu.CodeName.Unsupported))
                {
                    throw new ApplicationException("CPU model is not supported.\nPlease run a debug report and send to the developer.");
                }

                IconSource = GetIcon("pack://application:,,,/ZenTimings;component/Resources/ZenTimings.ico", 16);
                InitializeComponent();
                SplashWindow.Loading("Memory modules");
                ReadMemoryModulesInfo();
                SplashWindow.Loading("Timings");

                // Read from first enabled DCT
                if (modules.Count > 0)
                {
                    ReadTimings(modules[0].DctOffset);
                }
                else
                {
                    ReadTimings();
                }

                if (settings.AdvancedMode)
                {
                    PowerCfgTimer.Interval = TimeSpan.FromMilliseconds(2000);
                    PowerCfgTimer.Tick    += PowerCfgTimer_Tick;

                    SplashWindow.Loading("Waiting for power table");
                    if (WaitForPowerTable())
                    {
                        SplashWindow.Loading("Reading power table");
                        // refresh the table again, to avoid displaying initial fclk, mclk and uclk values,
                        // which seem to be a little off when transferring the table for the "first" time,
                        // after an idle period
                        RefreshPowerTable();
                    }
                    else
                    {
                        SplashWindow.Loading("Power table error!");
                    }

                    SplashWindow.Loading("Plugins");
                    SplashWindow.Loading("SVI2 Plugin");
                    plugins.Add(new SVI2Plugin(cpu));
                    ReadSVI();

                    /*computer = new Computer()
                     * {
                     *  //CPUEnabled = true,
                     *  //RAMEnabled = true,
                     *  MainboardEnabled = true,
                     *  //FanControllerEnabled = true,
                     * };
                     *
                     * computer.Open();*/

                    if (!AsusWmi.Init())
                    {
                        AsusWmi.Dispose();
                        AsusWmi = null;
                    }

                    StartAutoRefresh();


                    SplashWindow.Loading("Memory controller");
                    BMC = new BiosMemController();
                    ReadMemoryConfig();
                }

                SplashWindow.Loading("Done");

                DataContext = new
                {
                    timings = MEMCFG,
                    cpu.powerTable,
                    WMIPresent = !compatMode,
                    settings
                };
            }
            catch (Exception ex)
            {
                HandleError(ex.Message);
                ExitApplication();
            }
        }
Пример #2
0
        public MainWindow()
        {
            try
            {
                SplashWindow.Loading("CPU");

                IconSource = GetIcon("pack://application:,,,/ZenTimings;component/Resources/ZenTimings.ico", 16);

                if (cpu.info.family != Cpu.Family.FAMILY_17H && cpu.info.family != Cpu.Family.FAMILY_19H)
                {
                    HandleError("CPU is not supported.");
                    ExitApplication();
                }
                else if (cpu.info.codeName == Cpu.CodeName.Unsupported)
                {
                    HandleError("CPU model is not supported.\n" +
                                "Please run a debug report and send to the developer.");
                }

                InitializeComponent();
                SplashWindow.Loading("Memory modules");
                ReadMemoryModulesInfo();
                SplashWindow.Loading("Timings");

                // Read from first enabled DCT
                if (modules.Count > 0)
                {
                    ReadTimings(modules[0].DctOffset);
                }

                if (settings.AdvancedMode)
                {
                    if (cpu.info.codeName != Cpu.CodeName.Unsupported)
                    {
                        PowerCfgTimer.Interval = TimeSpan.FromMilliseconds(2000);
                        PowerCfgTimer.Tick    += new EventHandler(PowerCfgTimer_Tick);

                        SplashWindow.Loading("SVI2");
                        ReadSVI();

                        SplashWindow.Loading("Waiting for power table");
                        if (WaitForPowerTable())
                        {
                            // refresh the table again, to avoid displaying initial fclk, mclk and uclk values,
                            // which seem to be a little off when transferring the table for the "first" time,
                            // after an idle period
                            RefreshPowerTable();
                            SplashWindow.Loading("Reading power table");
                        }
                        else
                        {
                            SplashWindow.Loading("Power table error!");
                        }

                        if (!AsusWmi.Init())
                        {
                            AsusWmi.Dispose();
                            AsusWmi = null;
                        }

                        StartAutoRefresh();
                    }

                    SplashWindow.Loading("Memory controller");
                    BMC = new BiosMemController();
                    ReadMemoryConfig();
                }

                SplashWindow.Loading("Done");

                DataContext = new
                {
                    timings = MEMCFG,
                    cpu.powerTable,
                    WMIPresent = !compatMode,
                    settings
                };
            }
            catch (ApplicationException ex)
            {
                HandleError(ex.Message);
                //Dispose();
                ExitApplication();
            }
        }