private async Task DoSaveCommand()
        {
            var dialog = Resolve <IUserDialogs>();

            dialog.ShowLoading(Messages.General.Saving);

            try
            {
                await _context.CommitChanges();

                Publish(new EditingDoneEvent(this, EditAction.Edit));
                dialog.ShowSuccess($"{_context.ItemType} {Messages.General.SavedSuccessfully}");
                Close();
            }
            catch (Exception ex)
            {
                dialog.HideLoading();
                Mvx.Trace($"Unable to save {_context.ItemType}, exception: {ex}");
                await dialog.AlertAsync($"Unable to save {_context.ItemType}. Please try again");

                Close();
            }
            finally
            {
                dialog.HideLoading();
            }
        }
        private async Task <bool> ConnectDeviceAsync(DeviceListItemViewModel device, bool showPrompt = true)
        {
            if (showPrompt && !await _userDialogs.ConfirmAsync($"Connect to device '{device.Name}'?"))
            {
                return(false);
            }

            try
            {
                CancellationTokenSource tokenSource       = new CancellationTokenSource();
                ConnectParameters       connectParameters = new ConnectParameters();

                await Adapter.ConnectToDeviceAsync(device.Device, connectParameters, tokenSource.Token);

                _userDialogs.ShowSuccess($"Initializing Reader, Please Wait.", 8000);

                PreviousGuid = device.Device.Id;

                return(true);
            }
            catch (Exception ex)
            {
                _userDialogs.Alert(ex.Message, "Connection error");
                Mvx.Trace(ex.Message);
                return(false);
            }
            finally
            {
                //_userDialogs.HideLoading();
                device.Update();
            }
        }
Exemplo n.º 3
0
        public object ProvideValue(IServiceProvider serviceProvider)
        {
            IProvideValueTarget target           = serviceProvider.GetService(typeof(IProvideValueTarget)) as IProvideValueTarget;
            BindableObject      obj              = target.TargetObject as BindableObject;
            BindableProperty    bindableProperty = target.TargetProperty as BindableProperty;

            if (obj != null && bindableProperty != null)
            {
                StringBuilder bindingBuilder = new StringBuilder($"{bindableProperty.PropertyName} {Binding}, Mode={Mode}");

                if (!string.IsNullOrEmpty(Converter))
                {
                    bindingBuilder.Append($", Converter={Converter}");
                }

                if (!string.IsNullOrEmpty(ConverterParameter))
                {
                    bindingBuilder.Append($", ConverterParameter={ConverterParameter}");
                }

                if (!string.IsNullOrEmpty(FallbackValue))
                {
                    bindingBuilder.Append($", FallbackValue={FallbackValue}");
                }

                obj.SetValue(Bi.ndProperty, bindingBuilder.ToString());
            }
            else
            {
                Mvx.Trace(MvxTraceLevel.Diagnostic, "Cannot only use MvxBind on a bindable property");
            }

            return(null);
        }
Exemplo n.º 4
0
        /// <summary>
        ///     Get's the modification date for the existing backup.
        ///     If there is no backup yet, it will return <see cref="DateTime.MinValue" />
        /// </summary>
        /// <returns>Date of the last backup.</returns>
        public async Task <DateTime> GetBackupDate()
        {
            if (OneDriveClient == null)
            {
                OneDriveClient = await oneDriveAuthenticator.LoginAsync();
            }

            await LoadBackupFolder();

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

                if (existingBackup != null)
                {
                    return(existingBackup.LastModifiedDateTime?.DateTime ?? DateTime.MinValue);
                }
            }
            catch (Exception ex)
            {
                Mvx.Trace(MvxTraceLevel.Error, ex.Message);
            }

            return(DateTime.MinValue);
        }
Exemplo n.º 5
0
        public override void DestroyItem(ViewGroup container, int position, Object objectValue)
        {
            var fragment = (Fragment)objectValue;

            if (_curTransaction == null)
            {
                _curTransaction = _fragmentManager.BeginTransaction();
            }

#if DEBUG
            Mvx.Trace("Removing item #" + position + ": f=" + objectValue + " v=" + ((Fragment)objectValue).View +
                      " t=" + fragment.Tag);
#endif

            while (_savedState.Count <= position)
            {
                _savedState.Add(null);
                _savedFragmentTags.Add(null);
            }

            _savedState[position]        = _fragmentManager.SaveFragmentInstanceState(fragment);
            _savedFragmentTags[position] = fragment.Tag;
            _fragments[position]         = null;

            _curTransaction.Remove(fragment);
        }
