Beispiel #1
0
 public MainForm()
 {
     StaticForms.Forms.Add("MainForm", this);
     InitializeComponent();
     //FormBorderStyle = FormBorderStyle.None;     //设置窗体为无边框样式
     //WindowState = FormWindowState.Maximized;    //最大化窗体
     Task.Run(() =>
     {
         //AIDA64Handler.Start();
         OHMHandler.Start();
         PerformanceHandler.Start();
     });
 }
Beispiel #2
0
 static void Main(string[] args)
 {
     //PCounters.GetAllCategorysInfo("safasf.txt");
     //Console.WriteLine("计数器输出完成,按任意键退出");
     //Console.ReadKey();
     OHMHandler.Start();
     PerformanceHandler.Start();
     while (true)
     {
         Console.Clear();
         PerformanceDatas.AllItems.ForEach(t => Console.WriteLine($"{t.Name} {t.Type.ToString()} {t.Value.ToString("f2")}{t.Unit}"));
         Thread.Sleep(1000);
     }
 }
Beispiel #3
0
 static void Main()
 {
     try
     {
         Application.EnableVisualStyles();
         Application.SetCompatibleTextRenderingDefault(false);
         Config.ReadConfig();
         Task.Run(() => { OHMHandler.Start(); });
         using (MainForm form = new MainForm())
         {
             form.FormClosed += delegate(object sender, FormClosedEventArgs e)
             {
                 //记忆窗体位置
                 foreach (var item in StaticForms.Forms.Values)
                 {
                     if (item == null || item.IsDisposed == true)
                     {
                         continue;
                     }
                     Config.ConfigData.FormsInfo.AddOrUpdate(item.Name, new ScreenPositon
                     {
                         FormName   = item.Name,
                         Top        = item.Top,
                         Left       = item.Left,
                         Width      = item.Width,
                         Height     = item.Height,
                         ScreenName = Screen.FromControl(item).DeviceName.Replace("\\", "").Replace(".", "")
                     });
                 }
                 Config.SaveConfig();
                 Application.Exit();
             };
             Application.Run(form);
         }
     }
     catch (Exception ex)
     {
         Config.SaveConfig();
         FileHelper.Write(new string[] { "ErrorLog.txt" }, ex.ToString());
     }
 }