protected override void Init()
        {
            Container.Register <ILogger, DebugLogger>();
            Container.Register <IDbService, TestDbService>();
            SmallProfiler.Start();

            Container.Resolve <IDbService>().Initialize();



            AsanaStateService.Initialize();

            ViewModelMap.Register <DevRain.Asana.Pages.MainPage, MainViewModel>();
            ViewModelMap.Register <WorkspaceDetails, WorkspaceDetailsViewModel>();
            ViewModelMap.Register <UserDetails, UserDetailsViewModel>();
            ViewModelMap.Register <AddEditProject, AddEditProjectViewModel>();
            ViewModelMap.Register <TagDetails, TagDetailsViewModel>();
            ViewModelMap.Register <TaskDetails, TaskDetailsViewModel>();
            ViewModelMap.Register <AddEditTask, AddEditTaskViewModel>();
            ViewModelMap.Register <ProjectDetails, ProjectDetailsViewModel>();


            ViewModelCache.Register <WorkspaceDetailsViewModel>();
            ViewModelCache.Register <ProjectDetailsViewModel>();
            ViewModelCache.Register <UserDetailsViewModel>();
            ViewModelCache.Register <TagDetailsViewModel>();
            ViewModelCache.Register <TaskDetailsViewModel>();
            //Container.Resolve<ILogger>().Debug("Init complete");
        }
        protected override void Init()
        {
            Container.Register <ILogger, DebugLogger>();
            Container.Register <DbService, DbService>();
            Container.RegisterInstance <IAsanaResponseProcessor, AsanaResponseProcessor>();
            SmallProfiler.Start();

            Container.Resolve <DbService>().Initialize();

            InteractionEffectManager.AllowedTypes.Add(typeof(RadDataBoundListBoxItem));


            Counter.Start(10669);

            RadDiagnostics diagnostics = new RadDiagnostics();

            diagnostics.EmailTo            = AsanaConstants.FeedbackEmail;
            diagnostics.EmailSubject       = AsanaConstants.AppTitle;
            diagnostics.ApplicationVersion = DeviceHelper.GetAppVersion().ToString();
            //diagnostics.MessageBoxInfo.Title = "";
            diagnostics.MessageBoxInfo.Content = "Would you to like to send information about error to developers?";

            diagnostics.Init();
            Telerik.Windows.Controls.ApplicationUsageHelper.Init(DeviceHelper.GetAppVersion().ToString());
            /// ///

            AsanaStateService.Initialize();


            //ApplicationRatingNotificationServiceFromNokia.Initialize("Winsana","*****@*****.**");


            ViewModelMap.Register <MainPage, MainViewModel>();
            ViewModelMap.Register <WorkspaceDetails, WorkspaceDetailsViewModel>();
            ViewModelMap.Register <UserDetails, UserDetailsViewModel>();
            ViewModelMap.Register <AddEditProject, AddEditProjectViewModel>();
            ViewModelMap.Register <TagDetails, TagDetailsViewModel>();
            ViewModelMap.Register <TaskDetails, TaskDetailsViewModel>();
            ViewModelMap.Register <AddEditTask, AddEditTaskViewModel>();
            ViewModelMap.Register <ProjectDetails, ProjectDetailsViewModel>();
            ViewModelMap.Register <AllTasks, AllTasksViewModel>();
            ViewModelMap.Register <SettingsPage, SettingsViewModel>();

            ViewModelCache.Register <WorkspaceDetailsViewModel>();
            ViewModelCache.Register <ProjectDetailsViewModel>();
            ViewModelCache.Register <UserDetailsViewModel>();
            ViewModelCache.Register <TagDetailsViewModel>();
            ViewModelCache.Register <TaskDetailsViewModel>();



            System.Threading.Tasks.TaskScheduler.UnobservedTaskException += TaskScheduler_UnobservedTaskException;
        }
        protected override async void OnNavigatedTo(NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);

            SmallProfiler.PrintLine("StartPage - OnNavigatedTo");


#if DEBUG
            Bootstrapper.Current.Container.Resolve <IApplicationSettingsService>().SetSetting("ApiKey", "2IPsBtr.EBOluTYUi2mwwz86RkWKNHr6");
            AsanaStateService.Initialize();
#endif


            if (AsanaStateService.IsSetApiKey)
            {
                ExNavigationService.Navigate <MainPage>();
                return;
            }

            if (AsanaStateService.IsSetAuthToken)
            {
                if (NetworkHelper.IsNetworkAvailableNew())
                {
                    var response = await new AsanaRespository().GetUser("me");

                    if (AsanaClient.ProcessResponse(response, true))
                    {
                        ExNavigationService.Navigate <MainPage>();
                    }
                    else
                    {
                        ExNavigationService.Navigate <LoginNewPage>();
                    }
                }
                else
                {
                    ExNavigationService.Navigate <MainPage>();
                }
            }
            else
            {
                ExNavigationService.Navigate <LoginNewPage>();
            }
        }
Beispiel #4
0
 /// <remarks>
 /// ScheduledAgent constructor, initializes the UnhandledException handler
 /// </remarks>
 public ScheduledAgent()
 {
     if (!_classInitialized)
     {
         _classInitialized = true;
         // Subscribe to the managed exception handler
         Deployment.Current.Dispatcher.BeginInvoke(delegate
         {
             Application.Current.UnhandledException += ScheduledAgent_UnhandledException;
         });
         //var b = new BackgroundBootstrapper();
         //b.InitializeForBackgroundTask();
         AsanaStateService.Initialize();
         AppBootstrapperStateService.Container = new IocContainer();
         AppBootstrapperStateService.Container.Register <ILogger, DebugLogger>();
         AppBootstrapperStateService.Container.Register <DbService, DbService>();
         AppBootstrapperStateService.Container.RegisterInstance <IApplicationSettingsService, ApplicationSettingsService>();
         AppBootstrapperStateService.Container.RegisterInstance <IAsanaResponseProcessor, NonUiAsanaResponseProcessor>();
         //AppBootstrapperStateService.Container.Resolve<DbService>().Initialize();
     }
 }