Пример #1
0
        public AdicionarEmprestimoViewModel(ItemEmprestimo itemEncontrado)
        {
            ItemEncontrado       = itemEncontrado;
            servicoArmazenamento = DependencyService.Get <IArmazenamentoService>();
            ListaTelefones       = new ObservableCollection <ItemEmprestimo>();
            ListaEmprestador     = new ObservableCollection <Emprestador>();

            OnAppearingCommand = new Command(() => NoAparecimento());

            AdicionarDevolverEmprestimoCommand = new Command(async() => await AdicionarDevolverEmprestimo());
            VoltarTelaDeEmprestimoCommand      = new Command(async() => await App.navigationPage.PopAsync());

            ListaHistoricoTelefone = servicoArmazenamento.ResgatarListaEmprestimo();
            listaItens             = servicoArmazenamento.ResgatarListaItens();
            listaEmprestador       = servicoArmazenamento.ResgatarListaEmprestador();

            Devolucao = itemEncontrado.Devolucao;
        }
        public ConfiguracaoViewModel()
        {
            servicoArmazenamento      = DependencyService.Get <IArmazenamentoService>();
            ItensAtivoCommand         = new Command(() => AtivarItens());
            UsuariosAtivoCommand      = new Command(() => AtivarUsuarios());
            VoltarCommand             = new Command(async() => await App.navigationPage.PopAsync());
            OnAppearingCommand        = new Command(() => NoAparecimento());
            CadastrarCommand          = new Command(() => Cadastrar());
            CopiarItemCommand         = new Command <ItemEmprestimo>(async(x) => await CopiarItem(x));
            RemoverItemCommand        = new Command <ItemEmprestimo>((x) => RemoverItem(x));
            RemoverEmprestadorCommand = new Command <Emprestador>((x) => RemoverEmprestador(x));

            ListaEmprestador    = new ObservableCollection <Emprestador>();
            ListaItemEmprestimo = new ObservableCollection <ItemEmprestimo>();

            listaEmprestador    = servicoArmazenamento.ResgatarListaEmprestador();
            listaItemEmprestimo = servicoArmazenamento.ResgatarListaItens();
            ItensAtivo          = true;
        }