/**
         * Checks if databaseTable exists by given database name.
         *
         * @param database      Database for databaseTable consulting.
         * @param databaseTable DatabaseTable object with the name of the databaseTable inside.
         * @return True if exists, false otherwise
         * @since v2.0
         */
        public bool ExistsTable(Database database, DatabaseTable databaseTable)
        {
            // Start logging elapsed time.
            long     tIn    = TimerUtil.CurrentTimeMillis();
            ILogging logger = AppRegistryBridge.GetInstance().GetLoggingBridge();

            if (logger != null)
            {
                logger.Log(ILoggingLogLevel.Debug, this.apiGroup.ToString(), "DatabaseBridge executing existsTable...");
            }

            bool result = false;

            if (this._delegate != null)
            {
                result = this._delegate.ExistsTable(database, databaseTable);
                if (logger != null)
                {
                    logger.Log(ILoggingLogLevel.Debug, this.apiGroup.ToString(), "DatabaseBridge executed 'existsTable' in " + (TimerUtil.CurrentTimeMillis() - tIn) + "ms.");
                }
            }
            else
            {
                if (logger != null)
                {
                    logger.Log(ILoggingLogLevel.Error, this.apiGroup.ToString(), "DatabaseBridge no delegate for 'existsTable'.");
                }
            }
            return(result);
        }
示例#2
0
        /**
         * Removes all existing listeners from receiving lifecycle events.
         *
         * @since v2.0
         */
        public void RemoveLifecycleListeners()
        {
            // Start logging elapsed time.
            long     tIn    = TimerUtil.CurrentTimeMillis();
            ILogging logger = AppRegistryBridge.GetInstance().GetLoggingBridge();

            if (logger != null)
            {
                logger.Log(ILoggingLogLevel.Debug, this.apiGroup.ToString(), "LifecycleBridge executing removeLifecycleListeners...");
            }

            if (this._delegate != null)
            {
                this._delegate.RemoveLifecycleListeners();
                if (logger != null)
                {
                    logger.Log(ILoggingLogLevel.Debug, this.apiGroup.ToString(), "LifecycleBridge executed 'removeLifecycleListeners' in " + (TimerUtil.CurrentTimeMillis() - tIn) + "ms.");
                }
            }
            else
            {
                if (logger != null)
                {
                    logger.Log(ILoggingLogLevel.Error, this.apiGroup.ToString(), "LifecycleBridge no delegate for 'removeLifecycleListeners'.");
                }
            }
        }
