示例#1
0
        public DetailViewModel(
            ISniptRepository sniptRepository,
            IShareService shareService,
            IDialogService dialogService)
        {
            this.LocalSniptRepository = sniptRepository;
            this.ShareService         = shareService;
            this.DialogService        = dialogService;

            this.ShareCommand            = new RelayCommand(this.ShareItem);
            this.ChangeActiveItemCommand = new RelayCommand <Snipt>(this.ChangeActiveItem);
        }
        public SearchViewModel(
            ISniptRepository sniptRepository,
            INavigationService navigationService,
            IDialogService dialogService)
        {
            this.LocalSniptRepository = sniptRepository;
            this.NavigationService    = navigationService;
            this.DialogService        = dialogService;

            // Inicializar comandos
            this.ViewItemDetailCommand  = new RelayCommand <Snipt>(this.ViewItemDetail);
            this.DoSearchCommand        = new RelayCommand <string>(this.DoSearch);
            this.LoadMoreResultsCommand = new RelayCommand(this.LoadMoreResults);
        }
示例#3
0
        /// <summary>
        /// Initializes a new instance of the MainViewModel class.
        /// Hay que pasarle todos los servicios por el constructor
        /// inyectador por el contenedor de IoC.
        /// </summary>
        public MainViewModel(
            ISniptRepository sniptRepository,
            INavigationService navigationService,
            IDialogService dialogService)
        {
            ////if (IsInDesignMode)
            ////{
            ////    // Code runs in Blend --> create design time data.
            ////}
            ////else
            ////{
            ////    // Code runs "for real"
            ////}
            this.LocalSniptRepository = sniptRepository;
            this.NavigationService    = navigationService;
            this.DialogService        = dialogService;

            this.ViewItemDetailCommand = new RelayCommand <Snipt>(this.ViewItemDetail);
            this.LoadMoreItemsCommand  = new RelayCommand(this.LoadExtraItems);
            this.SearchCommand         = new RelayCommand(this.SearchSnipts);
            this.OpenSettingsCommand   = new RelayCommand(this.OpenSettings);
            this.AboutCommand          = new RelayCommand(this.OpenAboutPage);
        }