Exemplo n.º 6
0
        public void ClearPayments()
        {
            var payments = paymentRepository.GetUnclearedPayments();

            foreach (var payment in payments)
            {
                try {
                    if (payment.ChargedAccount == null)
                    {
                        payment.ChargedAccount =
                            accountRepository.Data.FirstOrDefault(x => x.Id == payment.ChargedAccountId);

                        Mvx.Trace(MvxTraceLevel.Error, "Charged account was missing while clearing payments.");
                    }

                    payment.IsCleared = true;
                    paymentRepository.Save(payment);

                    accountRepository.AddPaymentAmount(payment);
                }
                catch (Exception ex) {
                    Mvx.Trace(MvxTraceLevel.Error, ex.Message);
                }
            }
        }
Exemplo n.º 7
0
        async void DoSelectLOCommand(lo_by_circle_wrapper learningobj)
        {
            try
            {
                CurrentLOIDSelected = learningobj.lo.id;
                LoadLOComments(CurrentLOIDSelected);


                FilterQuizzes(CurrentLOIDSelected);

                //
                //reset the value of background image
                BackgroundImage = learningobj.background_bytes;
            }
            catch (WebException e)
            {
                ConnectionOK = false;
            }
            catch (HttpRequestException e)
            {
                ConnectionOK = false;
            }
            catch (MobileServiceInvalidOperationException e)
            {
                Mvx.Trace("MobileServiceInvalidOperationException " + e.Message);
                OperationOK = false;
            }
        }
Exemplo n.º 8
0
 protected virtual void CollectionChangedOnCollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
 {
     // just hope this isn't called while the picker is displayed...
     Mvx.Trace(
         "CollectionChanged called inside MvxPickerViewModel - beware that this isn't full tested - picker might not fully support changes while the picker is visible");
     _pickerView.ReloadComponent(0);
 }
        private async Task <bool> ConnectDeviceAsync(DeviceListItemViewModel device, bool showPrompt = true)
        {
            if (device.IsConnected)
            {
                return(true);
            }

            if (showPrompt && !await _userDialogs.ConfirmAsync($"Connect to device '{device.Name}'?"))
            {
                return(false);
            }
            try
            {
                _userDialogs.ShowLoading("Connecting ...");

                await Adapter.ConnectToDeviceAync(device.Device);

                _userDialogs.InfoToast($"Connected to {device.Device.Name}.");

                PreviousGuid = device.Device.Id;
                return(true);
            }
            catch (Exception ex)
            {
                _userDialogs.Alert(ex.Message, "Connection error");
                Mvx.Trace(ex.Message);
                return(false);
            }
            finally
            {
                _userDialogs.HideLoading();
                device.Update();
            }
        }
Exemplo n.º 10
0
        public virtual void EnsureInitialized()
        {
            lock (LockObject)
            {
                if (this._initialized)
                {
                    return;
                }

                if (IsInitialisedTaskCompletionSource != null)
                {
                    Mvx.Trace("EnsureInitialized has already been called so now waiting for completion");
                    IsInitialisedTaskCompletionSource.Task.Wait();
                }
                else
                {
                    _initializationStarted            = true;
                    IsInitialisedTaskCompletionSource = new TaskCompletionSource <bool>();
                    this._setup.Initialize();
                    this._initialized = true;

                    if (this._currentSplashScreen != null)
                    {
                        Mvx.Warning("Current splash screen not null during direct initialization - not sure this should ever happen!");
                        this._currentSplashScreen.InitializationComplete();
                    }

                    IsInitialisedTaskCompletionSource.SetResult(true);
                }
            }
        }
Exemplo n.º 11
0
        public override void AdjustSubviews()
        {
            // we want to keep the left subview width the same
            try
            {
                // this leads to issues with constraints though.
                var oldWidth = Subviews[0].Frame.Width;

                base.AdjustSubviews();

                var newFrame = Subviews[0].Frame;
                var diff     = newFrame.Width - oldWidth;
                newFrame.Width = oldWidth;

                Subviews[0].Frame = newFrame;

                var newFrame2 = Subviews[1].Frame;
                newFrame2.Width   = newFrame2.Width + diff;
                Subviews[1].Frame = newFrame2;
            }
            catch (Exception ex)
            {
                // what if we get too small
                Mvx.Trace(ex.Message);
            }
        }