示例#3
0
        /**
         * Returns the current orientation of the device. Please note that this may be different from the orientation
         * of the display. For display orientation, use the IDisplay APIs.
         *
         * @return The current orientation of the device.
         * @since v2.0.5
         */
        public ICapabilitiesOrientation GetOrientationCurrent()
        {
            // Start logging elapsed time.
            long     tIn    = TimerUtil.CurrentTimeMillis();
            ILogging logger = AppRegistryBridge.GetInstance().GetLoggingBridge();

            if (logger != null)
            {
                logger.Log(ILoggingLogLevel.Debug, this.apiGroup.ToString(), "DeviceBridge executing getOrientationCurrent...");
            }

            ICapabilitiesOrientation result = ICapabilitiesOrientation.Unknown;

            if (this._delegate != null)
            {
                result = this._delegate.GetOrientationCurrent();
                if (logger != null)
                {
                    logger.Log(ILoggingLogLevel.Debug, this.apiGroup.ToString(), "DeviceBridge executed 'getOrientationCurrent' in " + (TimerUtil.CurrentTimeMillis() - tIn) + "ms.");
                }
            }
            else
            {
                if (logger != null)
                {
                    logger.Log(ILoggingLogLevel.Error, this.apiGroup.ToString(), "DeviceBridge no delegate for 'getOrientationCurrent'.");
                }
            }
            return(result);
        }
        /**
         * Determine whether the current file/folder can be read from.
         *
         * @param descriptor File descriptor of file or folder used for operation.
         * @return True if the folder/file is readable, false otherwise.
         * @since v2.0
         */
        public bool CanRead(FileDescriptor descriptor)
        {
            // Start logging elapsed time.
            long     tIn    = TimerUtil.CurrentTimeMillis();
            ILogging logger = AppRegistryBridge.GetInstance().GetLoggingBridge();

            if (logger != null)
            {
                logger.Log(ILoggingLogLevel.Debug, this.apiGroup.ToString(), "FileBridge executing canRead...");
            }

            bool result = false;

            if (this._delegate != null)
            {
                result = this._delegate.CanRead(descriptor);
                if (logger != null)
                {
                    logger.Log(ILoggingLogLevel.Debug, this.apiGroup.ToString(), "FileBridge executed 'canRead' in " + (TimerUtil.CurrentTimeMillis() - tIn) + "ms.");
                }
            }
            else
            {
                if (logger != null)
                {
                    logger.Log(ILoggingLogLevel.Error, this.apiGroup.ToString(), "FileBridge no delegate for 'canRead'.");
                }
            }
            return(result);
        }
        /**
         * Deletes from the device internal storage the entry/entries containing the specified key names.
         *
         * @param keys             Array with the key names to delete.
         * @param publicAccessName The name of the shared internal storage object (if needed).
         * @param callback         callback to be executed upon function result.
         * @since v2.0
         */
        public void DeleteSecureKeyValuePairs(string[] keys, string publicAccessName, ISecurityResultCallback callback)
        {
            // Start logging elapsed time.
            long     tIn    = TimerUtil.CurrentTimeMillis();
            ILogging logger = AppRegistryBridge.GetInstance().GetLoggingBridge();

            if (logger != null)
            {
                logger.Log(ILoggingLogLevel.Debug, this.apiGroup.ToString(), "SecurityBridge executing deleteSecureKeyValuePairs...");
            }

            if (this._delegate != null)
            {
                this._delegate.DeleteSecureKeyValuePairs(keys, publicAccessName, callback);
                if (logger != null)
                {
                    logger.Log(ILoggingLogLevel.Debug, this.apiGroup.ToString(), "SecurityBridge executed 'deleteSecureKeyValuePairs' in " + (TimerUtil.CurrentTimeMillis() - tIn) + "ms.");
                }
            }
            else
            {
                if (logger != null)
                {
                    logger.Log(ILoggingLogLevel.Error, this.apiGroup.ToString(), "SecurityBridge no delegate for 'deleteSecureKeyValuePairs'.");
                }
            }
        }
        /**
         * Returns the security type of the file
         *
         * @param descriptor File descriptor of file or folder used for operation.
         * @return Security Level of the file
         * @since v2.0
         */
        public IFileSystemSecurity GetSecurityType(FileDescriptor descriptor)
        {
            // Start logging elapsed time.
            long     tIn    = TimerUtil.CurrentTimeMillis();
            ILogging logger = AppRegistryBridge.GetInstance().GetLoggingBridge();

            if (logger != null)
            {
                logger.Log(ILoggingLogLevel.Debug, this.apiGroup.ToString(), "FileBridge executing getSecurityType...");
            }

            IFileSystemSecurity result = IFileSystemSecurity.Unknown;

            if (this._delegate != null)
            {
                result = this._delegate.GetSecurityType(descriptor);
                if (logger != null)
                {
                    logger.Log(ILoggingLogLevel.Debug, this.apiGroup.ToString(), "FileBridge executed 'getSecurityType' in " + (TimerUtil.CurrentTimeMillis() - tIn) + "ms.");
                }
            }
            else
            {
                if (logger != null)
                {
                    logger.Log(ILoggingLogLevel.Error, this.apiGroup.ToString(), "FileBridge no delegate for 'getSecurityType'.");
                }
            }
            return(result);
        }
        /**
         * Moves the current file to the given file destination, optionally overwriting and creating the path to the
         * new destination file.
         *
         * @param source      File descriptor of file or folder used for operation as source.
         * @param destination File descriptor of file or folder used for operation as destination.
         * @param createPath  True to create the path if it does not already exist.
         * @param callback    Result of the operation.
         * @param overwrite   True to create the path if it does not already exist.
         * @since v2.0
         */
        public void Move(FileDescriptor source, FileDescriptor destination, bool createPath, bool overwrite, IFileResultCallback callback)
        {
            // Start logging elapsed time.
            long     tIn    = TimerUtil.CurrentTimeMillis();
            ILogging logger = AppRegistryBridge.GetInstance().GetLoggingBridge();

            if (logger != null)
            {
                logger.Log(ILoggingLogLevel.Debug, this.apiGroup.ToString(), "FileBridge executing move...");
            }

            if (this._delegate != null)
            {
                this._delegate.Move(source, destination, createPath, overwrite, callback);
                if (logger != null)
                {
                    logger.Log(ILoggingLogLevel.Debug, this.apiGroup.ToString(), "FileBridge executed 'move' in " + (TimerUtil.CurrentTimeMillis() - tIn) + "ms.");
                }
            }
            else
            {
                if (logger != null)
                {
                    logger.Log(ILoggingLogLevel.Error, this.apiGroup.ToString(), "FileBridge no delegate for 'move'.");
                }
            }
        }
        /**
         * Invoke a phone call
         *
         * @param number to call
         * @return Status of the call
         * @since v2.0
         */
        public ITelephonyStatus Call(string number)
        {
            // Start logging elapsed time.
            long     tIn    = TimerUtil.CurrentTimeMillis();
            ILogging logger = AppRegistryBridge.GetInstance().GetLoggingBridge();

            if (logger != null)
            {
                logger.Log(ILoggingLogLevel.Debug, this.apiGroup.ToString(), "TelephonyBridge executing call...");
            }

            ITelephonyStatus result = ITelephonyStatus.Unknown;

            if (this._delegate != null)
            {
                result = this._delegate.Call(number);
                if (logger != null)
                {
                    logger.Log(ILoggingLogLevel.Debug, this.apiGroup.ToString(), "TelephonyBridge executed 'call' in " + (TimerUtil.CurrentTimeMillis() - tIn) + "ms.");
                }
            }
            else
            {
                if (logger != null)
                {
                    logger.Log(ILoggingLogLevel.Error, this.apiGroup.ToString(), "TelephonyBridge no delegate for 'call'.");
                }
            }
            return(result);
        }
