public LocationViewModel()
        {
            PluginLoader.Instance.EnsureLoaded();
            _watcher = Mvx.Resolve <IMvxGeoLocationWatcher>();
#warning need IsStarted check here...
        }
示例#2
0
 public BagInfoViewModel(IMvxNavigationService navigationService)
 {
     _logger            = Mvx.Resolve <ILogService>();
     _navigationService = navigationService;
 }
示例#3
0
 public CalendarSettingsViewController() : base(nameof(CalendarSettingsViewController))
 {
     schedulerProvider = Mvx.Resolve <ISchedulerProvider>();
 }
示例#4
0
        public override bool FinishedLaunching(UIApplication app, NSDictionary options)
        {
            SetupNotifications();
            //We MUST wrap our setup in this block to wire up
            // Mono's SIGSEGV and SIGBUS signals
            HockeyApp.Setup.EnableCustomCrashReporting(() =>
            {
                //Get the shared instance
                var manager = BITHockeyManager.SharedHockeyManager;
                BITHockeyManager.SharedHockeyManager.DebugLogEnabled = true;

                //Configure it to use our APP_ID
                manager.Configure(AppSettings.HockeyAppID);

                //Start the manager
                manager.StartManager();

                //Authenticate (there are other authentication options)
                //manager.Authenticator will be null if HockeyAppiOSAppID was not set
                if (manager.Authenticator != null)
                {
                    manager.Authenticator.AuthenticateInstallation();

                    //Rethrow any unhandled .NET exceptions as native iOS
                    // exceptions so the stack traces appear nicely in HockeyApp
                    TaskScheduler.UnobservedTaskException += (sender, e) =>
                                                             HockeyApp.Setup.ThrowExceptionAsNative(e.Exception);

                    AppDomain.CurrentDomain.UnhandledException += (sender, e) =>
                                                                  HockeyApp.Setup.ThrowExceptionAsNative(e.ExceptionObject);
                }
            });

            Forms.Init();

            _window = new UIWindow(UIScreen.MainScreen.Bounds);

            Akavache.BlobCache.ApplicationName = "MyHealth";



            var setup = new Setup(this, _window);

            setup.Initialize();

            var startup = Mvx.Resolve <IMvxAppStart>();

            startup.Start();

            _window.MakeKeyAndVisible();

            var shouldPerformAdditionalDelegateHandling = true;

            // Get possible shortcut item
            if (options != null)
            {
                LaunchedShortcutItem = options[UIApplication.LaunchOptionsShortcutItemKey] as UIApplicationShortcutItem;
                shouldPerformAdditionalDelegateHandling = (LaunchedShortcutItem == null);
            }

            return(shouldPerformAdditionalDelegateHandling);
        }
        public async static Task GetLogoutInfo()
        {
            var logout_result = new LogoutInfo();

            customerId = Mvx.Resolve <ILocalStorage>().RetrieveSet("customer");
            string url = Java.Lang.String.Format("http://nxfrontend-qa.nxframework.com/NXRest.svc/logout?customer=" + customerId + "&session=" + Mvx.Resolve <ILocalStorage>().RetrieveSet("login_session_id"));

            logout_result = await APIAccess.logOut(url);

            result = logout_result.LogoutResult;
        }
示例#6
0
 private async void TakePhoto()
 {
     ImageByte = await Mvx.Resolve <IImageService>().TakePicture();
 }
        protected override string Convert(string value, Type targetType, object parameter, CultureInfo culture)
        {
            if (value != null)
            {
                var configuration = Mvx.Resolve <IConfiguration>();

                if (value == "default")
                {
                    return(configuration.BaseUrl + "Content/Dashboard/Assets/Img/Avatars/default_user_avatar.png");
                }

                if (value == Defaults.EventHeaderDefaultString)
                {
                    var eventHeaderUrl = Settings.EventHeaderUrl;

                    if (!string.IsNullOrEmpty(eventHeaderUrl))
                    {
                        return(Settings.BlobUrl + eventHeaderUrl);
                    }

                    return(configuration.BaseUrl + ApiCentralPlatformImages.EventsHeaderDefault);
                }

                if (value == Defaults.CompanyHeaderDefaultString)
                {
                    var companyHeaderUrl = Settings.CompanyHeaderUrl;

                    if (!string.IsNullOrEmpty(companyHeaderUrl))
                    {
                        return(Settings.BlobUrl + companyHeaderUrl);
                    }

                    var bla = configuration.BaseUrl + ApiCentralPlatformImages.CompanyHeaderDefault;

                    return(bla);
                }

                if (value == Defaults.GroupHeaderDefault)
                {
                    var groupsHeaderUrl = Settings.GroupsHeaderUrl;

                    if (!string.IsNullOrEmpty(groupsHeaderUrl))
                    {
                        return(Settings.BlobUrl + groupsHeaderUrl);
                    }

                    return(configuration.BaseUrl + ApiCentralPlatformImages.GroupsHeaderDefault);
                }

                if (value == Defaults.RoomHeaderDefault)
                {
                    return(configuration.BaseUrl + ApiCentralPlatformImages.RoomHeaderDefault);
                }

                var fullUrl = Settings.BlobUrl + value;

                return(fullUrl);
            }

            return(null);
        }
