This repository has been archived by the owner on Nov 7, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
exceptions.cs
executable file
·83 lines (71 loc) · 2.56 KB
/
exceptions.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
/*---------------------------------------------------------------------
Copyright (C) Microsoft Corporation. All rights reserved.
This source code is intended only as a supplement to Microsoft
Development Tools and/or on-line documentation. See these other
materials for detailed information regarding Microsoft code samples.
THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
PARTICULAR PURPOSE.
----------------------------------------------------------------------- *
* File: Exceptions.cs
*
* Purpose: Managed representation of the IExceptions interface
*
*
* Notes:
* This is a wrapper around a collection of Exceptions.
*
*/
namespace PocketOutlook
{
using System;
using System.Runtime.InteropServices;
public class Exceptions
{
private Application m_application;
private Appointment m_appointment;
private IntPtr m_pIExceptions;
internal Exceptions(Application application, Appointment appointment, IntPtr pIExceptions)
{
m_application = application;
m_appointment = appointment;
m_pIExceptions = pIExceptions;
}
public int Count
{
get
{
int nCount = 0;
PocketOutlook.CheckHRESULT(do_get_Count(m_pIExceptions, ref nCount));
return nCount;
}
}
public Application Application
{
get
{
return m_application;
}
}
public AppointmentException Item(int iIndex)
{
IntPtr pIException = new IntPtr(0);
int hResult = do_Item(m_pIExceptions, iIndex, ref pIException);
try
{
PocketOutlook.CheckHRESULT(hResult);
}
catch (Exception)
{
PocketOutlook.ReleaseCOMPtr(pIException);
throw;
}
return new AppointmentException(m_application, m_appointment, pIException);
}
[DllImport("PocketOutlook.dll", EntryPoint="IExceptions_get_Count")]
private static extern int do_get_Count(IntPtr pIException, ref int rnCount);
[DllImport("PocketOutlook.dll", EntryPoint="IExceptions_Item")]
private static extern int do_Item(IntPtr pIException, int iIndex, ref IntPtr rpIException);
}
}