Пример #1
0
        public void Warning(string w, [CallerMemberName] string memberName = "",
                            [CallerFilePath] string sourceFilePath         = "",
                            [CallerLineNumber] int sourceLineNumber        = 0)
        {
            if (w == null)
            {
                w = _defaultLogString;
            }

            AndroidLog.Warn(_target, w);
            CrashlyticsLog(w);

            if (FileExtensiveLogs)
            {
                Writer.Write(w);
            }

            if (_xamarinInsights)
            {
                Dictionary <string, string> additionalInfo = new Dictionary <string, string>
                {
                    { "Member Name", memberName },
                    { "Source Filepath", sourceFilePath },
                    { "Source Line Number", sourceLineNumber.ToString() },
                    { "CallStack", _traceEventCache.Callstack }
                };

                Insights.Report(new Exception(w), additionalInfo);
            }
        }
Пример #2
0
        public async Task Init()
        {
            if (LocalDBExists)
            {
                return;
            }

            var store = new MobileServiceSQLiteStore("syncstore.db");

            store.DefineTable <Order>();

            store.DefineTable <Account>();

            store.DefineTable <Category>();

            store.DefineTable <Product>();

            try
            {
                await _MobileServiceClient.SyncContext.InitializeAsync(store);
            }
            catch (Exception ex)
            {
                Debug.WriteLine(@"Failed to initialize sync context: {0}", ex.Message);
                Insights.Report(ex, Insights.Severity.Error);
            }

            _OrderTable = _MobileServiceClient.GetSyncTable <Order>();

            _AccountTable = _MobileServiceClient.GetSyncTable <Account>();

            _CategoryTable = _MobileServiceClient.GetSyncTable <Category>();

            _ProductTable = _MobileServiceClient.GetSyncTable <Product>();
        }
        public async Task <TaskCompletionType> Restore()
        {
            if (!IsLoggedIn)
            {
                await Login();
            }

            try
            {
                var children       = await OneDriveClient.Drive.Items[BackupFolder?.Id].Children.Request().GetAsync();
                var existingBackup = children.FirstOrDefault(x => x.Name == OneDriveAuthenticationConstants.BACKUP_NAME);

                if (existingBackup != null)
                {
                    var backup = await OneDriveClient.Drive.Items[existingBackup.Id].Content.Request().GetAsync();
                    if (fileStore.Exists(OneDriveAuthenticationConstants.DB_NAME))
                    {
                        fileStore.DeleteFile(OneDriveAuthenticationConstants.DB_NAME);
                    }
                    fileStore.WriteFile(OneDriveAuthenticationConstants.DB_NAME, backup.ReadToEnd());
                }
            }
            catch (OneDriveException ex)
            {
                Insights.Report(ex, Insights.Severity.Error);
                return(TaskCompletionType.Unsuccessful);
            }

            return(TaskCompletionType.Successful);
        }
Пример #4
0
        private void getCode()
        {
            ShowLoading();
            System.Xml.XmlDocument xml = new System.Xml.XmlDocument();
            string code = txtPapel.Text;

            Task.Factory.StartNew(
                () => {
                xml.Load(string.Format("http://www.bmfbovespa.com.br/Pregao-Online/ExecutaAcaoAjax.asp?CodigoPapel={0}", code));
            }
                ).ContinueWith(
                t => {
                try
                {
                    txtValidado.Text = "*Não encontrado.";
                    foreach (System.Xml.XmlElement node in xml.SelectNodes("ComportamentoPapeis/Papel"))
                    {
                        txtValidado.Text = node.Attributes.GetNamedItem("Nome").InnerText;
                    }
                }
                catch (Exception ex)
                {
                    Insights.Report(ex);
                    txtValidado.Text = "*N/D.";
                }
                finally
                {
                    this._loadPop.Hide();
                }
            }, TaskScheduler.FromCurrentSynchronizationContext()
                );
        }
Пример #5
0
        static async Task Execute(string insightsIdentifier, Func <Task> execute)
        {
            try
            {
                using (var handle = Insights.TrackTime(insightsIdentifier))
                {
                    handle.Start();
                    await execute();

                    handle.Stop();
                }
            }
            // isolate mobile service errors
            catch (MobileServiceInvalidOperationException ex)
            {
                Insights.Report(ex, Insights.Severity.Error);
                Debug.WriteLine(@"MOBILE SERVICE ERROR {0}", ex.Message);
            }
            // catch all other errors
            catch (Exception ex2)
            {
                Insights.Report(ex2, Insights.Severity.Error);
                Debug.WriteLine(@"ERROR {0}", ex2.Message);
            }
        }
