Exemplo n.º 1
0
        public async void GetRequest()
        {
            //Check network status
            if (NetworkCheck.IsInternet())
            {
                Uri                 geturi      = new Uri("https://yastatic.net/market-export/_/partner/help/YML.xml");
                HttpClient          client      = new HttpClient();
                HttpResponseMessage responseGet = await client.GetAsync(geturi);

                string response = await responseGet.Content.ReadAsStringAsync();//Getting response

                //Xml Parsing
                List <XmlOfferDetails> ObjOfferList = new List <XmlOfferDetails>();
                XDocument doc = XDocument.Parse(response);
                foreach (var item in doc.Descendants("offer"))
                {
                    XmlOfferDetails ObjOfferItem = new XmlOfferDetails();
                    ObjOfferItem.Id        = item.Attribute("id").Value.ToString();
                    ObjOfferItem.Type      = item.Attribute("type").Value.ToString();
                    ObjOfferItem.Bid       = item.Attribute("bid").Value.ToString();
                    ObjOfferItem.Available = item.Attribute("available").Value.ToString();
                    ObjOfferList.Add(ObjOfferItem);
                }
                //Binding listview with server response
                listviewOffer.ItemsSource = ObjOfferList;
            }
            else
            {
                await DisplayAlert("XmlParsing", "No network is available.", "Ok");
            }
            //Hide loader after server response
            ProgressLoader.IsRunning = false;
        }
Exemplo n.º 2
0
        protected async override void OnAppearing()
        {
            base.OnAppearing();

            App.ReadUnread    = "null";
            App.OrderByText   = Constants.LastPostDateText;
            App.SelectedTitle = string.Empty;

            var leftSwipeGesture = new SwipeGestureRecognizer {
                Direction = SwipeDirection.Left
            };


            if (Application.Current.Properties.ContainsKey("NAME"))
            {
                var name = Convert.ToString(Application.Current.Properties["NAME"]);
                txtName.Text = App.SelectedUserData.name;
            }
            //_headerList.Add(new LandingModel { Date = "Date", Borrower = "Borrower", Amount = "Amount" });
            //headerList.ItemsSource = _headerList;
            ViewModel = new LandingViewModel();

            this.BindingContext = ViewModel;

            if (NetworkCheck.IsInternet())
            {
                await ViewModel.FetchClosingData();

                //await ViewModel.FetchDecisionDueData();
            }
            else
            {
                await DisplayAlert("Simon", "No network is available.", "OK");
            }
        }
Exemplo n.º 3
0
        public void GetServerInformation(string city, string type)
        {
            Task <string> result = NetworkCheck.GetJSON(city, type);

            if (result == null)
            {
                DisplayAlert("JSONParsing", "No network is available.", "Ok");
                Debug.WriteLine("No internet!");
                return;
            }
            Debug.WriteLine("result:: " + result.Result); // Call the Result
            var json = result.Result;

            if (json != "")
            {
                if (type.Equals("weather"))
                {
                    BindWeatherInformation(JsonConvert.DeserializeObject <RootObjectWeather>(json));
                }
                else if (type.Equals("forecast"))
                {
                    BindForecastInformation(JsonConvert.DeserializeObject <RootObjectForecast>(json));
                }
                else
                {
                    Debug.WriteLine("weather type", "something went wrong");
                }
            }
            else
            {
                DisplayAlert("JSONParsing", "Something went wrong", "Ok");
            }
        }