示例#8
0
        protected void ComposeEmail(string to, string subject, string body)
        {
            var task = Mvx.Resolve <IMvxComposeEmailTask>();

            task.ComposeEmail(to, null, subject, body, false);
        }
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="parent">The parent view model (this is a nested view model).</param>
 public UsersViewModel(ListDetailViewModel parent) : base(new UsersModel(parent.CurrentListID))
 {
     _dialogs = Mvx.Resolve <IUserDialogs>();
 }
示例#10
0
        protected void MakePhoneCall(string name, string number)
        {
            var task = Mvx.Resolve <IMvxPhoneCallTask>();

            task.MakePhoneCall(name, number);
        }
示例#11
0
        protected void ShowWebPage(string webPage)
        {
            var task = Mvx.Resolve <IMvxWebBrowserTask>();

            task.ShowWebPage(webPage);
        }
示例#12
0
 protected void ReportError(string text)
 {
     Mvx.Resolve <IErrorReporter>().ReportError(text);
 }
示例#13
0
        public static void SaveState()
        {
            var sateService = Mvx.Resolve <IStateService>();

            sateService.Store();
        }
示例#14
0
        public static void InitializeState()
        {
            var sateService = Mvx.Resolve <IStateService>();

            sateService.Restore();
        }
示例#15
0
        public void EnsureLoaded()
        {
            var manager = Mvx.Resolve <IMvxPluginManager>();

            manager.EnsureLoaded <PluginLoader>();
        }
示例#16
0
 public FamilyMemberViewModel()
 {
     Title             = "FAMILY";
     _dialogService    = Mvx.Resolve <IDialogService>();
     _dashboardService = Mvx.Resolve <IDashboardService>();
 }
示例#17
0
        protected Task <MvxImage <T> > Parse(string path)
        {
            var loader = Mvx.Resolve <IMvxLocalFileImageLoader <T> >();

            return(loader.Load(path, false, 0, 0));
        }
示例#18
0
 protected void RegisterSubscriptions()
 {
     _messenger = Mvx.Resolve <IMvxMessenger> ();
     _usersUpdatedMessageToken = _messenger.Subscribe <UsersUpdatedMessage> (OnUsersUpdatedMessaged);
 }
示例#19
0
 private async void ChoosePhoto()
 {
     ImageByte = await Mvx.Resolve <IImageService>().SelectFromLibrary();
 }
        /// <summary>
        /// Loads Items from our Azure Mobile Service and sort into grouped enumerable
        /// </summary>
        private async void LoadItems(bool overrideCache = false)
        {
            IsBusy = true;

            List <Item>      items            = new List <Item>();
            MvxJsonConverter mvxJsonConverter = new MvxJsonConverter();
            var fileStore = Mvx.Resolve <IMvxFileStore>();

            foreach (var dataService in EnabledDataServices)
            {
                List <Item> currentItems    = new List <Item>();
                bool        loadedFromCache = false;

                if (fileStore != null)
                {
                    string lastRefreshText;
                    if (fileStore.TryReadTextFile("LastRefresh-" + dataService.GetType().ToString(), out lastRefreshText))
                    {
                        var lastRefreshTime = DateTime.Parse(lastRefreshText);

                        //has cache expired?
                        if (overrideCache || (DateTime.Now - lastRefreshTime).Minutes > AppSettings.CacheIntervalInMinutes)
                        {
                            currentItems = await dataService.GetItems();
                        }
                        else //load from cache
                        {
                            string cachedItemsText;
                            if (fileStore.TryReadTextFile("CachedItems-" + dataService.GetType().ToString(), out cachedItemsText))
                            {
                                currentItems    = mvxJsonConverter.DeserializeObject <List <Item> >(cachedItemsText);
                                loadedFromCache = true;
                            }
                        }
                    }
                    else
                    {
                        currentItems = await dataService.GetItems();
                    }
                }

                try
                {
                    if (!loadedFromCache && currentItems.Count > 0)
                    {
                        if (fileStore.Exists("CachedItems-" + dataService.GetType().ToString()))
                        {
                            fileStore.DeleteFile("CachedItems-" + dataService.GetType().ToString());
                        }

                        if (fileStore.Exists("LastRefresh-" + dataService.GetType().ToString()))
                        {
                            fileStore.DeleteFile("LastRefresh-" + dataService.GetType().ToString());
                        }

                        fileStore.WriteFile("CachedItems-" + dataService.GetType().ToString(), mvxJsonConverter.SerializeObject(currentItems));
                        fileStore.WriteFile("LastRefresh-" + dataService.GetType().ToString(), DateTime.Now.ToString());
                    }

                    foreach (var currentItem in currentItems)
                    {
                        if (AppSettings.ForceYoutubeVideosToLoadFullScreen)
                        {
                            currentItem.Description = currentItem.Description.Replace("/watch?v=", "/watch_popup?v=");
                        }

                        items.Add(currentItem);
                    }
                }
                catch
                {
                    ServiceLocator.MessageService.ShowErrorAsync("Error retrieving items from Remote Service. \n\nPossible Causes:\nNo internet connection\nRemote Service unavailable", "Application Error");
                }
            }

            ItemGroups = new List <Group <Item> >(from item in items
                                                  group item by item.Group into grp
                                                  orderby grp.Key
                                                  select new Group <Item>(grp.Key, grp)).ToList();

            IsBusy = false;
        }
