Пример #1
0
        public void TestInit1()
        {
            //App.MobileService = new MobileServiceClient(
            //    "https://pinthecloud.azure-mobile.net/",
            //    "yvulzHAGRgNsGnPLHKcEFCPJcuyzKj23"
            //);
            App.ApplicationSessions = new WSApplicationSessions();
            App.ApplicationSettings = new WSApplicationSettings();

            // Manager
            App.SpotManager = new SpotManager();
            App.Geolocator = new Geolocator();
            App.BlobStorageManager = new BlobStorageManager();
            App.LocalStorageManager = new LocalStorageManager();

            IStorageManager OneDriveManager = new OneDriveManager();
            IStorageManager DropBoxManager = new DropboxManager();
            IStorageManager GoogleDriveManger = new GoogleDriveManager();

            /////////////////////////////////////////////////////
            // This order will be displayed at every App Pages
            /////////////////////////////////////////////////////
            StorageHelper.AddStorageManager(OneDriveManager.GetStorageName(), OneDriveManager);
            StorageHelper.AddStorageManager(DropBoxManager.GetStorageName(), DropBoxManager);
            StorageHelper.AddStorageManager(GoogleDriveManger.GetStorageName(), GoogleDriveManger);
            Switcher.SetStorageToMainPlatform();
            App.AccountManager = new AccountManager();

            if (!App.ApplicationSettings.Contains(Switcher.MAIN_PLATFORM_TYPE_KEY))
                App.ApplicationSettings[Switcher.MAIN_PLATFORM_TYPE_KEY] = AppResources.OneDrive;

            // Check nick name at frist login.
            if (!App.ApplicationSettings.Contains(StorageAccount.ACCOUNT_DEFAULT_SPOT_NAME_KEY))
                App.ApplicationSettings[StorageAccount.ACCOUNT_DEFAULT_SPOT_NAME_KEY] = AppResources.AtHere;

            // Check location access consent at frist login.
            if (!App.ApplicationSettings.Contains(StorageAccount.LOCATION_ACCESS_CONSENT_KEY))
                App.ApplicationSettings[StorageAccount.LOCATION_ACCESS_CONSENT_KEY] = false;

            // Do Signin work of each cloud storage.
            if (App.AccountManager.IsSignIn())
            {
                if (NetworkInterface.GetIsNetworkAvailable())
                {
                    TaskHelper.AddTask(App.AccountManager.GetPtcId(), App.AccountManager.SignIn());
                    using (var itr = StorageHelper.GetStorageEnumerator())
                    {
                        while (itr.MoveNext())
                            if (itr.Current.IsSignIn())
                                TaskHelper.AddSignInTask(itr.Current.GetStorageName(), itr.Current.SignIn());
                    }
                }
            }
        }
Пример #2
0
        /// <summary>
        /// Singleton 응용 프로그램 개체를 초기화합니다.  이것은 실행되는 작성 코드의 첫 번째
        /// 줄이며 따라서 main() 또는 WinMain()과 논리적으로 동일합니다.
        /// </summary>
        public App()
        {
            this.InitializeComponent();
            this.Suspending += OnSuspending;

            /*** Injecting objects to public static instances ***/

            // App
            MobileService = new MobileServiceClient(
                "https://pinthecloud.azure-mobile.net/",
                "yvulzHAGRgNsGnPLHKcEFCPJcuyzKj23"
            );
            ApplicationSessions = new WSApplicationSessions();
            ApplicationSettings = new WSApplicationSettings();

            // Manager
            SpotManager = new SpotManager();
            Geolocator = new Geolocator();
            BlobStorageManager = new BlobStorageManager();
            LocalStorageManager = new LocalStorageManager();

            OneDriveManager = new OneDriveManager();
            DropBoxManager = new DropboxManager();
            GoogleDriveManger = new GoogleDriveManager();

            /////////////////////////////////////////////////////
            // This order will be displayed at every App Pages
            /////////////////////////////////////////////////////
            StorageHelper.AddStorageManager(OneDriveManager.GetStorageName(), OneDriveManager);
            StorageHelper.AddStorageManager(DropBoxManager.GetStorageName(), DropBoxManager);
            StorageHelper.AddStorageManager(GoogleDriveManger.GetStorageName(), GoogleDriveManger);
            Switcher.SetStorageToMainPlatform();
            AccountManager = new AccountManager();
        }