Exemplo n.º 4
0
        private async void Cancelar_Clicked(object sender, EventArgs e)
        {
            if (!NetworkCheck.IsInternet())
            {
                await DisplayAlert("ERRO", "Sem conexão com a internet :(", "OK");
            }
            else
            {
                if (etAtendente.Text != "Não atribuido")
                {
                    await DisplayAlert("ERRO", "Ei! Sua senha foi chamada, você não pode mais cancelar :(", "OK");
                }
                else
                {
                    await cancelarChamado();

                    if (avisoCancelamento == "Success")
                    {
                        await DisplayAlert("AVISO", "Senha cancelada com sucesso.", "OK");

                        App.Current.MainPage = new Home();
                    }
                    else
                    {
                        await DisplayAlert("AVISO", "Ops. Algo deu errado :(. Tente novamente", "OK");
                    }
                }
            }
        }
        protected async override void OnAppearing()
        {
            base.OnAppearing();

            App.ReadUnread    = "null";
            App.OrderByText   = Constants.LastPostDateText;
            App.SelectedTitle = string.Empty;
            if (Xamarin.Forms.Application.Current.Properties.ContainsKey("USERID"))
            {
                userId = Convert.ToString(Xamarin.Forms.Application.Current.Properties["USERID"]);
            }
            assignListView.RefreshCommand = new Command(() =>
            {
                assignListView.IsRefreshing = false;
            });


            ViewModel           = new ApprovalViewModel();
            this.BindingContext = ViewModel;

            if (NetworkCheck.IsInternet())
            {
                await ViewModel.GetApprovalData();
            }
            else
            {
                await DisplayAlert("Simon", "No network is available.", "OK");
            }
        }
        private async Task GetDataCommand()
        {
            if (IsBusy)
            {
                return;
            }
            try
            {
                IsBusy = true;
                if (NetworkCheck.IsInternet())
                {
                    ItemsList = await _Service.GetProducts();

                    Products.Clear();
                    Products.ReplaceRange(ItemsList);
                }
                else
                {
                    MessagingCenter.Send(this, "NetworkAlert");
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("Exception is : " + ex);
            }
            finally
            {
                IsBusy = false;
            }
        }
Exemplo n.º 7
0
        private async void Submitt_Clicked(object sender, EventArgs e)
        {
            actIndicator2.IsRunning = true;
            // Check network status
            if (NetworkCheck.IsInternet())
            {
                client = new HttpClient();

                client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));

                // var authHeader = new AuthenticationHeaderValue("bearer", "accessToken.Token");  // pass token
                //  client.DefaultRequestHeaders.Authorization = authHeader;

                var enteredValues = orderNumber.Text;
                var formContent   = new FormUrlEncodedContent(new[]
                {
                    new KeyValuePair <string, string>("ordernum", enteredValues),
                });

                try {
                    var result = await client.PostAsync("http://172.16.204.41:7000/getVehicle", formContent);

                    //var result = await client.PostAsync("https://172.16.204.41:20300/api/vehicle/vindecode/2T1BR32EX6C593681", formContent);
                    var responseResult = await result.Content.ReadAsStringAsync();

                    VehicleResponse vehicleResponse = JsonConvert.DeserializeObject <VehicleResponse>(responseResult);


                    // on error throw a exception
                    result.EnsureSuccessStatusCode();


                    if (result.IsSuccessStatusCode)
                    {
                        actIndicator2.IsRunning = false;
                        stackDisplay.SetValue(IsVisibleProperty, true);
                        VehicleName.Text = vehicleResponse.name;
                        stackForm.SetValue(IsVisibleProperty, false);
                        StackVinDisplay.SetValue(IsVisibleProperty, false);
                        stackVinDisplay.SetValue(IsVisibleProperty, true);

                        CarNumberDisplace.Text = "Work Order # " + enteredValues;
                    }
                    else
                    {
                        actIndicator2.IsRunning = false;
                        await DisplayAlert("Network Problem", "Please check interent connection or server runing status", "OK");
                    }
                }
                catch (Exception ex)
                {
                    Debug.WriteLine(" Exception error Order number API ", ex.ToString());
                }
            }
            else
            {
                actIndicator2.IsRunning = false;
                await DisplayAlert("Network Problem", "Please check interent connection or server runing status", "OK");
            }
        }
Exemplo n.º 8
0
        async void Login()
        {
            if (NetworkCheck.IsInternet())
            {
                IsIndicatorLoading = true;
                svcconnector       = new ServiceConnector();
                var response = await svcconnector.Login(UserName, Password);

                if (response.Success)
                {
                    IsIndicatorLoading = false;
                    var result = response.ResponseObject as UserAccount;
                    //save the access token in singleton object
                    AccessTokenSingleton.Instance.AccessToken = result.accessToken;
                    var parameter = new NavigationParameters();
                    parameter.Add(AppConstants.AccessToken, result.accessToken);
                    await _navigationservice.NavigateAsync("ClientPage", parameter);
                }
                else
                {
                    IsIndicatorLoading = false;
                    await _displayAlert.DisplayAlertAsync(response.ErrorObject.error.name, response.ErrorObject.error.message, "ok");
                }
            }
            else
            {
                await _displayAlert.DisplayAlertAsync(AppConstants.NoInternetConnection, String.Empty, "ok");
            }
        }
