private void deleteAccountResponse_Callback(JObject obj)
        {
            if (obj == null || "fail" == (string)obj["stat"])
            {
                logger.Info("Delete Account", "Could not delete account !!");
                return;
            }

            removeListeners();
            appSettings.Clear();
            MiscDBUtil.clearDatabase();
            /*This is used to avoid cross thread invokation exception*/
            Deployment.Current.Dispatcher.BeginInvoke(() =>
            {
                NavigationService.Navigate(new Uri("/View/WelcomePage.xaml", UriKind.Relative));
            });
        }
Ejemplo n.º 2
0
        private void getStarted_click(object sender, EventArgs e)
        {
            if (isClicked)
            {
                return;
            }
            if (!App.IS_MARKETPLACE) // this is done to save the server info
            {
                App.appSettings.Save();
            }

            #region SERVER INFO
            string env = (AccountUtils.IsProd) ? "PRODUCTION" : "STAGING";
            Debug.WriteLine("SERVER SETTING : " + env);
            Debug.WriteLine("HOST : " + AccountUtils.HOST);
            Debug.WriteLine("PORT : " + AccountUtils.PORT);
            Debug.WriteLine("MQTT HOST : " + AccountUtils.MQTT_HOST);
            Debug.WriteLine("MQTT PORT : " + AccountUtils.MQTT_PORT);
            #endregion
            NetworkErrorTxtBlk.Opacity = 0;
            if (!NetworkInterface.GetIsNetworkAvailable()) // if no network
            {
                progressBar.Opacity        = 0;
                progressBar.IsEnabled      = false;
                NetworkErrorTxtBlk.Opacity = 1;
                return;
            }

            nextIconButton.IsEnabled = false;
            try
            {
                if (App.appSettings.Contains(App.IS_DB_CREATED)) // if db is created then only delete tables.
                {
                    MiscDBUtil.clearDatabase();
                }
                //App.clearAllDatabasesAsync(); // this is async function and runs on the background thread.
            }
            catch { }
            isClicked             = true;
            progressBar.Opacity   = 1;
            progressBar.IsEnabled = true;
            AccountUtils.registerAccount(null, null, new AccountUtils.postResponseFunction(registerPostResponse_Callback));
        }
Ejemplo n.º 3
0
        private void DeleteLocalStorage()
        {
            NetworkManager.turnOffNetworkManager = true;
            App.MqttManagerInstance.disconnectFromBroker(false);
            App.ClearAppSettings();
            App.WriteToIsoStorageSettings(App.IS_DB_CREATED, true);
            MiscDBUtil.clearDatabase();

            HttpNotificationChannel pushChannel = HttpNotificationChannel.Find(HikeConstants.pushNotificationChannelName);

            if (pushChannel != null)
            {
                if (pushChannel.IsShellTileBound)
                {
                    pushChannel.UnbindToShellTile();
                }
                if (pushChannel.IsShellToastBound)
                {
                    pushChannel.UnbindToShellToast();
                }
                pushChannel.Close();
            }


            Deployment.Current.Dispatcher.BeginInvoke(() =>
            {
                App.ViewModel.ClearViewModel();
                try
                {
                    progress.Hide(LayoutRoot);
                    progress = null;
                }
                catch
                {
                }
                try
                {
                    NavigationService.Navigate(new Uri("/View/WelcomePage.xaml", UriKind.Relative));
                }
                catch { }
            });
        }
Ejemplo n.º 4
0
        public void onFailure(Exception value)
        {
            if ((value is ConnectionException) && ((ConnectionException)value).getCode().Equals(finalmqtt.Msg.ConnAckMessage.ConnectionStatus.BAD_USERNAME_OR_PASSWORD))
            {
                bool isPresent = false;
                if (App.appSettings.Contains(App.IS_DB_CREATED))
                {
                    isPresent = true;
                }
                App.ClearAppSettings();
                if (isPresent)
                {
                    App.WriteToIsoStorageSettings(App.IS_DB_CREATED, true);
                }
                NetworkManager.turnOffNetworkManager = true; // stop network manager
                App.MqttManagerInstance.disconnectFromBroker(false);
                MiscDBUtil.clearDatabase();

                HttpNotificationChannel pushChannel = HttpNotificationChannel.Find(HikeConstants.pushNotificationChannelName);
                if (pushChannel != null)
                {
                    if (pushChannel.IsShellTileBound)
                    {
                        pushChannel.UnbindToShellTile();
                    }
                    if (pushChannel.IsShellToastBound)
                    {
                        pushChannel.UnbindToShellToast();
                    }
                    pushChannel.Close();
                }
                App.HikePubSubInstance.publish(HikePubSub.BAD_USER_PASS, null);
            }
            else if (hikeMqttManager.connectionStatus != HikeMqttManager.MQTTConnectionStatus.NOTCONNECTED_WAITINGFORINTERNET)
            {
                scheduler.Schedule(hikeMqttManager.connect, TimeSpan.FromSeconds(5));
            }
            hikeMqttManager.setConnectionStatus(windows_client.Mqtt.HikeMqttManager.MQTTConnectionStatus.NOTCONNECTED_UNKNOWNREASON);
        }