Dispose() protected method

Clean up any resources being used.
protected Dispose ( bool disposing ) : void
disposing bool true if managed resources should be disposed; otherwise, false.
return void
コード例 #1
0
 private void OnClick_SaveAllTiff(object sender, EventArgs e)
 {
     using (FolderBrowserDialog dialog = new FolderBrowserDialog())
     {
         dialog.Description = "Select directory";
         dialog.ShowNewFolderButton = true;
         if (dialog.ShowDialog() == DialogResult.OK)
         {
             Cursor.Current = Cursors.WaitCursor;
             ProgressBar bar = new ProgressBar(listView1.Items.Count, "Export to tiff",false);
             for (int i = 0; i < listView1.Items.Count; ++i)
             {
                 FiddlerControls.Events.FireProgressChangeEvent();
                 Application.DoEvents();
                 int index = (int)listView1.Items[i].Tag;
                 if (index >= 0)
                 {
                     string FileName = Path.Combine(dialog.SelectedPath, String.Format("Item 0x{0:X}.tiff", index));
                     Bitmap bit = new Bitmap(Ultima.Art.GetStatic(index));
                     if (bit != null)
                         bit.Save(FileName, ImageFormat.Tiff);
                     bit.Dispose();
                 }
             }
             bar.Dispose();
             Cursor.Current = Cursors.Default;
             MessageBox.Show(String.Format("All Item saved to {0}", dialog.SelectedPath), "Saved", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1);
         }
     }
 }
コード例 #2
0
 private void OnClickSave(object sender, EventArgs e)
 {
     DialogResult result =
                 MessageBox.Show("Are you sure? Will take a while",
                 "Save",
                 MessageBoxButtons.YesNo,
                 MessageBoxIcon.Warning,
                 MessageBoxDefaultButton.Button2);
     if (result == DialogResult.Yes)
     {
         ProgressBar bar = new ProgressBar(Art.GetIdxLength(), "Save");
         Cursor.Current = Cursors.WaitCursor;
         Art.Save(FiddlerControls.Options.OutputPath);
         bar.Dispose();
         Cursor.Current = Cursors.Default;
         Options.ChangedUltimaClass["Art"] = false;
         MessageBox.Show(String.Format("Saved to {0}", FiddlerControls.Options.OutputPath),
             "Save",
             MessageBoxButtons.OK,
             MessageBoxIcon.Information,
             MessageBoxDefaultButton.Button1);
     }
 }