Exemplo n.º 9
0
 public bool webClient(string emailStr)
 {
     bool isDuplicate = false;
     if (NetworkCheck.IsInternet())
     {
         using (WebClient client = new WebClient())
         {
             Uri address = new Uri(app.url + "/AR_admin/checkUser");
             client.Encoding = Encoding.UTF8;
             client.Headers[HttpRequestHeader.ContentType] = "application/json";
             UserRegister data = new UserRegister() { email = emailStr };
             string json = JsonConvert.SerializeObject(data);
             string result = client.UploadString(address, "POST", json);
             var post = JsonConvert.DeserializeObject<Result>(result);
             if (post != null && post.result != null && post.result != "" && post.result == "0")
             {
                 isDuplicate = true;
             }
             else
             {
                 isDuplicate = false;
             }
         }
     }
     else
     {
         Application.Current.MainPage.DisplayAlert("訊息", app.networkMessage, "OK");
     }
     
     return isDuplicate;
 }
Exemplo n.º 10
0
        public async void GetJSON()
        {
            //Check network status
            if (NetworkCheck.IsInternet())
            {
                var client   = new System.Net.Http.HttpClient();
                var response = await client.GetAsync("http://api.androidhive.info/contacts/");

                string      contactsJson   = response.Content.ReadAsStringAsync().Result;
                ContactList ObjContactList = new ContactList();
                if (contactsJson != "")
                {
                    //Converting JSON Array Objects into generic list
                    ObjContactList = JsonConvert.DeserializeObject <ContactList>(contactsJson);
                }
                //Binding listview with server response
                listviewConacts.ItemsSource = ObjContactList.contacts;
            }
            else
            {
                await DisplayAlert("JSONParsing", "No network is available.", "Ok");
            }
            //Hide loader after server response
            ProgressLoader.IsVisible = false;
        }
        protected async override void OnAppearing()
        {
            base.OnAppearing();

            Xamarin.Forms.Application.Current.On <Xamarin.Forms.PlatformConfiguration.Android>().UseWindowSoftInputModeAdjust(WindowSoftInputModeAdjust.Resize);

            this.BindingContext = new MessageThreadViewModel();

            vm = this.BindingContext as MessageThreadViewModel;

            if (vm != null)
            {
                if (!string.IsNullOrEmpty(Settings.TypedMessage))
                {
                    txtMessage.Text = Settings.TypedMessage;
                }

                if (NetworkCheck.IsInternet())
                {
                    await vm.PostReadThreadData();

                    await vm.FetchThreadUserData();
                }
                else
                {
                    await DisplayAlert("Simon", "No network is available.", "OK");
                }
            }
        }
