Esempio n. 1
0
        private static bool CreateStatisctics(Statisctics statisctics)
        {
            XmlSerializer xmlSerializer = new XmlSerializer(typeof(Statisctics));

            if (File.Exists(FILENAME))
            {
                try
                {
                    File.Delete(FILENAME);
                    using (FileStream fs = new FileStream(FILENAME, FileMode.CreateNew))
                    {
                        xmlSerializer.Serialize(fs, statisctics);
                    }
                    return(true);
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                    return(false);
                }
            }
            else
            {
                using (FileStream fs = new FileStream(FILENAME, FileMode.CreateNew))
                {
                    xmlSerializer.Serialize(fs, statisctics);
                }
                return(true);
            }
        }
Esempio n. 2
0
        private void Source_OnEmpty(object sender, EventArgs e)
        {
            TheTimer.Stop();
            TheTimer.Enabled = false;
            IsRunning        = false;
            MessageBox.Show("Источник пуст!");
            Statisctics statisctics = new Statisctics()
            {
                Count       = this.Count,
                CrashCount  = this.CrashCount,
                ElapsedTime = this.ElapsedTime
            };

            if (CreateStatisctics(statisctics))
            {
                toolStripButtonStatisctics.Enabled = true;
                toolStripButtonStatisctics.Checked = true;
                btnStop.PerformClick();
                statusPanel.Text = "complete";
            }
        }
Esempio n. 3
0
 /// <summary>
 ///     Show the statistics tool
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void statisticsToolStripMenuItem_Click(object sender, EventArgs e)
 {
     using (var sf = new Statisctics(CurrentDemoFile.Sdi))
         sf.ShowDialog();
 }