PageRenderTime 56ms CodeModel.GetById 21ms RepoModel.GetById 1ms app.codeStats 0ms

/ViewModel/ComponentViewModelFactory.cs

https://github.com/shader/QuickArch
C# | 34 lines | 32 code | 2 blank | 0 comment | 7 complexity | 7d1c390cf5b24ccb13f758cf9f3e20d8 MD5 | raw file
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using QuickArch.Model;
  6. namespace QuickArch.ViewModel
  7. {
  8. public static class ComponentViewModelFactory
  9. {
  10. public static ComponentViewModel GetViewModel(QuickArch.Model.Component component)
  11. {
  12. if (component is QuickArch.Model.System)
  13. {
  14. return new SystemViewModel(component as QuickArch.Model.System);
  15. }
  16. else if (component is Sequence)
  17. {
  18. return new SequenceViewModel(component as Sequence);
  19. }
  20. else if (component is Document)
  21. {
  22. return new DocumentViewModel(component as Document);
  23. }
  24. else if (component is SystemDiagram)
  25. {
  26. return new SystemDiagramViewModel(component as QuickArch.Model.SystemDiagram);
  27. }
  28. else
  29. return null;
  30. }
  31. }
  32. }