private void toolStripMenuItemExport_Click(object sender, EventArgs e)
 {
     if (ExportSettingsForm.Show(Common.Instance.ExportParams))
     {
         Cursor.Current = Cursors.WaitCursor;
         try
         {
             foreach (Session session in listBoxSessions.SelectedItems)
             {
                 try
                 {
                     session.Save(Common.Instance.ExportParams);
                 }
                 catch (Exception ex)
                 {
                     MessageBox.Show(string.Format("Session '{0}'\n{1}", session.Name, ex.Message), @"Error");
                 }
             }
         }
         finally
         {
             Cursor.Current = Cursors.Default;
         }
     }
 }
        public static bool Show(ExportParams p)
        {
            using (ExportSettingsForm f = new ExportSettingsForm())
            {
                f.textBoxDir.Text         = p.Directory;
                f.checkBoxTiles.Checked   = p.ExportTiles;
                f.checkBoxMap.Checked     = p.ExportMap;
                f.checkBoxGrid.Checked    = p.ShowGrid;
                f.radioButtonPng.Checked  = p.Format == ImageFormat.Png;
                f.radioButtonJpeg.Checked = p.Format == ImageFormat.Jpeg;

                bool result = f.ShowDialog() == DialogResult.OK;
                if (result)
                {
                    p.Directory   = f.textBoxDir.Text;
                    p.ExportTiles = f.checkBoxTiles.Checked;
                    p.ExportMap   = f.checkBoxMap.Checked;
                    p.ShowGrid    = f.checkBoxGrid.Checked;
                    p.Format      = f.radioButtonPng.Checked ? ImageFormat.Png : ImageFormat.Jpeg;
                }

                return(result);
            }
        }
		public static bool Show(ExportParams p)
		{
			using (ExportSettingsForm f = new ExportSettingsForm())
			{
				f.textBoxDir.Text = p.Directory;
				f.checkBoxTiles.Checked = p.ExportTiles;
				f.checkBoxMap.Checked = p.ExportMap;
				f.checkBoxGrid.Checked = p.ShowGrid;
				f.radioButtonPng.Checked = p.Format == ImageFormat.Png;
				f.radioButtonJpeg.Checked = p.Format == ImageFormat.Jpeg;

				bool result = f.ShowDialog() == DialogResult.OK;
				if (result)
				{
					p.Directory = f.textBoxDir.Text;
					p.ExportTiles = f.checkBoxTiles.Checked;
					p.ExportMap = f.checkBoxMap.Checked;
					p.ShowGrid = f.checkBoxGrid.Checked;
					p.Format = f.radioButtonPng.Checked ? ImageFormat.Png : ImageFormat.Jpeg;
				}

				return result;
			}
		}