Пример #6
0
        public virtual async Task <TResponse> GetAsync <TResponse>(string url, CancellationToken token, string authToken = null)
        {
            try
            {
                using (var requestMessage = new HttpRequestMessage(HttpMethod.Get, url))
                {
                    if (!string.IsNullOrEmpty(authToken))
                    {
                        requestMessage.Headers.Authorization = new AuthenticationHeaderValue(authToken);
                    }

                    using (var response = await Client.SendAsync(requestMessage, token).ConfigureAwait(false))
                    {
                        //var responseJson = await response.Content.ReadAsStringAsync().ConfigureAwait(false);

                        if (!response.IsSuccessStatusCode)
                        {
                            var error = JsonConvert.DeserializeObject <TResponse>(await ParseJsonAsync(response, null, token));
                            await Mvx.Resolve <IUserInteraction>().AlertAsync(response.StatusCode.ToString(), "Error");//HttpExceptionHandler.Handle(response.StatusCode, error.Message);
                        }
                        var returnObject = JsonConvert.DeserializeObject <TResponse>(await ParseJsonAsync(response, null, token));
                        return(returnObject);
                    }
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex.Message, ex.StackTrace);
                Insights.Report(ex);
                return(default(TResponse));
            }
        }
Пример #7
0
        public void Transaction(Action action)
        {
            bool beganTransaction = false;

            try
            {
                if (!this.IsInTransaction)
                {
                    beganTransaction = true;
                    this.BeginTransaction();
                }

                action();

                if (beganTransaction)
                {
                    Commit();
                }
            }
            catch (Exception ex) {
                Insights.Report(ex);
                Console.WriteLine("Exception in " + ex.Source + ": " + ex.Message);
                if (beganTransaction)
                {
                    Rollback();
                }
                throw;
            }
        }
Пример #8
0
 /// <summary>
 /// Reports the passed exception if Insights are initialized
 /// </summary>
 /// <param name="exception">Excpetion to report.</param>
 /// <param name="serverity">Serverity for the to report the exception.</param>
 public static void Report(Exception exception, ReportSeverity serverity = ReportSeverity.Error)
 {
     if (Insights.IsInitialized)
     {
         Insights.Report(exception, serverity);
     }
 }
Пример #9
0
        private async void SaveUser()
        {
            try
            {
                IsBusy = true;

                this.UserProfile = await _userPreferenceService.SaveUser(this.UserProfile);
                await RefreshReferenceData(false, this.UserProfile.LocationCode);

                IsBusy = false;

                App.CurrentUserProfile = UserProfile;

                var page = ViewFactory <HomePage, HomeViewModel> .CreatePage();

                this.Publish(new NavigateToPageMessage(page));
            }
            catch (Exception ex)
            {
                IsBusy = false;
                Insights.Report(new Exception("Error while saving user preferences", ex));
                //TODO need to have friendly messages later on exceptions
                App.RootPage.DisplayAlert(ErrorMessages.ErrorType.Error.ToString(), ex.Message, ErrorMessages.MesssageButton.Ok.ToString());
            }
        }
Пример #10
0
        public async void ThrottledServer(List <ThrottledServerRequest> requests)
        {
            int      requestCounter = 0;
            DateTime minute         = DateTime.Now;

            foreach (var r in requests)
            {
                if (requestCounter > requestsPerMinuteLimit)
                {
                    while (DateTime.Now < minute.AddSeconds(60))
                    {
                    }
                    requestCounter = 0;
                    minute         = DateTime.Now;
                }
                HttpClient client     = new HttpClient();
                var        requestUrl = (r.GameServer + "/" + r.Url);
                try
                {
                    var result = await client.PostAsync(requestUrl, new StringContent(
                                                            r.Json,
                                                            Encoding.UTF8,
                                                            "application/json"));
                }
                catch (Exception e)
                {
                    Insights.Report(e);
                }
                finally
                {
                    requestCounter++;
                }
            }
        }
