Beispiel #1
0
 /// <summary>
 /// MainViewModel Constructor
 /// </summary>
 /// <param name="navigator">INavigator view model navigation</param>
 /// <param name="toastMessage">IToastMessage platform specific ToastMessage</param>
 public MainViewModel(INavigator navigator, IToastMessage toastMessage)
     : base(navigator, toastMessage)
 {
     SettingsCommand = new Command(NavigateSettingsPage);
     AboutCommand    = new Command(NavigateAboutPage);
     SeedTypeCommand = new Command(NavigateSeedTypePage);
 }
Beispiel #2
0
        public ChuckJokesPageViewModel(IJokeService jokeService,
                                       IDatabaseService databaseService,
                                       ISettingsService settingsService,
                                       IToastMessage toastMessage)
        {
            _jokeService     = jokeService;
            _databaseService = databaseService;
            _settingsService = settingsService;
            _toastMessage    = toastMessage;

            OnAddJokeCommand    = new DelegateCommand(AddJokeAsync, CanAddJokeAsync);
            OnCellTappedCommand = new DelegateCommand <string>(ReadJokeAsync, CanReadJokeAsync);
            OnDeleteJokeCommand = new DelegateCommand <JokeItem>(DeleteJoke);

            LoadUrl();

            var dbJokes = _databaseService.GetJokes();

            if (dbJokes != null)
            {
                foreach (var item in dbJokes)
                {
                    JokeList.Add(item);
                }
            }

            UpdateBindedCollection();

            if (!ExtensionMethods.IsConnected())
            {
                _toastMessage.ShowToast(notConnectedMessage);
            }
        }
Beispiel #3
0
 /// <summary>
 /// MainViewModel Constructor
 /// </summary>
 /// <param name="navigator">INavigator view model navigation</param>
 /// <param name="toastMessage">IToastMessage platform specific ToastMessage</param>
 /// <param name="seedTypeService">ISeedTypeService Test, Api, and Database</param>
 public AddNewSeedTypeViewModel(INavigator navigator, IToastMessage toastMessage, ISeedTypeService seedTypeService)
     : base(navigator, toastMessage)
 {
     _seedTypeService      = seedTypeService;
     AddNewSeedTypeCommand = new Command(AddNewSeedType);
     CancelCommand         = new Command(Cancel);
 }
Beispiel #4
0
 /// <summary>
 /// SeedTypeViewModel constructor
 /// </summary>
 /// <param name="navigator">INavigator view model navigation</param>
 /// <param name="toastMessage">IToastMessage platform specific ToastMessage</param>
 /// <param name="seedTypeService">ISeedTypeService Test, Api, and Database</param>
 /// <param name="viewFactory">IViewFactory Resolves Pages from view models</param>
 public SeedTypeViewModel(INavigator navigator, IToastMessage toastMessage, ISeedTypeService seedTypeService, IViewFactory viewFactory)
     : base(navigator, toastMessage)
 {
     _seedTypeService      = seedTypeService;
     _viewFactory          = viewFactory;
     SeedListCommand       = new Command(NavigateSeedListPage);
     AddNewSeedTypeCommand = new Command(NavigateAddNewSeedTypePage);
     OCSeedTypes           = new ObservableCollection <SeedType>();
 }