Exemplo n.º 12
0
        protected virtual async Task ServerCommandWrapper(Func <Task> action)
        {
            if (IsBusy)
            {
                return;
            }

            try
            {
                IsBusy = true;
                await action();
            }
            catch (Exception ex)
            {
                if (ex is UiApiException)
                {
                    await Mvx.Resolve <IUserInteraction>().AlertAsync(ex.Message, "Error has occured");
                }
                else
                {
                    Mvx.Trace(ex.Message, ex.StackTrace);
                }
            }
            finally
            {
                IsBusy = false;
            }
        }
Exemplo n.º 13
0
        protected virtual async Task <TResult> ServerCommandWrapper <TResult, T>(Func <T, Task <TResult> > function, T arg)
        {
            if (IsBusy)
            {
                return(await Task.Run(() => default(TResult)));
            }

            try
            {
                IsBusy = true;
                return(await function(arg));
            }
            catch (Exception ex)
            {
                if (ex is UiApiException)
                {
                    await Mvx.Resolve <IUserInteraction>().AlertAsync(ex.Message, "Error has occured");
                }
                else
                {
                    Mvx.Trace(ex.Message, ex.StackTrace);
                }
                return(await Task.Run(() => default(TResult)));
            }
            finally
            {
                IsBusy = false;
            }
        }
Exemplo n.º 14
0
        public override object ProvideValue(IServiceProvider serviceProvider)
        {
            if (BindableObj != null && !string.IsNullOrEmpty(PropertyName))
            {
                StringBuilder bindingBuilder = new StringBuilder($"{PropertyName} {Path}, Mode={Mode}");

                if (!string.IsNullOrEmpty(Converter))
                {
                    bindingBuilder.Append($", Converter={Converter}");
                }

                if (!string.IsNullOrEmpty(ConverterParameter))
                {
                    bindingBuilder.Append($", ConverterParameter={ConverterParameter}");
                }

                if (!string.IsNullOrEmpty(FallbackValue))
                {
                    bindingBuilder.Append($", FallbackValue={FallbackValue}");
                }

                if (!string.IsNullOrEmpty(CommandParameter))
                {
                    bindingBuilder.Append($", CommandParameter={CommandParameter}");
                }

                BindableObj.SetValue(Bi.ndProperty, bindingBuilder.ToString());
            }
            else
            {
                Mvx.Trace(MvxTraceLevel.Diagnostic, "Cannot only use MvxBind on a bindable property");
            }

            return(null);
        }
Exemplo n.º 15
0
        public override void OnReadRemoteRssi(BluetoothGatt gatt, int rssi, GattStatus status)
        {
            base.OnReadRemoteRssi(gatt, rssi, status);

            Mvx.Trace("OnReadRemoteRssi: device {0} status {1} value {2}", gatt.Device.Name, status, rssi);

            //ToDo add device id, or some link between this callback and the corresponding device
            var args = new RssiReadEventArgs()
            {
                Rssi = rssi
            };

            switch (status)
            {
            case GattStatus.Failure:
            case GattStatus.InsufficientAuthentication:
            case GattStatus.InsufficientEncryption:
            case GattStatus.InvalidAttributeLength:
            case GattStatus.InvalidOffset:
            case GattStatus.ReadNotPermitted:
            case GattStatus.RequestNotSupported:
            case GattStatus.WriteNotPermitted:
                args.Error = new Exception(status.ToString());
                break;

            case GattStatus.Success:
                break;
            }

            RemoteRssiRead(this, args);
        }
Exemplo n.º 16
0
        public static async Task <T> WithBusyIndicator <T>(this Task <T> self, AsyncViewModel vm = null)
        {
            if (vm != null)
            {
                vm.IsBusy = true;
            }

            try
            {
                return(await self.ConfigureAwait(false));
            }
            catch (Exception ex)
            {
                //TODO: Tratar erro
                Mvx.Trace(MvxTraceLevel.Error, ex.Message);
                return(default(T));
            }
            finally
            {
                if (vm != null)
                {
                    vm.IsBusy = false;
                }
            }
        }