Пример #11
0
        public void Reload()
        {
            Task.Factory.StartNew(async() => {
                try{
                    var newPostList = new List <Post>();
                    var editor      = pref.Edit();
                    editor.PutString("CurrentPage", "0");
                    editor.Apply();
                    await WebClient.LoadPosts(newPostList, 1);
                    _posts.Clear();
                    _posts.AddRange(newPostList);


                    //(_RecyclerView.GetAdapter()as PostViewAdapter)._Posts.AddRange(newPostList);

                    //_RecyclerView.GetAdapter().NotifyItemRangeInserted(_RecyclerView.GetAdapter().ItemCount,newPostList.Count);
                    //recyclerView.GetAdapter().HasStableIds = true;
                    //recyclerView.GetAdapter().NotifyDataSetChanged();
                    //_RecyclerView.GetAdapter().NotifyDataSetChanged();
                    RunOnUiThread(() => {
                        _recyclerView.ScrollToPosition(0);
                        _adapter.NotifyDataSetChanged();
                    });
                }
                catch (Exception ex)
                {
                    // ignored
                    Insights.Report(ex, new Dictionary <string, string> {
                        { "Message", ex.Message }
                    }, Insights.Severity.Error);
                    Toast.MakeText(this, ex.Message, ToastLength.Short).Show();
                }
            });
        }
Пример #12
0
        public async Task <string> GetHttpResultStringAsyncAsString(string gameServer, string url, string json)
        {
            if (requestCounter > requestsPerMinuteLimit)
            {
                while (DateTime.Now < minute.AddSeconds(60))
                {
                }
                requestCounter = 0;
                minute         = DateTime.Now;
            }

            HttpClient client = new HttpClient();

            url = url.Replace("/", "");             //Some sources for the URL have / at that start
            var requestUrl = (gameServer + "/" + url);

            try
            {
                var result = await client.PostAsync(requestUrl, new StringContent(
                                                        json,
                                                        Encoding.UTF8,
                                                        "application/json"));

                var x = await result.Content.ReadAsStringAsync();

                return(x);
            }
            catch (Exception e)
            {
                Insights.Report(e);
                return(null);
            }
        }
Пример #13
0
        public void Error(Exception e, [CallerMemberName] string memberName = "",
                          [CallerFilePath] string sourceFilePath            = "",
                          [CallerLineNumber] int sourceLineNumber           = 0)
        {
            if (string.IsNullOrEmpty(e.Message))
            {
                return;
            }

            AndroidLog.Error(_target, "member name: " + memberName);
            AndroidLog.Error(_target, "source file path: " + sourceFilePath);
            AndroidLog.Error(_target, "source line number: " + sourceLineNumber);
            AndroidLog.Error(_target, e.Message);

            if (!string.IsNullOrEmpty(e.StackTrace))
            {
                AndroidLog.Error(_target, e.StackTrace);
            }

            CrashlyticsLog(e);
            Writer.Write(e);

            if (_xamarinInsights)
            {
                Dictionary <string, string> additionalInfo = new Dictionary <string, string>
                {
                    { "Member Name", memberName },
                    { "Source Filepath", sourceFilePath },
                    { "Source Line Number", sourceLineNumber.ToString() },
                    { "CallStack", _traceEventCache.Callstack }
                };

                Insights.Report(e, additionalInfo);
            }
        }
Пример #14
0
        public void Error(string e, [CallerMemberName] string memberName = "",
                          [CallerFilePath] string sourceFilePath         = "",
                          [CallerLineNumber] int sourceLineNumber        = 0)
        {
            if (e == null)
            {
                e = _defaultLogString;
            }

            AndroidLog.Error(_target, e);
            CrashlyticsLog(e);
            Writer.Write(e);

            if (_xamarinInsights)
            {
                Dictionary <string, string> additionalInfo = new Dictionary <string, string>
                {
                    { "Member Name", memberName },
                    { "Source Filepath", sourceFilePath },
                    { "Source Line Number", sourceLineNumber.ToString() },
                    { "CallStack", _traceEventCache.Callstack }
                };

                Insights.Report(new Exception(e), additionalInfo);
            }
        }
Пример #15
0
 public void Log(Exception exception = null, LogType severity = LogType.WARNING, IDictionary extraData = null)
 {
     if (Insights.IsInitialized)
     {
         Insights.Report(exception, extraData, LogTypeToInsight(severity));
     }
 }
