public async Task <bool> GetCoverImage(string imgUrl) { bool result = false; string fileName = System.IO.Path.GetFileName(imgUrl); if (!string.IsNullOrEmpty(fileName)) { string pathToMediaFile = Path.Combine(ImagePathManager.GetPicturesDirectory(), fileName); if (!File.Exists(pathToMediaFile)) { try { result = await _serverRequest.HttpRequestGetFile(imgUrl, pathToMediaFile, _authToken); LastHttpStatusCode = _serverRequest.GetLastStatusCode(); if (LastHttpStatusCode != HttpStatusCode.OK) { UserDialogs.Instance.Toast("Error downloading cover image"); HandleError.Process("FeedApiRequest", "GetCoverImage", new Exception(LastHttpStatusCode.ToString()), false, imgUrl); deleteFile(pathToMediaFile); } } catch (Exception e) { HandleError.Process("FeedApiRequest", "GetCoverImage", e, showWarning: false); deleteFile(pathToMediaFile); } } } return(result); }
public void ShareRouteOnlyPointsDescription(ViewRoute vroute, string packageName) { Intent share = new Intent(Intent.ActionSend); share.SetType("html/*"); if ((vroute != null) && (!string.IsNullOrEmpty(vroute.Id))) { StringBuilder sbRoute = GetRouteText(vroute); share.PutExtra(Intent.ExtraText, $"{sbRoute.ToString()}"); share.SetFlags(ActivityFlags.NewTask); if (!string.IsNullOrEmpty(packageName)) { AddComponentNameToIntent(packageName, share); } try { Android.App.Application.Context.StartActivity(share); } catch (Exception e) { HandleError.Process("CommonShareService", "Share route", e, false); } } }
public bool SetSyncStatus(string Id, bool IsSyncPreview, bool Status) { bool result = false; try { RealmInstance.Write(() => { var mediaObject = RealmInstance.Find <RoutePointMediaObject>(Id); if (IsSyncPreview) { mediaObject.PreviewServerSynced = Status; } else { mediaObject.OriginalServerSynced = Status; } } ); result = true; } catch (Exception e) { HandleError.Process("RoutePointMediaObjectManager", "SetSyncStatus", e, false); } return(result); }
internal bool Save(ViewUserInfo viewUserInfo) { bool result = false; try { RealmInstance.Write(() => { var dbObject = !string.IsNullOrEmpty(viewUserInfo.UserId) ? RealmInstance.Find <User>(viewUserInfo.UserId) : null; if (dbObject == null) { dbObject = new User(); dbObject.UserId = viewUserInfo.UserId; RealmInstance.Add(dbObject); } dbObject.Name = viewUserInfo.Name; dbObject.Email = viewUserInfo.Email; dbObject.ImgUrl = viewUserInfo.ImgUrl; }); result = true; } catch (Exception e) { HandleError.Process("UserManager", "Save", e, false); } return(result); }
public async Task <SyncObjectStatus> GetSyncStatus(IEnumerable <Tuple <string, int> > points) { SyncObjectStatus requestValue = new SyncObjectStatus(); foreach (var point in points) { requestValue.Statuses.Add(new SyncObjectStatus.ObjectStatus() { ObjectId = point.Item1, Version = point.Item2 }); } JObject jsonRequestObject = JObject.FromObject(requestValue); SyncObjectStatus deserializedValue = new SyncObjectStatus(); try { ApiRequest api = new ApiRequest(); var response = await api.HttpRequestPOST($"{_hostUrl}/routepoints/sync", jsonRequestObject.ToString(), _authToken); LastHttpStatusCode = api.LastHttpStatusCode; deserializedValue = JsonConvert.DeserializeObject <SyncObjectStatus>(response); } catch (Exception e) { HandleError.Process("PointsApiRequest", "GetSyncStatus", e, false); } return(deserializedValue); }
public void Share(ViewRoute vroute, string packageName) { if ((vroute != null) && (!string.IsNullOrEmpty(vroute.Id))) { RoutePointManager pointManager = new RoutePointManager(); var routePoints = pointManager.GetPointsByRouteId(vroute.RouteId); Intent share = new Intent(Intent.ActionSendMultiple); share.SetType("image/*"); List <Uri> uris = new List <Uri>(); if (routePoints.Any()) { Java.IO.File file = new Java.IO.File(vroute.CoverImage); var fileUri = FileProvider.GetUriForFile(Android.App.Application.Context, Android.App.Application.Context.PackageName + ".fileprovider", file); share.PutExtra(Intent.ExtraStream, fileUri); uris.Add(fileUri); share.PutParcelableArrayListExtra(Intent.ExtraStream, uris.ToArray()); } share.SetFlags(ActivityFlags.NewTask); if (!string.IsNullOrEmpty(packageName)) { AddComponentNameToIntent(packageName, share); } try { Android.App.Application.Context.StartActivity(share); } catch (Exception e) { HandleError.Process("Facebook", "Share route", e, false); } } }
private async void addAudioAsync(object obj) { _vpoint.Version++; _vpoint.Save(); PermissionManager permissions = new PermissionManager(); if (await permissions.PermissionGrantedAsync(Plugin.Permissions.Abstractions.Permission.Microphone, CommonResource.RoutePoint_RightNeedToRecordAudio)) { string mediaId = Guid.NewGuid().ToString(); string pathAudioFile = Path.Combine(ImagePathManager.GetPicturesDirectory(), "audio_" + mediaId + ".3gp"); bool resultRecordInverted = true; try { DependencyService.Get <IRecordAudioService>().Start(pathAudioFile); resultRecordInverted = await App.Current.MainPage.DisplayAlert(CommonResource.CommonMsg_Audio, CommonResource.RoutePoint_AudioRecording, CommonResource.CommonMsg_Cancel, CommonResource.CommonMsg_OkAndSave); } catch (Exception e) { HandleError.Process("RoutePoint", "RecordAudio", e, false); } finally { DependencyService.Get <IRecordAudioService>().Stop(); } if (!resultRecordInverted) { _vpoint.AddMediaItem(mediaId, MediaObjectTypeEnum.Audio); ApplyChanges(); PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("Images")); Analytics.TrackEvent("Media: audio recorded"); } } }
public new void Share(ViewRoute vroute, string packageName) { if ((vroute != null) && (!string.IsNullOrEmpty(vroute.Id))) { RoutePointManager pointManager = new RoutePointManager(); var routePoints = pointManager.GetPointsByRouteId(vroute.RouteId); Intent share = new Intent(Intent.ActionSend); share.SetType("image/*"); if (routePoints.Any()) { Java.IO.File file = new Java.IO.File(vroute.CoverImage); var fileUri = FileProvider.GetUriForFile(Android.App.Application.Context, Android.App.Application.Context.PackageName + ".fileprovider", file); share.PutExtra(Intent.ExtraStream, fileUri); share.AddFlags(ActivityFlags.GrantReadUriPermission); } var componentName = new ComponentName("com.instagram.android", "com.instagram.share.handleractivity.ShareHandlerActivity"); share.SetComponent(componentName); try { var intentNew = Intent.CreateChooser(share, "Share to"); intentNew.SetFlags(ActivityFlags.NewTask); Android.App.Application.Context.StartActivity(intentNew); } catch (Exception e) { HandleError.Process("Instagram", "Share route", e, false); } } }
public async Task <List <RouteVersion> > GetRoutesVersions(bool onlyPersonal) { List <RouteVersion> deserializedValue = new List <RouteVersion>(); string cacheKey = $"{routesVersionsCacheId}-{onlyPersonal}"; if (!_memoryCache.TryGetValue(cacheKey, out deserializedValue)) { try { ApiRequest api = new ApiRequest(); var response = await api.HttpRequestGET($"{this._hostUrl}/route/version/get?onlyPersonal={onlyPersonal}", _authToken); LastHttpStatusCode = api.LastHttpStatusCode; deserializedValue = JsonConvert.DeserializeObject <List <RouteVersion> >(response); _memoryCache.Set(cacheKey, deserializedValue, new MemoryCacheEntryOptions() { AbsoluteExpirationRelativeToNow = TimeSpan.FromMinutes(5) }); } catch (Exception e) { HandleError.Process("RoutesApiRequest", "GetRoutesVersions", e, false); } } return(deserializedValue); }
public async Task <string> HttpRequestPost(string relativeUrl, string authToken, string parameters) { string result = string.Empty; string url = new Uri(_apiBaseUri, relativeUrl).AbsoluteUri; _logger.AddStringEvent($"POST start:{url}"); DateTime dStart = DateTime.Now; fillHeaders(authToken); try { HttpResponseMessage response = await _httpClient.PostAsync(url, new StringContent(parameters, System.Text.Encoding.UTF8, "application/json")); if (response.IsSuccessStatusCode) { result = await response.Content.ReadAsStringAsync(); } _lastHttpStatusCode = response.StatusCode; } catch (Exception e) { _logger.AddStringEvent($"POST error:[{url}], delay [{(dStart - DateTime.Now).Milliseconds}], error [{e.Message}]"); HandleError.Process("ServerRequest", "HttpRequestPost", e, false); } _logger.AddStringEvent($"POST end:[{url}], delay [{(dStart - DateTime.Now).Milliseconds}]"); return(result); }
public async Task <bool> SendImage(string routePointId, string routePointMediaObjectId, MediaObjectTypeEnum mediaType, bool isPreview = false) { bool sendResult = false; string nameMediafile = ImagePathManager.GetMediaFilename(routePointMediaObjectId, mediaType, isPreview); string pathToMediaFile = ImagePathManager.GetImagePath(routePointMediaObjectId, mediaType, isPreview); if (File.Exists(pathToMediaFile)) { int maxRetryCount = 3; for (int triesCount = 0; triesCount < maxRetryCount; triesCount++) { sendResult = await TryToSendFileAsync(pathToMediaFile, nameMediafile, routePointId, routePointMediaObjectId); if (sendResult) { return(sendResult); } else { Thread.Sleep(30); //ToDo: останавливает основной поток, UI будет тупить, надо на таймер переделать HandleError.Process("RoutePointMediaObjectApiRequest", "SendImage", new Exception($"Retry send {nameMediafile}"), false); if (triesCount >= maxRetryCount - 1) { HandleError.Process("RoutePointMediaObjectApiRequest", "SendImage", new Exception($"Error send {nameMediafile}"), false); } } } } else { HandleError.Process("RoutePointMediaObjectApiRequest", "SendImage", new Exception($"File {pathToMediaFile} not found"), false); } return(sendResult); }
internal bool Delete(ViewRoutePoint viewRoutePoint) { bool result = false; string rId = viewRoutePoint.RouteId; try { RealmInstance.Write(() => { var point = RealmInstance.Find <RoutePoint>(viewRoutePoint.Id); foreach (var item in point.MediaObjects) { RealmInstance.Remove(item); } RealmInstance.Remove(point); }); result = true; } catch (Exception e) { HandleError.Process("RoutePointManager", "DeleteRoutePoint", e, false); } return(result); }
public async Task <string> HttpRequestGet(string relativeUrl, string bodyText, string authToken) { string result = string.Empty; string url = new Uri(_apiBaseUri, relativeUrl).AbsoluteUri; _logger.AddStringEvent($"GET start:{url}"); fillHeaders(authToken); DateTime dStart = DateTime.Now; var request = new HttpRequestMessage() { Method = HttpMethod.Get, RequestUri = new Uri(url), //Content = new StringContent(bodyText) Content = new StringContent(bodyText, Encoding.UTF8, "application/json") }; try { HttpResponseMessage response = await _httpClient.SendAsync(request); if (response.IsSuccessStatusCode) { result = await response.Content.ReadAsStringAsync(); } _lastHttpStatusCode = response.StatusCode; } catch (Exception e) { _logger.AddStringEvent($"GET error:[{url}], delay [{(dStart - DateTime.Now).Milliseconds}], error [{e.Message}]"); HandleError.Process("ServerRequest", "HttpRequestGETwithBody", e, false); } _logger.AddStringEvent($"GET end:[{url}], delay [{(dStart - DateTime.Now).Milliseconds}]"); return(result); }
public async Task <bool> HttpRequestDELETE(string url, string authToken) { _lastHttpStatusCode = 0; bool result = false; var client = new HttpClient(); client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", authToken); try { var requestResult = await client.DeleteAsync(url); _lastHttpStatusCode = requestResult.StatusCode; result = requestResult.IsSuccessStatusCode; } catch (WebException webException) { _lastHttpStatusCode = ((HttpWebResponse)webException.Response).StatusCode; HandleError.Process("ApiRequest", "HttpRequestDELETE", webException, false); } catch (Exception e) { HandleError.Process("ApiRequest", "HttpRequestDELETE", e, false); } return(result); }
public async Task <string> HttpRequestPOST(string url, string parameters, string authToken) { _lastHttpStatusCode = 0; string result = string.Empty; var client = new HttpClient(); if (!string.IsNullOrEmpty(authToken)) { client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", authToken); } try { var requestResult = await client.PostAsync(url, new StringContent(parameters, System.Text.Encoding.UTF8, "application/json")); _lastHttpStatusCode = requestResult.StatusCode; if (requestResult.IsSuccessStatusCode) { result = await requestResult.Content.ReadAsStringAsync(); } } catch (WebException webException) { _lastHttpStatusCode = ((HttpWebResponse)webException.Response).StatusCode; HandleError.Process("ApiRequest", "HttpRequestPOST", webException, false); } catch (Exception e) { HandleError.Process("ApiRequest", "HttpRequestPOST", e, false); } return(result); }
public async Task <string> HttpRequestGET(string url, string authToken) { _lastHttpStatusCode = 0; string result = string.Empty; HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(new Uri(url)); request.Method = "GET"; request.Headers.Add("Authorization", "Bearer " + authToken); request.PreAuthenticate = !string.IsNullOrEmpty(authToken); try { using (WebResponse response = request.GetResponseAsync().GetAwaiter().GetResult()) { var webresponse = (HttpWebResponse)response; using (System.IO.Stream stream = response.GetResponseStream()) { using (var reader = new StreamReader(stream)) { result = reader.ReadToEnd(); _lastHttpStatusCode = webresponse.StatusCode; } } } } catch (WebException webException) { _lastHttpStatusCode = ((HttpWebResponse)webException.Response).StatusCode; HandleError.Process("ApiRequest", "HttpRequestGET", webException, false); } catch (Exception e) { HandleError.Process("ApiRequest", "HttpRequestGET", e, false); } return(result); }
public void Show(string filename) { Intent intent = new Intent(); intent.SetAction(Intent.ActionView); intent.AddFlags(ActivityFlags.NewTask); intent.AddFlags(ActivityFlags.MultipleTask); intent.AddFlags(ActivityFlags.GrantReadUriPermission); try { Java.IO.File file = new Java.IO.File(filename); //https://stackoverflow.com/questions/42516126/fileprovider-illegalargumentexception-failed-to-find-configured-root var fileUri = FileProvider.GetUriForFile(Android.App.Application.Context, Android.App.Application.Context.PackageName + ".fileprovider", file); if (Path.GetExtension(filename) == ".3gp") { intent.SetDataAndType(fileUri, "audio/*"); } else { intent.SetDataAndType(fileUri, "image/*"); } Android.App.Application.Context.StartActivity(intent); } catch (Exception e) { HandleError.Process("DefaultViewer", "Show", e, false); } }
public bool Set(string key, string value) { bool result = false; try { _realmInstance.Write(() => { var paramObject = _realmInstance.Find <Parameter>(key); if (paramObject != null) { _realmInstance.Remove(paramObject); } _realmInstance.Add(new Parameter() { KeyName = key, Value = value }); }); result = true; } catch (Exception e) { HandleError.Process("ParameterManager", "Set", e, false); } return(result); }
public async Task <List <Route> > GetPrivateRoutes(int pageSize, int indexStart, int count) { List <Route> deserializedValue = new List <Route>(); try { string filter = @"&filter={""isDeleted"":""False""}"; var response = await _serverRequest.HttpRequestGet($"/api/v2/routes?pageSize={pageSize}&range=%5B{indexStart}%2C{indexStart + count}%5D{filter}", _authToken); LastHttpStatusCode = _serverRequest.GetLastStatusCode(); if (LastHttpStatusCode == HttpStatusCode.OK) { deserializedValue = JsonConvert.DeserializeObject <List <Route> >(response); } else { HandleError.Process("RoutesApiRequest", "GetPrivateRoutes", new HttpRequestException(LastHttpStatusCode.ToString()), false); } } catch (Exception e) { HandleError.Process("RoutesApiRequest", "GetPrivateRoutes", e, false); } return(deserializedValue); }
internal bool Delete(string mediaObjectId) { bool result = false; try { RealmInstance.Write(() => { var mediaObject = RealmInstance.Find <RoutePointMediaObject>(mediaObjectId); if (mediaObject != null) { var pointObject = RealmInstance.Find <RoutePoint>(mediaObject.RoutePointId); if (pointObject != null) { mediaObject.IsDeleted = true; mediaObject.Version++; result = mediaObject.IsDeleted; //нужно для того, чтобы синхронизация обнаружила отличия от сервера и проверила версии с последующей отправкой изменений на сервер pointObject.MainRoute.ObjVerHash = string.Empty; } } } ); } catch (Exception e) { HandleError.Process("RoutePointMediaObjectManager", "Delete", e, false); } return(result); }
public void Start(string filePath) { try { if (File.Exists(filePath)) { File.Delete(filePath); } if (recorder == null) { recorder = new MediaRecorder(); // Initial state. } recorder.Reset(); recorder.SetAudioSource(AudioSource.Mic); recorder.SetOutputFormat(OutputFormat.Default); recorder.SetAudioEncoder(AudioEncoder.AmrNb); recorder.SetAudioChannels(1); recorder.SetAudioEncodingBitRate(96000); //recorder.SetAudioSamplingRate(44100); //recorder.SetAudioEncodingBitRate(48000); //recorder.SetAudioSamplingRate(22050); recorder.SetOutputFile(filePath); recorder.Prepare(); // Prepared state //recorder.SetMaxDuration(30000); recorder.Start(); // Recording state. } catch (Exception e) { HandleError.Process("RecordAudioService", "Start", e, false); } }
private (ObservableCollection <string>, ObservableCollection <string>, bool userHaveAccess) getDirContent(DirectoryInfo currentDirectory) { ObservableCollection <string> files = new ObservableCollection <string>(); ObservableCollection <string> dirs = new ObservableCollection <string>(); bool userHaveAccess = false; try { if (currentDirectory.FullName.Equals("/storage")) { dirs = currentDirectory.GetDirectories().Where(d => !d.Name.Equals("emulated")).OrderBy(d => d.Name).Select(d => d.Name) .ToObservableCollection(); dirs.Add("/storage/emulated/0"); } else { dirs = currentDirectory.GetDirectories().OrderBy(d => d.Name).Select(d => d.Name) .ToObservableCollection(); } MediaFileManager mediaFileManager = new MediaFileManager(); files = mediaFileManager.GetMediaFilesFromDirectory(currentDirectory).OrderByDescending(f => f.CreationTime) .Select(f => f.FullName).ToArray().ToObservableCollection();; userHaveAccess = true; } catch (IOException ioException) { HandleError.Process("Settings", "getDirContent", ioException, false, currentDirectory.FullName); } catch (UnauthorizedAccessException e) { HandleError.Process("Settings", "getDirContent", e, false, currentDirectory.FullName); } return(files, dirs, userHaveAccess); }
/// <summary> /// Здесь только старт авторизации, до появления окна Chrome - завершение через отдельное сообщение /// </summary> private void startLoginWithGoogleCommand() { IsWaitForServer = true; //_googleAuthManager = DependencyService.Get<IGoogleAuthManagerService>(); //_googleAuthManager.Login(OnLoginCompleteAsync); MessagingCenter.Subscribe <OAuthResultMessage>(this, string.Empty, async(sender) => { if (sender.IsAuthenticated) { try { var result = await TryToLoginServerWithOAuth(new OAuthUser() { Id = sender.AuthenticatorUserId, Name = sender.Username, Email = sender.Email, ImgUrl = !String.IsNullOrEmpty(sender.ImgUrl) ? new Uri(sender.ImgUrl) : new Uri("") }); if (result) { await Navigation.PopModalAsync(); } } catch (Exception e) { HandleError.Process("OAuthLogin", "OnLoginComplete", e, false); } } else { await Application.Current.MainPage.DisplayAlert(CommonResource.CommonMsg_Warning, CommonResource.Login_AuthError, "Ok"); } }); UserDialogs.Instance.ShowLoading(CommonResource.Login_AuthorizationProcess, MaskType.Black); OAuthGoogleAuthenticator oAuth = new OAuthGoogleAuthenticator(); oAuth.Login(); /*var login = DependencyService.Get<IOAuthService>(); * var resultAuthUser = await login.LoginAsync(); * if (!string.IsNullOrEmpty(resultAuthUser.Id)) * { * var taskRun = Task.Run(async () => * { * try * { * var result = await TryToLoginServerWithOAuth(resultAuthUser); * } * catch (Exception e) * { * HandleError.Process("OAuthLogin", "OnLoginComplete", e, false); * } * }); * } * else * { * await Application.Current.MainPage.DisplayAlert(CommonResource.CommonMsg_Warning, CommonResource.Login_AuthError, "Ok"); * }*/ }
private void deleteFile(string pathToFile) { try { File.Delete(pathToFile); }catch (Exception e) { HandleError.Process("FeedApiRequest", "DeleteCorruptedFile", e, showWarning: false); } }
private async void urlTappedCommandAsync() { try { await Browser.OpenAsync(UrlPresentationText); } catch (Exception e) { HandleError.Process("urlTappedCommand", "Open in browser", e, false); } }
public void RecordStop() { try { srvInstance.Stop(); } catch (Exception e) { HandleError.Process("AudioManager", "RecordStop", e, false); } }
public void Stop() { try { recorder.Stop(); } catch (Exception e) { HandleError.Process("RecordAudioService", "Stop", e, false); } }
private async Task <bool> uploadMedia(string routePointId, string mediaId, MediaObjectTypeEnum mediaMediaType, bool loadOnlyPreviewImg) { string filename = ImagePathManager.GetMediaFilename(mediaId, mediaMediaType, loadOnlyPreviewImg); bool uploadResult = await _routePointMediaObjectsApi.SendImage(routePointId, mediaId, mediaMediaType, loadOnlyPreviewImg); if (!uploadResult) { HandleError.Process("SyncRoute", "ErrorUploadMedia", new Exception("ErrorUploadMedia"), false, $"filename:[{filename}], status:[{_routePointMediaObjectsApi.LastHttpStatusCode.ToString()}]"); } return(uploadResult); }
public void Share(ViewRoutePoint vpoint, string packageName) { if ((vpoint != null) && (!string.IsNullOrEmpty(vpoint.Id))) { string pointCoordinates = $"{vpoint.Latitude.ToString(CultureInfo.InvariantCulture)},{vpoint.Longitude.ToString(CultureInfo.InvariantCulture)}"; Intent share = new Intent(); share.SetType("text/plain"); if (vpoint.MediaObjectPaths.Count > 1) { share = new Intent(Intent.ActionSendMultiple); share.SetType("image/*"); List <Uri> uris = new List <Uri>(); foreach (var path in vpoint.MediaObjectPaths) { Java.IO.File file = new Java.IO.File(path); var fileUri = FileProvider.GetUriForFile(Android.App.Application.Context, Android.App.Application.Context.PackageName + ".fileprovider", file); uris.Add(fileUri); } share.PutParcelableArrayListExtra(Intent.ExtraStream, uris.ToArray()); } else if (vpoint.MediaObjectPaths.Count == 1) { share = new Intent(Intent.ActionSend); share.SetType("image/*"); Java.IO.File file = new Java.IO.File(vpoint.MediaObjectPaths[0]); var fileUri = FileProvider.GetUriForFile(Android.App.Application.Context, Android.App.Application.Context.PackageName + ".fileprovider", file); share.PutExtra(Intent.ExtraStream, fileUri); } else if (vpoint.MediaObjectPaths.Count == 0) { } share.SetFlags(ActivityFlags.NewTask); share.PutExtra(Intent.ExtraText, $"{pointCoordinates}\n{vpoint.Description}"); share.PutExtra(Intent.ExtraSubject, $"{pointCoordinates}\n{vpoint.NameText}"); share.PutExtra(Intent.ExtraAllowMultiple, true); if (!string.IsNullOrEmpty(packageName)) { AddComponentNameToIntent(packageName, share); } try { Android.App.Application.Context.StartActivity(share); } catch (Exception e) { HandleError.Process("CommonShareService", "Share point", e, false); } } }
internal void DeleteAll() { try { RealmInstance.Write(() => { RealmInstance.RemoveAll <Poi>(); }); } catch (Exception e) { HandleError.Process("PoiManager", "DeleteAll", e, false); } }