Ejemplo n.º 1
0
        private void SaveTap(object sender, EventArgs e) {
            // this works but the on blur event is called by leaving the page
            // and will manipulate the current object so locking is required for
            // credentials
            (sender as ApplicationBarIconButton).UpdateBindingSource();

            Account account = (DataContext as AccountDataContext).CurrentAccount;

            if (!account.CanSave()) {
                return;
            }

            // show overlay
            if (_overlay == null) {
                _overlay = new ProgressOverlayPopup("EditAccountPage_CheckingConnection".Translate());
                _overlay.ShowCompleted += new EventHandler(OverlayFadeIn);
            }
            _overlay.Show();
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Tries to fetch a given path and refreshes the views.
        /// </summary>
        /// <param name="path"></param>
        private void FetchStructure(string path)
        {
            _board = (Storyboard)Resources["DropFileListFadeOut"] as Storyboard;

            if (_dropFileListFadeOutCompleted == null)
            {
                _dropFileListFadeOutCompleted = new EventHandler(delegate
                {
                    _context.Files.Clear();
                    _collector.Raise(_dropFileListFadeOutCompleted);
                });
                _board.Completed += _dropFileListFadeOutCompleted;
            }

            if (_overlay == null)
            {
                _overlay = new ProgressOverlayPopup()
                {
                    BackgroundColor = Colors.Transparent
                };

            }
            _overlay.Show();

            _result = null;
            _board.Begin();
            _collector.WaitFor(_dropFileListFadeOutCompleted);
            _collector.WaitFor("FileListReceived");

            _collector.Complete = () =>
            {
                FetchStructureCompleteHandler(_result);
                Dispatcher.BeginInvoke(() =>
                {
                    ((Storyboard)Resources["DropFileListFadeIn"] as Storyboard).Begin();
                    _overlay.Hide();
                });
            };

            if (_workingAccount != null)
            {
                var dav = new WebDAV(_workingAccount.GetUri(), _workingAccount.GetCredentials());
                dav.StartRequest(DAVRequestHeader.CreateListing(path), DAVRequestBody.CreateAllPropertiesListing(), null, FetchStructureComplete);
            }
        }