Ejemplo n.º 1
0
        //
        // This method is invoked when the application has loaded and is ready to run. In this
        // method you should instantiate the window, load the UI into it and then make the window
        // visible.
        //
        // You have 17 seconds to return from this method, or iOS will terminate your application.
        //
        public override bool FinishedLaunching(UIApplication app, NSDictionary options)
        {
            var manager = new DBAccountManager(DropboxSyncKey, DropboxSyncSecret);

            DBAccountManager.SharedManager = manager;

            Xamarin.Forms.Forms.Init();

            // create a new window instance based on the screen size
            window = new UIWindow(UIScreen.MainScreen.Bounds);

            Task.Factory.StartNew(() => {
                this.BeginInvokeOnMainThread(() => {
                    var account = DBAccountManager.SharedManager.LinkedAccount;
                    if (account != null)
                    {
                        var filesystem = new DBFilesystem(account);
                        DBFilesystem.SharedFilesystem = filesystem;
                        SetupDropbox();
                    }
                    else
                    {
                        manager.LinkFromController(window.RootViewController);
                    }
                });
            });

            // If you have defined a root view controller, set it here:
            window.RootViewController = RacePickerPage.Create(DropboxDatabase.Shared).CreateViewController();;

            // make the window visible
            window.MakeKeyAndVisible();

            return(true);
        }
 public FolderListController(DBFilesystem filesystem, DBPath root) : base()
 {
     Filesystem           = filesystem;
     Root                 = root;
     NavigationItem.Title = Root.Equals(DBPath.Root) ? "Dropbox" : root.Name;
     TableView.Source     = new MyFolderTableViewSource(this);
 }
Ejemplo n.º 3
0
        //
        // This method is invoked when the application has loaded and is ready to run. In this
        // method you should instantiate the window, load the UI into it and then make the window
        // visible.
        //
        // You have 17 seconds to return from this method, or iOS will terminate your application.
        //
        public override bool FinishedLaunching(UIApplication app, NSDictionary options)
        {
            window = new UIWindow(UIScreen.MainScreen.Bounds);

            var accountManager = new DBAccountManager(key: "t3ow4tvu36zlh5s", secret: "w4nmqlk5ul1uiw8");

            DBAccountManager.SetSharedManager(accountManager);
            settingsController = new SettingsController(accountManager);



            var initialControllers = new List <UIViewController>();

            initialControllers.Add(settingsController);

            var account = accountManager.LinkedAccount;

            if (account != null)
            {
                var fileSystem       = new DBFilesystem(account);
                var folderController = new FolderListController(fileSystem, DBPath.Root);
                initialControllers.Add(folderController);
            }

            navController = new UINavigationController();
            navController.ViewControllers = initialControllers.ToArray();
            window.RootViewController     = navController;
            window.BackgroundColor        = UIColor.White;

            window.MakeKeyAndVisible();
            return(true);
        }
Ejemplo n.º 4
0
        public override bool OpenUrl(UIApplication application, NSUrl url, string sourceApplication, NSObject annotation)
        {
            var account = DBAccountManager.SharedManager.HandleOpenURL(url);

            if (account != null)
            {
                var fileSystem       = new DBFilesystem(account);
                var folderController = new FolderListController(fileSystem, DBPath.Root);
                navController.PushViewController(folderController, true);
            }
            return(true);
        }
Ejemplo n.º 5
0
 public DropboxFile(DBFileInfo fileInfo, DBFilesystem fileSystem)
 {
     if (fileInfo == null)
     {
         throw new ArgumentNullException("fileInfo");
     }
     if (fileSystem == null)
     {
         throw new ArgumentNullException("fileSystem");
     }
     this.fileInfo   = fileInfo;
     this.fileSystem = fileSystem;
 }
Ejemplo n.º 6
0
        public override bool OpenUrl(UIApplication application, NSUrl url, string sourceApplication, NSObject annotation)
        {
            var account = DBAccountManager.SharedManager.HandleOpenURL(url);

            if (account != null)
            {
                var filesystem = new DBFilesystem(account);
                DBFilesystem.SharedFilesystem = filesystem;
                Console.WriteLine("App linked successfully!");
                return(true);
            }
            Console.WriteLine("App is not linked");
            return(false);
        }