Пример #16
0
        public async Task <bool> RefreshReferenceData(bool loadLocationsDataAswell, string location)
        {
            bool IsSuccessful = false;

            try
            {
                IsBusy = true;
                OnPropertyChanged("IsSubmitEnabled");
                if (loadLocationsDataAswell)
                {
                    IsSuccessful = await _referenceDataService.LoadLocations();
                }
                if (!string.IsNullOrEmpty(location))
                {
                    IsSuccessful = await _referenceDataService.LoadDataByLocation(location);
                }
                if (!IsSuccessful)
                {
                    IsBusy = false;
                    await App.RootPage.DisplayAlert(ErrorMessages.ErrorType.Error.ToString(), ErrorMessages.ErrorLoadingReferenceData, ErrorMessages.MesssageButton.Ok.ToString());
                }

                IsBusy = false;
            }
            catch (Exception ex)
            {
                IsBusy = false;
                Insights.Report(new Exception("Error Loading reference data", ex));
            }
            OnPropertyChanged("IsSubmitEnabled");
            return(IsSuccessful);
        }
Пример #17
0
        /// <summary>
        /// Shows the Google authentication web view so the user can authenticate
        /// </summary>
        async Task ShowGoogleAuthenticationView()
        {
            try
            {
                var api = new GoogleApi("google", Keys.GoogleApiClientId, Keys.GoogleClientSecret, new NativeMessageHandler())
                {
                    Scopes = Keys.GoogleScope.Split(' '),
                };

                if (_doResetWebCache)
                {
                    _doResetWebCache = false;
                    api.ResetData();
                }

                var account = await api.Authenticate();

                if (account != null)
                {
                    var oauthAccount = (OAuthAccount)account;

                    App.AuthToken = "{0} {1}".Fmt(oauthAccount.TokenType, oauthAccount.Token);
                    await Settings.Instance.Save();
                }
            }
            catch (Exception e)
            {
                Console.WriteLine("**SPORT AUTHENTICATION ERROR**\n\n" + e.GetBaseException());
                Insights.Report(e);
            }
        }
Пример #18
0
        async Task TryInitializeMasterViewModel()
        {
            while (true)
            {
                string errorMessage;
                try {
                    await MasterViewModel.InitializeAsync();

                    break;
                } catch (Exception ex) {
                    Insights.Report(ex, Insights.Severity.Error);
                    errorMessage = ex.Message;
                }

                if (!string.IsNullOrWhiteSpace(errorMessage))
                {
                    var retry = await DisplayAlert("Error", errorMessage, "Retry", "Close Application");

                    if (retry)
                    {
                        continue;
                    }
                }

                break;
            }
        }
Пример #19
0
        public TResult TransactionWithResult <TResult>(Func <TResult> action)
        {
            bool beganTransaction = false;

            try
            {
                if (!this.IsInTransaction)
                {
                    beganTransaction = true;
                    this.BeginTransaction();
                }

                TResult result = action();

                if (beganTransaction)
                {
                    Commit();
                }

                return(result);
            }
            catch (Exception ex) {
                Insights.Report(ex);
                Console.WriteLine("Exception in " + ex.Source + ": " + ex.Message);
                if (beganTransaction)
                {
                    Rollback();
                }
                throw;
            }
        }
Пример #20
0
        public static string GetMimeType(string path)
        {
            string mimeType = "";

            if (!String.IsNullOrEmpty(path))
            {
                try{
                    string extension = Path.GetExtension(path);

                    if (!extension.StartsWith("."))
                    {
                        extension = "." + extension;
                    }

                    return(mimeTypes.TryGetValue(extension, out mimeType) ? mimeType : "application/octet-stream");
                }
                catch (Exception ex) {
                    Insights.Report(ex);
                    return(mimeType);
                }
            }
            else
            {
                return(mimeType);
            }
        }
Пример #21
0
        //Resultaat van image picker
        protected override async void OnActivityResult(int requestCode, Result resultCode, Intent data)
        {
            base.OnActivityResult(requestCode, resultCode, data);

            if (resultCode == Result.Ok)
            {
                Android.Net.Uri uriResult = data.Data;
                try {
                    int    numberOfDirectoriesOpened   = ExplorerFragment.openedDirectories.Count;
                    string directoryNameToUploadFileTo = ExplorerFragment.openedDirectories [numberOfDirectoriesOpened - 1];
                    string pathToFile          = GetPathToImage(uriResult);
                    string fileName            = System.IO.Path.GetFileName(pathToFile);
                    string fullDestinationPath = System.IO.Path.Combine(directoryNameToUploadFileTo, fileName);
                    bool   uploadedSucceeded   = await DataLayer.Instance.UploadFile(fullDestinationPath, pathToFile);

                    HideProgressDialog();
                    if (!uploadedSucceeded)
                    {
                        ShowToast("Het uploaden is mislukt. Probeer het a.u.b. opnieuw");
                    }
                    else
                    {
                        ShowToast("Bestand succesvol geupload");
                        RefreshExplorerFragmentData();
                    }
                } catch (Exception ex) {
                    Insights.Report(ex);
                    HideProgressDialog();
                    ShowToast("Het uploaden is mislukt. Probeer het a.u.b. opnieuw");
                }
            }
        }
