示例#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 (!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);
            }
        }
示例#2
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);
            }
        }
示例#3
0
 public override void Download(ListItem item,
                               Action <ListItem, byte[]> downloaded)
 {
     _client.Download(_info.Path, (_, __, bytes) =>
                      downloaded(item, bytes));
 }