示例#9
0
        /**
         * Gets the full application configured literals (key/message pairs) corresponding to the given locale.
         *
         * @param locale The locale object to get localized message, or the locale desciptor ("language" or "language-country" two-letters ISO codes.
         * @return Localized texts in the form of an object.
         * @since v2.0
         */
        public KeyPair[] GetResourceLiterals(Locale locale)
        {
            // Start logging elapsed time.
            long     tIn    = TimerUtil.CurrentTimeMillis();
            ILogging logger = AppRegistryBridge.GetInstance().GetLoggingBridge();

            if (logger != null)
            {
                logger.Log(ILoggingLogLevel.Debug, this.apiGroup.ToString(), "GlobalizationBridge executing getResourceLiterals...");
            }

            KeyPair[] result = null;
            if (this._delegate != null)
            {
                result = this._delegate.GetResourceLiterals(locale);
                if (logger != null)
                {
                    logger.Log(ILoggingLogLevel.Debug, this.apiGroup.ToString(), "GlobalizationBridge executed 'getResourceLiterals' in " + (TimerUtil.CurrentTimeMillis() - tIn) + "ms.");
                }
            }
            else
            {
                if (logger != null)
                {
                    logger.Log(ILoggingLogLevel.Error, this.apiGroup.ToString(), "GlobalizationBridge no delegate for 'getResourceLiterals'.");
                }
            }
            return(result);
        }
        /**
         * Whether the application dismiss the splash screen successfully or not
         *
         * @return true if the application has dismissed the splash screen;false otherwise
         * @since v2.0
         */
        public bool DismissSplashScreen()
        {
            // Start logging elapsed time.
            long     tIn    = TimerUtil.CurrentTimeMillis();
            ILogging logger = AppRegistryBridge.GetInstance().GetLoggingBridge();

            if (logger != null)
            {
                logger.Log(ILoggingLogLevel.Debug, this.apiGroup.ToString(), "RuntimeBridge executing dismissSplashScreen...");
            }

            bool result = false;

            if (this._delegate != null)
            {
                result = this._delegate.DismissSplashScreen();
                if (logger != null)
                {
                    logger.Log(ILoggingLogLevel.Debug, this.apiGroup.ToString(), "RuntimeBridge executed 'dismissSplashScreen' in " + (TimerUtil.CurrentTimeMillis() - tIn) + "ms.");
                }
            }
            else
            {
                if (logger != null)
                {
                    logger.Log(ILoggingLogLevel.Error, this.apiGroup.ToString(), "RuntimeBridge no delegate for 'dismissSplashScreen'.");
                }
            }
            return(result);
        }
        /**
         * Dismiss the current Application
         *
         * @since v2.0
         */
        public void DismissApplication()
        {
            // Start logging elapsed time.
            long     tIn    = TimerUtil.CurrentTimeMillis();
            ILogging logger = AppRegistryBridge.GetInstance().GetLoggingBridge();

            if (logger != null)
            {
                logger.Log(ILoggingLogLevel.Debug, this.apiGroup.ToString(), "RuntimeBridge executing dismissApplication...");
            }

            if (this._delegate != null)
            {
                this._delegate.DismissApplication();
                if (logger != null)
                {
                    logger.Log(ILoggingLogLevel.Debug, this.apiGroup.ToString(), "RuntimeBridge executed 'dismissApplication' in " + (TimerUtil.CurrentTimeMillis() - tIn) + "ms.");
                }
            }
            else
            {
                if (logger != null)
                {
                    logger.Log(ILoggingLogLevel.Error, this.apiGroup.ToString(), "RuntimeBridge no delegate for 'dismissApplication'.");
                }
            }
        }