Пример #22
0
        async Task <CSSearchableItem> AddConferenceToSearch(Conference conference)
        {
            var attributes = new CSSearchableItemAttributeSet(itemContentType: MobileCoreServices.UTType.DelimitedText.ToString());

            attributes.Title = conference.Name;
            attributes.ContentDescription = conference.Description;
            if (!string.IsNullOrWhiteSpace(conference.ImageUrl))
            {
                try {
                    var imageService = ServiceLocator.Current.GetInstance <IImageService> ();
                    var localPath    = await imageService.GetConferenceImagePath(conference);

                    UIImage image = null;
                    await Task.Run(() => {
                        var uiImage = UIImage.FromFile(localPath);
                        if (uiImage != null)
                        {
                            attributes.ThumbnailData = uiImage.AsPNG();
                        }
                    });
                } catch (Exception e) {
                    Insights.Report(e);
                }
            }
            var searchableConference = new CSSearchableItem(conference.Slug, "tekconf", attributes);

            return(searchableConference);
        }
Пример #23
0
        public override bool ValueMatches(object conditionValue, bool conjunctive)
        {
            // if a list is passed, compare values
            if (conditionValue is List <object> )
            {
                List <object> selectedValueList  = Value as List <object>;
                List <object> conditionValueList = conditionValue as List <object>;

                // if the matching condition is conjunctive, then the two lists must be identical.
                if (conjunctive)
                {
                    return(selectedValueList.OrderBy(o => o).SequenceEqual(conditionValueList.OrderBy(o => o)));
                }
                // if the matching condiction is disjunctive, then any of the condition values may be selected.
                else
                {
                    return(conditionValueList.Any(o => selectedValueList.Contains(o)));
                }
            }
            else
            {
                try
                {
                    Insights.Report(new Exception("Called ItemPickerPageInput.ValueMatches with conditionValue that is not a List<object>."), Insights.Severity.Critical);
                }
                catch (Exception)
                {
                }

                return(false);
            }
        }
Пример #24
0
 public override async void PerformFetch(UIApplication application, Action <UIBackgroundFetchResult> completionHandler)
 {
     try {
         if (MainApp != null && MainApp.IsUserConnected)
         {
             var handle = Insights.TrackTime("TimeToFetch");
             handle.Start();
             foreach (var item in RootMaster.MenuTabs)
             {
                 if (item.PageType == typeof(Profile) || item.PageType == typeof(ELearning) || item.PageType == typeof(Projets))
                 {
                     continue;
                 }
                 if (item.PageType == typeof(Notifications))
                 {
                     await((Notifications)item.Page).SilentUpdateForNotification(null);
                     FireNotification(((Notifications)item.Page).News);
                 }
                 else
                 {
                     await item.Page.SilentUpdate(null);
                 }
             }
             handle.Stop();
             completionHandler(UIBackgroundFetchResult.NewData);
             return;
         }
     } catch (Exception ex) {
         Insights.Report(ex);
         completionHandler(UIBackgroundFetchResult.Failed);
     }
 }
Пример #25
0
        static async Task <T> Execute <T>(string insightsIdentifier, Func <Task <T> > execute, T defaultReturnObject)
        {
            try
            {
                using (var handle = Insights.TrackTime(insightsIdentifier))
                {
                    T result;
                    handle.Start();
                    result = await execute();

                    handle.Stop();
                    return(result);
                }
            }
            catch (MobileServiceInvalidOperationException ex) // isolate mobile service errors
            {
                Insights.Report(ex, Insights.Severity.Error);
                Debug.WriteLine(@"MOBILE SERVICE ERROR {0}", ex.Message);
            }
            catch (Exception ex2) // catch all other errors
            {
                Insights.Report(ex2, Insights.Severity.Error);
                Debug.WriteLine(@"ERROR {0}", ex2.Message);
            }
            return(defaultReturnObject);
        }