Exemplo n.º 17
0
        private async Task Load()
        {
            var dialog = Resolve <IUserDialogs>();

            dialog.ShowLoading(Messages.General.Loading);
            try
            {
                var disasterService = Resolve <ITap2HelpService>();

                var disasters = await disasterService.GetDisasters();

                if (disasters != null)
                {
                    Items.AddRange(disasters.Select(d => new DisasterListItemViewModel(d)));
                }
            }
            catch (Exception ex)
            {
                dialog.HideLoading();
                Mvx.Trace("Unable to load Disasters list, exception: {0}", ex);
                await dialog.AlertAsync("Unable to load Disasters list. Please try again");
            }
            finally
            {
                dialog.HideLoading();
            }
        }
Exemplo n.º 18
0
 protected virtual async Task ServerCommandWrapper <T>(Func <T, Task> action, T arg)
 {
     if (IsBusy)
     {
         return;
     }
     try
     {
         IsBusy = true;
         await action(arg);
     }
     catch (Exceptions.UiApiException ex)
     {
         Mvx.Trace(ex.Message, ex.StackTrace);
         InvokeOnMainThread(async() => await Mvx.Resolve <IUserInteraction>().AlertAsync(ex.Message, ex.Title));
     }
     catch (Exception ex)
     {
         Mvx.Trace(ex.Message, ex.StackTrace);
         _insightsService.LogError(ex);
     }
     finally
     {
         IsBusy = false;
     }
 }
Exemplo n.º 19
0
        async Task DoSelectCircleCommand(circle_by_user circle)
        {
            CircleID = circle.id;

            try
            {
                var watch = Stopwatch.StartNew();
                await LoadCircleTags(CircleID);
                await LoadPostsInCircle(CircleID);
                await LoadUsersInCircle(CircleID);
                await LoadLearningObjects(CircleID);
                await LoadQuizzes(CircleID);

                watch.Stop();

                Mvx.Trace("Time elapsed: " + watch.ElapsedMilliseconds);
            }
            catch (WebException e)
            {
                ConnectionOK = false;
            }
            catch (HttpRequestException e)
            {
                ConnectionOK = false;
            }
            catch (MobileServiceInvalidOperationException e)
            {
                Mvx.Trace("MobileServiceInvalidOperationException " + e.Message);
                OperationOK = false;
            }
        }
Exemplo n.º 20
0
        public static async Task <List <string> > uploadMultipleFiles(List <Stream> streamList, List <string> filepaths)
        {
            List <string> result = new List <string>();

            try
            {
                Resource [] resources = await registerResource(streamList.Count, filepaths);

                for (int i = 0; i < resources.Length; i++)
                {
                    result.Add(resources[i].CloudPath);
                }

                for (int i = 0; i < streamList.Count; i++)
                {
                    try
                    {
                        uploadResource(resources[i], streamList[i]);
                    }
                    catch (StorageException e)
                    {
                    }
                }
            }
            catch (WebException e)
            {
                Mvx.Trace("Error " + e.Message);
                throw;
            }

            return(result);
        }
Exemplo n.º 21
0
        protected override async Task <HttpResponseMessage> SendAsync(
            HttpRequestMessage request,
            CancellationToken cancellationToken)
        {
            Exception           lastException = null;
            HttpResponseMessage response      = null;

            for (var i = 0; i < _maxRetries; i++)
            {
                try
                {
                    response = await base.SendAsync(request, cancellationToken);

                    if (response.IsSuccessStatusCode)
                    {
                        Mvx.Trace(MvxTraceLevel.Diagnostic, "Request was ok after {0} retries...", i);
                        return(response);
                    }
                }
                catch (Exception e)
                {
                    lastException = e;
                }
                Mvx.Trace(MvxTraceLevel.Diagnostic, "Request failed, retrying...\n{0}", lastException);
                await Task.Delay(500 + (i * 500), cancellationToken);
            }

            if (lastException != null)
            {
                throw lastException;
            }

            return(response);
        }
