From ee6b77c41401c0726b23ba47d4b407ea1babcc34 Mon Sep 17 00:00:00 2001 From: Jeesun Kim Date: Mon, 4 Sep 2017 14:28:01 +0900 Subject: [PATCH] [Calendar] Fix Validator issues Change-Id: I6023c2bef1d161976714d02d022306b93375552d --- .../Tizen.Pims.Calendar/CalendarDatabase.cs | 35 ++++++++-------------- .../Tizen.Pims.Calendar/CalendarFilter.cs | 1 + .../Tizen.Pims.Calendar/CalendarList.cs | 2 +- .../Tizen.Pims.Calendar/CalendarManager.cs | 3 +- .../Tizen.Pims.Calendar/CalendarReminder.cs | 3 +- .../Tizen.Pims.Calendar/CalendarStructs.cs | 14 +++++++-- .../Tizen.Pims.Calendar/CalendarTypes.cs | 6 ++-- .../Tizen.Pims.Calendar/CalendarVcalendar.cs | 5 ++-- .../Tizen.Pims.Calendar/CalendarViews.cs | 27 +++++++++-------- .../Tizen.Pims.Calendar/ReminderEventArgs.cs | 6 ++-- 10 files changed, 54 insertions(+), 48 deletions(-) diff --git a/src/Tizen.Pims.Calendar/Tizen.Pims.Calendar/CalendarDatabase.cs b/src/Tizen.Pims.Calendar/Tizen.Pims.Calendar/CalendarDatabase.cs index 0b75c81..acd1670 100644 --- a/src/Tizen.Pims.Calendar/Tizen.Pims.Calendar/CalendarDatabase.cs +++ b/src/Tizen.Pims.Calendar/Tizen.Pims.Calendar/CalendarDatabase.cs @@ -19,18 +19,19 @@ using System.Collections.Generic; using System.Runtime.InteropServices; using System.Diagnostics.CodeAnalysis; -/// -/// The Calendar Service API provides functions, enumerations used in the entire Content Service. -/// -/// -/// The Calendar Service API provides functions and ienumerations used in the entire Content Service. -/// The Information about calendar items i.e. book, event, todo, alarm, attendee and extended are managed in the database -/// and operations that involve database requires an active connection with the calendar service. -/// - namespace Tizen.Pims.Calendar { /// + /// Delegate for detecting the calendar database changes. + /// + /// The record uri + /// + /// The delegate must be registered using AddDBChangedDelegate. + /// It's invoked when the designated view changes. + /// + public delegate void CalendarDBChanged(string uri); + + /// /// CalendarDatabase provides methods to manage calendar information from/to the database. /// /// @@ -38,16 +39,6 @@ namespace Tizen.Pims.Calendar /// public class CalendarDatabase { - /// - /// Delegete for detecting the calendar database changes. - /// - /// The record uri - /// - /// The delegate must be registered using AddDBChangedDelegate. - /// It's invoked when the designated view changes. - /// - public delegate void CalendarDBChanged(string uri); - private Object thisLock = new Object(); private Dictionary _callbackMap = new Dictionary(); private Dictionary _delegateMap = new Dictionary(); @@ -430,7 +421,7 @@ namespace Tizen.Pims.Calendar /// The view URI to get records from /// The calendar book ID to filter /// The calendar database version - /// + /// The current calendar database versio> /// /// The record list /// @@ -518,7 +509,7 @@ namespace Tizen.Pims.Calendar Log.Error(Globals.LogTag, "AddDBChangedDelegate Failed with error " + error); throw CalendarErrorFactory.GetException(error); } - _callbackMap[viewUri] = callback; + _callbackMap[viewUri] += callback; _delegateMap[viewUri] = _dbChangedDelegate; } @@ -539,7 +530,7 @@ namespace Tizen.Pims.Calendar Log.Error(Globals.LogTag, "RemoveDBChangedDelegate Failed with error " + error); throw CalendarErrorFactory.GetException(error); } - _callbackMap.Remove(viewUri); + _callbackMap[viewUri] -= callback; _delegateMap.Remove(viewUri); } diff --git a/src/Tizen.Pims.Calendar/Tizen.Pims.Calendar/CalendarFilter.cs b/src/Tizen.Pims.Calendar/Tizen.Pims.Calendar/CalendarFilter.cs index 431fb1b..9ca6b53 100644 --- a/src/Tizen.Pims.Calendar/Tizen.Pims.Calendar/CalendarFilter.cs +++ b/src/Tizen.Pims.Calendar/Tizen.Pims.Calendar/CalendarFilter.cs @@ -267,6 +267,7 @@ namespace Tizen.Pims.Calendar /// /// Dispose /// + /// true to release both managed and unmanaged resources; false to release only unmanaged resources. protected virtual void Dispose(bool disposing) { if (!disposedValue) diff --git a/src/Tizen.Pims.Calendar/Tizen.Pims.Calendar/CalendarList.cs b/src/Tizen.Pims.Calendar/Tizen.Pims.Calendar/CalendarList.cs index 0c5ac4a..c462db9 100644 --- a/src/Tizen.Pims.Calendar/Tizen.Pims.Calendar/CalendarList.cs +++ b/src/Tizen.Pims.Calendar/Tizen.Pims.Calendar/CalendarList.cs @@ -74,7 +74,7 @@ namespace Tizen.Pims.Calendar } /// - /// Destory CalendarList resource. + /// Destroy CalendarList resource. /// ~CalendarList() { diff --git a/src/Tizen.Pims.Calendar/Tizen.Pims.Calendar/CalendarManager.cs b/src/Tizen.Pims.Calendar/Tizen.Pims.Calendar/CalendarManager.cs index cce5eb0..d289ec4 100644 --- a/src/Tizen.Pims.Calendar/Tizen.Pims.Calendar/CalendarManager.cs +++ b/src/Tizen.Pims.Calendar/Tizen.Pims.Calendar/CalendarManager.cs @@ -15,7 +15,6 @@ */ using System; -using System.Diagnostics.CodeAnalysis; namespace Tizen.Pims.Calendar { @@ -42,7 +41,7 @@ namespace Tizen.Pims.Calendar } /// - /// Destory CalendarManager resource. + /// Destroy CalendarManager resource. /// ~CalendarManager() { diff --git a/src/Tizen.Pims.Calendar/Tizen.Pims.Calendar/CalendarReminder.cs b/src/Tizen.Pims.Calendar/Tizen.Pims.Calendar/CalendarReminder.cs index 4063591..f5e3760 100644 --- a/src/Tizen.Pims.Calendar/Tizen.Pims.Calendar/CalendarReminder.cs +++ b/src/Tizen.Pims.Calendar/Tizen.Pims.Calendar/CalendarReminder.cs @@ -52,6 +52,7 @@ namespace Tizen.Pims.Calendar public void Dispose() { Dispose(true); + GC.SuppressFinalize(this); } #endregion @@ -78,7 +79,6 @@ namespace Tizen.Pims.Calendar if (CalendarError.None != (CalendarError)error) { Log.Error(Globals.LogTag, "Add reminder Failed with error " + error); - throw CalendarErrorFactory.GetException(error); } } s_reminderAlerted += value; @@ -96,7 +96,6 @@ namespace Tizen.Pims.Calendar if (CalendarError.None != (CalendarError)error) { Log.Error(Globals.LogTag, "Remove reminder Failed with error " + error); - throw CalendarErrorFactory.GetException(error); } } } diff --git a/src/Tizen.Pims.Calendar/Tizen.Pims.Calendar/CalendarStructs.cs b/src/Tizen.Pims.Calendar/Tizen.Pims.Calendar/CalendarStructs.cs index 2087cc3..ed69c5b 100644 --- a/src/Tizen.Pims.Calendar/Tizen.Pims.Calendar/CalendarStructs.cs +++ b/src/Tizen.Pims.Calendar/Tizen.Pims.Calendar/CalendarStructs.cs @@ -81,7 +81,7 @@ namespace Tizen.Pims.Calendar /// /// Get localTime /// - /// The localtime + /// The Localtime public DateTime LocalTime { get; @@ -110,8 +110,18 @@ namespace Tizen.Pims.Calendar return LocalTime.CompareTo(other.LocalTime); } - public bool Equals(CalendarTime other) + /// + /// Equals CalendarTime + /// + /// The CalendarTime to be compared + /// + /// A 32-bit signed integer that indicates the relative order of the objects being compared. + /// + /// Thrown when one of the arguments provided to a method is not valid + /// Thrown when failed due to out of memory + public override bool Equals(object obj) { + var other = obj as CalendarTime; if (_type != other._type) { Log.Error(Globals.LogTag, "Not to compare with different type"); diff --git a/src/Tizen.Pims.Calendar/Tizen.Pims.Calendar/CalendarTypes.cs b/src/Tizen.Pims.Calendar/Tizen.Pims.Calendar/CalendarTypes.cs index 43bcf24..dbd1933 100644 --- a/src/Tizen.Pims.Calendar/Tizen.Pims.Calendar/CalendarTypes.cs +++ b/src/Tizen.Pims.Calendar/Tizen.Pims.Calendar/CalendarTypes.cs @@ -17,10 +17,10 @@ namespace Tizen.Pims.Calendar { /// - /// This class provides enumurations about calendar inforamtion. + /// This class provides enumurations about calendar information. /// /// - /// Most enumurations are based on vcalendar, icalendar(ver 2.0) specification. + /// Most enumerations are based on vcalendar, icalendar(ver 2.0) specification. /// https://www.ietf.org/rfc/rfc2445.txt /// public static class CalendarTypes @@ -276,7 +276,7 @@ namespace Tizen.Pims.Calendar /// Gregorian, /// - /// East asian lunisolar calendar + /// East Asian lunisolar calendar /// Lunisolar, } diff --git a/src/Tizen.Pims.Calendar/Tizen.Pims.Calendar/CalendarVcalendar.cs b/src/Tizen.Pims.Calendar/Tizen.Pims.Calendar/CalendarVcalendar.cs index c064da4..fc272b4 100644 --- a/src/Tizen.Pims.Calendar/Tizen.Pims.Calendar/CalendarVcalendar.cs +++ b/src/Tizen.Pims.Calendar/Tizen.Pims.Calendar/CalendarVcalendar.cs @@ -22,6 +22,7 @@ namespace Tizen.Pims.Calendar /// Parsing vcalendar file callback function. /// /// The record + /// public delegate bool ParseCallback(CalendarRecord record); /// @@ -76,7 +77,7 @@ namespace Tizen.Pims.Calendar } /// - /// Parse vcalendar file with foreach + /// Parse vcalendar file with ForEach /// /// The file path of the vCalendar stream file /// he callback function to invoke @@ -95,7 +96,7 @@ namespace Tizen.Pims.Calendar error = Interop.Vcalendar.ParseForEach(path, cb, IntPtr.Zero); if (CalendarError.None != (CalendarError)error) { - Log.Error(Globals.LogTag, "Parse foreach Vcalendar Failed [" + error + "]"); + Log.Error(Globals.LogTag, "Parse ForEach Vcalendar Failed [" + error + "]"); throw CalendarErrorFactory.GetException(error); } } diff --git a/src/Tizen.Pims.Calendar/Tizen.Pims.Calendar/CalendarViews.cs b/src/Tizen.Pims.Calendar/Tizen.Pims.Calendar/CalendarViews.cs index cd649a7..d711daa 100644 --- a/src/Tizen.Pims.Calendar/Tizen.Pims.Calendar/CalendarViews.cs +++ b/src/Tizen.Pims.Calendar/Tizen.Pims.Calendar/CalendarViews.cs @@ -62,6 +62,8 @@ namespace Tizen.Pims.Calendar internal enum Id : uint { + None, + /// book BookId = (Book|DataTypeInteger|PropertyReadOnly), BookUid = (Book|DataTypeString) + 1, @@ -341,7 +343,7 @@ namespace Tizen.Pims.Calendar } /// - /// Describes properies of a Book record. + /// Describes properties of a Book record. /// public static class Book { @@ -412,8 +414,9 @@ namespace Tizen.Pims.Calendar } /// - /// Describes properies of a Event record. + /// Describes properties of a Event record. /// + [SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords")] public static class Event { /// @@ -659,7 +662,7 @@ namespace Tizen.Pims.Calendar } /// - /// Describes properies of a Todo record. + /// Describes properties of a Todo record. /// public static class Todo { @@ -862,7 +865,7 @@ namespace Tizen.Pims.Calendar } /// - /// Describes properies of a Timezone record. + /// Describes properties of a Timezone record. /// public static class Timezone { @@ -933,7 +936,7 @@ namespace Tizen.Pims.Calendar } /// - /// Describes properies of a Attendee record. + /// Describes properties of a Attendee record. /// public static class Attendee { @@ -1000,7 +1003,7 @@ namespace Tizen.Pims.Calendar } /// - /// Describes properies of a Alarm record. + /// Describes properties of a Alarm record. /// public static class Alarm { @@ -1043,7 +1046,7 @@ namespace Tizen.Pims.Calendar } /// - /// Describes properies of a InstanceUtimeBook record. + /// Describes properties of a InstanceUtimeBook record. /// /// Read only view public static class InstanceUtimeBook @@ -1127,7 +1130,7 @@ namespace Tizen.Pims.Calendar } /// - /// Describes properies of a InstanceLocaltimeBook record. + /// Describes properties of a InstanceLocaltimeBook record. /// /// Read only view public static class InstanceLocaltimeBook @@ -1215,7 +1218,7 @@ namespace Tizen.Pims.Calendar } /// - /// Describes properies of a InstanceUtimeBookExtended record. + /// Describes properties of a InstanceUtimeBookExtended record. /// /// Read only view public static class InstanceUtimeBookExtended @@ -1323,7 +1326,7 @@ namespace Tizen.Pims.Calendar } /// - /// Describes properies of a InstanceLocaltimeBookExtended record. + /// Describes properties of a InstanceLocaltimeBookExtended record. /// /// Read only view public static class InstanceLocaltimeBookExtended @@ -1435,7 +1438,7 @@ namespace Tizen.Pims.Calendar } /// - /// Describes properies of a UpdatedInfo record. + /// Describes properties of a UpdatedInfo record. /// /// Read only view public static class UpdatedInfo @@ -1463,7 +1466,7 @@ namespace Tizen.Pims.Calendar } /// - /// Describes properies of a Extended record. + /// Describes properties of a Extended record. /// public static class Extended { diff --git a/src/Tizen.Pims.Calendar/Tizen.Pims.Calendar/ReminderEventArgs.cs b/src/Tizen.Pims.Calendar/Tizen.Pims.Calendar/ReminderEventArgs.cs index 678a093..aa4e020 100644 --- a/src/Tizen.Pims.Calendar/Tizen.Pims.Calendar/ReminderEventArgs.cs +++ b/src/Tizen.Pims.Calendar/Tizen.Pims.Calendar/ReminderEventArgs.cs @@ -15,7 +15,6 @@ */ using System; -using System.Collections.Generic; namespace Tizen.Pims.Calendar { @@ -31,8 +30,11 @@ namespace Tizen.Pims.Calendar } /// - /// The paramter which data is combinded(Value string like id=value&time=value&tick=value&unit=value&type=value) + /// The parameter which data is combinded. /// + /// + /// The combination of reminder data(Value string like id=value&time=value&tick=value&unit=value&type=value) + /// public string Param { get; -- 2.7.4