Пример #1
0
        //string title = string.Empty;
        //public string Title
        //{
        //    get { return title; }
        //    set { SetProperty(ref title, value); }
        //}

        //protected bool SetProperty<T>(ref T backingStore, T value,
        //    [CallerMemberName]string propertyName = "",
        //    Action onChanged = null)
        //{
        //    if (EqualityComparer<T>.Default.Equals(backingStore, value))
        //        return false;

        //    backingStore = value;
        //    onChanged?.Invoke();
        //    OnPropertyChanged(propertyName);
        //    return true;
        //}
        public BaseViewModel()
        {
            DialogService     = ViewModelInjector.Resolve <IDialogService>();
            NavigationService = ViewModelInjector.Resolve <INavigationService>();

            // var settingsService = ViewModelInjector.Resolve<ISettingsService>();

            // GlobalSetting.Instance.BaseIdentityEndpoint = settingsService.IdentityEndpointBase;
            // GlobalSetting.Instance.BaseGatewayShoppingEndpoint = settingsService.GatewayShoppingEndpointBase;
            // GlobalSetting.Instance.BaseGatewayMarketingEndpoint = settingsService.GatewayMarketingEndpointBase;
        }
Пример #2
0
        public T Create <T>(string id)
            where T : UserControl
        {
            // check current chain to find the view
            object v = this[id];

            if (v != null)
            {
                return(v as T);
            }

            T instance = Activator.CreateInstance <T>();

            ViewModelInjector injector = GetInjector(instance);

            if (injector != null)
            {
                instance.DataContext = ViewModelLocator.Get(injector.ViewModelKey);
            }

            _views.Add(id, instance);

            return(instance);
        }
Пример #3
0
        /// <summary>
        /// Creates new NavigatonService object in DI container, and returns a reference to it,
        /// before invoking InitializeAsync()
        /// </summary>
        private Task InitNavigation()
        {
            var navigationService = ViewModelInjector.Resolve <INavigationService>();

            return(navigationService.InitializeAsync());
        }
Пример #4
0
 private void InitApp()
 {
     _settingsService = ViewModelInjector.Resolve <ISettingsService>();
     //if (!_settingsService.UseMocks)
     //ViewModelLocator.UpdateDependencies(_settingsService.UseMocks);
 }