コード例 #1
0
ファイル: MainWindow.xaml.cs プロジェクト: mwilcox-wi/guqu
        private async void mimicLogin()
        {
            InitializeAPI temp = new InitializeAPI();

            try
            {
                temp.initGoogleDriveAPI();
                await CloudLogin.googleDriveLogin();

                temp.initOneDriveAPI();
                await CloudLogin.oneDriveLogin(user);

                GoogleDriveCalls gdc  = new GoogleDriveCalls();
                OneDriveCalls    odc  = new OneDriveCalls();
                bool             goog = await gdc.fetchAllMetaData(metaDataController, "Google Drive");

                bool one = await odc.fetchAllMetaData(metaDataController, "One Drive");
            }
            catch (Exception e)
            {
            }
            finally
            {
                Models.SupportClasses.TreeNode googleRootnode   = metaDataController.getRoot("Google Drive", "googleRoot", "Google Drive");
                Models.SupportClasses.TreeNode oneDriveRootnode = metaDataController.getRoot("One Drive", "driveRoot", "One Drive");
                hierarchyAdd(googleRootnode);
                hierarchyAdd(oneDriveRootnode);
            }
        }
コード例 #2
0
        private async void googleDriveClick(object sender, RoutedEventArgs e)
        {
            cloudId = 2;
            List <string> token        = api.initGoogleDriveAPI(); //TODO: try catch
            var           accessToken  = token[0];
            var           refreshToken = token[1];

            Console.WriteLine("googledrive token: " + token);

            if (registerUserCloud(accessToken, cloudId, refreshToken))
            {
                Console.WriteLine("Registration succeeded for Google Drive.");
            }
            else
            {
                Console.WriteLine("Registration failed for Google Drive.");
            }

            CloudLogin.googleDriveLogin();

            bool       main       = false;//check to see if there is a main open
            MainWindow mainWindow = null;

            foreach (var wnd in Application.Current.Windows)
            {
                if (wnd is MainWindow)
                {
                    Console.WriteLine("Main or Cloud window open");
                    mainWindow = (MainWindow)wnd;
                    main       = true;
                }
            }
            //does a mainWindow exist?
            if (main == false)
            {
                //only if this was on new guqu account
                mainWindow = new MainWindow(user);
                mainWindow.Show();
            }
            InitializeAPI temp = new InitializeAPI();

            try
            {
                temp.initGoogleDriveAPI();
                await CloudLogin.googleDriveLogin();
            }
            catch (Exception ex)
            {
                return;
            }
            GoogleDriveCalls gdc = new GoogleDriveCalls();

            mainWindow.addHierarchy(gdc, "Google Drive", "googleRoot", "Google Drive");
            mainWindow.setButtonsClickable(true);

            this.Close();
        }
コード例 #3
0
        public GoogleDriveCallsTests()
        {
            try
            {
                List <string> s = api.initGoogleDriveAPI();
                CloudLogin.googleDriveLogin();

                gdc = new GoogleDriveCalls();
            }
            catch (Exception e) { }
        }