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 the calendar information. It allows the applications to use the calendar service.
24 /// <since_tizen> 4 </since_tizen>
25 public class CalendarManager : IDisposable
27 private CalendarDatabase _db = null;
30 /// Creates a manager.
32 /// <since_tizen> 4 </since_tizen>
33 /// <feature>http://tizen.org/feature/calendar</feature>
34 /// <exception cref="NotSupportedException">Thrown when the feature is not supported.</exception>
35 /// <exception cref="InvalidOperationException">Thrown when the method failed due to an 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 /// Destroys the 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 /// <since_tizen> 4 </since_tizen>
64 protected virtual void Dispose(bool disposing)
68 Log.Debug(Globals.LogTag, "Dispose :" + disposing);
70 int error = Interop.Service.Disconnect();
71 if (CalendarError.None != (CalendarError)error)
73 Log.Error(Globals.LogTag, "Disconnect Failed with error " + error);
80 /// Releases all the resources used by the CalendarManager.
81 /// It should be called after it has finished using the object.
83 /// <since_tizen> 4 </since_tizen>
87 GC.SuppressFinalize(this);
92 /// Gets the database.
94 /// <since_tizen> 4 </since_tizen>
95 /// <value>The database instance.</value>
96 public CalendarDatabase Database