0
SkyDrive에서 파일을 다운로드하려고하면 응용 프로그램이 다운됩니다. 다시 앱을 열면 작동합니다.SkyDrive에서 파일을 다운로드하려고하면 오류가 발생합니다.
무엇이 잘못 될 수 있습니까? , FileMode.Create
IsolatedStorageFileStream fileToSave = storage.OpenFile ("3VSwipeBrowser.sdf"
namespace SDKMiniBrowserCS
{
public partial class Address : PhoneApplicationPage
{
private LiveConnectClient client = null;
private IsolatedStorageFileStream stream;
IsolatedStorageSettings settings = IsolatedStorageSettings.ApplicationSettings;
IsolatedStorageSettings inviato = IsolatedStorageSettings.ApplicationSettings;
public Address()
{
InitializeComponent();
Loaded += Customers_Loaded;
}
void Customers_Loaded(object sender, RoutedEventArgs e)
{
using (AddressBookDataContext dc = new AddressBookDataContext())
{
var itemSource = (from c in dc.Contacts select c).AsEnumerable();
ContactListBox.ItemsSource = from c in itemSource orderby c.Name ascending select c;
}
}
private void Edit_Tap(object sender, System.Windows.Input.GestureEventArgs e)
{
NavigationService.Navigate(
new Uri(string.Format("/AddressDetail.xaml?Id={0}", (ContactListBox.SelectedItem as AddressUser).Id), UriKind.Relative));
}
private void Go_Fav(object sender, System.Windows.Input.GestureEventArgs e)
{
inviato["inviato"] = (ContactListBox.SelectedItem as AddressUser).Url;
inviato["pannello"] = "1";
inviato.Save();
NavigationService.GoBack();
}
private void AddCustomerButton_Click(object sender, EventArgs e)
{
NavigationService.Navigate(new Uri("/AddressDetail.xaml", UriKind.Relative));
}
private void SignInButton_OnSessionChanged(object sender, Microsoft.Live.Controls.LiveConnectSessionChangedEventArgs e)
{
if (e.Status == LiveConnectSessionStatus.Connected)
{
client = new LiveConnectClient(e.Session);
restore.IsEnabled = true;
btnBackup.IsEnabled = true;
}
}
private void OnBackupClicked(object sender, RoutedEventArgs e)
{
client.UploadCompleted += client_UploadCompleted;
using (IsolatedStorageFile storage = IsolatedStorageFile.GetUserStoreForApplication())
{
stream = storage.OpenFile("3VSwipeBrowser.sdf", FileMode.Open);
client.UploadAsync("me/skydrive/my_documents", "3VSwipeBrowser.sdf", stream, OverwriteOption.Overwrite, null);
}
}
void client_UploadCompleted(object sender, LiveOperationCompletedEventArgs e)
{
if (e.Error == null)
{
MessageBox.Show("Upload successfull!");
stream.Close();
}
}
private void OnRestoreClicked(object sender, RoutedEventArgs e)
{
string id = string.Empty;
client.GetCompleted += (obj, args) =>
{
List<object> items = args.Result["data"] as List<object>;
foreach (object item in items)
{
Dictionary<string, object> file = item as Dictionary<string, object>;
if (file["name"].ToString() == "3VSwipeBrowser.sdf")
{
id = file["id"].ToString();
}
}
client.DownloadCompleted += (o, a) =>
{
Stream stream = a.Result;
using (IsolatedStorageFile storage = IsolatedStorageFile.GetUserStoreForApplication())
{
using (
IsolatedStorageFileStream fileToSave = storage.OpenFile("3VSwipeBrowser.sdf", FileMode.Create,
FileAccess.ReadWrite))
{
stream.CopyTo(fileToSave);
stream.Flush();
stream.Close();
}
}
};
client.DownloadAsync(string.Format("{0}/content", id));
};
client.GetAsync("me/skydrive/my_documents/files");
MessageBox.Show("Download successfull!");
NavigationService.Navigate(new Uri("/MainPage.xaml", UriKind.Relative));
}
}}
오류가 일치한다 : 여기
는 xaml.cs이고 , FileAccess.ReadWrite))감사합니다.
죄송합니다. 코드를 잘 분석하지 못했습니다. 실제 VB 또는 SharpDevelop를 사용하고 있습니까? –
C Sharp를 사용하고 있습니다 – Alessandro
죄송합니다 ... 잘 모르겠습니다 ... 다른 라이브러리를 사용해보십시오 ... 가끔 시스템 라이브러리도 모릅니다 ... 환경을 업데이트하려고 시도합니다 ... –