コード例 #1
0
        protected override void OnResume()
        {
            // Handle when your app resumes
            base.OnResume();

            DependencyLocator.Resolve <INavigationService>().InitAfterResumeApp();
        }
コード例 #2
0
 public void SetViewModel <T>(object initialData = null) where T : BasePageViewModel
 {
     try
     {
         BindingContext = ViewModel = DependencyLocator.Resolve <T>(initialData);
     }
     catch (Exception e)
     { }
 }
コード例 #3
0
        protected override void OnSleep()
        {
            base.OnSleep();

            BaseSingleton <GlobalSetting> .Instance.SaveState();

            MessagingCenter.Unsubscribe <object, INotificationMessage>(this, NotificationService.RESIDENT_VEHICLE_DETAIL_RECEIVED_NOTIFICATION);

            DependencyLocator.Resolve <INavigationService>().UnsubscribeAfterSleepApp();
        }
コード例 #4
0
        /// <summary>
        ///     ctor().
        /// </summary>
        public StepBaseViewModel()
        {
            _validationObjectFactory = DependencyLocator.Resolve <IValidationObjectFactory>();

            ActionBarViewModel = DependencyLocator.Resolve <IdentityAccountingActionBarViewModel>();
            ((IdentityAccountingActionBarViewModel)ActionBarViewModel).InitializeAsync(this);

            _mainInput = _validationObjectFactory.GetValidatableObject <string>();

            ResetValidationObjects();
        }
コード例 #5
0
        /// <summary>
        ///     ctor();
        /// </summary>
        public DriveAutoDetailsViewModel(IPickMediaService pickMediaService,
                                         IVisionService visionService,
                                         IDriveAutoService driveAutoService)
        {
            _visionService    = visionService;
            _pickMediaService = pickMediaService;
            _driveAutoService = driveAutoService;

            ActionBarViewModel = DependencyLocator.Resolve <CommonActionBarViewModel>();

            IsBackButtonAvailable = NavigationService.IsBackButtonAvailable;
        }
コード例 #6
0
        public NewPostViewModel(
            IPickMediaService pickMediaService,
            IValidationObjectFactory validationObjectFactory)
        {
            _pickMediaService        = pickMediaService;
            _validationObjectFactory = validationObjectFactory;

            ResetValidationObjects();
            AttachedPostMedias = new ObservableCollection <AttachedAnnounceMediaBase>();

            ActionBarViewModel = DependencyLocator.Resolve <NewPostActionBarViewModel>();
        }
コード例 #7
0
        /// <summary>
        ///     ctor().
        /// </summary>
        public App()
        {
            InitializeComponent();

            InitApp();

#if DEBUG
            //TrackMemoryUsage();
#endif

            MessagingCenter.Subscribe <object, INotificationMessage>(this, NotificationService.RESIDENT_VEHICLE_DETAIL_RECEIVED_NOTIFICATION, (sender, args) => {
                DependencyLocator.Resolve <INotificationService>().InvokeReceivedResidentVehicleDetailInfo(args);
            });
        }
コード例 #8
0
        /// <summary>
        ///     ctor().
        /// </summary>
        public VehicleDetailViewModel()
        {
            ActionBarViewModel = DependencyLocator.Resolve <CommonActionBarViewModel>();

            IsBackButtonAvailable = NavigationService.IsBackButtonAvailable;
        }
コード例 #9
0
 public BaseViewModel()
 {
     navigationService = DependencyLocator.Resolve <INavigationService>();
     userDialogService = DependencyLocator.Resolve <IUserDialogService>();
 }
コード例 #10
0
        public MapPage()
        {
            InitializeComponent();

            BindingContext = DependencyLocator.Resolve <MapViewModel>();
        }
コード例 #11
0
        private Task InitNavigation()
        {
            var navigationService = DependencyLocator.Resolve <INavigationService>();

            return(navigationService.InitializeAsync());
        }
コード例 #12
0
ファイル: App.xaml.cs プロジェクト: NoltIvanov/TOua
        private void InitNavigation()
        {
            INavigationService navigationService = DependencyLocator.Resolve <INavigationService>();

            navigationService.Initialize();
        }
