示例#1
0
 public DiscoverViewModel()
 {
     DiscoverList      = new ObservableRangeCollection <DiscoverItem>();
     RefreshCommand    = new AsyncCommand(Refresh);
     ShowDetailCommand = new AsyncCommand <DiscoverItem>(ShowDetail);
     SearchCommand     = new Xamarin.Forms.Command <string>(async param => await SearchDatabase(param));
 }
示例#2
0
 public TransactionListViewModel()
 {
     Transactions      = new ObservableRangeCollection <Transaction>();
     TransactionTapped = new Xamarin.Forms.Command <Transaction>(Selected);
     RefreshCommand    = new AsyncCommand(GetTransactionList);
     GetTransactionListInitial();
 }
 public MarketsViewModel()
 {
     Markets         = new ObservableRangeCollection <Market>();
     FilteredMarkets = new ObservableRangeCollection <Market>();
     RefreshCommand  = new AsyncCommand(GetMarketListCommand);
     MarketList      = new string[] { "BTC/USD", "ETH/USD", "ETH/BTC", "DOGE/BTC", "TSLA/BTC", "AAPL/USD", "AAPL-0625" };
     MarketTapped    = new Xamarin.Forms.Command <Market>(Selected);
     GetMarketList();
 }
        public WalletViewModel()
        {
            var properties = Xamarin.Forms.Application.Current.Properties;

            UserId          = (int)properties["userId"];
            Wallets         = new ObservableRangeCollection <Wallet>();
            ExtendedWallets = new ObservableRangeCollection <ExtendedWallet>();
            RefreshCommand  = new AsyncCommand(Refresh);
            WalletTapped    = new Xamarin.Forms.Command <Wallet>(Selected);
            RefreshInitial();
        }
        public ChildInformationpageViewModel(int offlineStudentId)
        {
            productResearchCodeValuesService = DependencyService.Get <IProductResearchCodeValuesService>();
            productResearchCodesService      = DependencyService.Get <IProductResearchCodesService>();

            userPermissionService   = DependencyService.Get <IUserPermissionService>();
            studentTestFormsService = DependencyService.Get <IStudentTestFormsService>();
            commonDataService       = DependencyService.Get <ICommonDataService>();
            locationService         = DependencyService.Get <ILocationService>();
            clinicalTestFormService = DependencyService.Get <IClinicalTestFormService>();
            OfflineStudentId        = offlineStudentId;
            EditCommand             = new Command(EditClicked);
            AddNewRecordCommand     = new Command(AddNew);
            HyperLinkClickedCommand = new Xamarin.Forms.Command <ChildInformationRecord>(HyperlinkClicked);

            _studentService = DependencyService.Get <IStudentsService>();
            _tokenService   = DependencyService.Get <ITokenService>();
            var tokenModel = _tokenService.GetTokenResposne();

            if (tokenModel != null)
            {
                UserFullName = "" + tokenModel.FirstName + "  " + "" + tokenModel.LastName + "";
            }

            FailedString  = "Failed: 0";
            PendingString = "Pending: 0";
            Task.Run(async() => { await LoadData(OfflineStudentId); });
            LoadTestRecordsFromDB(OfflineStudentId);

            if (Connectivity.NetworkAccess != NetworkAccess.Internet)
            {
                foreach (var child in ChildInformationRecords)
                {
                    child.EnableRow = false;
                }
                EnableSync = false;
            }
            else
            {
                if (ChildInformationRecords.Any(p => p.Status != "Not started") && ChildInformationRecords.Any(p => p.IsSelect))
                {
                    EnableSync = true;
                }
            }
            Connectivity.ConnectivityChanged -= Connectivity_ConnectivityChanged;
            Connectivity.ConnectivityChanged += Connectivity_ConnectivityChanged;

            commonDataService.ClearAddChildContent = ResetContent;
        }
 public SelectResidenceViewModel()
 {
     GetPlacesCommand      = new Xamarin.Forms.Command <string>(async param => await GetPlacesByName(param));
     GetPlaceDetailCommand =
         new Xamarin.Forms.Command <GooglePlaceAutoCompletePrediction>(
             async param => await GetPlacesDetail(param));
     Places = new ObservableRangeCollection <GooglePlaceAutoCompletePrediction>();
     GoogleMapsApiService.Initialize("AIzaSyAnMLFzwkR17l4TfHYiBou6ZXmPRsLgpNg");
     ClearSelectedPlaceCommand = new Command(() =>
     {
         SelectedPlace = null;
         PlaceSelected = null;
     });
     ConfirmSelectedPlaceCommand = new AsyncCommand(ConfirmPlace);
 }
