JSON import added
This commit is contained in:
@@ -45,15 +45,29 @@ public partial class MainWindowViewModel : ViewModelBase
|
||||
}
|
||||
|
||||
[RelayCommand]
|
||||
private void ImportPoint(Window w)
|
||||
private async Task ImportPoint(Window w)
|
||||
{
|
||||
|
||||
var files = await w.StorageProvider.OpenFilePickerAsync(new FilePickerOpenOptions
|
||||
{
|
||||
AllowMultiple = true,
|
||||
SuggestedStartLocation =
|
||||
await w.StorageProvider.TryGetFolderFromPathAsync(
|
||||
Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments))
|
||||
});
|
||||
foreach (var file in files)
|
||||
{
|
||||
var url = file.Path.AbsolutePath;
|
||||
var decoded = HttpUtility.HtmlDecode(url);
|
||||
var point = DataSerialization.LoadPoint(decoded);
|
||||
point?.SetPropertyParents();
|
||||
Points.Add(new PointViewModel(point ?? new Point()));
|
||||
}
|
||||
}
|
||||
|
||||
[RelayCommand]
|
||||
private async Task ExportPoint(Window w)
|
||||
{
|
||||
var folder = await w.StorageProvider.OpenFolderPickerAsync(new FolderPickerOpenOptions()
|
||||
var folder = await w.StorageProvider.OpenFolderPickerAsync(new FolderPickerOpenOptions
|
||||
{
|
||||
AllowMultiple = false,
|
||||
SuggestedStartLocation =
|
||||
@@ -64,9 +78,10 @@ public partial class MainWindowViewModel : ViewModelBase
|
||||
{
|
||||
DataSerialization.SavePoint(point.GetPoint(), Path.Combine(HttpUtility.HtmlDecode(folder[0].Path.AbsolutePath), point.Name + ".json") );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Visual properties
|
||||
// Visual and other properties
|
||||
|
||||
[ObservableProperty]
|
||||
private bool _isLineVisible;
|
||||
|
||||
Reference in New Issue
Block a user