示例#21
0
        public void Selector(List <SelectorItem> items, Action <SelectorItem> selector, string title = null, string cancelButton = "Cancel") 

        {
            
 UIAlertController alertController = UIAlertController.Create(title, null, UIAlertControllerStyle.ActionSheet); 

            foreach (var item in items)
            {
                
            {
                    
 alertController.AddAction(UIAlertAction.Create(item.Text, UIAlertActionStyle.Default, (obj) => selector(items.ElementAt(item.Id)))); 

                }
            }
            
 alertController.AddAction(UIAlertAction.Create(cancelButton, UIAlertActionStyle.Cancel, (obj) => { })); 

 var controller = (Mvx.Resolve <IMvxIosViewPresenter>() as MvxIosViewPresenter).MasterNavigationController.TopViewController; 
 UIPopoverPresentationController presentationPopover = alertController.PopoverPresentationController;

            controller = controller.PresentedViewController ?? controller; 
            if (presentationPopover != null)
            {
                
            {
                    
 presentationPopover.SourceView = controller.View; 
 presentationPopover.PermittedArrowDirections = UIPopoverArrowDirection.Up; 

                }
            }
            

 controller.PresentViewController(alertController, true, null); 

        }
 public static IMvxMacView CreateViewControllerFor(
     this IMvxMacView view,
     MvxViewModelRequest request)
 {
     return(Mvx.Resolve <IMvxMacViewCreator>().CreateView(request));
 }
示例#23
0
 public TranslateExtension()
 {
     _cultureInfo = Mvx.Resolve <Services.ILocalizeService>().GetCurrentCultureInfo();
 }
 public static IMvxMacView CreateViewControllerFor(
     this IMvxMacView view,
     IMvxViewModel viewModel)
 {
     return(Mvx.Resolve <IMvxMacViewCreator>().CreateView(viewModel));
 }
示例#25
0
 public MvxShareTask()
 {
     _modalHost = Mvx.Resolve <IMvxIosModalHost>();
 }
示例#26
0
 public Setup(Context applicationContext) : base(applicationContext)
 {
     UserDialogs.Init(() => Mvx.Resolve <IMvxAndroidCurrentTopActivity>().Activity);
 }
        public override void Show(MvxViewModelRequest request)
        {
            IMvxIosView viewController = Mvx.Resolve <IMvxIosViewCreator>().CreateView(request);

            Show(viewController);
        }
 private void Display()
 {
     Mvx.Resolve <ICustomUserInteraction>().PopUpImage(_image.Bytes, null, null, null, "Close");
 }
        public ErrorDisplayer()
        {
            var source = Mvx.Resolve <IErrorSource>();

            source.ErrorReported += (sender, args) => ShowError(args.Message);
        }
示例#30
0
        protected override void OnResume()
        {
            base.OnResume();
            apiClient.Connect();

            if (ViewModel.IsEditMode)
            {
                if (Mvx.Resolve <ICacheService>().NextStatus == AddSpotStatus.Activation)
                {
                    return;
                }

                if (Mvx.Resolve <ICacheService>().NextStatus != AddSpotStatus.GotoSpot &&
                    Mvx.Resolve <ICacheService>().NextStatus != AddSpotStatus.Complete)
                {
                    ViewModel.DoAddOrSaveParkingSpot();
                }

                else if (Mvx.Resolve <ICacheService>().NextStatus == AddSpotStatus.Complete)
                {
                    ViewModel.DoAddOrSaveParkingSpot();
                }
            }
            else
            {
                if (Mvx.Resolve <ICacheService>().NextStatus == AddSpotStatus.SpotCalendar)
                {
                    ViewModel.DoAddOrSaveParkingSpot();
                }
                else if (Mvx.Resolve <ICacheService>().NextStatus == AddSpotStatus.Complete)
                {
                    ViewModel.SaveParkingSpot();
                }
            }

            if (Mvx.Resolve <ICacheService>().NextStatus != ViewModel.Status)
            {
                ViewModel.UpdateTasksStatus(Mvx.Resolve <ICacheService>().NextStatus);
            }
            if (ViewModel.Status == AddSpotStatus.GPS)
            {
                GetGPS();
            }

            if (ViewModel.Parking != null && Mvx.Resolve <ICacheService>().CreateParkingRequest != null && Mvx.Resolve <ICacheService>().CreateParkingRequest.HourlyRate != null)
            {
                ViewModel.Parking.HourlyRate = Mvx.Resolve <ICacheService>().CreateParkingRequest.HourlyRate;
            }
        }