/// <summary> /// Open file using open dialog. /// </summary> public void OpeFile() { OpenFileDialog dialog = new OpenFileDialog(); dialog.Filter = "Binary file (.bin)|*.bin"; bool?result = dialog.ShowDialog(); if (result == true) { string filename = dialog.FileName; try { _folder = _serializeClient.DeserializeFolderModel(filename); var treeItem = Mapper.Map <TreeViewItemModel>(_folder); Filename = filename; TreeViewItemModels.Clear(); TreeViewItemModels.Add(treeItem); } catch (Exception ex) { _logger.Error(ex); } } }
private void GetItemList() { try { TreeItems.Clear(); var dir = new DirectoryInfo(SelectedLogicalDrive); var folders = dir .GetDirectories() .Select(x => x.ConvertToTreeItemModel()) .ToList(); foreach (var folder in folders) { folder.LoadChildItems(folder); TreeItems.Add(folder); } } catch (Exception ex) { _logger.Error(ex.Message); } }