Ejemplo n.º 1
0
 public void getData(string device)
 {
     if (NetworkCheck.IsInternet())
     {
         devices = ApiClientWinAuthExampleSingleton.Instance.findInAllFields(device);
         //listviewdevices.ItemsSource = devices;
     }
 }
Ejemplo n.º 2
0
 public void getData()
 {
     if (NetworkCheck.IsInternet())
     {
         locations = ApiClientWinAuthExampleSingleton.Instance.GetLocations();
         listviewLocations.ItemsSource = locations;
     }
 }
Ejemplo n.º 3
0
        public void getData()
        {
            if (NetworkCheck.IsInternet())
            {
                var instrumetns = ApiClientWinAuthExampleSingleton.Instance.GetUserInstruments(CrossSecureStorage.Current.GetValue("username"));

                if (instrumetns.Count > 0)
                {
                    listviewDevices.ItemsSource = instrumetns;

                    itemLabel.Text = "My Items [" + instrumetns.Count() + "]";
                }
                else
                {
                    listviewDevices.ItemsSource = null;
                    itemLabel.Text = "You have no devices";
                }
            }
        }
Ejemplo n.º 4
0
        private async Task AcceptClick(object sender, EventArgs e)
        {
            if (NetworkCheck.IsInternet())
            {
                if (string.IsNullOrEmpty(NameEntry.Text) || string.IsNullOrEmpty(PwEntry.Text))
                {
                    await DisplayAlert("Missing information", "Please type in both username and password", "OK");
                }
                else
                {
                    activitySpinner.IsVisible = true;

                    //Save to secure storage

                    CrossSecureStorage.Current.SetValue("username", NameEntry.Text);
                    CrossSecureStorage.Current.SetValue("password", PwEntry.Text);

                    var instrumetns = ApiClientO2AuthExampleSingleton.Instance.GetUserInstruments(CrossSecureStorage.Current.GetValue("username"));
                    //List<InstrumentDetails> instrumetns = null;

                    LoginTest tester = new LoginTest();

                    NetworkCheck.getLogged();
                    if (NetworkCheck.getLogged() == true)
                    {
                        CrossSecureStorage.Current.SetValue("username", NameEntry.Text);
                        CrossSecureStorage.Current.SetValue("password", PwEntry.Text);
                        CrossSecureStorage.Current.SetValue("token", "1");
                        activitySpinner.IsVisible    = false;
                        Application.Current.MainPage = new NavigationPage(new Front());

                        await Navigation.PopToRootAsync(true);
                    }
                }
            }
            else
            {
                await DisplayAlert("Internet", "No internet available", "OK");
            }
        }
Ejemplo n.º 5
0
        private async void ExampleMethodAsync(String miaoCodeToCheck)
        {
            //await Task.Delay(2000); //PLACE HOLDER FOR NETOWRK COMMUNICATION!!

            mainGrid.Children.Add(activitySpinner, 0, 2);
            activitySpinner.IsRunning = true;
            if (NetworkCheck.IsInternet())
            {
                try
                {
                    //   Uri geturi = new Uri("http://miaodev.oticon.dk/Sisyphus/GetSearchInstruments?itemNumber=" + miaoCodeToCheck);


                    List <MobileDetails> geturo = ApiClientWinAuthExampleSingleton.Instance.GetInstrument(miaoCodeEntry.Text);

                    if (geturo.Count > 0)
                    {
                        activitySpinner.IsRunning = false;
                        mainGrid.Children.Remove(activitySpinner);
                        listviewSingleDevice.ItemsSource = geturo;

                        rentItemBtn.IsEnabled = true;
                        rentItemBtn.IsVisible = true;
                    }
                    else
                    {
                        await DisplayAlert("Not found", "No device was found for the following ID " + miaoCodeEntry.Text, "OK");

                        activitySpinner.IsRunning = false;
                        mainGrid.Children.Remove(activitySpinner);
                    }
                }
                catch
                {
                    await DisplayAlert("Error", "Some weird error happent, try again", "OK");
                }

                //HttpClient client = new HttpClient();
                //HttpResponseMessage responseGet = await client.GetAsync(geturi);
                //string response = await responseGet.Content.ReadAsStringAsync();//Getting response


                ////string contactsJson = await jsonText.Content.ReadAsStringAsync(); //Getting response
                //activitySpinner.IsRunning = false;
                //mainGrid.Children.Remove(activitySpinner);
                //mobileInfo.Text = response;
                //try {
                //XDocument doc = XDocument.Parse(response); //TRY CATCH EXECEPTION HERE!

                //XNamespace ns = "http://schemas.datacontract.org/2004/07/MIAO.Services.ViewModels.SisyphusAPI";

                //List<MobileDetails> MobileList = new List<MobileDetails>();
                //int inn = 0;
                //foreach (var item in doc.Descendants(ns + "SearchInstrumentViewModel"))
                //{
                //    //mobileInfo.Text = item.ToString();

                //    //"SearchInstrumentViewModel"
                //    MobileDetails objMobileItem = new MobileDetails();
                //    objMobileItem.ItemNumber = item.Element(ns + "ItemNumber").Value.ToString();
                //    objMobileItem.Model = item.Element(ns + "Model").Value.ToString();
                //    objMobileItem.Manufacturer = item.Element(ns + "Manufacturer").Value.ToString();

                //    MobileList.Add(objMobileItem);
                //}
            }
        }