Exemplo n.º 22
0
        public virtual void EnsureInitialized()
        {
            lock (LockObject)
            {
                if (_initialized)
                {
                    return;
                }

                if (IsInitialisedTaskCompletionSource != null)
                {
                    Mvx.Trace("EnsureInitialized has already been called so now waiting for completion");
                    IsInitialisedTaskCompletionSource.Task.Wait();
                }
                else
                {
                    IsInitialisedTaskCompletionSource = new TaskCompletionSource <bool>();
                    _setup.Initialize();
                    _initialized = true;

                    if (_currentSplashScreen != null)
                    {
                        Mvx.Warning("Current splash screen not null during direct initialization - not sure this should ever happen!");
                        var dispatcher = Mvx.GetSingleton <IMvxMainThreadDispatcher>();
                        dispatcher.RequestMainThreadAction(() =>
                        {
                            _currentSplashScreen?.InitializationComplete();
                        });
                    }

                    IsInitialisedTaskCompletionSource.SetResult(true);
                }
            }
        }
Exemplo n.º 23
0
        protected virtual void SetupSideMenu()
        {
            var leftSideMenu  = ResolveSideMenu(MvxPanelEnum.Left);
            var rightSideMenu = ResolveSideMenu(MvxPanelEnum.Right);

            if (leftSideMenu == null && rightSideMenu == null)
            {
                Mvx.Trace(MvxTraceLevel.Warning, $"No sidemenu found. To use a sidemenu decorate the viewcontroller class with the 'MvxPanelPresentationAttribute' class and set the panel to 'Left' or 'Right'.");
                AttachNavigationController();
                return;
            }

            if (leftSideMenu != null && rightSideMenu != null)
            {
                LeftSidebarController = new SidebarController(_subRootViewController, NavigationController, leftSideMenu);
                ConfigureSideMenu(LeftSidebarController);

                RightSidebarController = new SidebarController(this, _subRootViewController, rightSideMenu);
                ConfigureSideMenu(RightSidebarController);
            }
            else if (leftSideMenu != null)
            {
                LeftSidebarController  = new SidebarController(this, NavigationController, leftSideMenu);
                RightSidebarController = null;
                ConfigureSideMenu(LeftSidebarController);
            }
            else if (rightSideMenu != null)
            {
                LeftSidebarController  = null;
                RightSidebarController = new SidebarController(this, NavigationController, rightSideMenu);
                ConfigureSideMenu(RightSidebarController);
            }
        }
Exemplo n.º 24
0
        protected override void SetItemsSource(System.Collections.IEnumerable value)
        {
            Mvx.Trace("Setting itemssource");
            if (_itemsSource == value)
            {
                return;
            }
            var existingObservable = _itemsSource as INotifyCollectionChanged;

            if (existingObservable != null)
            {
                existingObservable.CollectionChanged -= OnItemsSourceCollectionChanged;
            }

            _itemsSource = value as IList;

            var newObservable = _itemsSource as INotifyCollectionChanged;

            if (newObservable != null)
            {
                newObservable.CollectionChanged += OnItemsSourceCollectionChanged;
            }

            base.SetItemsSource(value);
        }
        private async void ScanForDevices()
        {
            Devices.Clear();

            foreach (var connectedDevice in Adapter.ConnectedDevices)
            {
                //update rssi for already connected evices (so tha 0 is not shown in the list)
                try
                {
                    await connectedDevice.UpdateRssiAsync();
                }
                catch (Exception ex)
                {
                    Mvx.Trace(ex.Message);
                    _userDialogs.ShowError($"Failed to update RSSI for {connectedDevice.Name}");
                }

                AddOrUpdateDevice(connectedDevice);
            }

            _cancellationTokenSource = new CancellationTokenSource();
            RaisePropertyChanged(() => StopScanCommand);

            RaisePropertyChanged(() => IsRefreshing);
            await Adapter.StartScanningForDevicesAsync(_cancellationTokenSource.Token);
        }
Exemplo n.º 26
0
        private Bitmap LoadScaledBitmap(Uri uri)
        {
            ContentResolver contentResolver  = Mvx.Resolve <IMvxAndroidGlobals>().ApplicationContext.ContentResolver;
            var             maxDimensionSize = GetMaximumDimension(contentResolver, uri);
            var             sampleSize       = (int)Math.Ceiling((maxDimensionSize) /
                                                                 ((double)_currentRequestParameters.MaxPixelDimension));

            if (sampleSize < 1)
            {
                // this shouldn't happen, but if it does... then trace the error and set sampleSize to 1
                MvxTrace.Trace(
                    "Warning - sampleSize of {0} was requested - how did this happen - based on requested {1} and returned image size {2}",
                    sampleSize,
                    _currentRequestParameters.MaxPixelDimension,
                    maxDimensionSize);
                // following from https://github.com/MvvmCross/MvvmCross/issues/565 we return null in this case
                // - it suggests that Android has returned a corrupt image uri
                return(null);
            }
            var sampled = LoadResampledBitmap(contentResolver, uri, sampleSize);

            try
            {
                var rotated = ExifRotateBitmap(contentResolver, uri, sampled);
                return(rotated);
            }
            catch (Exception pokemon)
            {
                Mvx.Trace("Problem seem in Exit Rotate {0}", pokemon.ToLongString());
                return(sampled);
            }
        }
