public ExportViewModel(XmlViewModel xmlViewModel) { m_xmlViewModel = xmlViewModel; FolderViewModel = new FolderViewModel(m_xmlViewModel); RemoveExportCommand = new DelegateCommand(RemoveExportExecute); IsVisible = true; }
public FolderViewModel(XmlViewModel xmlViewModel) { m_xmlViewModel = xmlViewModel; AddFolderCommand = new DelegateCommand(AddFolderExecute); Folders = new ObservableCollection<Folder> { new Folder { FromRestriction = m_xmlViewModel.BaseFolderViewModel.FromBasePath } }; }
public DisciplineViewModel(XmlViewModel xmlViewModel) { m_xmlViewModel = xmlViewModel; AddExportCommand = new DelegateCommand(AddFolderExecute); StartFileViewModel = new StartFileViewModel(xmlViewModel); ExportViewModels = new ObservableCollection<ExportViewModel> {new ExportViewModel(m_xmlViewModel)}; RemoveDisciplineCommand = new DelegateCommand(RemoveDisciplineExecute); IsVisible = true; }
public static void SetFromBaseFolders(XmlViewModel m_xmlViewModel, string FromBasePath) { m_xmlViewModel.IFCViewModel.IFC.FromRestriction = FromBasePath; foreach (var file in m_xmlViewModel.FileViewModel.Files) { file.FromRestriction = FromBasePath; } foreach (var dicsipline in m_xmlViewModel.DisciplineViewModels) { dicsipline.StartFileViewModel.StartFile.FromRestriction = FromBasePath; foreach (var export in dicsipline.ExportViewModels) { foreach (var folder in export.FolderViewModel.Folders) { folder.FromRestriction = FromBasePath; } } } }
public XmlViewModel ToFieldGenerator(XmlViewModel _xmlViewModel) { baseToFolder = _xmlViewModel.BaseFolderViewModel.ToBasePath; baseFromFolder = _xmlViewModel.BaseFolderViewModel.FromBasePath; foreach (var Discipline in _xmlViewModel.DisciplineViewModels) { foreach (var Export in Discipline.ExportViewModels) { foreach (var Folder in Export.FolderViewModel.Folders) { if (string.IsNullOrEmpty(Folder.From)) { Folder.From = string.Empty; } Folder.To = ConvertFromTo(Folder.From); } var FoldersToRemove = Export.FolderViewModel.Folders.Where(x => x.IsVisible == false).ToList(); foreach (var folder in FoldersToRemove) { Export.FolderViewModel.Folders.Remove(folder); } if (string.IsNullOrEmpty(Export.IFC)) { Export.IFC = string.Empty; } if (string.IsNullOrEmpty(Export.Value)) { Export.Value = string.Empty; } } if (string.IsNullOrEmpty(Discipline.Value)) { Discipline.Value = string.Empty; } if (string.IsNullOrEmpty(Discipline.StartFileViewModel.StartFile.FromPath)) { Discipline.StartFileViewModel.StartFile.FromPath = string.Empty; } Discipline.StartFileViewModel.StartFile.ToPath = ConvertFromTo(Discipline.StartFileViewModel.StartFile.FromPath); var ExportsToRemove = Discipline.ExportViewModels.Where(x => x.IsVisible == false).ToList(); foreach (var export in ExportsToRemove) { Discipline.ExportViewModels.Remove(export); } } if (string.IsNullOrEmpty(_xmlViewModel.IFCViewModel.IFC.Export)) { _xmlViewModel.IFCViewModel.IFC.Export = string.Empty; } if (string.IsNullOrEmpty(_xmlViewModel.IFCViewModel.IFC.From)) { _xmlViewModel.IFCViewModel.IFC.From = string.Empty; } foreach (var File in _xmlViewModel.FileViewModel.Files) { if (string.IsNullOrEmpty(File.From)) { File.From = string.Empty; } File.To = ConvertFromTo(File.From); } var FilesToRemove = _xmlViewModel.FileViewModel.Files.Where(x => x.IsVisible == false).ToList(); foreach (var export in FilesToRemove) { _xmlViewModel.FileViewModel.Files.Remove(export); } var DisciplineToRemove = _xmlViewModel.DisciplineViewModels.Where(x => x.IsVisible == false).ToList(); foreach (var export in DisciplineToRemove) { _xmlViewModel.DisciplineViewModels.Remove(export); } _xmlViewModel.IFCViewModel.IFC.To = ConvertFromTo(_xmlViewModel.IFCViewModel.IFC.From); return _xmlViewModel; }
public StartFileViewModel(XmlViewModel xmlViewModel) { m_xmlViewModel = xmlViewModel; StartFile = new StartFile { FromRestriction = m_xmlViewModel.BaseFolderViewModel.FromBasePath}; FileDialogCommand = new DelegateCommand(FileDialogExecute); }
public XMLObject(XmlViewModel xmlViewModel) { m_xmlViewModel = xmlViewModel; m_ifcViewModel = xmlViewModel.IFCViewModel; m_disciplineViewModels = xmlViewModel.DisciplineViewModels; }
public IFCViewModel(XmlViewModel xmlViewModel) { m_xmlViewModel = xmlViewModel; IFC = new IFC() {FromRestriction = xmlViewModel.BaseFolderViewModel.FromBasePath }; }
private bool CanGenerate(XmlViewModel xmlViewModel) { return !(string.IsNullOrEmpty(xmlViewModel.BaseFolderViewModel.ToBasePath) || string.IsNullOrEmpty(xmlViewModel.BaseFolderViewModel.FromBasePath)); }
private ObservableCollection<ViewModelBase> InitialSetupXmlViewModel() { var xmlVM = new XmlViewModel(); xmlVM.ProjectName = "Project1"; ObservableCollection<ViewModelBase> xmlVms = new ObservableCollection<ViewModelBase>(); xmlVms.Add(xmlVM); return xmlVms; }
private bool IsSelectedProjectEmpty(XmlViewModel p) { var EmptyBool = true; if (p.IFCViewModel.IFC.Export != string.Empty && p.IFCViewModel.IFC.Export != null) { EmptyBool = false; } if (p.IFCViewModel.IFC.From != string.Empty && p.IFCViewModel.IFC.From != null) { EmptyBool = false; } if (p.IFCViewModel.IFC.To != string.Empty && p.IFCViewModel.IFC.To != null) { EmptyBool = false; } if (p.BaseFolderViewModel.FromBasePath != string.Empty && p.BaseFolderViewModel.FromBasePath != null) { EmptyBool = false; } if (p.BaseFolderViewModel.ToBasePath != string.Empty && p.BaseFolderViewModel.ToBasePath != null) { EmptyBool = false; } foreach (var file in p.FileViewModel.Files) { if (file.To != string.Empty && file.To != null) { EmptyBool = false; } if (file.From != string.Empty && file.From != null) { EmptyBool = false; } } foreach (var Discipline in p.DisciplineViewModels) { if (Discipline.Value != string.Empty && Discipline.Value != null) { EmptyBool = false; } if (Discipline.StartFileViewModel.StartFile.FromPath != string.Empty && Discipline.StartFileViewModel.StartFile.FromPath != null) { EmptyBool = false; } foreach (var Export in Discipline.ExportViewModels) { if (Export.Value != string.Empty && Export.Value != null) { EmptyBool = false; } if (Export.IFC != string.Empty && Export.IFC != null) { EmptyBool = false; } foreach (var Folder in Export.FolderViewModel.Folders) { if (Folder.From != string.Empty && Folder.From != null) { EmptyBool = false; } if (Folder.To != string.Empty && Folder.To != null) { EmptyBool = false; } } } } return EmptyBool; }
private void AddNewProject() { var newProject = new XmlViewModel { ProjectName = "New Project" }; CurrentViewModel.Add(newProject); SelectedTabIndex = CurrentViewModel.Count - 1; }
public BaseFolderViewModel(XmlViewModel xmlViewModel) { m_xmlViewModel = xmlViewModel; FileDialogToCommand = new DelegateCommand(FileDialogToExecute); FileDialogFromCommand = new DelegateCommand(FileDialogFromEcecute); }
public XmlViewModel MapXMLToXmlViewModel(string path, XmlViewModel xmlViewModel) { var XMLvm = new XmlViewModel(); XElement xdoc = XElement.Load(path); XMLvm.ProjectName = xdoc.Attribute("Name").Value; var basef = xdoc.Element("BaseFolder"); var BaseVm = new BaseFolderViewModel(XMLvm) { FromBasePath = basef.Attribute("From").Value, ToBasePath = basef.Attribute("To").Value }; XMLvm.BaseFolderViewModel = BaseVm; var Dicsiplines = xdoc.Elements("Discipline"); var disciplinecol = new ObservableCollection<DisciplineViewModel>(); foreach (var dis in Dicsiplines) { var disciplineVM = new DisciplineViewModel(XMLvm); disciplineVM.Value = dis.Attribute("Value").Value; var exportVMCOL = new ObservableCollection<ExportViewModel>(); var startfile = new StartFile {FromPath = dis.Element("StartFile").Attribute("From").Value, ToPath = dis.Element("StartFile").Attribute("To").Value }; disciplineVM.StartFileViewModel = new StartFileViewModel(XMLvm) {StartFile = startfile}; var exps = dis.Elements("Export"); foreach (var exp in exps) { var expVM = new ExportViewModel(XMLvm); var fVM = new FolderViewModel(XMLvm); var foldersCol = new ObservableCollection<Folder>(); var folders = exp.Elements("Folder"); foreach (var folder in folders) { var From = folder.Attribute("From").Value; var To = folder.Attribute("To").Value; var f= new Folder {From = From,To=To}; foldersCol.Add(f); fVM.Folders = foldersCol; } fVM.Folders = foldersCol; expVM.FolderViewModel = fVM; expVM.Value = exp.Attribute("Value").Value; expVM.IFC = exp.Attribute("IFC").Value; exportVMCOL.Add(expVM); } disciplineVM.ExportViewModels = exportVMCOL; disciplinecol.Add(disciplineVM); } var fileVM = new FileViewModel(XMLvm); var files = xdoc.Element("Files").Elements("File"); var filecol = new ObservableCollection<File>(); foreach (var file in files) { var f = new File(fileVM) {From = file.Attribute("From").Value,To=file.Attribute("To").Value}; filecol.Add(f); } fileVM.Files = filecol; XMLvm.FileViewModel = fileVM; XMLvm.DisciplineViewModels = disciplinecol; var ifc = xdoc.Element("IFC"); var ifcvm = new IFCViewModel(XMLvm) { IFC = new IFC { Export = ifc.Attribute("Export").Value, To = ifc.Attribute("To").Value, From = ifc.Attribute("From").Value } }; XMLvm.IFCViewModel = ifcvm; XMLvm.SavePath = path; return XMLvm; }