Пример #26
0
        public async Task <AuthenticationResult> Login()
        {
            try
            {
                var authUser = await _client.LoginAsync(AppDelegate.RootViewController, Auth0Settings.AdfsConnection, true, "openid email name nickname given_name family_name");

                var authToken = authUser.Profile.ToObject <AuthToken>();

                authToken.IdToken      = authUser.IdToken;
                authToken.AccessToken  = authUser.Auth0AccessToken;
                authToken.RefreshToken = authUser.RefreshToken;

                Insights.Identify(authToken);

                return(new AuthenticationResult(authToken, AuthenticationStatus.Succeded));
            }
            catch (TaskCanceledException cancelException)
            {
                AuthenticationStatus authenticationStatus = AuthenticationStatus.Failed;

                if (cancelException.Task != null && cancelException.Task.Status == TaskStatus.Canceled)
                {
                    authenticationStatus = AuthenticationStatus.Canceled;
                }

                return(new AuthenticationResult(null, authenticationStatus, cancelException));
            }
            catch (Exception exception)
            {
                Insights.Report(exception);
                return(new AuthenticationResult(null, AuthenticationStatus.Failed, exception));
            }
        }
        public async Task <TaskCompletionType> Upload()
        {
            if (!IsLoggedIn)
            {
                await Login();
            }

            try
            {
                using (var dbstream = fileStore.OpenRead(OneDriveAuthenticationConstants.DB_NAME))
                {
                    var uploadedItem = await OneDriveClient
                                       .Drive
                                       .Root
                                       .ItemWithPath(Path.Combine(OneDriveAuthenticationConstants.BACKUP_FOLDER_NAME,
                                                                  OneDriveAuthenticationConstants.BACKUP_NAME))
                                       .Content
                                       .Request()
                                       .PutAsync <Item>(dbstream);

                    return(uploadedItem != null ? TaskCompletionType.Successful : TaskCompletionType.Unsuccessful);
                }
            }
            catch (OneDriveException ex)
            {
                Insights.Report(ex, Insights.Severity.Error);
                return(TaskCompletionType.Unsuccessful);
            }
        }
Пример #28
0
        public static DateTime getDateFromString(string datetime)
        {
            //Value: 27/11/201400:00:00 or 26/11/2014 00:00:00
            DateTime returnDate = new DateTime();

            try
            {
                int day   = int.Parse(datetime.Split('/') [0]);
                int month = int.Parse(datetime.Split('/') [1]);
                int year  = int.Parse((datetime.Split('/') [2]).ToString().Substring(0, 4));

                string time = datetime.Split('/')[2].ToString().Trim().Replace(" ", "");

                int hour   = int.Parse(time.Substring(4, 2));
                int minute = int.Parse(time.Substring(7, 2));
                int second = int.Parse(time.Substring(10, 2));

                returnDate = new DateTime(year, month, day, hour, minute, second);
            }
            catch (Exception ex)
            {
                Insights.Report(ex);
                returnDate = DateTime.MinValue;
            }

            return(returnDate);
        }
Пример #29
0
        public async Task RefreshTollRoads(CancellationToken token)
        {
            try
            {
                var currentTime = DateTime.UtcNow;
                var timeSpan    = TimeSpan.FromDays(1);
                //var shouldUpdateTollRoads = currentTime - _storedSettingsService.LastSyncDateTime > timeSpan;

                var list = await _serverApiService.RefreshTollRoads(_storedSettingsService.LastSyncDateTime.UnixTime(), token);

                if (list != null)
                {
                    _storedSettingsService.LastSyncDateTime = currentTime;
                    _dataBaseStorage.InsertOrUpdateAllTollRoads(list);
                }
                else
                {
                    Insights.Report(new NullReferenceException {
                        Source = "Response, has no roads!"
                    });
                    Mvx.Resolve <IUserInteraction>().Alert("App has not get any roads!", null, "Warning", "Ok");
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex.Message);
            }
        }
        private async void listviewInspo_ItemTapped(object sender, ItemTappedEventArgs e)
        {
            try
            {
                if (listviewInspo.SelectedItem != null)
                {
                    var obj  = e.Item as Inspo;
                    var page = new ImagePage(obj);
                    page.BindingContext = obj;


                    await Navigation.PushAsync(page);

                    //listviewInspo.SelectedItem = null;
                }
            }
            catch (Exception ex)
            {
                try
                {
                    Insights.Report(ex);
                    await DisplayAlert("Useless", "I tried to load the inspo, but I failed. Horribly.", "Be better");
                }
                catch
                {
                    await DisplayAlert("Error", "Error when trying to connect! Something is wrong! HELP!", "Jesus, calm down already.");
                }
            }
        }