コード例 #1
0
        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);
        }
コード例 #5
0
        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();
 }
コード例 #7
0
        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);
        }
コード例 #9
0
 /// <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
ファイル: App.cs プロジェクト: Lupin1st/ShoppingList.Net
        public static void SaveState()
        {
            var sateService = Mvx.Resolve <IStateService>();

            sateService.Store();
        }
コード例 #14
0
ファイル: App.cs プロジェクト: Lupin1st/ShoppingList.Net
        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();
 }
コード例 #20
0
        /// <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); 

        }
コード例 #22
0
 public static IMvxMacView CreateViewControllerFor(
     this IMvxMacView view,
     MvxViewModelRequest request)
 {
     return(Mvx.Resolve <IMvxMacViewCreator>().CreateView(request));
 }
コード例 #23
0
ファイル: TranslateExtension.cs プロジェクト: FSorek/KinoApp
 public TranslateExtension()
 {
     _cultureInfo = Mvx.Resolve <Services.ILocalizeService>().GetCurrentCultureInfo();
 }
コード例 #24
0
 public static IMvxMacView CreateViewControllerFor(
     this IMvxMacView view,
     IMvxViewModel viewModel)
 {
     return(Mvx.Resolve <IMvxMacViewCreator>().CreateView(viewModel));
 }
コード例 #25
0
ファイル: MvxShareTask.cs プロジェクト: xakpc/MvvmCross
 public MvxShareTask()
 {
     _modalHost = Mvx.Resolve <IMvxIosModalHost>();
 }
コード例 #26
0
ファイル: Setup.cs プロジェクト: YevhenKuraiev/ExchangeRates
 public Setup(Context applicationContext) : base(applicationContext)
 {
     UserDialogs.Init(() => Mvx.Resolve <IMvxAndroidCurrentTopActivity>().Activity);
 }
コード例 #27
0
        public override void Show(MvxViewModelRequest request)
        {
            IMvxIosView viewController = Mvx.Resolve <IMvxIosViewCreator>().CreateView(request);

            Show(viewController);
        }
コード例 #28
0
 private void Display()
 {
     Mvx.Resolve <ICustomUserInteraction>().PopUpImage(_image.Bytes, null, null, null, "Close");
 }
コード例 #29
0
        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;
            }
        }