Exemplo n.º 12
0
        public async void GetProcessStageUserList()
        {
            if (NetworkCheck.IsInternet())
            {
                var    httpClient = new System.Net.Http.HttpClient();
                string url        = Config.PROCESS_STAGE_FUNCTION_USER_API + vm.processIdTxt + '/' + vm.stageIdTxt + '/' + functionIdTxt + '/' + userId;
                var    response   = await httpClient.GetAsync(url);

                if (response.StatusCode != System.Net.HttpStatusCode.OK)
                {
                    Device.BeginInvokeOnMainThread(async() =>
                    {
                        await DisplayAlert("No Record!!", string.Format("Response contained status code: {0}", response.StatusCode), "OK");
                    });
                }
                else
                {
                    var assignJson = await response.Content.ReadAsStringAsync();

                    if (assignJson != "")
                    {
                        resultUserList = JsonConvert.DeserializeObject <IEnumerable <ProcessStageUserModel> >(assignJson);
                        foreach (var Data in resultUserList)
                        {
                            var lastPostDateStr = Data.userId;
                        }
                        processStageUserPicker.ItemsSource = (System.Collections.IList)resultUserList;
                    }
                }
            }
            else
            {
                await DisplayAlert("JSONParsing", "No network is available.", "OK");
            }
        }
        public MessageThreadPage()
        {
            InitializeComponent();

            if (Application.Current.Properties.ContainsKey("PARTYNAME"))
            {
                txtPartyName      = Convert.ToString(Application.Current.Properties["PARTYNAME"]);
                lblPartyName.Text = txtPartyName;
            }
            if (Application.Current.Properties.ContainsKey("TOPIC"))
            {
                txtTopic      = Convert.ToString(Application.Current.Properties["TOPIC"]);
                lblTopic.Text = txtTopic;
            }
            if (Application.Current.Properties.ContainsKey("THREADID"))
            {
                threadId = (int)Application.Current.Properties["THREADID"];
            }
            if (NetworkCheck.IsInternet())
            {
                ViewModel = new MessageThreadViewModel();
                ViewModel.FetchThreadUserData();
                BindingContext = ViewModel;
            }
            else
            {
                DisplayAlert("Simon", "No network is available.", "Ok");
            }

            GetJSON();
        }
        public async void GetJSON()
        {
            //Check network status
            if (NetworkCheck.IsInternet())
            {
                //var httpClient = new System.Net.Http.HttpClient();
                //var response = await httpClient.GetAsync("REPLACE YOUR JSON URL");
                //****************************************************************
                // httpClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
                // httpClient.DefaultRequestHeaders.Add("APP_VERSION", "1.0.0");
                // httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", "your_authorization_token_string");
                string assignJson = "{\"Assignments\": [{\"titleName\": \"Trevor Johnson\",\"subTitleName\": \"Executive Vice President\"},{\"titleName\": \"John Trevorson\",\"subTitleName\": \"Executive Vice President\"},{\"titleName\": \"Sidney Sheldon\",\"subTitleName\": \"Executive Vice President\"}]}";

                //*****************************************************************

                //string assignJson = await response.Content.ReadAsStringAsync();
                if (assignJson != "")
                {
                    //Converting JSON Array Objects into generic list
                    ObjAssignList = JsonConvert.DeserializeObject <AssignListItems>(assignJson);
                }
                //Binding listview with server response
                list.ItemsSource = ObjAssignList.Assignments;
            }
            else
            {
                await DisplayAlert("JSONParsing", "No network is available.", "Ok");
            }
            //Hide loader after server response
            //ProgressLoader.IsVisible = false;
        }
Exemplo n.º 15
0
        /*When the main page loads, it calls the GetJsonData() method which is defined.
         * This method uses the HttpClient.getAsync method to the web API specified in the
         * URL link to send a GET request. In response, the web API sends a HttpResponseMessage
         * object. This response contains content which is then de-serialized into a list to get the actual
         * question and options set which is used to load into the Page1.xaml
         */

        public async void GetJsonData()
        {
            // If device is connected to the Internet
            if (NetworkCheck.IsInternet())
            {
                try
                {
                    HttpClient          client   = new System.Net.Http.HttpClient();
                    HttpResponseMessage response = await client.GetAsync(jsonURI);

                    // If HTTP response is succesful, seraialize the HTTP content to the the string - JsonString
                    if (response.IsSuccessStatusCode)
                    {
                        string JsonString = await response.Content.ReadAsStringAsync();

                        //Converting JSON array objects into generic list
                        quizQuestionList = JsonConvert.DeserializeObject <QuizQuestionList>(JsonString);
                    }
                }

                catch (Exception ex)
                {
                    Debug.WriteLine("\tERROR {0}", ex.Message);
                }
            }
            else
            {
                //Device is not connected to the internet.
                await DisplayAlert("JSONParsing", "No Network is available.", "Ok");
            }

            QuizPageViewModel.PopulateQuestionSet(quizQuestionList);
        }