Exemplo n.º 27
0
        public void ClearPayments()
        {
            var payments = paymentRepository
                           .GetList(p => !p.IsCleared && p.Date.Date <= DateTime.Now.Date);

            foreach (var payment in payments)
            {
                try
                {
                    if (payment.ChargedAccount == null)
                    {
                        payment.ChargedAccount =
                            accountRepository.GetList(x => x.Id == payment.ChargedAccountId).FirstOrDefault();

                        Mvx.Trace(MvxTraceLevel.Error, "Charged AccountViewModel was missing while clearing payments.");
                    }

                    payment.IsCleared = true;

                    AddPaymentAmount(payment);
                    paymentRepository.Save(payment);
                }
                catch (Exception ex)
                {
                    payment.IsCleared = false;
                    Mvx.Trace(MvxTraceLevel.Error, ex.Message);
                }
            }
        }
Exemplo n.º 28
0
        public override void OnCharacteristicWrite(BluetoothGatt gatt, BluetoothGattCharacteristic characteristic, GattStatus status)
        {
            base.OnCharacteristicWrite(gatt, characteristic, status);

            Mvx.Trace("OnCharacteristicWrite: value {0} status {1}", characteristic.GetValue().ToHexString(), status);

            var args = new CharacteristicWriteEventArgs {
                Characteristic = new Characteristic(characteristic, gatt, this)
            };

            switch (status)
            {
            case GattStatus.Failure:
            case GattStatus.InsufficientAuthentication:
            case GattStatus.InsufficientEncryption:
            case GattStatus.InvalidAttributeLength:
            case GattStatus.InvalidOffset:
            case GattStatus.ReadNotPermitted:
            case GattStatus.RequestNotSupported:
            case GattStatus.WriteNotPermitted:
                args.IsSuccessful = false;
                break;

            case GattStatus.Success:
                args.IsSuccessful = true;
                break;
            }

            CharacteristicValueWritten(this, args);
        }
Exemplo n.º 29
0
        protected override void OnCreate(Bundle bundle)
        {
            // Prevents crash when activity in background with history enable is reopened after
            // Android does some auto memory management.
            var setup = MvxAndroidSetupSingleton.EnsureSingletonAvailable(this);

            setup.EnsureInitialized();

            base.OnCreate(bundle);

            if (bundle == null)
            {
                HandleIntent(Intent);
            }
            else
            {
                IMvxJsonConverter serializer;
                if (!Mvx.TryResolve(out serializer))
                {
                    Mvx.Trace(
                        "Could not resolve IMvxJsonConverter, it is going to be hard to create ViewModel cache");
                    return;
                }

                FragmentCacheConfiguration.RestoreCacheConfiguration(bundle, serializer);
                // Gabriel has blown his trumpet. Ressurect Fragments from the dead
                RestoreFragmentsCache();

                RestoreViewModelsFromBundle(serializer, bundle);
            }
        }
Exemplo n.º 30
0
        private async Task LoadIncidents()
        {
            var dialog = Mvx.Resolve <IUserDialogs>();

            dialog.ShowLoading(Messages.Loading);

            var disasterService = Mvx.Resolve <ITap2GiveService>();

            try
            {
                var disasters = await disasterService.GetDisasters(true);

                if (disasters != null)
                {
                    DisasterIncidents.AddRange(disasters.Where(d => !string.IsNullOrEmpty(d.GiveUrl))
                                               .Select(d => new DisasterListItemViewModel(d)));
                }
            }
            catch (Exception ex)
            {
                dialog.HideLoading();
                Mvx.Trace("Unable to load Disasters list, exception: {0}", ex);
                await dialog.AlertAsync("Unable to load Disasters list. Please try again");
            }
            finally
            {
                dialog.HideLoading();
            }
        }