DumpQueue() protected méthode

protected DumpQueue ( ) : void
Résultat void
Exemple #1
0
        public void InitializeValues(string advId, string advKey)
        {
            var hardwareId = HardwareIdentification.GetPackageSpecificToken(null).Id;
            var dataReader = DataReader.FromBuffer(hardwareId);

            byte[] bytes = new byte[hardwareId.Length];
            dataReader.ReadBytes(bytes);

            this.parameters = new Parameters(advId, advKey, bytes);

            eventQueue = new MATEventQueue(parameters);

            GetUserAgent();

            // Handles the OnNetworkStatusChange event
            NetworkStatusChangedEventHandler networkStatusCallback = null;

            // Indicates if the connection profile is registered for network status change events. Set the default value to FALSE.
            bool registeredNetworkStatusNotif = false;

            networkStatusCallback = new NetworkStatusChangedEventHandler(OnNetworkStatusChange);

            // Register for network status change notifications
            if (!registeredNetworkStatusNotif)
            {
                NetworkInformation.NetworkStatusChanged += networkStatusCallback;
                registeredNetworkStatusNotif             = true;
            }

            // Send queued requests
            eventQueue.DumpQueue();
        }
 private void DeviceNetworkInformation_NetworkAvailabilityChanged(object sender, NetworkNotificationEventArgs e)
 {
     if (!DeviceNetworkInformation.IsNetworkAvailable)
     {
         nextConnectIsFirst = true;
     }
     else if (DeviceNetworkInformation.IsNetworkAvailable && nextConnectIsFirst)
     {
         // Connected to network, dump event queue if any
         nextConnectIsFirst = false;
         eventQueue.DumpQueue();
     }
 }
Exemple #3
0
        public void InitializeValues(string advId, string advKey)
        {
            urlEncrypter = new Encryption(advKey, IV);

            // Attached objects for attributes, queue functionality, and more
            this.parameters = new Parameters(advId, advKey);
            eventQueue      = new MATEventQueue(parameters);

            // Add listener for network availability
            DeviceNetworkInformation.NetworkAvailabilityChanged += DeviceNetworkInformation_NetworkAvailabilityChanged;

            // Check for Internet connectivity and send queued requests
            if (DeviceNetworkInformation.IsNetworkAvailable)
            {
                eventQueue.DumpQueue();
            }
        }
        private void OnNetworkStatusChange(object sender)
        {
            // Get the ConnectionProfile that is currently used to connect to the Internet
            ConnectionProfile profile = NetworkInformation.GetInternetConnectionProfile();

            if (profile != null)
            {
                // NetworkInformation.NetworkStatusChanged fires multiple times for some reason, so we only want to get the first real reconnect
                if (profile.GetNetworkConnectivityLevel() < NetworkConnectivityLevel.InternetAccess)
                {
                    nextConnectIsFirst = true;
                }
                else if (profile.GetNetworkConnectivityLevel() >= NetworkConnectivityLevel.InternetAccess && nextConnectIsFirst)
                {
                    nextConnectIsFirst = false;
                    eventQueue.DumpQueue();
                }
            }
        }
        public void InitializeValues(string advId, string advKey)
        {
            var hardwareId = HardwareIdentification.GetPackageSpecificToken(null).Id;
            var dataReader = DataReader.FromBuffer(hardwareId);
            byte[] bytes = new byte[hardwareId.Length];
            dataReader.ReadBytes(bytes);

            this.parameters = new Parameters(advId, advKey, bytes);

            eventQueue = new MATEventQueue(parameters);

            GetUserAgent();

            // Handles the OnNetworkStatusChange event
            NetworkStatusChangedEventHandler networkStatusCallback = null;

            // Indicates if the connection profile is registered for network status change events. Set the default value to FALSE.
            bool registeredNetworkStatusNotif = false;

            networkStatusCallback = new NetworkStatusChangedEventHandler(OnNetworkStatusChange);

            // Register for network status change notifications
            if (!registeredNetworkStatusNotif)
            {
                NetworkInformation.NetworkStatusChanged += networkStatusCallback;
                registeredNetworkStatusNotif = true;
            }

            // Send queued requests
            eventQueue.DumpQueue();
        }
        public void InitializeValues(string advId, string advKey)
        {
            urlEncrypter = new Encryption(advKey, IV);

            // Attached objects for attributes, queue functionality, and more
            this.parameters = new Parameters(advId, advKey);
            eventQueue = new MATEventQueue(parameters);

            // Add listener for network availability
            DeviceNetworkInformation.NetworkAvailabilityChanged += DeviceNetworkInformation_NetworkAvailabilityChanged;

            // Check for Internet connectivity and send queued requests
            if (DeviceNetworkInformation.IsNetworkAvailable)
            {
                eventQueue.DumpQueue();
            }
        }