コード例 #1
0
        private void buttonModifyMaxRank_Click(object sender, EventArgs e)
        {
            int newRankMax;

            try
            {
                newRankMax = int.Parse(Interaction.InputBox("Enter a new max rank", "Modify Max Rank", WallpaperData.GetMaxRank().ToString()));
            }
            catch // no response
            {
                return;
            }

            if (newRankMax > 0 && newRankMax != WallpaperData.GetMaxRank()) // cannot be equal to or less than 0 and this will not change anything if the same rank is chosen
            {
                if (newRankMax <= WallpaperData.LargestMaxRank)
                {
                    WallpaperData.SetMaxRank(newRankMax);
                }
                else
                {
                    MessageBox.Show("Cannot be larger than 1000");
                }
            }
            else
            {
                MessageBox.Show("Invalid Input");
            }
        }
コード例 #2
0
        public RankDistributionChart()
        {
            InitializeComponent();

            int maxRank = WallpaperData.GetMaxRank();

            // Adds each rank's image count to the graph
            SuspendLayout();
            chartRankDistribution.ChartAreas[0].AxisX.Interval = maxRank / 20;
            chartRankDistribution.ChartAreas[0].AxisX.Maximum  = maxRank + 0.5; // this offsets the graph's visuals otherwise only half of the last bar would appear
            for (int i = 1; i <= maxRank; i++)
            {
                chartRankDistribution.Series[0].Points.Add(new DataPoint(i, WallpaperData.GetImagesOfRank(i).Length));
            }

            labelImageCount.Text = "Ranked Images: " + WallpaperData.GetAllRankedImages().Length + " | Unranked Images: " + (WallpaperData.GetAllImageData().Length - WallpaperData.GetAllRankedImages().Length);
            ResumeLayout();
        }