示例#12
0
        /**
         * The type of context provided by the getContext method.
         *
         * @return Type of platform context.
         * @since v2.0
         */
        public IOSType GetContextType()
        {
            // Start logging elapsed time.
            long     tIn    = TimerUtil.CurrentTimeMillis();
            ILogging logger = AppRegistryBridge.GetInstance().GetLoggingBridge();

            if (logger != null)
            {
                logger.Log(ILoggingLogLevel.Debug, this.apiGroup.ToString(), "AppContextBridge executing getContextType...");
            }

            IOSType result = IOSType.Unknown;

            if (this._delegate != null)
            {
                result = this._delegate.GetContextType();
                if (logger != null)
                {
                    logger.Log(ILoggingLogLevel.Debug, this.apiGroup.ToString(), "AppContextBridge executed 'getContextType' in " + (TimerUtil.CurrentTimeMillis() - tIn) + "ms.");
                }
            }
            else
            {
                if (logger != null)
                {
                    logger.Log(ILoggingLogLevel.Error, this.apiGroup.ToString(), "AppContextBridge no delegate for 'getContextType'.");
                }
            }
            return(result);
        }
示例#13
0
        /**
         * Method for opening a URL like a link in the native default browser
         *
         * @param url Url to open
         * @return The result of the operation
         * @since v2.0
         */
        public bool OpenExtenalBrowser(string url)
        {
            // Start logging elapsed time.
            long     tIn    = TimerUtil.CurrentTimeMillis();
            ILogging logger = AppRegistryBridge.GetInstance().GetLoggingBridge();

            if (logger != null)
            {
                logger.Log(ILoggingLogLevel.Debug, this.apiGroup.ToString(), "BrowserBridge executing openExtenalBrowser...");
            }

            bool result = false;

            if (this._delegate != null)
            {
                result = this._delegate.OpenExtenalBrowser(url);
                if (logger != null)
                {
                    logger.Log(ILoggingLogLevel.Debug, this.apiGroup.ToString(), "BrowserBridge executed 'openExtenalBrowser' in " + (TimerUtil.CurrentTimeMillis() - tIn) + "ms.");
                }
            }
            else
            {
                if (logger != null)
                {
                    logger.Log(ILoggingLogLevel.Error, this.apiGroup.ToString(), "BrowserBridge no delegate for 'openExtenalBrowser'.");
                }
            }
            return(result);
        }
        /**
         * Creates a database on default path for every platform.
         *
         * @param callback Asynchronous callback
         * @param database Database object to create
         * @since v2.0
         */
        public void CreateDatabase(Database database, IDatabaseResultCallback callback)
        {
            // Start logging elapsed time.
            long     tIn    = TimerUtil.CurrentTimeMillis();
            ILogging logger = AppRegistryBridge.GetInstance().GetLoggingBridge();

            if (logger != null)
            {
                logger.Log(ILoggingLogLevel.Debug, this.apiGroup.ToString(), "DatabaseBridge executing createDatabase...");
            }

            if (this._delegate != null)
            {
                this._delegate.CreateDatabase(database, callback);
                if (logger != null)
                {
                    logger.Log(ILoggingLogLevel.Debug, this.apiGroup.ToString(), "DatabaseBridge executed 'createDatabase' in " + (TimerUtil.CurrentTimeMillis() - tIn) + "ms.");
                }
            }
            else
            {
                if (logger != null)
                {
                    logger.Log(ILoggingLogLevel.Error, this.apiGroup.ToString(), "DatabaseBridge no delegate for 'createDatabase'.");
                }
            }
        }
        /**
         * Returns the file system dependent file separator.
         *
         * @return char with the directory/file separator.
         * @since v2.0
         */
        public char GetSeparator()
        {
            // Start logging elapsed time.
            long     tIn    = TimerUtil.CurrentTimeMillis();
            ILogging logger = AppRegistryBridge.GetInstance().GetLoggingBridge();

            if (logger != null)
            {
                logger.Log(ILoggingLogLevel.Debug, this.apiGroup.ToString(), "FileSystemBridge executing getSeparator...");
            }

            char result = ' ';

            if (this._delegate != null)
            {
                result = this._delegate.GetSeparator();
                if (logger != null)
                {
                    logger.Log(ILoggingLogLevel.Debug, this.apiGroup.ToString(), "FileSystemBridge executed 'getSeparator' in " + (TimerUtil.CurrentTimeMillis() - tIn) + "ms.");
                }
            }
            else
            {
                if (logger != null)
                {
                    logger.Log(ILoggingLogLevel.Error, this.apiGroup.ToString(), "FileSystemBridge no delegate for 'getSeparator'.");
                }
            }
            return(result);
        }