コード例 #13
0
        public PolandDriveAutoDetailsViewModel()
        {
            ActionBarViewModel = DependencyLocator.Resolve <CommonActionBarViewModel>();
            ActionBarViewModel.InitializeAsync(this);

            Year.Spans.Add(BuildHeaderSpan(nameof(AppStrings.YearOfCreation)));
            Year.Spans.Add(BuildValueSpan());

            Vin.Spans.Add(BuildHeaderSpan(nameof(AppStrings.VinUppercase)));
            Vin.Spans.Add(BuildValueSpan());

            VehicleTechnicalInspection.Spans.Add(BuildHeaderSpan(nameof(AppStrings.VehicleTechnicalInspection)));
            VehicleTechnicalInspection.Spans.Add(BuildValueSpan());

            LastOdometrData.Spans.Add(BuildHeaderSpan(nameof(AppStrings.LastRecordedOdometerReading)));
            LastOdometrData.Spans.Add(BuildValueSpan());

            RegistrationStatus.Spans.Add(BuildHeaderSpan(nameof(AppStrings.RegistrationStatus)));
            RegistrationStatus.Spans.Add(BuildValueSpan());

            EngineCapacity.Spans.Add(BuildHeaderSpan(nameof(AppStrings.EngineCapacity)));
            EngineCapacity.Spans.Add(BuildValueSpan());

            EnginePower.Spans.Add(BuildHeaderSpan(nameof(AppStrings.EnginePower)));
            EnginePower.Spans.Add(BuildValueSpan());

            FuelType.Spans.Add(BuildHeaderSpan(nameof(AppStrings.FuelType)));
            FuelType.Spans.Add(BuildValueSpan());

            TotalCapacity.Spans.Add(BuildHeaderSpan(nameof(AppStrings.TotalСapacity)));
            TotalCapacity.Spans.Add(BuildValueSpan());

            NumberOfSeats.Spans.Add(BuildHeaderSpan(nameof(AppStrings.NumberOfSeats)));
            NumberOfSeats.Spans.Add(BuildValueSpan());

            CurbWeight.Spans.Add(BuildHeaderSpan(nameof(AppStrings.CurbWeight)));
            CurbWeight.Spans.Add(BuildValueSpan());

            MaximumLadenMassOfBrakedTrailer.Spans.Add(BuildHeaderSpan(nameof(AppStrings.MaximumLadenMassOfBrakedTrailer)));
            MaximumLadenMassOfBrakedTrailer.Spans.Add(BuildValueSpan());

            MaximumLadenMassOfUnbrakedTrailer.Spans.Add(BuildHeaderSpan(nameof(AppStrings.MaximumLadenMassOfUnbrakedTrailer)));
            MaximumLadenMassOfUnbrakedTrailer.Spans.Add(BuildValueSpan());

            MaximumPermissibleTowableMass.Spans.Add(BuildHeaderSpan(nameof(AppStrings.MaximumPermissibleTowableMass)));
            MaximumPermissibleTowableMass.Spans.Add(BuildValueSpan());

            NumberOfAxles.Spans.Add(BuildHeaderSpan(nameof(AppStrings.NumberOfAxles)));
            NumberOfAxles.Spans.Add(BuildValueSpan());

            DateСurrentVehicleRegistrationCertificateIssued.Spans.Add(BuildHeaderSpan(nameof(AppStrings.DateСurrentVehicleRegistrationCertificateIssued)));
            DateСurrentVehicleRegistrationCertificateIssued.Spans.Add(BuildValueSpan());

            DateVehicleRecordDocumentIssued.Spans.Add(BuildHeaderSpan(nameof(AppStrings.DateVehicleRecordDocumentIssued)));
            DateVehicleRecordDocumentIssued.Spans.Add(BuildValueSpan());

            CivilLiabilityInsurance.Spans.Add(BuildHeaderSpan(nameof(AppStrings.CivilLiabilityInsurance)));
            CivilLiabilityInsurance.Spans.Add(BuildValueSpan());

            Type.Spans.Add(BuildHeaderSpan(nameof(AppStrings.Type)));
            Type.Spans.Add(BuildValueSpan());

            Number.Spans.Add(BuildHeaderSpan(nameof(AppStrings.Number)));
            Number.Spans.Add(BuildValueSpan());
        }
