2 * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the License);
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an AS IS BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
19 namespace Tizen.Pims.Calendar
22 /// A class for managing calendar information. It allows applications to use calendar service.
24 /// <since_tizen> 4 </since_tizen>
25 public class CalendarManager : IDisposable
27 private CalendarDatabase _db = null;
32 /// <since_tizen> 4 </since_tizen>
33 /// <feature>http://tizen.org/privilege/calendar</feature>
34 /// <exception cref="NotSupportedException">Thrown when feature is not supported</exception>
35 /// <exception cref="InvalidOperationException">Thrown when method failed due to invalid operation</exception>
36 public CalendarManager()
38 int error = Interop.Service.Connect();
39 if (CalendarError.None != (CalendarError)error)
41 Log.Error(Globals.LogTag, "Connect Failed with error " + error);
42 throw CalendarErrorFactory.GetException(error);
44 _db = new CalendarDatabase();
48 /// Destroy CalendarManager resource.
55 #region IDisposable Support
56 /// To detect redundant calls
57 private bool disposedValue = false;
60 /// Disposes of the resources (other than memory) used by the CalendarManager.
62 /// <param name="disposing">true to release both managed and unmanaged resources; false to release only unmanaged resources.</param>
63 protected virtual void Dispose(bool disposing)
67 Log.Debug(Globals.LogTag, "Dispose :" + disposing);
69 int error = Interop.Service.Disconnect();
70 if (CalendarError.None != (CalendarError)error)
72 Log.Error(Globals.LogTag, "Disconnect Failed with error " + error);
73 throw CalendarErrorFactory.GetException(error);
80 /// Releases all resources used by the CalendarManager.
81 /// It should be called after having finished using of the object.
86 GC.SuppressFinalize(this);
93 /// <since_tizen> 4 </since_tizen>
94 /// <value>The database instance</value>
95 public CalendarDatabase Database