コード例 #1
0
        public static void Run([QueueTrigger("station-imports", Connection = "StationStorage")] string stationImportItem,
                               TraceWriter log)
        {
            WebAppSettings settings = new WebAppSettings
            {
                CosmosEndpoint    = ConfigurationManager.AppSettings[""],
                CosmosAuthKey     = ConfigurationManager.AppSettings[""],
                DatabaseId        = "",
                EventCollectionId = "",
                ViewCollectionId  = ""
            };

            WebAppService app = new WebAppService(settings);

            StationImportModel stationImportModel = JsonConvert.DeserializeObject <StationImportModel>(stationImportItem);

            log.Info($"Importing station: {stationImportModel.StationName}");

            // todo create import command
            var importStation = new ImportStation(stationImportModel.StationName, stationImportModel.ThreeAlphaCode);

            app.Bus.Send(importStation);

            log.Info($"Imported station: {stationImportModel.StationName}");
        }
コード例 #2
0
        public void Init(string testName)
        {
            TestName = testName;
            QueryServiceMock               queryService                  = new QueryServiceMock();
            WoxContextServiceMock          woxContextService             = new WoxContextServiceMock(queryService);
            SystemWebAppServiceMock        systemService                 = new SystemWebAppServiceMock();
            IDataAccessService             dataAccessService             = new DataAccessService(systemService);
            IWebAppItemRepository          webAppItemRepository          = new WebAppItemRepository(dataAccessService);
            IWebAppConfigurationRepository webAppConfigurationRepository = new WebAppConfigurationRepository(dataAccessService);
            FileGeneratorServiceMock       fileGeneratorService          = new FileGeneratorServiceMock();
            FileReaderServiceMock          fileReaderService             = new FileReaderServiceMock();
            IHelperService helperService = new HelperService();
            ApplicationInformationServiceMock applicationInformationService = new ApplicationInformationServiceMock();
            IWebAppService   webAppService         = new WebAppService(dataAccessService, webAppItemRepository, webAppConfigurationRepository, systemService, fileGeneratorService, fileReaderService, helperService);
            IWoxResultFinder woxWebAppResultFinder = new WebAppResultFinder(woxContextService, webAppService, helperService, applicationInformationService, systemService);

            systemService.ApplicationDataPath = GetApplicationDataPath();

            WoxContextService             = woxContextService;
            QueryService                  = queryService;
            SystemService                 = systemService;
            WebAppService                 = webAppService;
            FileGeneratorService          = fileGeneratorService;
            FileReaderService             = fileReaderService;
            WoxWebAppResultFinder         = woxWebAppResultFinder;
            HelperService                 = helperService;
            ApplicationInformationService = applicationInformationService;

            WoxContextService.AddQueryFetcher("wap", WoxWebAppResultFinder);
        }
コード例 #3
0
ファイル: HomeController.cs プロジェクト: junjifeng/H5
 /// <summary>
 /// 预览页面
 /// </summary>
 /// <param name="id"></param>
 /// <returns></returns>
 public ActionResult Preview(int id)
 {
     if (id <= 0)
     {
         return(Content("id错误"));
     }
     Models.WebApp app = WebAppService.GetAppById(id);
     return(View(app));
 }
コード例 #4
0
ファイル: HomeAjaxController.cs プロジェクト: junjifeng/H5
 /// <summary>
 /// 保存APP
 /// </summary>
 /// <param name="webAppHTML"></param>
 /// <param name="designHTML"></param>
 /// <param name="id"></param>
 /// <param name="name"></param>
 /// <param name="state"></param>
 /// <returns></returns>
 public ActionResult SaveApp(string webAppHTML,
                             string designHTML, int id, string name, int state)
 {
     if (string.IsNullOrEmpty(name))
     {
         return(Json(new BaseResp <string>()
         {
             success = false,
             message = "名称不能为空"
         }));
     }
     try
     {
         if (id > 0)
         {
             WebAppService.UpdateApp(new Models.WebApp()
             {
                 AppId       = id,
                 DesignHTML  = designHTML,
                 Name        = name,
                 PreviewHTML = webAppHTML,
                 State       = state
             });
         }
         else
         {
             id = WebAppService.AddApp(new Models.WebApp()
             {
                 DesignHTML  = designHTML,
                 IsDelete    = false,
                 Name        = name,
                 PreviewHTML = webAppHTML,
                 State       = state,
                 CreateTime  = DateTime.Now,
                 Creator     = ""
             });
         }
         return(Json(new BaseResp <int>()
         {
             success = true,
             data = id
         }));
     }
     catch (Exception ex)
     {
         return(Json(new BaseResp <string>()
         {
             success = false,
             message = ex.Message
         }));
     }
 }
コード例 #5
0
ファイル: WebAppPlugin.cs プロジェクト: gissehel/Wox-WebApp
        public override IWoxResultFinder PrepareContext()
        {
            IQueryService                  queryService                  = new QueryService();
            IResultService                 resultService                 = new ResultService(WoxContextService);
            ISystemWebAppService           systemWebAppService           = new SystemWebAppService("Wox.WebApp");
            IDataAccessService             dataAccessService             = new DataAccessService(systemWebAppService);
            IWebAppItemRepository          webAppItemRepository          = new WebAppItemRepository(dataAccessService);
            IWebAppConfigurationRepository webAppConfigurationRepository = new WebAppConfigurationRepository(dataAccessService);
            IFileGeneratorService          fileGeneratorService          = new FileGeneratorService();
            IFileReaderService             fileReaderService             = new FileReaderService();
            IHelperService                 helperService                 = new HelperService();
            IWebAppService                 webAppService                 = new WebAppService(dataAccessService, webAppItemRepository, webAppConfigurationRepository, systemWebAppService, fileGeneratorService, fileReaderService, helperService);
            IApplicationInformationService applicationInformationService = new ApplicationInformationService(systemWebAppService);
            IWoxResultFinder               woxWebAppResultFinder         = new WebAppResultFinder(WoxContextService, webAppService, helperService, applicationInformationService, systemWebAppService);

            return(woxWebAppResultFinder);
        }
コード例 #6
0
ファイル: HomeAjaxController.cs プロジェクト: junjifeng/H5
 /// <summary>
 /// 根据id删除app
 /// </summary>
 /// <param name="id"></param>
 /// <returns></returns>
 public ActionResult DeleteAppById(int id)
 {
     try
     {
         WebAppService.DeleteAppById(id);
         return(Json(new BaseResp <string>()
         {
             success = true
         }));
     }
     catch (Exception ex)
     {
         return(Json(new BaseResp <string>()
         {
             success = false,
             message = ex.Message
         }));
     }
 }
コード例 #7
0
ファイル: HomeAjaxController.cs プロジェクト: junjifeng/H5
        /// <summary>
        /// 根据id获取App
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public ActionResult GetAppById(int id)
        {
            var app = WebAppService.GetAppById(id);

            return(Json(app));
        }
コード例 #8
0
ファイル: HomeAjaxController.cs プロジェクト: junjifeng/H5
        /// <summary>
        /// 获取APP列表
        /// </summary>
        /// <returns></returns>
        public ActionResult GetAppList()
        {
            var list = WebAppService.GetAppList();

            return(Json(list));
        }