示例#16
0
        /**
         * Send an Email
         *
         * @param data     Payload of the email
         * @param callback Result callback of the operation
         * @since v2.0
         */
        public void SendEmail(Email data, IMessagingCallback callback)
        {
            // Start logging elapsed time.
            long     tIn    = TimerUtil.CurrentTimeMillis();
            ILogging logger = AppRegistryBridge.GetInstance().GetLoggingBridge();

            if (logger != null)
            {
                logger.Log(ILoggingLogLevel.Debug, this.apiGroup.ToString(), "MailBridge executing sendEmail...");
            }

            if (this._delegate != null)
            {
                this._delegate.SendEmail(data, callback);
                if (logger != null)
                {
                    logger.Log(ILoggingLogLevel.Debug, this.apiGroup.ToString(), "MailBridge executed 'sendEmail' in " + (TimerUtil.CurrentTimeMillis() - tIn) + "ms.");
                }
            }
            else
            {
                if (logger != null)
                {
                    logger.Log(ILoggingLogLevel.Error, this.apiGroup.ToString(), "MailBridge no delegate for 'sendEmail'.");
                }
            }
        }
        /**
         * Creates a new reference to a new or existing location in the filesystem.
         * This method does not create the actual file in the specified folder.
         *
         * @param parent Parent directory.
         * @param name   Name of new file or directory.
         * @return A reference to a new or existing location in the filesystem.
         * @since v2.0
         */
        public FileDescriptor CreateFileDescriptor(FileDescriptor parent, string name)
        {
            // Start logging elapsed time.
            long     tIn    = TimerUtil.CurrentTimeMillis();
            ILogging logger = AppRegistryBridge.GetInstance().GetLoggingBridge();

            if (logger != null)
            {
                logger.Log(ILoggingLogLevel.Debug, this.apiGroup.ToString(), "FileSystemBridge executing createFileDescriptor...");
            }

            FileDescriptor result = null;

            if (this._delegate != null)
            {
                result = this._delegate.CreateFileDescriptor(parent, name);
                if (logger != null)
                {
                    logger.Log(ILoggingLogLevel.Debug, this.apiGroup.ToString(), "FileSystemBridge executed 'createFileDescriptor' in " + (TimerUtil.CurrentTimeMillis() - tIn) + "ms.");
                }
            }
            else
            {
                if (logger != null)
                {
                    logger.Log(ILoggingLogLevel.Error, this.apiGroup.ToString(), "FileSystemBridge no delegate for 'createFileDescriptor'.");
                }
            }
            return(result);
        }
        /**
         * Determines whether a specific Sensor capability is supported by the
         * device.
         *
         * @param type Type of feature to check.
         * @return true if supported, false otherwise.
         * @since v2.0
         */
        public bool HasSensorSupport(ICapabilitiesSensor type)
        {
            // Start logging elapsed time.
            long     tIn    = TimerUtil.CurrentTimeMillis();
            ILogging logger = AppRegistryBridge.GetInstance().GetLoggingBridge();

            if (logger != null)
            {
                logger.Log(ILoggingLogLevel.Debug, this.apiGroup.ToString(), "CapabilitiesBridge executing hasSensorSupport...");
            }

            bool result = false;

            if (this._delegate != null)
            {
                result = this._delegate.HasSensorSupport(type);
                if (logger != null)
                {
                    logger.Log(ILoggingLogLevel.Debug, this.apiGroup.ToString(), "CapabilitiesBridge executed 'hasSensorSupport' in " + (TimerUtil.CurrentTimeMillis() - tIn) + "ms.");
                }
            }
            else
            {
                if (logger != null)
                {
                    logger.Log(ILoggingLogLevel.Error, this.apiGroup.ToString(), "CapabilitiesBridge no delegate for 'hasSensorSupport'.");
                }
            }
            return(result);
        }
        /**
         * List all the files matching the speficied regex filter within this file/path reference. If the reference
         * is a file, it will not yield any results.
         *
         * @param descriptor File descriptor of file or folder used for operation.
         * @param regex      Filter (eg. *.jpg, *.png, Fil*) name string.
         * @param callback   Result of operation.
         * @since v2.0
         */
        public void ListFilesForRegex(FileDescriptor descriptor, string regex, IFileListResultCallback callback)
        {
            // Start logging elapsed time.
            long     tIn    = TimerUtil.CurrentTimeMillis();
            ILogging logger = AppRegistryBridge.GetInstance().GetLoggingBridge();

            if (logger != null)
            {
                logger.Log(ILoggingLogLevel.Debug, this.apiGroup.ToString(), "FileBridge executing listFilesForRegex...");
            }

            if (this._delegate != null)
            {
                this._delegate.ListFilesForRegex(descriptor, regex, callback);
                if (logger != null)
                {
                    logger.Log(ILoggingLogLevel.Debug, this.apiGroup.ToString(), "FileBridge executed 'listFilesForRegex' in " + (TimerUtil.CurrentTimeMillis() - tIn) + "ms.");
                }
            }
            else
            {
                if (logger != null)
                {
                    logger.Log(ILoggingLogLevel.Error, this.apiGroup.ToString(), "FileBridge no delegate for 'listFilesForRegex'.");
                }
            }
        }
        /**
         * Executes the given ServiceRequest and provides responses to the given callback handler.
         *
         * @param serviceRequest ServiceRequest with the request body.
         * @param callback       IServiceResultCallback to handle the ServiceResponse.
         * @since v2.0.6
         */
        public void InvokeService(ServiceRequest serviceRequest, IServiceResultCallback callback)
        {
            // Start logging elapsed time.
            long     tIn    = TimerUtil.CurrentTimeMillis();
            ILogging logger = AppRegistryBridge.GetInstance().GetLoggingBridge();

            if (logger != null)
            {
                logger.Log(ILoggingLogLevel.Debug, this.apiGroup.ToString(), "ServiceBridge executing invokeService...");
            }

            if (this._delegate != null)
            {
                this._delegate.InvokeService(serviceRequest, callback);
                if (logger != null)
                {
                    logger.Log(ILoggingLogLevel.Debug, this.apiGroup.ToString(), "ServiceBridge executed 'invokeService' in " + (TimerUtil.CurrentTimeMillis() - tIn) + "ms.");
                }
            }
            else
            {
                if (logger != null)
                {
                    logger.Log(ILoggingLogLevel.Error, this.apiGroup.ToString(), "ServiceBridge no delegate for 'invokeService'.");
                }
            }
        }
        /**
         * Sets the content of the file.
         *
         * @param descriptor File descriptor of file or folder used for operation.
         * @param content    Binary content to store in the file.
         * @param callback   Result of the operation.
         * @since v2.0
         */
        public void SetContent(FileDescriptor descriptor, byte[] content, IFileDataStoreResultCallback callback)
        {
            // Start logging elapsed time.
            long     tIn    = TimerUtil.CurrentTimeMillis();
            ILogging logger = AppRegistryBridge.GetInstance().GetLoggingBridge();

            if (logger != null)
            {
                logger.Log(ILoggingLogLevel.Debug, this.apiGroup.ToString(), "FileBridge executing setContent...");
            }

            if (this._delegate != null)
            {
                this._delegate.SetContent(descriptor, content, callback);
                if (logger != null)
                {
                    logger.Log(ILoggingLogLevel.Debug, this.apiGroup.ToString(), "FileBridge executed 'setContent' in " + (TimerUtil.CurrentTimeMillis() - tIn) + "ms.");
                }
            }
            else
            {
                if (logger != null)
                {
                    logger.Log(ILoggingLogLevel.Error, this.apiGroup.ToString(), "FileBridge no delegate for 'setContent'.");
                }
            }
        }
        /**
         * Checks whether a specific service, endpoint, function and method type is configured in the platform's
         * XML service definition file.
         *
         * @param serviceName  Service name.
         * @param endpointName Endpoint name.
         * @param functionName Function name.
         * @param method       Method type.
         * @return Returns true if the service is configured, false otherwise.
         * @since v2.0.6
         */
        public bool IsServiceRegistered(string serviceName, string endpointName, string functionName, IServiceMethod method)
        {
            // Start logging elapsed time.
            long     tIn    = TimerUtil.CurrentTimeMillis();
            ILogging logger = AppRegistryBridge.GetInstance().GetLoggingBridge();

            if (logger != null)
            {
                logger.Log(ILoggingLogLevel.Debug, this.apiGroup.ToString(), "ServiceBridge executing isServiceRegistered...");
            }

            bool result = false;

            if (this._delegate != null)
            {
                result = this._delegate.IsServiceRegistered(serviceName, endpointName, functionName, method);
                if (logger != null)
                {
                    logger.Log(ILoggingLogLevel.Debug, this.apiGroup.ToString(), "ServiceBridge executed 'isServiceRegistered' in " + (TimerUtil.CurrentTimeMillis() - tIn) + "ms.");
                }
            }
            else
            {
                if (logger != null)
                {
                    logger.Log(ILoggingLogLevel.Error, this.apiGroup.ToString(), "ServiceBridge no delegate for 'isServiceRegistered'.");
                }
            }
            return(result);
        }
        /**
         * Whether there is connectivity to a host, via domain name or ip address, or not.
         *
         * @param host     domain name or ip address of host.
         * @param callback Callback called at the end.
         * @since v2.0
         */
        public void IsNetworkReachable(string host, INetworkReachabilityCallback callback)
        {
            // Start logging elapsed time.
            long     tIn    = TimerUtil.CurrentTimeMillis();
            ILogging logger = AppRegistryBridge.GetInstance().GetLoggingBridge();

            if (logger != null)
            {
                logger.Log(ILoggingLogLevel.Debug, this.apiGroup.ToString(), "NetworkReachabilityBridge executing isNetworkReachable...");
            }

            if (this._delegate != null)
            {
                this._delegate.IsNetworkReachable(host, callback);
                if (logger != null)
                {
                    logger.Log(ILoggingLogLevel.Debug, this.apiGroup.ToString(), "NetworkReachabilityBridge executed 'isNetworkReachable' in " + (TimerUtil.CurrentTimeMillis() - tIn) + "ms.");
                }
            }
            else
            {
                if (logger != null)
                {
                    logger.Log(ILoggingLogLevel.Error, this.apiGroup.ToString(), "NetworkReachabilityBridge no delegate for 'isNetworkReachable'.");
                }
            }
        }
        /**
         * Evaluate the specified javascript on the specified webview of the application.
         *
         * @param javaScriptText   The javascript expression to execute on the webview.
         * @param webViewReference The target webview on which to execute the expression.
         */
        public void ExecuteJavaScript(string javaScriptText, Object webViewReference)
        {
            // Start logging elapsed time.
            long     tIn    = TimerUtil.CurrentTimeMillis();
            ILogging logger = AppRegistryBridge.GetInstance().GetLoggingBridge();

            if (logger != null)
            {
                logger.Log(ILoggingLogLevel.Debug, this.apiGroup.ToString(), "AppContextWebviewBridge executing executeJavaScript...");
            }

            if (this._delegate != null)
            {
                this._delegate.ExecuteJavaScript(javaScriptText, webViewReference);
                if (logger != null)
                {
                    logger.Log(ILoggingLogLevel.Debug, this.apiGroup.ToString(), "AppContextWebviewBridge executed 'executeJavaScript' in " + (TimerUtil.CurrentTimeMillis() - tIn) + "ms.");
                }
            }
            else
            {
                if (logger != null)
                {
                    logger.Log(ILoggingLogLevel.Error, this.apiGroup.ToString(), "AppContextWebviewBridge no delegate for 'executeJavaScript'.");
                }
            }
        }
