Example #1
0
        /// <summary>
        /// Display the drive data information as entered
        /// </summary>
        /// <param name="data"></param>
        private void DisplayDrives(int[,] data)
        {
            // fetch data
            int[] used  = GetRowData(data, 0);
            int[] total = GetRowData(data, 1);

            // convert data into model
            DiskSpace diskSpace = new DiskSpace();

            // load data in the model
            drives = diskSpace.LoadData(used, total);

            // add all model rows to the data grid
            PopulateDriveData();

            txtResult.Text = "Press [Process] to attempt to pack the data onto as few hard drives as possible";
        }
Example #2
0
        /// <summary>
        /// Try to find the minimum number of drives needed
        /// </summary>
        /// <param name="data"></param>
        private void ProcessDrives(int[,] data)
        {
            DiskSpace diskSpace = new DiskSpace();

            // fetch data
            int[] used  = GetRowData(data, 0);
            int[] total = GetRowData(data, 1);

            // convert
            int retVal = diskSpace.minDrives(used, total);

            // display results
            if (retVal != -1)
            {
                drives = diskSpace.ProcessedDrives;

                PopulateDriveData();

                txtResult.Text = $" {retVal } hard drive(s) still contain data after the consolidation is complete.";
            }
        }