Пример #1
0
        // ALTERED SATRT
        private void statisticsDataGridViewe_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.ColumnIndex == _StatisticsDataGridView.Columns["reset"].Index)
            {
                Stats.StatInfo statInfo = _Statistics[e.RowIndex];
                if (statInfo.IsIncrementOnly)
                {
                    MessageBox.Show(
                        this,
                        String.Format("Can't reset \"{0}\" statistic.", statInfo.Extra),
                        "Information",
                        MessageBoxButtons.OK,
                        MessageBoxIcon.Information);
                    return;
                }

                ResetObjectStat(statInfo);
                if (statInfo.IsModified)
                {
                    StoreStatistics(new List <Stats.StatInfo> {
                        statInfo
                    });
                }
                ;
            }
        }
Пример #2
0
 private void ResetObjectStat(Stats.StatInfo statInfo)
 {
     if (statInfo is Stats.IntStatInfo)
     {
         Stats.IntStatInfo intStat = (Stats.IntStatInfo)statInfo;
         intStat.Value = "0";
     }
     else if (statInfo is Stats.FloatStatInfo)
     {
         Stats.FloatStatInfo floatStat = (Stats.FloatStatInfo)statInfo;
         floatStat.Value = "0";
     }
     else
     {
         throw new Exception();
     }
 }