Beispiel #1
0
        public async Task ExecuteFetchMomentsCommand()
        {
            if (IsBusy)
            {
                return;
            }

            IsBusy = true;

            try
            {
                var connected = await CrossConnectivity.Current.IsRemoteReachable(Keys.ApplicationMobileService, 80, 10000);

                if (connected)
                {
                    Moments.Clear();
                    var refreshedMoments = await MomentService.Instance.GetMoments();

                    Moments.AddRange(refreshedMoments);
                }
                else
                {
                    DialogService.ShowError(Strings.NoInternetConnection);
                }
            }
            catch (Exception ex)
            {
                Xamarin.Insights.Report(ex);
            }

            IsBusy = false;
        }
Beispiel #2
0
        public async Task ExecuteFetchMomentsCommand()
        {
            if (IsBusy)
            {
                return;
            }

            IsBusy = true;

            try
            {
                if (await ConnectivityService.IsConnected())
                {
                    Moments.Clear();
                    var refreshedMoments = await MomentService.GetMoments();

                    Moments.AddRange(refreshedMoments);
                }
                else
                {
                    DialogService.ShowError(Strings.NoInternetConnection);
                }
            }
            catch (Exception ex)
            {
                Logger.Report(ex);
            }

            IsBusy = false;
        }
        /// <summary>
        /// Set initial values
        /// </summary>
        public void SetInitialValues()
        {
            d.Clear();
            S.Clear();
            F.Clear();
            M.Clear();
            C.Clear();
            N.Clear();
            del.Clear();
            C.Clear();

            //Обнуляем массивы интегрирования
            for (int j = 0; j < modelDimention; j++)
            {
                X[j]  = 0;
                X0[j] = 0;
                Y[j]  = 0;
            }

            modeling.bal(S, C, del, s);
            modeling.setRealParamValuesFromIncrements(S, d, del);
            modeling.calcLinearCoef(S, del, c, s);
        }
        public async Task UpdateMomentsAsync()
        {
            if (IsBusy)
            {
                return;
            }

            IsBusy = true;

            try
            {
                if (await ConnectivityService.IsConnected())
                {
                    Moments.Clear();

                    //var items = await AzureService.Instance.GetItemsAsync(x => x.CountryCode == Country.CountryCode);
                    var moments = await AmazonWebService.Instance.GetLatestMomentsAsync();

                    Moments.AddRange(moments);
                }
                else
                {
                    DialogService.ShowError("No internet connection");
                }
            }
            catch (Exception ex)
            {
                //Xamarin.Insights.Report(ex);
            }

            //UserDialogs.Instance.Toast(new ToastConfig(new ToastEvent(), "Test", "Testing toast functionality....fun!")
            //{
            //    Duration = TimeSpan.FromSeconds(3)
            //});

            IsBusy = false;
        }