private void Button_Click(object sender, RoutedEventArgs e) { if (_item == null) { return; } var file = _item.GetFile(); if (file.Local.IsDownloadingActive) { _item.ProtoService.Send(new CancelDownloadFile(file.Id, false)); } else if (file.Local.CanBeDownloaded && !file.Local.IsDownloadingActive && !file.Local.IsDownloadingCompleted) { _item.ProtoService.Send(new DownloadFile(file.Id, 1)); } else { if (_item.IsVideo) { _delegate?.OpenFile(_item, file); } _delegate?.OpenItem(_item); } }
private void Button_Click(object sender, RoutedEventArgs e) { var item = _item; if (item == null) { return; } var file = item.GetFile(); if (file == null) { return; } if (file.Local.IsDownloadingActive) { item.ProtoService.Send(new CancelDownloadFile(file.Id, false)); } else if (file.Local.CanBeDownloaded && !file.Local.IsDownloadingActive && !file.Local.IsFileExisting()) { if (SettingsService.Current.IsStreamingEnabled && item.IsVideo && item.IsStreamable) { _delegate?.OpenFile(item, file); } else { item.ProtoService.DownloadFile(file.Id, 32); } } else { if (item.IsVideo) { _delegate?.OpenFile(item, file); } else { _delegate?.OpenItem(item); } } }