コード例 #1
0
        public void CreateAt(string input)
        {
            DBError error;

            if (!creatingFolder)
            {
                string noteFilename = string.Format("{0}.txt", input);
                var    newPath      = path.ChildPath(noteFilename);
                var    file         = DBFilesystem.SharedFilesystem.CreateFile(newPath, out error);

                if (file == null)
                {
                    new UIAlertView("Unable to create note", "An error has occurred: " + error.Description, null, "Ok", null).Show();
                }
                else
                {
                    var controller = new NoteController(file);
                    NavigationController.PushViewController(controller, true);
                }
            }
            else
            {
                var  newPath = path.ChildPath(input);
                bool success = DBFilesystem.SharedFilesystem.CreateFolder(newPath, out error);
                if (!success)
                {
                    new UIAlertView("Unable to create folder", "An error has occurred: " + error.Description, null, "Ok", null).Show();
                }
                else
                {
                    var controller = new DVCFiles(newPath);
                    NavigationController.PushViewController(controller, true);
                }
            }
        }
コード例 #2
0
        public void MoveTo(string input)
        {
            DBError error;
            var     components = input.Split('/');
            int     startIndex = 0;
            DBPath  path       = Root;

            if (components[0].Length == 0)
            {
                path       = DBPath.Root;
                startIndex = 1;
            }

            foreach (var component in components)
            {
                if (component == "..")
                {
                    path = path.Parent;
                }
                else
                {
                    path = path.ChildPath(component);
                }
            }
            Filesystem.MovePath(FromPath, path, out error);
            Moving   = false;
            FromPath = null;
        }
コード例 #3
0
ファイル: DVCFiles.cs プロジェクト: dannycabrera/DropboxPaint
 public void CreateAt(string input)
 {
     if (!creatingFolder)
     {
         string noteFilename = string.Format("{0}.txt", input);
         var    newPath      = path.ChildPath(noteFilename);
         DBFilesystem.SharedFilesystem.CreateFileAsync(newPath).ContinueWith(t => {
             InvokeOnMainThread(() => {
                 if (t.Result == null)
                 {
                     new UIAlertView("Unable to create note", "An error has occurred", null, "Ok", null).Show();
                 }
                 else
                 {
                     var controller = new NoteController(t.Result);
                     NavigationController.PushViewController(controller, true);
                 }
             });
         });
     }
     else
     {
         var newPath = path.ChildPath(input);
         DBFilesystem.SharedFilesystem.CreateFolderAsync(newPath).ContinueWith(t => {
             InvokeOnMainThread(() => {
                 if (!t.Result)
                 {
                     new UIAlertView("Unable to create folder", "An error has occurred", null, "Ok", null).Show();
                 }
                 else
                 {
                     var controller = new DVCFiles(newPath);
                     NavigationController.PushViewController(controller, true);
                 }
             });
         });
     }
 }