コード例 #14
0
        protected override void OnStartListeningToHub()
        {
            _hubConnection.On <object>(UPDATE_POST_LIKES_COUNT, async(args) => {
                try {
                    DrivenEventResponse drivenEventResponse = ParseResponseData <DrivenEventResponse>(args);

                    if (drivenEventResponse.StatusCode == HttpStatusCode.OK)
                    {
                        DrivenEvent drivenEvent = ParseResponseData <DrivenEvent>(drivenEventResponse.Data);

                        PostLikedBody postLikedBody = ParseResponseData <PostLikedBody>(drivenEvent.Data);
                        Device.BeginInvokeOnMainThread(() => PostLikesCountReceived(this, postLikedBody));
                    }
                    else if (drivenEventResponse.StatusCode == HttpStatusCode.Unauthorized)
                    {
                        await DependencyLocator.Resolve <IIdentityService>().LogOutAsync();
                    }
                }
                catch (Exception ex) {
                    Debugger.Break();
                    Crashes.TrackError(ex);
                }
            });

            _hubConnection.On <object>(REMOVE_POST, async(args) => {
                try {
                    DrivenEventResponse drivenEventResponse = ParseResponseData <DrivenEventResponse>(args);

                    if (drivenEventResponse.StatusCode == HttpStatusCode.OK)
                    {
                        DrivenEvent drivenEvent = ParseResponseData <DrivenEvent>(drivenEventResponse.Data);

                        string postId = ParseResponseData <string>(drivenEvent.Data);
                        Device.BeginInvokeOnMainThread(() => DeletedPostReceived(this, postId));
                    }
                    else if (drivenEventResponse.StatusCode == HttpStatusCode.Unauthorized)
                    {
                        await DependencyLocator.Resolve <IIdentityService>().LogOutAsync();
                    }
                }
                catch (Exception ex) {
                    Debugger.Break();
                    Crashes.TrackError(ex);
                }
            });

            _hubConnection.On <object>(NEW_POST_COMMENT, async(args) => {
                try {
                    DrivenEventResponse drivenEventResponse = ParseResponseData <DrivenEventResponse>(args);

                    if (drivenEventResponse.StatusCode == HttpStatusCode.OK)
                    {
                        DrivenEvent drivenEvent = ParseResponseData <DrivenEvent>(drivenEventResponse.Data);

                        Comment comment = ParseResponseData <Comment>(drivenEvent.Data);
                        Device.BeginInvokeOnMainThread(() => NewPostCommentReceived(this, comment));
                    }
                    else if (drivenEventResponse.StatusCode == HttpStatusCode.Unauthorized)
                    {
                        await DependencyLocator.Resolve <IIdentityService>().LogOutAsync();
                    }
                }
                catch (Exception ex) {
                    Debugger.Break();
                    Crashes.TrackError(ex);
                }
            });

            _hubConnection.On <object>(UPDATE_POST_COMMENTS_C0UNT, async(args) => {
                try {
                    DrivenEventResponse drivenEventResponse = ParseResponseData <DrivenEventResponse>(args);

                    if (drivenEventResponse.StatusCode == HttpStatusCode.OK)
                    {
                        DrivenEvent drivenEvent = ParseResponseData <DrivenEvent>(drivenEventResponse.Data);

                        CommentCountBody commentCountBody = ParseResponseData <CommentCountBody>(drivenEvent.Data);
                        Device.BeginInvokeOnMainThread(() => PostCommentsCountReceived(this, commentCountBody));
                    }
                    else if (drivenEventResponse.StatusCode == HttpStatusCode.Unauthorized)
                    {
                        await DependencyLocator.Resolve <IIdentityService>().LogOutAsync();
                    }
                }
                catch (Exception ex) {
                    Debugger.Break();
                    Crashes.TrackError(ex);
                }
            });

            _hubConnection.On <object>(NEW_ANNOUNCE, async(args) => {
                try {
                    Console.WriteLine("===> AnnouncementHubService.NewPostHubEndpoint <===");
                    DrivenEventResponse drivenEventResponse = ParseResponseData <DrivenEventResponse>(args);

                    if (drivenEventResponse.StatusCode == HttpStatusCode.OK)
                    {
                        DrivenEvent drivenEvent = ParseResponseData <DrivenEvent>(drivenEventResponse.Data);

                        Announce announce = ParseResponseData <Announce>(drivenEvent.Data);
                        if (announce != null && announce.AnnounceBody != null && announce.ImageUrl != null)
                        {
                            Device.BeginInvokeOnMainThread(() => NewAnnounceReceived(this, announce));
                        }
                        else
                        {
                            announce = new Announce();
                            AnnounceBody announceBody = ParseResponseData <AnnounceBody>(drivenEvent.Data);
                            announce.AnnounceBody     = announceBody;
                            Device.BeginInvokeOnMainThread(() => NewAnnounceReceived(this, announce));
                        }
                    }
                    else if (drivenEventResponse.StatusCode == HttpStatusCode.Unauthorized)
                    {
                        await DependencyLocator.Resolve <IIdentityService>().LogOutAsync();
                    }
                }
                catch (Exception exc) {
                    Debugger.Break();
                    Crashes.TrackError(exc);
                }
            });
        }
コード例 #15
0
        private async void InitializeNavigation()
        {
            var navigation = DependencyLocator.Resolve <INavigationService>();

            await navigation.InitializeAsync();
        }
コード例 #16
0
        protected override void OnBindingContextChanged()
        {
            base.OnBindingContextChanged();

            _sideMenuView.BindingContext = DependencyLocator.Resolve <SideMenuViewModel>();
        }
コード例 #17
0
ファイル: App.xaml.cs プロジェクト: NoltIvanov/CarPark
 protected override void OnSleep()
 {
     DependencyLocator.Resolve <INavigationService>().UnsubscribeAfterSleepApp();
 }
コード例 #18
0
ファイル: App.xaml.cs プロジェクト: NoltIvanov/CarPark
 protected override void OnResume()
 {
     DependencyLocator.Resolve <INavigationService>().InitAfterResumeApp();
 }