Exemplo n.º 1
0
        public App()
        {
            InitializeComponent();
            CompositionRoot.Init();
            if (Settings.IsDark)
            {
                ThemeService.ChangeToDark();
            }
            var mainPage = CompositionRoot.Resolve <MainPage>();

            mainPage.ViewModel = CompositionRoot.Resolve <MainViewModel>();
            var navigationPage = new NavigationPage(mainPage);

            MainPage = navigationPage;
            CompositionRoot.Resolve <INavigationService>().SetNavigation(navigationPage.Navigation);
        }
Exemplo n.º 2
0
 public SettingsViewModel
 (
     INavigationService navigationService,
     TimeAccountingContext timeAccountingContext,
     Func <WorkDaysViewModel> workDaysFactory
 )
 {
     _workDaysFactory       = workDaysFactory;
     _timeAccountingContext = timeAccountingContext;
     _navigationService     = navigationService;
     ClearCommand           = ReactiveCommand.CreateFromTask(ClearExecuteAsync);
     WorkDaysCommand        = ReactiveCommand.CreateFromTask(WorkDaysExecuteAsync);
     DevelopCommand         = ReactiveCommand.CreateFromTask(DevelopExecuteAsync);
     LightCommand           = ReactiveCommand.Create(() =>
     {
         if (!Settings.IsDark)
         {
             return;
         }
         Settings.IsDark = false;
         ThemeService.ChangeToLight();
     });
     DarkCommand = ReactiveCommand.Create(() =>
     {
         if (Settings.IsDark)
         {
             return;
         }
         Settings.IsDark = true;
         ThemeService.ChangeToDark();
     });
     WorkDaysCommand  = ReactiveCommand.CreateFromTask(WorkDaysExecuteAsync);
     InstagramCommand = ReactiveCommand.CreateFromTask(async() =>
     {
         InstagramBackgroundColor = Color.FromHex("#D4F4FF");
         await Task.Delay(150);
         await Browser.OpenAsync(new Uri(BaseValue.CreatorInstagram));
         InstagramBackgroundColor = Color.Transparent;
     });
     VkCommand = ReactiveCommand.CreateFromTask(async() =>
     {
         VkBackgroundColor = Color.FromHex("#D4F4FF");
         await Task.Delay(150);
         await Browser.OpenAsync(new Uri(BaseValue.CreatorVk));
         VkBackgroundColor = Color.Transparent;
     });
     GitCommand = ReactiveCommand.CreateFromTask(async() =>
     {
         GitBackgroundColor = Color.FromHex("#D4F4FF");
         await Task.Delay(150);
         await Browser.OpenAsync(new Uri(BaseValue.CreatorGithub));
         GitBackgroundColor = Color.Transparent;
     });
     SupportCommand = ReactiveCommand.Create(() =>
     {
         var emailMessenger = CrossMessaging.Current.EmailMessenger;
         if (emailMessenger.CanSendEmail)
         {
             emailMessenger.SendEmail(
                 BaseValue.SupportEmail,
                 TranslationCodeExtension.GetTranslation("MessageToSupport"),
                 string.Empty);
         }
     });
 }