Ejemplo n.º 1
0
        /// <summary>
        /// Represents the immutable class for the attach panel.
        /// </summary>
        /// <since_tizen> 4 </since_tizen>
        /// <param name="conformant">The caller's conformant.</param>
        /// <exception cref="OutOfMemoryException">Thrown when an attempt to allocate the memory fails.</exception>
        /// <exception cref="InvalidOperationException">Thrown when the AttachPanel already exists or the <paramref name="conformant"/> is not a conformant object.</exception>
        public AttachPanel(Conformant conformant)
        {
            if (conformant == IntPtr.Zero)
            {
                throw new ArgumentNullException("Use the value property, not null value");
            }

            IntPtr candidateAttachPanel = new IntPtr();

            Interop.AttachPanel.ErrorCode err = Interop.AttachPanel.CreateAttachPanel(conformant, ref candidateAttachPanel);
            CheckException(err);

            Tizen.Log.Debug("AttachPanelSharp", "Success to create an AttachPanel Instance");
            isCreationSucceed = true;
            _attachPanel      = candidateAttachPanel;

            if (_eventEventHandler == null)
            {
                StateEventListenStart();
            }

            if (_resultEventHandler == null)
            {
                ResultEventListenStart();
            }
        }
Ejemplo n.º 2
0
        internal static void CheckException(Interop.AttachPanel.ErrorCode err)
        {
            switch (err)
            {
            case Interop.AttachPanel.ErrorCode.InvalidParameter:
                throw new ArgumentOutOfRangeException("Invalid parameter error at unmanaged code");

            case Interop.AttachPanel.ErrorCode.OutOfMemory:
                throw new OutOfMemoryException("Out of Memory");

            case Interop.AttachPanel.ErrorCode.PermissionDenied:
                throw new UnauthorizedAccessException();

            case Interop.AttachPanel.ErrorCode.AlreadyExists:
                throw new InvalidOperationException("Already Exists");

            case Interop.AttachPanel.ErrorCode.NotInitialized:
                throw new InvalidOperationException("Not initialized");

            case Interop.AttachPanel.ErrorCode.UnsupportedContentCategory:
                throw new NotSupportedException("Unsupported Content Category");

            case Interop.AttachPanel.ErrorCode.AlreadyDestroyed:
                throw new InvalidOperationException("Already Destroyed");
            }
        }
Ejemplo n.º 3
0
        private void StateEventListenStart()
        {
            Interop.AttachPanel.ErrorCode err = 0;

            SetEventListener = (attachPanel, eventType, eventInfo, userData) =>
            {
                _eventEventHandler?.Invoke(null, new StateEventArgs((EventType)eventType));
            };
            err = Interop.AttachPanel.SetEventCb(_attachPanel, SetEventListener, IntPtr.Zero);
            CheckException(err);
        }
Ejemplo n.º 4
0
 private void ResultEventListenStart()
 {
     Interop.AttachPanel.ErrorCode err = 0;
     SetResultListener = (attachPanel, category, resulthandler, resultCode, userData) =>
     {
         SafeAppControlHandle handle = new SafeAppControlHandle(resulthandler, false);
         AppControl           result = new AppControl(handle);
         _resultEventHandler?.Invoke(null, new ResultEventArgs((ContentCategory)category, result, (AppControlReplyResult)resultCode));
     };
     err = Interop.AttachPanel.SetResultCb(_attachPanel, SetResultListener, IntPtr.Zero);
     CheckException(err);
 }
Ejemplo n.º 5
0
        /// <summary>
        /// Adds a content category in the AttachPanel.
        /// </summary>
        /// <param name="category">The ContentCategory to be added in the AttachPanel.</param>
        /// <param name="extraData">The AttachPanel sends some information using the Bundle.</param>
        /// <privilege>http://tizen.org/privilege/mediastorage</privilege>
        /// <privilege>http://tizen.org/privilege/camera</privilege>
        /// <privilege>http://tizen.org/privilege/recorder</privilege>
        /// <privilege>http://tizen.org/privilege/appmanager.launch</privilege>
        /// <feature>http://tizen.org/feature/camera</feature>
        /// <feature>http://tizen.org/feature/microphone</feature>
        /// <remarks>
        /// The caller application has to check the return value of this function.
        /// Content categories will be shown as the sequence of using AddCategory.
        /// Some contents need time to load it all.
        /// So, it is needed to use this before the mainloop of the Show.
        /// Privileges,
        /// http://tizen.org/privilege/mediastorage, for using Image or Camera.
        /// http://tizen.org/privilege/camera, for using Camera or TakePicture.
        /// http://tizen.org/privilege/recorder, for using Voice.
        /// http://tizen.org/privilege/appmanager.launch, for adding content categories on the More tab.
        /// http://tizen.org/feature/camera, for using Camera or TakePicture.
        /// http://tizen.org/feature/microphone, for using Voice.
        /// Deliver more information to the callee with a bundle if you need.
        /// http://tizen.org/appcontrol/data/total_count
        /// http://tizen.org/appcontrol/data/total_size
        /// </remarks>
        /// <exception cref="ArgumentOutOfRangeException">Thrown when the <paramref name="category"/> is not a valid category.</exception>
        /// <exception cref="UnauthorizedAccessException">Thrown when the application does not have the privilege to access this method.</exception>
        /// <exception cref="NotSupportedException">Thrown when the device does not support the <paramref name="category"/> feature.</exception>
        /// <exception cref="InvalidOperationException">Thrown when the AttachPanel is not created yet or is already destroyed.</exception>
        /// <since_tizen> 4 </since_tizen>
        public void AddCategory(ContentCategory category, Bundle extraData)
        {
            IntPtr bundle = IntPtr.Zero;

            if (extraData != null)
            {
                bundle = extraData.SafeBundleHandle.DangerousGetHandle();
            }

            Interop.AttachPanel.ErrorCode err = Interop.AttachPanel.AddCategory(_attachPanel, (int)category, bundle);
            CheckException(err);
        }
