Beispiel #1
0
 static ViewModelLocator()
 {
     if (!ViewModelBase.IsInDesignModeStatic)
     {
         NavigationService = new NavigationService();
         GithubService = new GithubService();
         GithubService.IsAuthenticatedChanged += (s, e) =>
         {
             if (e.IsAuthenticated == false && !NavigationService.CurrentUri().Contains(HomeUrl))
                 NavigationService.NavigateTo(HomeUrl);
         };
         GithubService.Loading += (s, e) =>
         {
             GlobalLoading.Instance.IsLoading = e.IsLoading;
         };
         GithubService.ConnectionError += (s, e) =>
         {
             MessageBox.Show("Server unreachable.", "Gi7", MessageBoxButton.OK);
         };
         GithubService.Unauthorized += (s, e) =>
         {
             MessageBox.Show("Wrong credentials.", "Gi7", MessageBoxButton.OK);
         };
         GithubService.Init();
     }
 }
Beispiel #2
0
        public ViewModelLocator()
        {
            ServiceLocator.SetLocatorProvider(() => SimpleIoc.Default);

            if (ViewModelBase.IsInDesignModeStatic)
            {

            }
            else
            {
                NavigationService = new NavigationService();
                GithubService = new GithubService();
                GithubService.IsAuthenticatedChanged += (s, e) =>
                {
                    if (e.IsAuthenticated == false && !NavigationService.CurrentUri().Contains(HOME_URL))
                        NavigationService.NavigateTo(HOME_URL);
                };
                GithubService.Loading += (s, e) => { GlobalLoading.Instance.IsLoading = e.IsLoading; };
                GithubService.ConnectionError += (s, e) => MessageBox.Show("Server unreachable.", "Gi7", MessageBoxButton.OK);
                GithubService.Unauthorized += (s, e) => MessageBox.Show("Wrong credentials.", "Gi7", MessageBoxButton.OK);
                GithubService.Init();
            }
        }