*/
using System;
-using System.Collections;
-using System.Collections.Generic;
namespace Tizen.Pims.Calendar
{
/// <summary>
/// A list of records with the same type.
/// </summary>
+ /// <since_tizen> 4 </since_tizen>
public class CalendarList:IDisposable
{
private Int64 _memoryPressure = 20;
{
_listHandle = handle;
- _memoryPressure += this.Count * CalendarViews.AverageSizeOfRecord;
+ int error = Interop.List.First(_listHandle);
+ if (CalendarError.None != (CalendarError)error)
+ {
+ Log.Error(Globals.LogTag, "MoveFirst Failed with error " + error);
+ throw CalendarErrorFactory.GetException(error);
+ }
+
+ _memoryPressure += this.Count * CalendarViews.Record.AverageSize;
GC.AddMemoryPressure(_memoryPressure);
}
/// <summary>
/// Creates a calendar list.
/// </summary>
- /// <exception cref="NotSupportedException">Thrown when an invoked method is not supported</exception>
+ /// <since_tizen> 4 </since_tizen>
+ /// <feature>http://tizen.org/feature/calendar</feature>
+ /// <exception cref="NotSupportedException">Thrown when feature is not supported</exception>
/// <exception cref="OutOfMemoryException">Thrown when failed due to out of memory</exception>
public CalendarList()
{
- int error = Interop.Calendar.List.Create(out _listHandle);
+ int error = Interop.List.Create(out _listHandle);
if (CalendarError.None != (CalendarError)error)
{
Log.Error(Globals.LogTag, "CalendarList Failed with error " + error);
GC.AddMemoryPressure(_memoryPressure);
}
- ~CalendarList()
- {
- Dispose(false);
- }
-
/// <summary>
/// The count of the calendar entity.
/// </summary>
+ /// <since_tizen> 4 </since_tizen>
+ /// <value>The count of calendar entity.</value>
public int Count
{
get
if (_count == -1)
{
int count = -1;
- int error = Interop.Calendar.List.GetCount(_listHandle, out count);
+ int error = Interop.List.GetCount(_listHandle, out count);
if (CalendarError.None != (CalendarError)error)
{
Log.Error(Globals.LogTag, "GetCount Failed with error " + error);
}
}
+ /// <summary>
+ /// Destroy CalendarList resource.
+ /// </summary>
+ ~CalendarList()
+ {
+ Dispose(false);
+ }
+
#region IDisposable Support
private bool disposedValue = false; // To detect redundant calls
+ /// <summary>
+ /// Disposes of the resources (other than memory) used by the CalendarList.
+ /// </summary>
+ /// <param name="disposing">true to release both managed and unmanaged resources; false to release only unmanaged resources.</param>
protected virtual void Dispose(bool disposing)
{
if (!disposedValue)
{
Log.Debug(Globals.LogTag, "Dispose :" + disposing);
- int error = Interop.Calendar.List.Destroy(_listHandle, true);
+ int error = Interop.List.Destroy(_listHandle, true);
if (CalendarError.None != (CalendarError)error)
{
Log.Error(Globals.LogTag, "Destroy Failed with error " + error);
- throw CalendarErrorFactory.GetException(error);
}
disposedValue = true;
GC.RemoveMemoryPressure(_memoryPressure);
/// <summary>
/// Releases all resources used by the CalendarList.
- /// It should be called after finished using of the object.
+ /// It should be called after having finished using of the object.
/// </summary>
public void Dispose()
{
Dispose(true);
+ GC.SuppressFinalize(this);
}
#endregion
/// <summary>
/// Adds a record to the calendar list.
/// </summary>
+ /// <since_tizen> 4 </since_tizen>
/// <param name="record">The record to be added</param>
- /// <exception cref="NotSupportedException">Thrown when an invoked method is not supported</exception>
- /// <exception cref="ArgumentException">Thrown when one of the arguments provided to a method is not valid</exception>
+ /// <feature>http://tizen.org/feature/calendar</feature>
+ /// <exception cref="NotSupportedException">Thrown when feature is not supported</exception>
public void AddRecord(CalendarRecord record)
{
- int error = Interop.Calendar.List.Add(_listHandle, record._recordHandle);
+ int error = Interop.List.Add(_listHandle, record._recordHandle);
if (CalendarError.None != (CalendarError)error)
{
Log.Error(Globals.LogTag, "AddRecord Failed with error " + error);
}
record._disposedValue = true;
_count = -1;
- _memoryPressure += CalendarViews.AverageSizeOfRecord;
+ _memoryPressure += CalendarViews.Record.AverageSize;
}
/// <summary>
/// Removes a record from the calendar list.
/// </summary>
+ /// <since_tizen> 4 </since_tizen>
/// <param name="record">The record to be removed</param>
- /// <exception cref="NotSupportedException">Thrown when an invoked method is not supported</exception>
- /// <exception cref="ArgumentException">Thrown when one of the arguments provided to a method is not valid</exception>
+ /// <feature>http://tizen.org/feature/calendar</feature>
+ /// <exception cref="NotSupportedException">Thrown when feature is not supported</exception>
public void RemoveRecord(CalendarRecord record)
{
- int error = Interop.Calendar.List.Remove(_listHandle, record._recordHandle);
+ int error = Interop.List.Remove(_listHandle, record._recordHandle);
if (CalendarError.None != (CalendarError)error)
{
Log.Error(Globals.LogTag, "RemoveRecord Failed with error " + error);
}
record._disposedValue = false;
_count = -1;
- _memoryPressure -= CalendarViews.AverageSizeOfRecord;
+ _memoryPressure -= CalendarViews.Record.AverageSize;
}
/// <summary>
/// Retrieves a record from the calendar list.
/// </summary>
+ /// <since_tizen> 4 </since_tizen>
/// <returns>
/// calendar record
/// </returns>
+ /// <feature>http://tizen.org/feature/calendar</feature>
+ /// <exception cref="NotSupportedException">Thrown when feature is not supported</exception>
public CalendarRecord GetCurrentRecord()
{
IntPtr handle;
- int error = Interop.Calendar.List.GetCurrentRecordP(_listHandle, out handle);
+ int error = Interop.List.GetCurrentRecordP(_listHandle, out handle);
if (CalendarError.None != (CalendarError)error)
{
Log.Error(Globals.LogTag, "GetCurrentRecord Failed with error " + error);
/// <summary>
/// Moves a calendar list to the previous position.
/// </summary>
+ /// <since_tizen> 4 </since_tizen>
/// <returns>
/// if cursor is moved to the end, it returns false.
/// </returns>
+ /// <feature>http://tizen.org/feature/calendar</feature>
+ /// <exception cref="NotSupportedException">Thrown when feature is not supported</exception>
public bool MovePrevious()
{
- int error = Interop.Calendar.List.Prev(_listHandle);
+ int error = Interop.List.Prev(_listHandle);
if (CalendarError.None == (CalendarError)error)
{
return true;
/// <summary>
/// Moves a calendar list to the next position.
/// </summary>
+ /// <since_tizen> 4 </since_tizen>
/// <returns>
/// if cursor is moved to the end, it returns false.
/// </returns>
+ /// <feature>http://tizen.org/feature/calendar</feature>
+ /// <exception cref="NotSupportedException">Thrown when feature is not supported</exception>
public bool MoveNext()
{
- int error = Interop.Calendar.List.Next(_listHandle);
+ int error = Interop.List.Next(_listHandle);
if (CalendarError.None == (CalendarError)error)
{
return true;
/// <summary>
/// Moves a calendar list to the first position.
/// </summary>
+ /// <since_tizen> 4 </since_tizen>
+ /// <feature>http://tizen.org/feature/calendar</feature>
+ /// <exception cref="NotSupportedException">Thrown when feature is not supported</exception>
public void MoveFirst()
{
- int error = Interop.Calendar.List.First(_listHandle);
+ int error = Interop.List.First(_listHandle);
if (CalendarError.None != (CalendarError)error)
{
Log.Error(Globals.LogTag, "MoveFirst Failed with error " + error);
/// <summary>
/// Moves a calendar list to the last position.
/// </summary>
+ /// <since_tizen> 4 </since_tizen>
+ /// <feature>http://tizen.org/feature/calendar</feature>
+ /// <exception cref="NotSupportedException">Thrown when feature is not supported</exception>
public void MoveLast()
{
- int error = Interop.Calendar.List.Last(_listHandle);
+ int error = Interop.List.Last(_listHandle);
if (CalendarError.None != (CalendarError)error)
{
Log.Error(Globals.LogTag, "MoveLast Failed with error " + error);