Exemplo n.º 16
0
        protected override void OnSleep()
        {
            // Handle when your app sleeps

            if (!NetworkCheck.IsInternet())
            {
                CrossLocalNotifications.Current.Show("Secretaria UNIFAAT", "Sem conexão com a internet. Reinicie o App :(");
            }
            else
            {
                var startTimeSpan  = TimeSpan.Zero;
                var periodTimeSpan = TimeSpan.FromSeconds(5);
                var timer          = new System.Threading.Timer(async(e) =>
                {
                    if (NetworkCheck.IsInternet())
                    {
                        await notificaSleep();
                        await alertaSleep();
                        //await ausenciaSleep();
                        if (notifica_sleep != "ERRO")
                        {
                            CrossLocalNotifications.Current.Show("Secretaria UNIFAAT", "Sua senha foi chamada! Consulte os detalhes no App :)");
                        }
                        if (alerta_sleep != "ERRO")
                        {
                            CrossLocalNotifications.Current.Show("Secretaria UNIFAAT", "Sua vez está chegando! Dirija-se à secretaria :)");
                        }
                    }
                }, null, startTimeSpan, periodTimeSpan);
            }
        }
Exemplo n.º 17
0
        protected override void OnResume()
        {
            //Handle when your app resumes

            if (!NetworkCheck.IsInternet())
            {
                MainPage.DisplayAlert("ERRO", "Sem conexão com a internet :(", "OK");
            }
            else
            {
                var startTimeSpan  = TimeSpan.Zero;
                var periodTimeSpan = TimeSpan.FromSeconds(5);
                var timer          = new System.Threading.Timer(async(e) =>
                {
                    if (NetworkCheck.IsInternet())
                    {
                        await notificaResume();
                        await alertaResume();
                        if (notifica_resume != "ERRO")
                        {
                            CrossLocalNotifications.Current.Show("Secretaria UNIFAAT", "Sua senha foi chamada! :)");
                        }
                        if (alerta_resume != "ERRO")
                        {
                            CrossLocalNotifications.Current.Show("Secretaria UNIFAAT", "Sua vez está chegando! Dirija-se à secretaria :)");
                        }
                    }
                }, null, startTimeSpan, periodTimeSpan);
            }
        }
Exemplo n.º 18
0
        protected async override void OnAppearing()
        {
            try
            {
                base.OnAppearing();

                Settings.TypedMessage = null;

                if (Application.Current.Properties.ContainsKey("USERID"))
                {
                    userId = Convert.ToString(Application.Current.Properties["USERID"]);
                }

                if (NetworkCheck.IsInternet())
                {
                    ViewModel           = new MessageViewModel();
                    this.BindingContext = ViewModel;
                    await ViewModel.FetchData();

                    ViewModel._helper = this;
                }
                else
                {
                    await DisplayAlert("Simon", "No network is available.", "OK");
                }
            }
            catch (Exception ex)
            {
                await DisplayAlert("Exception", ex.Message, "OK");
            }
        }
Exemplo n.º 19
0
        protected override void OnStart()
        {
            // Handle when your app starts

            if (!NetworkCheck.IsInternet())
            {
                MainPage.DisplayAlert("ERRO", "Sem conexão com a internet :(", "OK");
            }
            else
            {
                var startTimeSpan  = TimeSpan.Zero;
                var periodTimeSpan = TimeSpan.FromSeconds(5);
                var timer          = new System.Threading.Timer(async(e) =>
                {
                    if (NetworkCheck.IsInternet())
                    {
                        await monitoraSessao();
                        if (monitora_sessao == "Error" && user_in_id > 0)
                        {
                            user_in_id           = -1;
                            App.Current.MainPage = new MainPage();
                        }
                    }
                }, null, startTimeSpan, periodTimeSpan);
            }
        }
