App.cs 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. using Edge.Core.Processor;
  2. using Edge.Core.Processor.Dispatcher.Attributes;
  3. using Edge.Core.UniversalApi;
  4. using System;
  5. using System.Collections.Generic;
  6. using System.Threading.Tasks;
  7. namespace WebConsoleConfigApp
  8. {
  9. [MetaPartsDescriptor(
  10. "lang-zh-cn:控制台应用配置lang-zh-tw:控製臺應用配置lang-en-us:WebConsole Config",
  11. "lang-zh-cn:控制台应用配置, 用于支持此应用的配置,配置将被获取用于定制化的界面和功能" +
  12. "lang-zh-tw:控製臺應用配置, 用於支持此應用的配置,配置將被獲取用於定製化的界面和功能" +
  13. "lang-en-us:控制台应用配置, 用于支持此应用的配置,配置将被获取用于定制化的界面和功能",
  14. new[] { "lang-zh-cn:控制台lang-zh-tw:控製臺lang-en-us:WebConsole" })]
  15. public class App : IAppProcessor
  16. {
  17. private AppConfigV1 appConfig;
  18. public string MetaConfigName { get; set; }
  19. #region AppConfig
  20. public class NaviMenuItemConfigV1
  21. {
  22. public string IconUrl { get; set; }
  23. public string LinkUrl { get; set; }
  24. public string Action { get; set; }
  25. }
  26. public enum NaviMenuSizeEnum
  27. {
  28. Medium,
  29. Small,
  30. Large,
  31. }
  32. public enum NaviMenuPositionEnum
  33. {
  34. Bottom,
  35. Top,
  36. Left,
  37. Right,
  38. }
  39. public class NaviMenuConfigV1
  40. {
  41. public NaviMenuSizeEnum MenuSize { get; set; }
  42. public NaviMenuPositionEnum MenuPosition { get; set; }
  43. public string LogoUrl { get; set; }
  44. public NaviMenuItemConfigV1[] MenuItemConfigs { get; set; }
  45. }
  46. public class LayoutConfigV1
  47. {
  48. public string Theme { get; set; }
  49. public string IndexPageUrl { get; set; }
  50. public NaviMenuConfigV1 NaviMenuConfig { get; set; }
  51. }
  52. public class AppConfigV1
  53. {
  54. public LayoutConfigV1 LayoutConfig { get; set; }
  55. }
  56. #endregion
  57. public App(AppConfigV1 appConfig, IServiceProvider services)
  58. {
  59. this.appConfig = appConfig;
  60. }
  61. public void Init(IEnumerable<IProcessor> processors)
  62. {
  63. }
  64. [UniversalApi(Description = "Get the App Config")]
  65. public Task<AppConfigV1> GetAppConfigAsync()
  66. {
  67. return Task.FromResult(this.appConfig);
  68. }
  69. }
  70. }