示例#25
0
        /**
         * Whether the application is in background or not
         *
         * @return true if the application is in background;false otherwise
         * @since v2.0
         */
        public bool IsBackground()
        {
            // Start logging elapsed time.
            long     tIn    = TimerUtil.CurrentTimeMillis();
            ILogging logger = AppRegistryBridge.GetInstance().GetLoggingBridge();

            if (logger != null)
            {
                logger.Log(ILoggingLogLevel.Debug, this.apiGroup.ToString(), "LifecycleBridge executing isBackground...");
            }

            bool result = false;

            if (this._delegate != null)
            {
                result = this._delegate.IsBackground();
                if (logger != null)
                {
                    logger.Log(ILoggingLogLevel.Debug, this.apiGroup.ToString(), "LifecycleBridge executed 'isBackground' in " + (TimerUtil.CurrentTimeMillis() - tIn) + "ms.");
                }
            }
            else
            {
                if (logger != null)
                {
                    logger.Log(ILoggingLogLevel.Error, this.apiGroup.ToString(), "LifecycleBridge no delegate for 'isBackground'.");
                }
            }
            return(result);
        }
        /**
         * Returns an array of webviews currently managed by the context - composed of primary and the list of those added.
         * This method will always return at least one element; the primary webview.
         *
         * @return Array with all the Webview instances being managed by ARP.
         * @since v2.0
         */
        public Object[] GetWebviews()
        {
            // Start logging elapsed time.
            long     tIn    = TimerUtil.CurrentTimeMillis();
            ILogging logger = AppRegistryBridge.GetInstance().GetLoggingBridge();

            if (logger != null)
            {
                logger.Log(ILoggingLogLevel.Debug, this.apiGroup.ToString(), "AppContextWebviewBridge executing getWebviews...");
            }

            Object[] result = null;
            if (this._delegate != null)
            {
                result = this._delegate.GetWebviews();
                if (logger != null)
                {
                    logger.Log(ILoggingLogLevel.Debug, this.apiGroup.ToString(), "AppContextWebviewBridge executed 'getWebviews' in " + (TimerUtil.CurrentTimeMillis() - tIn) + "ms.");
                }
            }
            else
            {
                if (logger != null)
                {
                    logger.Log(ILoggingLogLevel.Error, this.apiGroup.ToString(), "AppContextWebviewBridge no delegate for 'getWebviews'.");
                }
            }
            return(result);
        }
