private void itemDestination_Click(object sender, EventArgs e) { SaveFileDialog saveDialog = new SaveFileDialog { AddExtension = true, DefaultExt = "prblm" }; if (saveDialog.ShowDialog() == DialogResult.OK) { file = new HeavyFile(saveDialog.FileName, this); txtSize.Enabled = true; Console.WriteLine("Selected file: " + file.Path); } }
private void btnCreate_Click(object sender, EventArgs e) { long size = long.Parse(txtSize.Text); file.Size = size; DialogResult confirmResult = MessageBox.Show(this, "Create file with these features?\n\nSize: " + file.Size + "\nSize on disk: " + file.SizeOnDisk + "\nSectors: " + file.Sectors, "Confirm creation", MessageBoxButtons.YesNo); if (confirmResult == DialogResult.Yes) { Console.WriteLine("\nCreating file..."); file.CreateFile(); Console.WriteLine("\n\nCreated file: " + file.Path); Console.WriteLine("Size: " + file.Size + "\nSize on disk: " + file.SizeOnDisk + "\nSectors: " + file.Sectors + "\n\n"); } file = null; txtSize.Text = ""; txtSize.Enabled = false; btnCreate.Enabled = false; progress.Value = 0; }