1

好吧,我尝试了很多东西,但我并不真正了解保存在本地存储中的所有内容。自从有了相机我就知道它是如何工作的,但我不知道如何用inkManager制作它。如果你有什么想法?

这是我保存用户想要的位置的代码,但我想在 localstorage 中“自动保存”:

private async void save_Button(object sender, RoutedEventArgs e)
    {
        if (_inkManager.GetStrokes().Count > 0)
        {
            try
            {
                Windows.Storage.Pickers.FileSavePicker save = new Windows.Storage.Pickers.FileSavePicker();
                save.SuggestedStartLocation = Windows.Storage.Pickers.PickerLocationId.Desktop;
                save.DefaultFileExtension = ".jpg";
                save.FileTypeChoices.Add("JPG", new string[] { ".jpg" });
                StorageFile filesave = await save.PickSaveFileAsync();
                IOutputStream ab = await filesave.OpenAsync(FileAccessMode.ReadWrite);

                if (ab != null)
                    await _inkManager.SaveAsync(ab);

              //  await save.CopyAsync(ApplicationData.Current.LocalFolder, "merge1.jpg");

                if (save != null)
                {
                    Clipboard.Source = new Windows.UI.Xaml.Media.Imaging.BitmapImage(new Uri("ms-appdata:///local/merge1.jpg"));
                }

            }
            catch (Exception)
            {
            }
        }
    }
4

1 回答 1

1

最终解决方案非常简单:

StorageFile myMerge = await ApplicationData.Current.LocalFolder.CreateFileAsync("myimg.png");
IOutputStream ac = await myMerge.OpenAsync(FileAccessMode.ReadWrite);
if (ac != null)
    await _inkManager.SaveAsync(ac);
于 2013-02-11T14:03:19.343 回答