Skip to content

Commit

Permalink
pagesettings dialog small fixes...
Browse files Browse the repository at this point in the history
  • Loading branch information
t0815 committed Aug 21, 2024
1 parent d846618 commit afb9479
Showing 1 changed file with 36 additions and 80 deletions.
116 changes: 36 additions & 80 deletions MyCBZ/Forms/PageSettingsForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -252,32 +252,17 @@ private void TabControlPageProperties_SelectedIndexChanged(object sender, EventA

// Transform the XML data
MemoryStream ms = new MemoryStream();
//xTrans.OutputSettings.

xTrans.Transform(xReader, null, ms);

ms.Position = 0;
// Set to the document stream
//ms.CopyTo(docStream);

TextReader tr = new StreamReader(ms);

string xml = tr.ReadToEnd();

metaDataView.DocumentText = xml;

//docStream.Position = 0;
//metaDataView.DocumentStream?.Close();
//metaDataView.DocumentStream?.Dispose();
//metaDataView.DocumentStream = null;
//metaDataView.AllowNavigation = false;
//metaDataView.Navigate("about:blank");
//metaDataView.Update();
///metaDataView.
//metaDataView.Document.OpenNew(false);

//metaDataView.Refresh();



}
catch (Exception ex)
{
Expand Down Expand Up @@ -314,11 +299,9 @@ private void ButtonReloadImage_Click(object sender, EventArgs e)
ProgressBarReload.Maximum = Pages.Count;
int index = 0;

//PreviewThumb?.Dispose();
ImagePreviewButton.BackgroundImage?.Dispose();

ImagePreviewButton.BackgroundImage = null;
//PreviewThumb = null;

foreach (Page page in Pages)
{
Expand Down Expand Up @@ -347,39 +330,14 @@ private void ButtonReloadImage_Click(object sender, EventArgs e)
{
Task<Bitmap> imageTask = new Task<Bitmap>(() =>
{

Bitmap thumb = null;

try
{
thumb = FirstPage.GetThumbnailBitmap();
}
catch (PageMemoryIOException pme)
{
//ButtonOk.Enabled = false;
if (pme.ShowErrorDialog)
{
//ApplicationMessage.ShowException(pme);
}
}
catch (Exception xe)
{
//ButtonOk.Enabled = false;
//ApplicationMessage.ShowException(xe);
}
finally
{
FirstPage.FreeImage();
}

return thumb;
return FirstPage.GetThumbnailBitmap();
});

imageTask.ContinueWith(t =>
{
try
{
if (t.IsCompletedSuccessfully && t.Result != null)
if (t.IsCompletedSuccessfully)
{
Invoke(new Action(() =>
{
Expand All @@ -394,10 +352,24 @@ private void ButtonReloadImage_Click(object sender, EventArgs e)
}
}));
}
else
{
Invoke(new Action(() =>
{
//ButtonOk.Enabled = false;
if ((t.Exception.InnerException as ApplicationException).ShowErrorDialog)
{
ApplicationMessage.ShowException(t.Exception);
}
}));
}
}
catch (Exception ee)
{
ApplicationMessage.ShowException(ee);
Invoke(new Action(() =>
{
ApplicationMessage.ShowException(ee);
}));
}
finally
{
Expand Down Expand Up @@ -650,44 +622,14 @@ private void PageSettingsForm_Shown(object sender, EventArgs e)
{
Task<Bitmap> imageTask = new Task<Bitmap>(() =>
{
Bitmap thumb = null;

try
{
thumb = FirstPage.GetThumbnailBitmap();
}
catch (PageMemoryIOException pme)
{
Invoke(new Action(() =>
{
ButtonOk.Enabled = false;
if (pme.ShowErrorDialog)
{
ApplicationMessage.ShowException(pme);
}
}));


}
catch (Exception ex)
{
Invoke(new Action(() =>
{
ButtonOk.Enabled = false;
ApplicationMessage.ShowException(ex);
}));


}

return thumb;
return FirstPage.GetThumbnailBitmap();
});

imageTask.ContinueWith(t =>
{
try
{
if (t.IsCompletedSuccessfully && t.Result != null)
if (t.IsCompletedSuccessfully)
{
Invoke(new Action(() =>
{
Expand All @@ -702,10 +644,24 @@ private void PageSettingsForm_Shown(object sender, EventArgs e)
}
}));
}
else
{
Invoke(new Action(() =>
{
//ButtonOk.Enabled = false;
if ((t.Exception.InnerException as ApplicationException).ShowErrorDialog)
{
ApplicationMessage.ShowException(t.Exception);
}
}));
}
}
catch (Exception ee)
{
ApplicationMessage.ShowException(ee);
Invoke(new Action(() =>
{
ApplicationMessage.ShowException(ee);
}));
}
finally
{
Expand Down

0 comments on commit afb9479

Please sign in to comment.