Ejemplo n.º 1
0
        /// <summary>
        /// Attempts to cancel a previously requested invite sending process. If invite dialog has not yet been completed by the user, this request will
        /// dismiss the dialog and cancel the invite sending process. Otherwise this operation will return an error.
        /// </summary>
        /// <returns>
        /// <para>MLResult.Result will be <c>MLResult.Code.Ok</c> if invite was successfully cancelled.</para>
        /// <para>MLResult.Result will be <c>MLResult.Code.UnspecifiedFailure</c> if there was an unexpected failure.</para>
        /// <para>MLResult.Result will be <c>MLResult.Code.PrivilegeDenied</c> if permissions haven't been granted to make this API call.</para>
        /// <para>MLResult.Result will be <c>MLResult.Code.ConnectionsInvalidHandle</c> if input handle is invalid.</para>
        /// <para>MLResult.Result will be <c>MLResult.Code.ConnectionsCancellationPending</c> if the invite request has been found and the system is attempting to cancel the process.</para>
        /// </returns>
        public static MLResult CancelSentInvite()
        {
            if (MLConnections.IsValidInstance())
            {
                MLResult.Code resultCode = NativeBindings.MLConnectionsCancelInvite(_instance.requestHandle);
                MLResult      result     = MLResult.Create(resultCode);

                if (!result.IsOk && (result.Result != MLResult.Code.ConnectionsCancellationPending))
                {
                    MLPluginLog.ErrorFormat("MLConnections.CancelSentInvite failed to cancel the sent invite. Reason: {0}", result);
                }

                return(result);
            }
            else
            {
                MLPluginLog.ErrorFormat("MLConnections.CancelSentInvite failed. Reason: No Instance for MLConnections");
                return(MLResult.Create(MLResult.Code.UnspecifiedFailure, "MLConnections.CancelSentInvite failed. Reason: No Instance for MLConnections"));
            }
        }