本文整理汇总了C#中MainForm.CheckHRESULT方法的典型用法代码示例。如果您正苦于以下问题:C# MainForm.CheckHRESULT方法的具体用法?C# MainForm.CheckHRESULT怎么用?C# MainForm.CheckHRESULT使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MainForm
的用法示例。
在下文中一共展示了MainForm.CheckHRESULT方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CheckGetBitmapSource
void CheckGetBitmapSource(MainForm form, DataEntry[] de, Func<IWICBitmapSource> method, WinCodecError error)
{
IWICBitmapSource bs = null;
try
{
bs = method();
}
catch (Exception e)
{
form.CheckHRESULT(this, error, e, de);
}
finally
{
bs.ReleaseComObject();
}
}
示例2: CheckGetColorContexts
void CheckGetColorContexts(MainForm form, DataEntry[] de, Func<uint, IWICColorContext[], uint> method)
{
IWICColorContext[] contexts = null;
IWICImagingFactory factory = new WICImagingFactory() as IWICImagingFactory;
try
{
try
{
contexts = new IWICColorContext[method(0, null)];
}
catch (Exception e)
{
form.CheckHRESULT(this, WinCodecError.WINCODEC_ERR_UNSUPPORTEDOPERATION, e, "0, NULL", de);
return;
}
if (contexts.Length > 0)
{
for (int i = 0; i < contexts.Length; i++)
{
contexts[i] = factory.CreateColorContext();
}
try
{
method((uint)contexts.Length, contexts);
int index = 0;
foreach (IWICColorContext c in contexts)
{
if (c == null)
{
form.Add(this, method.ToString(Resources._0_NULLItem), de, new DataEntry(Resources.Index, index));
}
index++;
}
}
catch (Exception e)
{
form.Add(this, method.ToString(Resources._0_Failed), de, new DataEntry(e));
}
}
}
finally
{
contexts.ReleaseComObject();
factory.ReleaseComObject();
}
}
示例3: CheckCopyPalette
void CheckCopyPalette(MainForm form, DataEntry[] de, Action<IWICPalette> method)
{
IWICImagingFactory factory = (IWICImagingFactory)new WICImagingFactory();
IWICPalette palette = factory.CreatePalette();
try
{
method(palette);
try
{
if (palette.GetColorCount() == 0)
{
form.Add(this, method.ToString(Resources._0_ZeroColorPalette), de);
}
}
catch (Exception e)
{
form.Add(this, method.ToString(Resources._0_IncorrectStatePalette), de, new DataEntry(e));
}
}
catch (Exception e)
{
form.CheckHRESULT(this, WinCodecError.WINCODEC_ERR_PALETTEUNAVAILABLE, e, de);
}
finally
{
palette.ReleaseComObject();
factory.ReleaseComObject();
}
}