Ejemplo n.º 7
0
        public DropboxFileSystem(DBAccount account, DBFilesystem filesystem)
        {
            if (account == null)
            {
                throw new ArgumentNullException("account");
            }
            if (filesystem == null)
            {
                throw new ArgumentNullException("filesystem");
            }

            this.account    = account;
            this.filesystem = filesystem;
            FileExtensions  = new Collection <string> ();
        }
Ejemplo n.º 8
0
        public DropboxFileSystemProvider(string key, string secret)
        {
            fss = new List <DropboxFileSystem> ();

            var manager = new DBAccountManager(key, secret);

            DBAccountManager.SharedManager = manager;

            var account = manager.LinkedAccount;

            if (account != null && account.Linked)
            {
                var dbfs = new DBFilesystem(account);
                var fs   = new DropboxFileSystem(account, dbfs);
                fss.Add(fs);
                DBFilesystem.SharedFilesystem = dbfs;
            }
        }
Ejemplo n.º 9
0
        //
        // This method is invoked when the application has loaded and is ready to run. In this
        // method you should instantiate the window, load the UI into it and then make the window
        // visible.
        //
        // You have 17 seconds to return from this method, or iOS will terminate your application.
        //
        public override bool FinishedLaunching(UIApplication app, NSDictionary options)
        {
            _splitViewController  = new TimingSplitViewController();
            _splashViewController = new SplashDialogViewController();

            _splashViewController.Changed += (string arg1, string arg2) => {
                _splitViewController.Initialise(arg1, arg2);
                window.RootViewController = _splitViewController;
            };

            // create a new window instance based on the screen size

            window = new UIWindow(UIScreen.MainScreen.Bounds)
            {
                RootViewController = _splashViewController
            };

            // make the window visible
            window.MakeKeyAndVisible();

            // The account manager stores all the account info. Create this when your app launches
            var manager = new DBAccountManager(DropboxSyncKey, DropboxSyncSecret);

            DBAccountManager.SharedManager = manager;

            var account = manager.LinkedAccount;

            if (account != null)
            {
                var filesystem = new DBFilesystem(account);
                DBFilesystem.SharedFilesystem = filesystem;
            }
            else
            {
                DBAccountManager.SharedManager.LinkFromController(_splitViewController);
            }

            return(true);
        }
Ejemplo n.º 10
0
        //
        // This method is invoked when the application has loaded and is ready to run. In this
        // method you should instantiate the window, load the UI into it and then make the window
        // visible.
        //
        // You have 17 seconds to return from this method, or iOS will terminate your application.
        //
        public override bool FinishedLaunching(UIApplication app, NSDictionary options)
        {
            // The account manager stores all the account info. Create this when your app launches
            var accountMgr = new DBAccountManager(key: appKey, secret: appSecret);

            DBAccountManager.SharedManager = accountMgr;
            var account = accountMgr.LinkedAccount;

            if (account != null)
            {
                var filesystem = new DBFilesystem(account);
                DBFilesystem.SharedFilesystem = filesystem;
            }

            window = new UIWindow(UIScreen.MainScreen.Bounds);

            loginController           = new DVCLogin();
            navController             = new UINavigationController(loginController);
            window.RootViewController = navController;
            window.MakeKeyAndVisible();

            return(true);
        }
        public override void RowSelected(UITableView tableView, NSIndexPath indexPath)
        {
            switch (RowTypeForIndexPath(indexPath))
            {
            case RowType.AccountRow:
                var account    = ctlr.Manager.LinkedAccount;
                var fileSystem = new DBFilesystem(account);
                Console.WriteLine("Created filesystem " + fileSystem.Description);
                var controller = new FolderListController(fileSystem, DBPath.Root);
                ctlr.NavigationController.PushViewController(controller, true);
                break;

            case RowType.LinkRow:
                ctlr.Manager.LinkFromController(ctlr.NavigationController);
                break;

            case RowType.UnlinkRow:
                ctlr.Manager.LinkedAccount.Unlink();
                break;

            default:
                break;
            }
        }