Beispiel #1
0
        /// <summary>
        /// Sends the launch request asynchronously.
        /// </summary>
        /// <remarks>
        /// The operation is mandatory information for the launch request.
        /// If the operation is not specified, AppControlOperations.Default is used by default.
        /// If the operation is AppControlOperations.Default, the application ID is mandatory to explicitly launch the application.<br/>
        /// Since Tizen 2.4, the launch request of the service application over out of packages is restricted by the platform.
        /// Also, implicit launch requests are NOT delivered to service applications since 2.4.
        /// To launch a service application, an explicit launch request with the application ID given by property ApplicationId MUST be sent.
        /// </remarks>
        /// <param name="appControl">The AppControl.</param>
        /// <returns>A task with the result of the launch request.</returns>
        /// <exception cref="ArgumentException">Thrown when failed because of the argument is invalid.</exception>
        /// <exception cref="AppNotFoundException">Thrown when the application to run is not found.</exception>
        /// <exception cref="LaunchRejectedException">Thrown when the launch request is rejected.</exception>
        /// <privilege>http://tizen.org/privilege/appmanager.launch</privilege>
        internal Task <FrameBrokerBaseResult> SendLaunchRequest(AppControl appControl)
        {
            if (appControl == null)
            {
                throw FrameBrokerBaseErrorFactory.GetException(Interop.FrameBroker.ErrorCode.InvalidParameter, "Invalid parameter");
            }

            var task      = new TaskCompletionSource <FrameBrokerBaseResult>();
            int requestId = 0;

            lock (resultCallbackMaps)
            {
                requestId = resultId++;
                resultCallbackMaps[requestId] = (handle, result, userData) =>
                {
                    task.SetResult((FrameBrokerBaseResult)result);
                    lock (resultCallbackMaps)
                    {
                        resultCallbackMaps.Remove((int)userData);
                    }
                };
            }

            Interop.FrameBroker.ErrorCode err;
            err = Interop.FrameBroker.SendLaunchRequest(handle, appControl.SafeAppControlHandle, resultCallbackMaps[requestId], null, (IntPtr)requestId);

            if (err != Interop.FrameBroker.ErrorCode.None)
            {
                throw FrameBrokerBaseErrorFactory.GetException(err, "Failed to send launch request");
            }

            return(task.Task);
        }
 /// <summary>
 /// Notifies that the animation is finished.
 /// </summary>
 /// <exception cref="ArgumentException">Thrown when failed because of the argument is invalid.</exception>
 /// <exception cref="InvalidOperationException">Thrown when failed because of system error.</exception>
 internal void FinishAnimation()
 {
     Interop.FrameBroker.ErrorCode err = Interop.FrameBroker.FinishAnimation(context);
     if (err != Interop.FrameBroker.ErrorCode.None)
     {
         throw FrameBrokerBaseErrorFactory.GetException(err, "Failed to notify that the animation is finished");
     }
 }
        /// <summary>
        /// Initializes the FrameBroker class.
        /// </summary>
        /// <param name="window">The window instance of Ecore_Wl2_Window pointer.</param>
        /// <exception cref="ArgumentException">Thrown when failed because of an invalid parameter.</exception>
        /// <exception cref="Applications.Exceptions.OutOfMemoryException">Thrown when the memory is insufficient.</exception>
        /// <exception cref="InvalidOperationException">Thrown when failed to create the frame broker handle.</exception>
        /// <remarks>This class is only avaliable for platform level signed applications.</remarks>
        internal FrameBrokerBase(Window window)
        {
            Interop.FrameBroker.ErrorCode err;

            if (window == null)
            {
                throw FrameBrokerBaseErrorFactory.GetException(Interop.FrameBroker.ErrorCode.InvalidParameter, "Invalid parameter");
            }

            callbacks.OnCreate  = new Interop.FrameBroker.FrameContextCreateCallback(OnCreateNative);
            callbacks.OnResume  = new Interop.FrameBroker.FrameContextResumeCallback(OnResumeNavie);
            callbacks.OnPause   = new Interop.FrameBroker.FrameContextPauseCallback(OnPauseNative);
            callbacks.OnDestroy = new Interop.FrameBroker.FrameContextDestroyCallback(OnDestroyNative);
            callbacks.OnError   = new Interop.FrameBroker.FrameContextErrorCallback(OnErrorNative);
            callbacks.OnUpdate  = new Interop.FrameBroker.FrameContextUpdateCallback(OnUpdateNative);

            err = Interop.FrameBroker.Create(window.GetNativeWindowHandler(), ref callbacks, IntPtr.Zero, out handle);
            if (err != Interop.FrameBroker.ErrorCode.None)
            {
                throw FrameBrokerBaseErrorFactory.GetException(err, "Failed to create frame broker handle");
            }
        }