Exemplo n.º 1
0
        private void lstItems_SelectionChanged(object sender,
            NavigationListControl.NavigationEventArgs e)
        {
            if (!Network.CheckNetwork())
                return;

            var item = e.Item as MetaListItemInfo;

            if (item != null)
            {
                if (item.IsDir)
                {
                    RefreshList(item.Path);
                    return;
                }

                if (item.Size > 10485760) // 10MB
                {
                    MessageBox.Show(Properties.Resources.FileTooLarge);
                    return;
                }

                progBusy.IsBusy = true;
                _client.Download(item.Path,
                    OnFileDownloaded);

                return;
            }

            var parent = e.Item as ParentItem;
            if (parent != null)
                RefreshList(parent.Path);
        }
Exemplo n.º 2
0
 private void navigationControl_Navigation(object sender, NavigationListControl.NavigationEventArgs e)
 {
     if (this.ExpenseClicked != null)
     {
         this.ExpenseClicked(this, new ExpenseEventArgs { Expense = (Expense)e.Item });
     }
 }
Exemplo n.º 3
0
        private void lstBrowse_SelectionChanged(object sender,
            NavigationListControl.NavigationEventArgs e)
        {
            var meta = e.Item as MetaListItemInfo;

            if (meta == null)
                return;

            if (!Network.CheckNetwork())
                return;

            if (meta.IsDir)
            {
                NavigateTo(meta.Path);
                return;
            }

            if (meta.Size > 10485760) // 10MB
            {
                MessageBox.Show(Properties.Resources.FileTooLarge);
                return;
            }

            progBusy.IsBusy = true;

            _client.DownloadAsync(meta.Path, x =>
                OnFileDownloaded(x, meta.Path,
                    meta.Title, meta.Modified),
                OnFileDownloadFailed);
        }
Exemplo n.º 4
0
        private void lstItems_SelectionChanged(object sender,
            NavigationListControl.NavigationEventArgs e)
        {
            var meta = e.Item as MetaListItemInfo;

            if (meta == null)
                return;

            if (!Network.CheckNetwork())
                return;

            if (meta.IsDir)
            {
                NavigateTo(meta.Path);
                return;
            }

            if (meta.Size > 10485760) // 10MB
            {
                MessageBox.Show(Properties.Resources.FileTooLarge);
                return;
            }

            progBusy.IsBusy = true;

            var client = DropBoxUtils
                .Create(_token, _secret);

            var url = client.GetUrl(meta.Path);
            client.GetFileAsync(meta.Path,
                x => OnFileDownloaded(x.RawBytes, url,
                    meta.Title, meta.Modified),
                OnFileDownloadFailed);
        }
Exemplo n.º 5
0
        private void lstBrowse_SelectionChanged(object sender,
            NavigationListControl.NavigationEventArgs e)
        {
            var meta = e.Item as MetaListItemInfo;

            if (meta == null)
                return;

            if (Network.CheckNetwork())
            {
                if (meta.IsDir)
                    NavigateTo(meta.Path);
                else
                {
                    progBusy.IsBusy = true;

                    var client = DropBoxInfo
                        .Create(_token, _secret);

                    var url = client.GetUrl(meta.Path);
                    client.GetFileAsync(meta.Path,
                        x => OnFileDownloaded(x.RawBytes, url,
                            meta.Title, meta.Modified),
                        OnFileDownloadFailed);
                }
            }
        }
Exemplo n.º 6
0
        private void lstItems_SelectionChanged(object sender,
            NavigationListControl.NavigationEventArgs e)
        {
            if (!Network.CheckNetwork())
                return;

            var item = e.Item as MetaListItemInfo;

            if (item != null)
            {
                if (item.IsDir)
                {
                    RefreshList(item.Path);
                    return;
                }

                progBusy.IsBusy = true;
                _client.Download(item.Path,
                    OnFileDownloaded);

                return;
            }

            var parent = e.Item as ParentItem;
            if (parent != null)
                RefreshList(parent.Path);
        }
Exemplo n.º 7
0
        private void lstLinks_Navigation(object sender,
            NavigationListControl.NavigationEventArgs e)
        {
            var item = e.Item as WebLinkInfo;
            if (item == null)
                return;

            progBusy.IsBusy = true;
            lstLinks.IsEnabled = false;

            _download.Download(item.Url,
                WebLinks.Credentials);
        }
Exemplo n.º 8
0
        private void lstItems_SelectionChanged(object sender,
            NavigationListControl.NavigationEventArgs e)
        {
            if (!Network.CheckNetwork())
                return;

            var item = e.Item as MetaListItemInfo;

            if (item != null)
            {
                if (item.IsDir)
                {
                    RefreshList(item.Path);
                    return;
                }

                if (!IsSupportedFormat(item.Title))
                {
                    var result = MessageBox.Show(
                        Strings.SkyDrive_Unsupported,
                        "SkyDrive", MessageBoxButton.OKCancel);

                    if (result != MessageBoxResult.OK)
                        return;

                    progBusy.IsBusy = true;
                    var name = item.Title + ".doc";

                    _client.Rename(item.Path, name,
                        path => _client.Download(path,
                            OnFileDownloaded));

                    return;
                }

                progBusy.IsBusy = true;
                _client.Download(item.Path,
                    OnFileDownloaded);

                return;
            }

            var parent = e.Item as ParentItem;
            if (parent != null)
                RefreshList(parent.Path);
        }
Exemplo n.º 9
0
        private void lstBrowse_SelectionChanged(object sender,
            NavigationListControl.NavigationEventArgs e)
        {
            var meta = e.Item as MetaListItemInfo;

            if (meta == null)
                return;

            if (!Network.CheckNetwork())
                return;

            if (meta.IsDir)
                NavigateTo(meta.Path);
            else
            {
                progBusy.IsBusy = true;

                _client.DownloadAsync(meta.Path, x =>
                    OnFileDownloaded(x, meta.Path,
                        meta.Title, meta.Modified),
                    OnFileDownloadFailed);
            }
        }
Exemplo n.º 10
0
        private void lstDatabases_Navigation(object sender,
            NavigationListControl.NavigationEventArgs e)
        {
            var item = e.Item as DatabaseItem;
            if (item == null)
                return;

            if (item.IsUpdating)
                item.IsUpdating = false;
            else
                Open((DatabaseInfo)item.Info, false);
        }
Exemplo n.º 11
0
        private void lstHistory_SelectionChanged(object sender,
            NavigationListControl.NavigationEventArgs e)
        {
            var item = e.Item as GroupItem;
            if (item == null)
                return;

            NavigationService.Navigate(item.TargetUri);
        }
Exemplo n.º 12
0
        private void lst_SelectionChanged(object sender,
            NavigationListControl.NavigationEventArgs e)
        {
            var item = e.Item as GroupItem;
            if (item == null)
                return;

            _target = (Group)item.Data;
            Refresh();
        }
Exemplo n.º 13
0
        private void NavigationListNavigation(object sender, NavigationListControl.NavigationEventArgs e)
        {
            var expenseViewModel = e.Item as ExpenseViewModel;

            // navigate to the feed items page
            NavigationService.Navigate(new Uri("/Views/ExpenseView.xaml?id=" + expenseViewModel.Model.Key, UriKind.Relative));
        }