Exemplo n.º 20
0
        public async void GetJSON()
        {
            if (NetworkCheck.IsInternet())
            {
                var client   = new System.Net.Http.HttpClient();
                var response = await client.GetAsync("https://api.themoviedb.org/3/movie/upcoming?api_key=440d3555391bf8ebbceae19005baea22&language=fr-FR&page=1");

                string   contactsJson   = response.Content.ReadAsStringAsync().Result;
                FilmList ObjContactList = new FilmList();

                // Test crash
                //contactsJson = "";
                try
                {
                    //Converting JSON Array Objects into generic list
                    ObjContactList = JsonConvert.DeserializeObject <FilmList>(contactsJson);
                }
                catch (Exception exception)
                {
                    Crashes.TrackError(exception);
                }
                //Binding listview with server response
                listviewFilms.ItemsSource = ObjContactList.Results;
            }
            else
            {
                await DisplayAlert("JSONParsing", "No network is available.", "Ok");

                Analytics.TrackEvent("No_Internet");
            }
            //Hide loader after server response
            ProgressLoader.IsVisible = false;
        }
        public async void GetJSON()
        {
            //Check network status
            if (NetworkCheck.IsInternet())
            {
                //var httpClient = new System.Net.Http.HttpClient();
                //var response = await httpClient.GetAsync("REPLACE YOUR JSON URL");
                //****************************************************************
                // httpClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
                // httpClient.DefaultRequestHeaders.Add("APP_VERSION", "1.0.0");
                // httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", "your_authorization_token_string");
                string assignJson = "{\"messages\":[{\"mainTitleMsg\":\"New Message\",\"mainSubTitleMsg\": \"Hey Trevor, we receive a title work \"}]}";

                //*****************************************************************

                //string assignJson = await response.Content.ReadAsStringAsync();
                MessagesList ObjAssignList = new MessagesList();
                if (assignJson != "")
                {
                    //Converting JSON Array Objects into generic list
                    ObjAssignList = JsonConvert.DeserializeObject <MessagesList>(assignJson);
                }
                //Binding listview with server response
                msgListView.ItemsSource = ObjAssignList.messages;
            }
            else
            {
                await DisplayAlert("JSONParsing", "No network is available.", "Ok");
            }
            //Hide loader after server response
            //ProgressLoader.IsVisible = false;
        }
Exemplo n.º 22
0
        public async Task RefreshPic()
        {
            if (!myChecker30Min.Check_ReadOnly())
            {
                return;
            }
            if (NetworkCheck.IsWwanConnectionNow())
            {
                return;
            }
            MyBGSetting.LoadSetting(); if (MyBGSetting.State)
            {
                return;
            }

            var mypicinfo = new PictureInfo();

            PicInfoShowing = await mypicinfo.RunSession();

            if (PicInfoShowing != null)
            {
                PicBkg.InputPicInfo = PicInfoShowing;
                myChecker30Min.Check();
            }
        }
Exemplo n.º 23
0
        async void GetBranches(string accessToken, string clientId)
        {
            if (NetworkCheck.IsInternet())
            {
                IsIndicatorLoading = true;
                svcconnector       = new ServiceConnector();
                var response = await svcconnector.GetAllBranches(accessToken, clientId);

                if (response.Success)
                {
                    IsIndicatorLoading = false;

                    Branches = mapper.MapBranchserviceModelToDTOModel(response.ResponseObject as BranchRootObject);
                }
                else
                {
                    IsIndicatorLoading = false;
                    await _displayAlert.DisplayAlertAsync(response.ErrorObject.error.name, response.ErrorObject.error.message, "ok");
                }
            }
            else
            {
                await _displayAlert.DisplayAlertAsync(AppConstants.NoInternetConnection, String.Empty, "ok");
            }
        }
Exemplo n.º 24
0
        public async Task <HttpStatusCode> checkLogin(String email, String password)
        {
            // Check network status
            if (NetworkCheck.IsInternet())
            {
                var       client = new HttpClient();
                UserLogin user   = new UserLogin
                {
                    userId         = "string",
                    firstName      = "string",
                    lastName       = "string",
                    email          = email,
                    phoneNumber    = "string",
                    token          = "string",
                    password       = password,
                    activationCode = "string",
                    isActive       = true
                };
                StringContent sc       = new StringContent(JsonConvert.SerializeObject(user), Encoding.UTF8, "application/json");
                var           response = await client.PostAsync("http://113.161.54.29:8081/User/signing", sc);

                var StatusCode = response.StatusCode;
                return(StatusCode);
            }
            return(HttpStatusCode.UseProxy);
        }