示例#27
0
        /**
         * Returns the device information for the current device executing the runtime.
         *
         * @return DeviceInfo for the current device.
         * @since v2.0
         */
        public DeviceInfo GetDeviceInfo()
        {
            // Start logging elapsed time.
            long     tIn    = TimerUtil.CurrentTimeMillis();
            ILogging logger = AppRegistryBridge.GetInstance().GetLoggingBridge();

            if (logger != null)
            {
                logger.Log(ILoggingLogLevel.Debug, this.apiGroup.ToString(), "DeviceBridge executing getDeviceInfo...");
            }

            DeviceInfo result = null;

            if (this._delegate != null)
            {
                result = this._delegate.GetDeviceInfo();
                if (logger != null)
                {
                    logger.Log(ILoggingLogLevel.Debug, this.apiGroup.ToString(), "DeviceBridge executed 'getDeviceInfo' in " + (TimerUtil.CurrentTimeMillis() - tIn) + "ms.");
                }
            }
            else
            {
                if (logger != null)
                {
                    logger.Log(ILoggingLogLevel.Error, this.apiGroup.ToString(), "DeviceBridge no delegate for 'getDeviceInfo'.");
                }
            }
            return(result);
        }
        /**
         * Additional views may be added to an application - a separate activity - and if these will make calls to the
         * ARP methods, they must be registered by adding them to the context. When they are added to the context, ARP
         * methods are bound to the webview so that they're callable from the HTML application. The primary webview should
         * not be added using this method.
         *
         * @param webView Platform specific webview reference (WebView, UIWebView, WKWebView,etc.)
         * @since v2.0
         */
        public void AddWebview(Object webView)
        {
            // Start logging elapsed time.
            long     tIn    = TimerUtil.CurrentTimeMillis();
            ILogging logger = AppRegistryBridge.GetInstance().GetLoggingBridge();

            if (logger != null)
            {
                logger.Log(ILoggingLogLevel.Debug, this.apiGroup.ToString(), "AppContextWebviewBridge executing addWebview...");
            }

            if (this._delegate != null)
            {
                this._delegate.AddWebview(webView);
                if (logger != null)
                {
                    logger.Log(ILoggingLogLevel.Debug, this.apiGroup.ToString(), "AppContextWebviewBridge executed 'addWebview' in " + (TimerUtil.CurrentTimeMillis() - tIn) + "ms.");
                }
            }
            else
            {
                if (logger != null)
                {
                    logger.Log(ILoggingLogLevel.Error, this.apiGroup.ToString(), "AppContextWebviewBridge no delegate for 'addWebview'.");
                }
            }
        }
