Beispiel #1
0
        /// <summary>
        /// Inserts a sticker data using JSON file.
        /// </summary>
        /// <since_tizen> 10 </since_tizen>
        /// <feature>http://tizen.org/feature/ui_service.sticker</feature>
        /// <remarks>
        /// All data except thumbnail, description, and display_type must be set in the JSON file to insert the sticker data.
        /// <paramref name="jsonPath"/> must have a non-null value and must be an existing file.
        /// If the URI type is local path, the sticker file is copied to a sticker directory.
        /// It is recommended to delete your sticker files after inserting a sticker data.
        /// </remarks>
        /// <param name="jsonPath">The path of JSON file containing sticker data to be saved</param>
        /// <exception cref="NotSupportedException">The required feature is not supported.</exception>
        /// <exception cref="ArgumentException">This exception can be due to an invalid parameter.</exception>
        /// <exception cref="InvalidOperationException">This exception can be due to operation failed.</exception>
        public static Task InsertData(string jsonPath)
        {
            var task = new TaskCompletionSource <bool>();

            _insertDelegate = (ErrorCode errorCode, IntPtr userData) =>
            {
                if (errorCode != ErrorCode.None)
                {
                    Log.Error(LogTag, "Exception occurred while inserting");
                    throw ExceptionFactory.CreateException(errorCode);
                }
                else
                {
                    task.SetResult(true);
                }
            };
            ErrorCode error = StickerProviderInsertDataByJsonFile(_handle, jsonPath, _insertDelegate, IntPtr.Zero);

            if (error != ErrorCode.None)
            {
                Log.Error(LogTag, "InsertData Failed with error " + error);
                task.SetException(ExceptionFactory.CreateException(error));
            }
            return(task.Task);
        }
 internal static extern ErrorCode StickerProviderInsertDataByJsonFile(IntPtr stickerProvider, string jsonPath, StickerProviderInsertFinishedCallback callback, IntPtr userData);