示例#7
0
        public TelaPrincipalViewModel()
        {
            TarefaAtual         = new Tarefa();
            Tarefas             = new ObservableCollection <Tarefa>(new TarefasDataAccess().GetTarefas());
            SalvarTarefaCommand = new Xamarin.Forms.Command(SalvarTarefa); //Falhei na tentativa de implementar um command
            EditarTarefaCommand = new Xamarin.Forms.Command <Tarefa>(EditarTarefa);
            //ModificarTarefaCommand = new Xamarin.Forms.Command<Tarefa>(ModificarTarefa);

            /*
             * Aqui chamamos a classe que ficará responsavel por executar o command
             * Levando a própria classe como parametro atraves do this
             */
            ModificarTarefaCommand = new Command.ModificarTarefaCommand(this);
            ExcluirTarefaCommand   = new Xamarin.Forms.Command <Tarefa>(ExcluirTarefa);
        }
示例#8
0
        public FavoriteAnimeViewModel()
        {
            GroupedFavoriteByWeekList = new ObservableRangeCollection <GroupedFavoriteAnimeByWeekDay>();

            SearchCommand               = new magno.AsyncCommand(OnSearch);
            ClearTextCommand            = new magno.Command(OnClearText);
            DeleteFavoriteCommand       = new magno.AsyncCommand(OnDeleteFavoriteCommand);
            ArchiveFavoriteCommand      = new magno.AsyncCommand(OnArchiveFavorite);
            ClearAllCommand             = new magno.AsyncCommand(OnClearAll);
            SelectionModeCommand        = new magno.Command(OnSelectionMode);
            OpenAnimeCommand            = new magno.AsyncCommand(OnOpenAnime);
            ObjectCheckedCommand        = new magno.Command <ICheckableObject>(OnObjectChecked);
            ApplyFilterCommand          = new magno.AsyncCommand(OnApplyFilter);
            ResetFilterCommand          = new magno.Command(OnResetFilter);
            SwitchCommand               = new Xamarin.Forms.Command <FavoritedAnime>(OnSwitch);
            StepperCommand              = new Xamarin.Forms.Command <FavoritedAnime>(OnStepper);
            UpdateFavoriteAnimesCommand = new AsyncCommand(OnUpdateAnimes);
        }
示例#9
0
        public SearchEditViewModel()
        {
            IsTableBottomLineVisible   = true;
            SearchErrorVisible         = false;
            userPermissionService      = DependencyService.Get <IUserPermissionService>();
            _tokenservice              = DependencyService.Get <ITokenService>();
            _locationService           = DependencyService.Get <ILocationService>();
            _studentService            = DependencyService.Get <IStudentsService>();
            EditChildCommand           = new Command <ChildRecord>(EditChildClicked);
            HyperLinkClickedCommand    = new Xamarin.Forms.Command <ChildRecord>(HyperlinkClicked);
            AscendingButtonCommand     = new Command <string>(AscendingClicked);
            DescendingButtonCommand    = new Command <string>(DecendingClicked);
            UpdateListviewBoundCommand = new Command <double>(UpdateChildRecordTableBounds);
            GetLocations();
            PopulateCountryNames();

            ActionClickedCommand = new Command <ChildRecord>(ActionClicked);

            MessagingCenter.Subscribe <ItemGroup>(this, "LocationSelected", (arg1) =>
            {
                Cover = false;
                if (SelectedLocation != null && SelectedLocation.LocationId == arg1.TreeViewId)
                {
                    LocationName     = "";
                    SelectedLocation = null;
                }
                else
                {
                    LocationName     = arg1.Name;
                    SelectedLocation = new Location()
                    {
                        LocationId = arg1.TreeViewId, LocationName = arg1.Name
                    };
                }
                ShowLocation = false;
            });

            if (Device.RuntimePlatform == Device.Android || Device.RuntimePlatform == Device.iOS)
            {
                MinimumDate = DateTime.SpecifyKind(new DateTime(1919, 01, 01), DateTimeKind.Unspecified);
            }
        }
示例#10
0
 public RentalOwnerProfileViewModel()
 {
     _rentalService        = DependencyService.Get <IRentalService>();
     ToggleFavoriteCommand = new Xamarin.Forms.Command <Rental>(rental => rental.IsFavorite = !rental.IsFavorite);
     SendEmailCommand      = new AsyncCommand(() => Launcher.TryOpenAsync($"mailto:{Owner.Email}"));
     CallCommand           = new Xamarin.Forms.Command(() =>
     {
         try
         {
             PhoneDialer.Open(Owner.PhoneNumber);
         }
         catch { }
     });
     OpenRentalDetailsCommand = new AsyncCommand <Rental>(async(rental) =>
     {
         await _navigationService.GoToPageAsync <RentalDetailsPage>(new RentalDetailsPage.Args
         {
             Rental = rental
         });
     });
 }
 public InviteMusicianViewModel()
 {
     AvailableUsers            = new ObservableRangeCollection <Musician>();
     SearchCommand             = new Xamarin.Forms.Command <string>(async param => await SearchDatabase(param));
     InviteSelectedUserCommand = new AsyncCommand(InviteSelectedUser);
 }