Beispiel #5
0
        public HomePageViewModel(ISettingsService settingsService,
                                 IDatabaseService databaseService,
                                 IToastMessage toastMessage)
        {
            _settingsService = settingsService;
            _databaseService = databaseService;
            _toastMessage    = toastMessage;

            //_databaseService.DeleteDatabase();

            var dbJoke = _databaseService.GetRandomJoke();

            if (dbJoke != null)
            {
                Joke = dbJoke;
            }

            var dbQuote = _databaseService.GetRandomQuote();

            if (dbQuote != null)
            {
                Quote = new QuoteItem
                {
                    Tags  = dbQuote.Tags.Split(';').ToList(),
                    Icon  = dbQuote.Icon,
                    Id    = dbQuote.Id,
                    Quote = dbQuote.Quote
                }
            }
            ;

            var dbMeme = _databaseService.GetRandomMeme();

            if (dbMeme != null)
            {
                Meme = new MemeDbItem
                {
                    Image = dbMeme.Image,
                    Id    = dbMeme.Id
                }
            }
            ;

            InitSettings();

            if (!ExtensionMethods.IsConnected())
            {
                _toastMessage.ShowToast(notConnectedMessage);
            }
        }
        public TronaldDumpMemePageViewModel(ITronaldDumpService tronaldDumpService, IDatabaseService databaseService, ISettingsService settingsService, IToastMessage toastMessage)
        {
            _tronaldDumpService = tronaldDumpService;
            _databaseService    = databaseService;
            _settingsService    = settingsService;
            _toastMessage       = toastMessage;

            OnAddMemeCommand    = new DelegateCommand(AddMemeAsync, CanAddMemeAsync);
            OnDeleteMemeCommand = new DelegateCommand(DeleteMeme, CanDeleteMeme);

            ImageCollection.CollectionChanged += ImageCollection_CollectionChanged;

            var dbJokes = _databaseService.GetMemes();

            if (dbJokes != null)
            {
                foreach (var item in dbJokes)
                {
                    ImageCollection.Add(item);
                }
            }

            LoadSettings();
        }
        public TronaldDumpQuotesPageViewModel(ITronaldDumpService tronaldDumpService,
                                              IDatabaseService databaseService,
                                              ISettingsService settingsService,
                                              IToastMessage toastMessage)
        {
            _tronaldDumpService = tronaldDumpService;
            _databaseService    = databaseService;
            _settingsService    = settingsService;
            _toastMessage       = toastMessage;

            OnRequestNewQuoteCommand = new DelegateCommand(RequestQuote, CanRequestQuote);
            OnCellTappedCommand      = new DelegateCommand <string>(ReadQuoteAsync, CanReadQuoteAsync);
            OnDeleteQuoteCommand     = new DelegateCommand <QuoteItem>(DeleteQuote);

            GetQuoteUrl();

            var dbQuotes = _databaseService.GetQuotes();

            if (dbQuotes != null)
            {
                foreach (var item in dbQuotes)
                {
                    Quotes.Add(new QuoteItem {
                        Tags  = item.Tags.Split(';').ToList(),
                        Icon  = item.Icon,
                        Id    = item.Id,
                        Quote = item.Quote
                    });
                }
            }

            if (!ExtensionMethods.IsConnected())
            {
                _toastMessage.ShowToast(notConnectedMessage);
            }
        }
Beispiel #8
0
 public Mqtt(IAudio audio, IToastMessage toastMessage, ILogger logger)
 {
     _audio        = audio;
     _toastMessage = toastMessage;
     _logger       = logger;
 }
 /// <summary>
 /// SeedTypeViewModel constructor
 /// </summary>
 /// <param name="navigator">INavigator view model navigation</param>
 /// <param name="toastMessage">IToastMessage platform specific ToastMessage</param>
 /// <param name="seedService">ISeedService Test, Api, and Database</param>
 public SeedListViewModel(INavigator navigator, IToastMessage toastMessage, ISeedService seedService)
     : base(navigator, toastMessage)
 {
     _seedService = seedService;
     OCSeedList   = new ObservableCollection <Seed>();
 }
 /// <summary>
 /// Base Constructor.  All view models will need navigation and toast messages.
 /// </summary>
 /// <param name="navigator">INavigator view model navigation</param>
 /// <param name="toastMessage">IToastMessage platform specific ToastMessage</param>
 public BaseViewModel(INavigator navigator, IToastMessage toastMessage)
 {
     _navigator    = navigator;
     _toastMessage = toastMessage;
 }
