private void OnLoadExistingDevice() { OpenFileDialog ofd = new OpenFileDialog(); ofd.Multiselect = false; ofd.Filter = " JSON файл (*.json)|*.json" + "|Все файлы (*.*)|*.* "; ofd.CheckFileExists = true; ofd.InitialDirectory = _currentFolder; if (ofd.ShowDialog() == true) { ResultingDeviceViewModel.LoadDevice(ofd.FileName); _currentFolder = Path.GetDirectoryName(ofd.FileName); } DeviceEditorValidationViewModel .RefreshErrors.Execute(null); }
private void OnSaveInFileExecute() { if (!ValidateDevice()) { return; } SaveFileDialog sfd = new SaveFileDialog(); sfd.Filter = " JSON файл (*.json)|*.json" + "|Все файлы (*.*)|*.* "; sfd.DefaultExt = ".json"; sfd.FileName = ResultingDeviceViewModel.DeviceName; sfd.InitialDirectory = _currentFolder; if (sfd.ShowDialog() == true) { ResultingDeviceViewModel.SaveDevice(sfd.FileName, false); _currentFolder = Path.GetDirectoryName(sfd.FileName); } }