Exemple #1
0
        public override SyncInfo Initialize(DatabaseInfo info)
        {
            if (info == null)
                throw new ArgumentNullException("info");

            var details = info.Details;

            string id;
            _client = OneDriveClient
                .ParsePath(details.Url, out id);

            _info = new SyncInfo
            {
                Path = id,
                Modified = details.Modified,
                HasLocalChanges = details.HasLocalChanges,
            };

            info.OpenDatabaseFile(x =>
            {
                using (var buffer = new MemoryStream())
                {
                    BufferEx.CopyStream(x, buffer);
                    _info.Database = buffer.ToArray();
                }
            });

            return _info;
        }
Exemple #2
0
        public override SyncInfo Initialize(DatabaseInfo info)
        {
            if (info == null)
            {
                throw new ArgumentNullException("info");
            }

            var details = info.Details;

            string id;

            _client = OneDriveClient
                      .ParsePath(details.Url, out id);

            _info = new SyncInfo
            {
                Path            = id,
                Modified        = details.Modified,
                HasLocalChanges = details.HasLocalChanges,
            };

            info.OpenDatabaseFile(x =>
            {
                using (var buffer = new MemoryStream())
                {
                    BufferEx.CopyStream(x, buffer);
                    _info.Database = buffer.ToArray();
                }
            });

            return(_info);
        }
Exemple #3
0
        protected override void OnNavigatedTo(
            bool cancelled, NavigationEventArgs e)
        {
            if (cancelled)
                return;

            var pars = NavigationContext
                .QueryString;

            _folder = pars["folder"];
            _client = new OneDriveClient(pars["token"]);

            RefreshList(null);
        }
Exemple #4
0
        protected override void OnNavigatedTo(
            bool cancelled, NavigationEventArgs e)
        {
            if (cancelled)
            {
                return;
            }

            var pars = NavigationContext
                       .QueryString;

            _folder = pars["folder"];
            _client = new OneDriveClient(pars["token"]);

            RefreshList(null);
        }
Exemple #5
0
        private void CheckToken(Uri uri)
        {
            const string prefix = "?code=";

            var query = uri.Query;

            if (!query.StartsWith(prefix,
                                  StringComparison.InvariantCultureIgnoreCase))
            {
                return;
            }

            var code = query.Substring(prefix.Length);

            OneDriveClient.GetToken(code, token =>
            {
                this.NavigateTo <List>(
                    "token={0}&folder={1}",
                    token, _folder);
            });
        }