Exemplo n.º 25
0
        protected async override void OnAppearing()
        {
            base.OnAppearing();

            App.isFromAddParticipantPage = true;

            thisVm = new MessageReplayViewModel();
            this.BindingContext = thisVm;

            //if (Application.Current.Properties.ContainsKey("USERID"))
            //{
            //    userId = Convert.ToString(Application.Current.Properties["USERID"]);
            //}
            //if (Application.Current.Properties.ContainsKey("PARTYNAME"))
            //{
            //    txtPartyName = Convert.ToString(Application.Current.Properties["PARTYNAME"]);
            //    lblPartyName.Text = txtPartyName;
            //}
            //if (Application.Current.Properties.ContainsKey("TOPIC"))
            //{
            //    txtTopic = Convert.ToString(Application.Current.Properties["TOPIC"]);
            //    lblTopic.Text = txtTopic;
            //}

            if (NetworkCheck.IsInternet())
            {
                await thisVm.GetData();

                await thisVm.GetThreadUsersData();
            }
            else
            {
                await DisplayAlert("Simon", "No network is available.", "OK");
            }
        }
Exemplo n.º 26
0
 void BusStopList_Refreshing(object sender, EventArgs e)
 {
     if (NetworkCheck.IsInternet())
     {
         GetStopList();
     }
 }
Exemplo n.º 27
0
        /// <summary>
        /// 断开
        /// </summary>
        public static async Task Deauthenticate()
        {
            NetworkCheck.StopCheck();
            await HeartBeatProxy.Kill();

            PPPoE.Hangup();
        }
Exemplo n.º 28
0
        protected override void OnAppearing()
        {
            base.OnAppearing();

            App.ReadUnread    = "null";
            App.OrderByText   = Constants.LastPostDateText;
            App.SelectedTitle = string.Empty;
            App.SelectedName  = string.Empty;
            App.FollowUp      = "null";
            vm = new DealViewModel();
            this.BindingContext = vm;

            if (NetworkCheck.IsInternet())
            {
                _ = vm.FetchDealData();
            }
            else
            {
                DisplayAlert("Simon", "No network is available.", "OK");
            }

            if (Application.Current.Properties.ContainsKey("USERID"))
            {
                userId = Convert.ToString(Application.Current.Properties["USERID"]);
            }
        }
        protected async override void OnAppearing()
        {
            base.OnAppearing();

            App.ReadUnread    = "null";
            App.FollowUp      = "null";
            App.OrderByText   = Constants.LastPostDateText;
            App.SelectedTitle = string.Empty;
            App.SelectedName  = string.Empty;
            var leftSwipeGesture = new SwipeGestureRecognizer {
                Direction = SwipeDirection.Left
            };

            ViewModel           = new LandingViewModel();
            this.BindingContext = ViewModel;

            if (App.IsFirstTime)
            {
                App.IsFirstTime = false;
                ViewModel.FooterNavigation(SessionService.BaseFooterItems[0]);
            }

            txtName.Text = Settings.LoggedInUser.name;

            if (NetworkCheck.IsInternet())
            {
                await ViewModel.FetchClosingData();
            }
            else
            {
                await DisplayAlert("Simon", "No network is available.", "OK");
            }
        }
        protected async override void OnAppearing()
        {
            base.OnAppearing();

            Xamarin.Forms.Application.Current.On <Xamarin.Forms.PlatformConfiguration.Android>().UseWindowSoftInputModeAdjust(WindowSoftInputModeAdjust.Resize);

            if (FirstTime)
            {
                FirstTime = false;

                if (vm != null)
                {
                    if (NetworkCheck.IsInternet())
                    {
                        await vm.PostReadThreadData();

                        await vm.FetchThreadUserData();
                    }
                    else
                    {
                        await DisplayAlert("Simon", "No network is available.", "OK");
                    }
                }
            }
            else
            {
                if (App.FrameImage != null)
                {
                    vm.ImageUrl       = App.FrameImage;
                    vm.isImageVisible = true;
                }
                if (App.FileName != null)
                {
                    vm.FileName      = App.FileName;
                    vm.isDocsVisible = true;
                }
            }

            if (App.IsFromAddParticipantPage == true)
            {
                if (App.FrameImage != null)
                {
                    vm.ImageUrl       = App.FrameImage;
                    vm.isImageVisible = true;
                }
                if (App.FileName != null)
                {
                    vm.FileName      = App.FileName;
                    vm.isDocsVisible = true;
                }
                txtMessage.HtmlText = Settings.TypedMessage;
            }
            else
            {
                txtMessage.HtmlText = null;
            }
        }