Esempio n. 1
0
        private async void Logout(object sender, RoutedEventArgs e)
        {
            //foreach (var task in BackgroundTaskRegistration.AllTasks)
            //{
            //    //return;
            //}
            bool level = await Pronto.GetNetworkLevelUsingGoogle();

            if (!level)
            {
                ShowDialog("Already DisConnected ");
                return;
            }
            else
            {
                var networkName = await Network.Pronto.GetNetwoksSSid();

                if (networkName.Equals("OK"))
                {
                    Busy.SetBusy(true, "Logging Out");
                    var response = await Pronto.Logout();

                    Busy.SetBusy(false);
                    ShowDialog(response);
                }
                else
                {
                    Busy.SetBusy(false);
                    ShowDialog("Not Connected To Vit 2.4G");
                }
            }
        }
Esempio n. 2
0
        private async void Login(object sender, RoutedEventArgs e)
        {
            var localSettings = Windows.Storage.ApplicationData.Current.LocalSettings;

            localSettings.Values["user"] = User.Text;
            localSettings.Values["pass"] = Pass.Password;
            //  NetworkConnectivityLevel _level = await Network.Pronto.GetNetworkLevel();
            bool level = await Pronto.GetNetworkLevelUsingGoogle();

            if (level)
            {
                ShowDialog("Already Connected ");
                return;
            }
            else
            {
                var networkName = await Network.Pronto.GetNetwoksSSid();

                if (networkName.Equals("OK", StringComparison.CurrentCultureIgnoreCase))
                {
                    Busy.SetBusy(true, "Logging In");
                    var response = await Network.Pronto.Login();

                    Busy.SetBusy(false);
                    ShowDialog(response);
                }
                else
                {
                    Busy.SetBusy(false);
                    ShowDialog("Not Connected To Vit 2.4G");
                }
            }
        }
Esempio n. 3
0
        private async Task BackgroundLogin()
        {
            bool level = await Pronto.GetNetworkLevelUsingGoogle();

            if (level)
            {
                return;
            }
            else
            {
                var networkName = await Network.Pronto.GetNetwoksSSid();

                if (networkName.Equals("OK", StringComparison.CurrentCultureIgnoreCase))
                {
                    PopToast("Vit 2.4G");
                }

                else
                {
                    return;
                }
            }
        }
Esempio n. 4
0
        protected async override void OnNavigatedTo(NavigationEventArgs e)
        {
            try
            {
                var    localSettings = Windows.Storage.ApplicationData.Current.LocalSettings;
                string user          = localSettings.Values["user"].ToString();
                string pass          = localSettings.Values["pass"].ToString();
                User.Text     = user;
                Pass.Password = pass;
                //        await Pronto.TileUpdater();
                register.IsEnabled    = true;
                LoginButton.IsEnabled = true;
                var level = await Pronto.GetNetworkLevelUsingGoogle();

                if (level)
                {
                    LogoutButton.IsEnabled = true;
                }
            }
            catch
            {
                return;
            }
        }
Esempio n. 5
0
        public async void Run(IBackgroundTaskInstance taskInstance)
        {
            // Create the deferral by requesting it from the task instance
            serviceDeferral = taskInstance.GetDeferral();

            AppServiceTriggerDetails triggerDetails = taskInstance.TriggerDetails as AppServiceTriggerDetails;

            if (triggerDetails != null && triggerDetails.Name.Equals("VoiceCommandService"))
            {
                voiceServiceConnection = VoiceCommandServiceConnection.FromAppServiceTriggerDetails(triggerDetails);

                VoiceCommand voiceCommand = await voiceServiceConnection.GetVoiceCommandAsync();

                // Perform the appropriate command depending on the operation defined in VCD
                switch (voiceCommand.CommandName)
                {
                case "Login":
                    string loginMessage;
                    bool   loginlevel = await Pronto.GetNetworkLevelUsingGoogle();

                    if (loginlevel)
                    {
                        loginMessage = " You are already Connected ";
                    }
                    else
                    {
                        var networkName = await Network.Pronto.GetNetwoksSSid();

                        if (networkName.Equals("OK"))
                        {
                            loginMessage = await Pronto.Login();
                        }
                        else
                        {
                            loginMessage = "You are Not Connected To Vit 2.4G";
                        }
                    }
                    VoiceCommandUserMessage userLoginMessage = new VoiceCommandUserMessage();
                    userLoginMessage.DisplayMessage = loginMessage;
                    userLoginMessage.SpokenMessage  = loginMessage;
                    VoiceCommandResponse loginResponse = VoiceCommandResponse.CreateResponse(userLoginMessage, null);
                    await voiceServiceConnection.ReportSuccessAsync(loginResponse);

                    break;

                case "Logout":
                    string logoutMessage;
                    bool   level = await Pronto.GetNetworkLevelUsingGoogle();

                    if (!level)
                    {
                        logoutMessage = " You are already Disconnected ";
                    }
                    else
                    {
                        var networkName = await Network.Pronto.GetNetwoksSSid();

                        if (networkName.Equals("OK"))
                        {
                            logoutMessage = await Pronto.Logout();
                        }
                        else
                        {
                            logoutMessage = "You are Not Connected To Vit 2.4G";
                        }
                    }
                    VoiceCommandUserMessage userLogoutMessage = new VoiceCommandUserMessage();
                    userLogoutMessage.DisplayMessage = logoutMessage;
                    userLogoutMessage.SpokenMessage  = logoutMessage;
                    VoiceCommandResponse logoutResponse = VoiceCommandResponse.CreateResponse(userLogoutMessage, null);
                    await voiceServiceConnection.ReportSuccessAsync(logoutResponse);

                    break;

                case "Usage":
                    string dataMessage;
                    bool   usageLevel = await Pronto.GetNetworkLevelUsingGoogle();

                    if (!usageLevel)
                    {
                        dataMessage = "Sorry Internet is Unavialable";
                    }
                    else
                    {
                        var data = await Pronto.DataUsage();

                        if (data.errorList.Count == 0)
                        {
                            var consumed = data.usageList[2];
                            dataMessage = string.Format("Your Monthly Data Consumed is :" + consumed);
                        }
                        else
                        {
                            dataMessage = "Sorry" + data.errorList[0];
                        }
                    }
                    VoiceCommandUserMessage userDataMessage = new VoiceCommandUserMessage();
                    userDataMessage.DisplayMessage = dataMessage;
                    userDataMessage.SpokenMessage  = dataMessage;
                    VoiceCommandResponse dataUsageResponse = VoiceCommandResponse.CreateResponse(userDataMessage, null);
                    await voiceServiceConnection.ReportSuccessAsync(dataUsageResponse);

                    break;

                default:
                    break;
                }
            }

            // Once the asynchronous method(s) are done, close the deferral
            serviceDeferral.Complete();
        }