Exemplo 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)
        {
            _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;
        }
Exemplo n.º 2
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;
        }
        //
        // 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;
        }
 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);
 }
        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;
        }
Exemplo n.º 6
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> ();
		}
Exemplo n.º 7
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.SetSharedFilesystem (filesystem);
         Console.WriteLine ("App linked successfully!");
         return true;
     }
     Console.WriteLine ("App is not linked");
     return false;
 }
Exemplo 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;
			}
		}
Exemplo 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)
        {
            // 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;
            }

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

            viewController = new CameraSyncViewController ();
            UINavigationController rootController = new UINavigationController (viewController);
            window.RootViewController = rootController;
            window.MakeKeyAndVisible ();
            return true;
        }
Exemplo 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.SetSharedManager (accountMgr);
            var account = accountMgr.LinkedAccount;

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

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

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

            return true;
        }
Exemplo n.º 11
0
        private void Initialize()
        {
			_watchedFiles = new List<DBFile>();

            var manager = new DBAccountManager(_dropboxAppKey, _dropboxAppSecret);
            DBAccountManager.SharedManager = manager;

            // Check if user is logged in 
            var account = DBAccountManager.SharedManager.LinkedAccount;
            if (account == null)
                return;

//            if (_store != null && _store.Open)
//                return;
//
//            DBError error = null;
//            _store = DBDatastore.OpenDefaultStoreForAccount(account, out error);
//            if(error != null)
//                throw new Exception(error.Description);

            _fileSystem = new DBFilesystem(account);
            DBFilesystem.SharedFilesystem = _fileSystem;

//			_fileSystem.AddObserverForPathAndChildren(_fileSystem, new DBPath("/Devices"), () => {
//				Console.WriteLine("iOSDropboxService - FileSystem - Data changed!");
////                if(OnCloudDataChanged != null)
////                    OnCloudDataChanged(string.Empty);
//            });

//            _store.AddObserver (_store, () => {
//                Console.WriteLine("SyncCloudViewController - DBDatastore - Data changed!");
//                if (_store.Status.HasFlag(DBDatastoreStatus.Incoming)) {
//                    // Handle the updated data
//                    Console.WriteLine("SyncCloudViewController - DBDatastore - Incoming data!");
//                    try
//                    {
//                        DBError error2 = null;
//                        var changes = _store.Sync(error2);
//                        if(error2 != null)
//                            throw new Exception(error2.Description);
//
//                        if (!changes.ContainsKey(new NSString("stuff")))
//                            return;
//
//                        var records = (NSSet)changes["stuff"];
//                        foreach(var record in records)
//                        {
//                            var theRecord = (DBRecord)record;
//                            var timestamp = theRecord.ObjectForKey("timestamp");
//                            var deviceType = theRecord.ObjectForKey("deviceType");
//                            var deviceName = theRecord.ObjectForKey("deviceName");
//                            //lblValue.Text = string.Format("{0} {1} {2}", deviceType, deviceName, timestamp);
//                        }
//                    }
//                    catch (Exception ex)
//                    {
//                        Console.WriteLine("SyncCloudActivity - OnDatastoreStatusChange exception: {0}", ex);
//                        //lblValue.Text = string.Format("Error: {0}", ex);
//                    }
//                }
//            });
        }
 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;
     }
 }
Exemplo n.º 13
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;
		}
Exemplo n.º 14
0
 public override bool OpenUrl(UIApplication application, NSUrl url, string sourceApplication, NSObject annotation)
 {
     Console.WriteLine("AppDelegate - OpenUrl");
     var cloudService = Bootstrapper.GetContainer().Resolve<ICloudService>();
     var account = DBAccountManager.SharedManager.HandleOpenURL(url);
     if (account != null) 
     {
         Console.WriteLine("AppDelegate - OpenUrl - Dropbox linked successfully!");
         var filesystem = new DBFilesystem(account);
         DBFilesystem.SharedFilesystem = filesystem;
         cloudService.ContinueLinkApp();
         return true;
     } 
     else 
     {
         Console.WriteLine("AppDelegate - OpenUrl - Dropbox is not linked!");
         cloudService.ContinueLinkApp();
         return false;
     }
 }