Ejemplo n.º 6
0
 /// <summary>
 /// Hides the attach panel and selects whether or not to animate.
 /// </summary>
 /// <param name="animation">A flag which turns on or turns off the animation while the attach panel is hiding.</param>
 /// <exception cref="InvalidOperationException">Thrown when the AttachPanel is destroyed.</exception>
 /// <since_tizen> 4 </since_tizen>
 public void Hide(bool animation)
 {
     if (animation)
     {
         Interop.AttachPanel.ErrorCode err = Interop.AttachPanel.Hide(_attachPanel);
         CheckException(err);
     }
     else
     {
         Interop.AttachPanel.ErrorCode err = Interop.AttachPanel.HideWithoutAnimation(_attachPanel);
         CheckException(err);
     }
 }
Ejemplo n.º 7
0
        /// <summary>
        /// Sets the extraData to be sent to the ContentCategory using a Bundle.
        /// </summary>
        /// <param name="category">The ContentCategory that some information is to be set, in the AttachPanel.</param>
        /// <param name="extraData">The AttachPanel sends some information using a Bundle.</param>
        /// <exception cref="ArgumentOutOfRangeException">Thrown when the <paramref name="category"/> is not a valid category.</exception>
        /// <exception cref="InvalidOperationException">Thrown when the AttachPanel is destroyed.</exception>
        /// <exception cref="OutOfMemoryException">Thrown when an attempt to allocate the memory fails.</exception>
        /// <since_tizen> 4 </since_tizen>
        public void SetExtraData(ContentCategory category, Bundle extraData)
        {
            if (extraData == null)
            {
                CheckException(Interop.AttachPanel.ErrorCode.InvalidParameter);
            }

            IntPtr bundle = IntPtr.Zero;

            if (extraData != null)
            {
                bundle = extraData.SafeBundleHandle.DangerousGetHandle();
            }

            Interop.AttachPanel.ErrorCode err = Interop.AttachPanel.SetExtraData(_attachPanel, (int)category, bundle);
            CheckException(err);
        }
Ejemplo n.º 8
0
 private void ResultEventListenStop()
 {
     Interop.AttachPanel.ErrorCode err = 0;
     err = Interop.AttachPanel.UnsetResultCb(_attachPanel);
     CheckException(err);
 }
Ejemplo n.º 9
0
 /// <summary>
 /// Hides the attach panel with the animations.
 /// </summary>
 /// <exception cref="InvalidOperationException">Thrown when the AttachPanel is destroyed.</exception>
 /// <since_tizen> 4 </since_tizen>
 public void Hide()
 {
     Interop.AttachPanel.ErrorCode err = Interop.AttachPanel.Hide(_attachPanel);
     CheckException(err);
 }
Ejemplo n.º 10
0
 /// <summary>
 /// Shows the attach panel with the animations.
 /// </summary>
 /// <exception cref="InvalidOperationException">Thrown when the AttachPanel is destroyed.</exception>
 /// <since_tizen> 4 </since_tizen>
 public void Show()
 {
     Interop.AttachPanel.ErrorCode err = Interop.AttachPanel.Show(_attachPanel);
     CheckException(err);
 }
Ejemplo n.º 11
0
 /// <summary>
 /// Removes the ContentCategory from the AttachPanel.
 /// </summary>
 /// <param name="category">The ContentCategory to be added in the AttachPanel.</param>
 ///  <exception cref="ArgumentOutOfRangeException">Thrown when the <paramref name="category"/> is not a valid category.</exception>
 /// <exception cref="InvalidOperationException">Thrown when the AttachPanel is not created yet or is already destroyed.</exception>
 /// <since_tizen> 4 </since_tizen>
 public void RemoveCategory(ContentCategory category)
 {
     Interop.AttachPanel.ErrorCode err = Interop.AttachPanel.RemoveCategory(_attachPanel, (int)category);
     CheckException(err);
 }