Beispiel #11
0
 public AboutViewModel(INavigator navigator, IToastMessage toastMessage)
     : base(navigator, toastMessage)
 {
 }
Beispiel #12
0
        public SoundsPageViewModel(INavigationService navigationService
                                   , IPageDialogService pageDialogService
                                   , IAudioPlayerService audioPlayerService
                                   , IToastMessage toastMessage)
        {
            _navigationService  = navigationService;
            _pageDialogService  = pageDialogService;
            _audioPLayerService = audioPlayerService;
            _toastMessage       = toastMessage;

            Categories = new ObservableCollection <Category>
            {
                new Category
                {
                    Title        = AppResource.Nature,
                    ControlColor = Color.Green,
                    SoundsList   = new ObservableCollection <SoundSample>
                    {
                        new SoundSample {
                            Name = AppResource.Fireplace, Icon = Helpers.ImageNameHelper.FirePLace, Path = Constants.Constants.Fireplace
                        },
                        new SoundSample {
                            Name = AppResource.Forest, Icon = Helpers.ImageNameHelper.Forest, Path = Constants.Constants.Forest
                        },
                        new SoundSample {
                            Name = AppResource.Storm, Icon = Helpers.ImageNameHelper.Storm, Path = Constants.Constants.Thunder
                        },
                        new SoundSample {
                            Name = AppResource.Rain, Icon = Helpers.ImageNameHelper.Rain, Path = Constants.Constants.SmallRain
                        },
                        new SoundSample {
                            Name = AppResource.Sea, Icon = Helpers.ImageNameHelper.Sea, Path = Constants.Constants.Sea
                        },
                        new SoundSample {
                            Name = AppResource.Space, Icon = Helpers.ImageNameHelper.Night, Path = Constants.Constants.Space
                        },
                        new SoundSample {
                            Name = AppResource.Bonfire, Icon = Helpers.ImageNameHelper.Bonfire1, Path = Constants.Constants.Bonfire
                        },
                        new SoundSample {
                            Name = AppResource.Night, Icon = Helpers.ImageNameHelper.NightForest, Path = Constants.Constants.Night
                        },
                        new SoundSample {
                            Name = AppResource.Snowstorm, Icon = Helpers.ImageNameHelper.SnowStorm, Path = Constants.Constants.Snowstorm
                        }
                    }
                },
                new Category
                {
                    Title        = AppResource.Technick,
                    ControlColor = Color.Red,
                    SoundsList   = new ObservableCollection <SoundSample>
                    {
                        new SoundSample {
                            Name = AppResource.City, Icon = Helpers.ImageNameHelper.City, Path = Constants.Constants.City
                        },
                        new SoundSample {
                            Name = AppResource.Helicopter, Icon = Helpers.ImageNameHelper.Helicopter, Path = Constants.Constants.Helicopter
                        },
                        new SoundSample {
                            Name = AppResource.Keyboard, Icon = Helpers.ImageNameHelper.Keyboard, Path = Constants.Constants.Keyboard
                        },
                        new SoundSample {
                            Name = AppResource.Mixer, Icon = Helpers.ImageNameHelper.Mixer, Path = Constants.Constants.Mixer
                        },
                        new SoundSample {
                            Name = AppResource.CoffeeMashine, Icon = Helpers.ImageNameHelper.CoffeeMashine, Path = Constants.Constants.CoffeeMashine
                        },
                        new SoundSample {
                            Name = AppResource.Train, Icon = Helpers.ImageNameHelper.Train, Path = Constants.Constants.Train
                        },
                        new SoundSample {
                            Name = AppResource.Calculator, Icon = Helpers.ImageNameHelper.Calculator, Path = Constants.Constants.Calculator
                        },
                        new SoundSample {
                            Name = AppResource.Laminator, Icon = Helpers.ImageNameHelper.Laminator, Path = Constants.Constants.Laminator
                        },
                        new SoundSample {
                            Name = AppResource.Sail, Icon = Helpers.ImageNameHelper.Sail, Path = Constants.Constants.Sail
                        }
                    }
                },
                new Category
                {
                    Title        = AppResource.ASMR,
                    ControlColor = Color.Violet,
                    SoundsList   = new ObservableCollection <SoundSample>
                    {
                        new SoundSample {
                            Name = AppResource.Cats, Icon = Helpers.ImageNameHelper.Cat, Path = Constants.Constants.Cat
                        },
                        new SoundSample {
                            Name = AppResource.Birds, Icon = Helpers.ImageNameHelper.Bird, Path = Constants.Constants.Birds
                        },
                        new SoundSample {
                            Name = AppResource.Sea, Icon = Helpers.ImageNameHelper.UnderWater, Path = Constants.Constants.UnderWater
                        },
                        new SoundSample {
                            Name = AppResource.Snow, Icon = Helpers.ImageNameHelper.Snow, Path = Constants.Constants.Snow
                        },
                        new SoundSample {
                            Name = AppResource.Pen, Icon = Helpers.ImageNameHelper.Pen, Path = Constants.Constants.Pen
                        },
                        new SoundSample {
                            Name = AppResource.Pencil, Icon = Helpers.ImageNameHelper.Pencil, Path = Constants.Constants.Pencil
                        },
                        new SoundSample {
                            Name = AppResource.Scissors, Icon = Helpers.ImageNameHelper.Scissors, Path = Constants.Constants.Scissors
                        },
                        new SoundSample {
                            Name = AppResource.Chalk, Icon = Helpers.ImageNameHelper.Chalk, Path = Constants.Constants.Chalk
                        },
                        new SoundSample {
                            Name = AppResource.Clock, Icon = Helpers.ImageNameHelper.Clock, Path = Constants.Constants.Clock
                        }
                    }
                },
                new Category
                {
                    Title        = AppResource.Instrumental,
                    ControlColor = Color.AliceBlue,
                    SoundsList   = new ObservableCollection <SoundSample>
                    {
                        new SoundSample {
                            Name = AppResource.Harp, Icon = Helpers.ImageNameHelper.Harp, Path = Constants.Constants.Harp
                        },
                        new SoundSample {
                            Name = AppResource.Flute, Icon = Helpers.ImageNameHelper.Flute, Path = Constants.Constants.Flute
                        },
                        new SoundSample {
                            Name = AppResource.Tambourine, Icon = Helpers.ImageNameHelper.Tambourine, Path = Constants.Constants.Tambourine
                        },
                        new SoundSample {
                            Name = AppResource.Piano, Icon = Helpers.ImageNameHelper.Piano, Path = Constants.Constants.Piano
                        },
                        new SoundSample {
                            Name = AppResource.Guitar, Icon = Helpers.ImageNameHelper.Guitar, Path = Constants.Constants.Guitar
                        },
                        new SoundSample {
                            Name = AppResource.Xylophone, Icon = Helpers.ImageNameHelper.Xylophone, Path = Constants.Constants.Xylophone
                        },
                        new SoundSample {
                            Name = AppResource.ElectricGuitar, Icon = Helpers.ImageNameHelper.ElectricGuitar, Path = Constants.Constants.ElectricGuitar
                        },
                        new SoundSample {
                            Name = AppResource.Saxophone, Icon = Helpers.ImageNameHelper.Saxophone, Path = Constants.Constants.Saxophone
                        },
                        new SoundSample {
                            Name = AppResource.Meditation, Icon = Helpers.ImageNameHelper.Meditation, Path = Constants.Constants.Meditation
                        },
                    }
                },
            };
            if (_audioPLayerService.IsPlaying())
            {
                IsPlaying = true;
            }
        }
 public SettingsViewModel(INavigator navigator, IToastMessage toastMessage)
     : base(navigator, toastMessage)
 {
 }