ServiceCollectionHelpers.cs 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. using Microsoft.Extensions.DependencyInjection;
  2. using PixiEditor.Models.Controllers;
  3. using PixiEditor.Models.Controllers.Shortcuts;
  4. using PixiEditor.Models.DataProviders;
  5. using PixiEditor.Models.IO;
  6. using PixiEditor.Models.IO.ClsFile;
  7. using PixiEditor.Models.IO.JascPalFile;
  8. using PixiEditor.Models.Services;
  9. using PixiEditor.Models.Tools;
  10. using PixiEditor.Models.Tools.Tools;
  11. using PixiEditor.Models.UserPreferences;
  12. using PixiEditor.ViewModels;
  13. using PixiEditor.ViewModels.SubViewModels.Main;
  14. namespace PixiEditor.Helpers.Extensions
  15. {
  16. public static class ServiceCollectionHelpers
  17. {
  18. /// <summary>
  19. /// Add's all the services required to fully run PixiEditor's MainWindow
  20. /// </summary>
  21. public static IServiceCollection AddPixiEditor(this IServiceCollection collection) => collection
  22. .AddSingleton<ViewModelMain>()
  23. .AddSingleton<IPreferences, PreferencesSettings>()
  24. // View Models
  25. .AddSingleton<StylusViewModel>()
  26. .AddSingleton<WindowViewModel>()
  27. .AddSingleton<ToolsViewModel>()
  28. .AddSingleton<FileViewModel>()
  29. .AddSingleton<UpdateViewModel>()
  30. .AddSingleton<IoViewModel>()
  31. .AddSingleton<LayersViewModel>()
  32. .AddSingleton<ClipboardViewModel>()
  33. .AddSingleton<UndoViewModel>()
  34. .AddSingleton<SelectionViewModel>()
  35. .AddSingleton<ViewportViewModel>()
  36. .AddSingleton<ColorsViewModel>()
  37. .AddSingleton<DocumentViewModel>()
  38. .AddSingleton<MiscViewModel>()
  39. .AddSingleton<RegistryViewModel>()
  40. .AddSingleton(x => new DiscordViewModel(x.GetService<ViewModelMain>(), "764168193685979138"))
  41. .AddSingleton<DebugViewModel>()
  42. // Controllers
  43. .AddSingleton<ShortcutController>()
  44. .AddSingleton<BitmapManager>()
  45. // Tools
  46. .AddSingleton<Tool, MoveViewportTool>()
  47. .AddSingleton<Tool, MoveTool>()
  48. .AddSingleton<Tool, PenTool>()
  49. .AddSingleton<Tool, SelectTool>()
  50. .AddSingleton<Tool, MagicWandTool>()
  51. .AddSingleton<Tool, FloodFillTool>()
  52. .AddSingleton<Tool, LineTool>()
  53. .AddSingleton<Tool, CircleTool>()
  54. .AddSingleton<Tool, RectangleTool>()
  55. .AddSingleton<Tool, EraserTool>()
  56. .AddSingleton<Tool, ColorPickerTool>()
  57. .AddSingleton<Tool, BrightnessTool>()
  58. .AddSingleton<Tool, ZoomTool>()
  59. // Palette Parsers
  60. .AddSingleton<PaletteFileParser, JascFileParser>()
  61. .AddSingleton<PaletteFileParser, ClsFileParser>()
  62. // Palette data sources
  63. .AddSingleton<PaletteListDataSource, LocalPalettesFetcher>()
  64. // Other
  65. .AddSingleton<DocumentProvider>();
  66. }
  67. }