Ejemplo n.º 1
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");
                }
            }
        }
Ejemplo n.º 2
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");
                }
            }
        }
Ejemplo n.º 3
0
        private async void Button_Click(object sender, Windows.UI.Xaml.RoutedEventArgs e)
        {
            try
            {
                Busy.SetBusy(true, "Checking Usage");
                var dataList = await Pronto.DataUsage();

                if (dataList.errorList.Count == 0)
                {
                    dataLimit.Text      = dataList.planList[0].ToString();
                    dataStartDate.Text  = dataList.planList[1].ToString();
                    dataEndDate.Text    = dataList.planList[2].ToString();
                    dataTime.Text       = dataList.usageList[0].ToString();
                    dataUploaded.Text   = dataList.usageList[1].ToString();
                    dataDownloaded.Text = dataList.usageList[2].ToString();
                    dataTotal.Text      = dataList.usageList[3].ToString();
                    Busy.SetBusy(false);
                    StorageFolder localFolder = ApplicationData.Current.LocalFolder;
                    StorageFile   sampleFile  = await localFolder.CreateFileAsync("dataUsage.txt", CreationCollisionOption.ReplaceExisting);

                    ////Read the first line of dataFile.txt in LocalFolder and store it in a String
                    //StorageFile sampleFiile = await localFolder.GetFileAsync("dataFittlee.txt");
                    //IList<string> fileContent = await FileIO.ReadLinesAsync(sampleFiile);

                    // Read complex/large objects
                    var helper = new LocalObjectStorageHelper();
                    await helper.SaveFileAsync(keyLargeObject, dataList);

                    Pronto.ValueTileUpdater(dataList.usageList[2].ToString());
                }
                else
                {
                    Busy.SetBusy(false);
                    MainPage.ShowDialog(dataList.errorList[0]);
                }
            }
            catch (System.Exception)
            {
                Busy.SetBusy(false);
                return;
            }
        }
Ejemplo n.º 4
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;
                }
            }
        }
Ejemplo n.º 5
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;
            }
        }
Ejemplo n.º 6
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();
        }
Ejemplo n.º 7
0
 private async Task UpdateTile()
 {
     await Pronto.TileUpdater();
 }
Ejemplo n.º 8
0
        private static async Task  Login()
        {
            var x = await Network.Pronto.Login();

            Pronto.PopToast(x);
        }