示例#29
0
        /**
         * Register a new listener that will receive button events.
         *
         * @param listener to be registered.
         * @since v2.0
         */
        public void AddButtonListener(IButtonListener listener)
        {
            // Start logging elapsed time.
            long     tIn    = TimerUtil.CurrentTimeMillis();
            ILogging logger = AppRegistryBridge.GetInstance().GetLoggingBridge();

            if (logger != null)
            {
                logger.Log(ILoggingLogLevel.Debug, this.apiGroup.ToString(), "DeviceBridge executing addButtonListener...");
            }

            if (this._delegate != null)
            {
                this._delegate.AddButtonListener(listener);
                if (logger != null)
                {
                    logger.Log(ILoggingLogLevel.Debug, this.apiGroup.ToString(), "DeviceBridge executed 'addButtonListener' in " + (TimerUtil.CurrentTimeMillis() - tIn) + "ms.");
                }
            }
            else
            {
                if (logger != null)
                {
                    logger.Log(ILoggingLogLevel.Error, this.apiGroup.ToString(), "DeviceBridge no delegate for 'addButtonListener'.");
                }
            }
        }
        /**
         * Executes SQL transaction (some statements chain) inside given database.
         *
         * @param database     The database object reference.
         * @param statements   The statements to be executed during transaction.
         * @param rollbackFlag Indicates if rollback should be performed when any
         *        statement execution fails.
         * @param callback     DatabaseTable callback with the response.
         * @since v2.0
         */
        public void ExecuteSqlTransactions(Database database, string[] statements, bool rollbackFlag, IDatabaseTableResultCallback callback)
        {
            // Start logging elapsed time.
            long     tIn    = TimerUtil.CurrentTimeMillis();
            ILogging logger = AppRegistryBridge.GetInstance().GetLoggingBridge();

            if (logger != null)
            {
                logger.Log(ILoggingLogLevel.Debug, this.apiGroup.ToString(), "DatabaseBridge executing executeSqlTransactions...");
            }

            if (this._delegate != null)
            {
                this._delegate.ExecuteSqlTransactions(database, statements, rollbackFlag, callback);
                if (logger != null)
                {
                    logger.Log(ILoggingLogLevel.Debug, this.apiGroup.ToString(), "DatabaseBridge executed 'executeSqlTransactions' in " + (TimerUtil.CurrentTimeMillis() - tIn) + "ms.");
                }
            }
            else
            {
                if (logger != null)
                {
                    logger.Log(ILoggingLogLevel.Error, this.apiGroup.ToString(), "DatabaseBridge no delegate for 'executeSqlTransactions'.");
                }
            }
        }