public static void LoadFile() //in ingresso
 {
     data = (UsageStats)Tools.Serializer.ObjFromFile(filename);
     if (data == null)
     {
         data = new UsageStats();
     }
     data.UsageCount++;
 }
示例#2
0
        void MainFormFormClosing(object sender, FormClosingEventArgs e)
        {
            if (Core.InProgram && System.Windows.Forms.MessageBox.Show(Strings.ExitAnyway, "Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button2) != System.Windows.Forms.DialogResult.Yes)
            {
                e.Cancel = true;
            }

            if (!e.Cancel)
            {
                Core.CloseCom(true);
                Settings.SetObject("Mainform Size and Position", new object[] { Size, Location, WindowState });
                Settings.Save();

                UsageStats.SaveFile(Core);
            }
        }
示例#3
0
        static void Main(string[] args)
        {
            Tools.TimingBase.TimeFromApplicationStartup();

            Logger.Start();
            GitHub.CleanupOldVersion();
            UsageStats.LoadFile();
            CustomButtons.LoadFile();
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            System.Globalization.CultureInfo ci = (System.Globalization.CultureInfo)Settings.GetObject("User Language", null);
            if (ci != null)
            {
                System.Threading.Thread.CurrentThread.CurrentUICulture = ci;
            }

            Tools.TaskScheduler.SetClockResolution(1);             //use a fast clock
            Application.Run(new MainForm());
            GrblEmulator.WebSocketEmulator.Stop();
            Autotrace.CleanupTmpFolder();
            Logger.Stop();
        }