public static void Initialize(ILayoutService layoutService, ISecurityService securityService) { ServiceFactoryBase.SecurityService = SecurityService = securityService; Layout = layoutService; ContentService = new ContentService("Monitor"); DragDropService = new DragDropService(); }
public async void Configure(Area show) { this.nameLabel.Text = show.DisplayName; this.dateLabel.Text = show.MostRecentEntry.ToString("dd-MM"); imageView.Image = null; var byteImage = await ContentService.DownloadImageArrayAsync(show.WidescreenThumbnailImage ?? show.ThumbnailImage); imageView.Image = UIImage.LoadFromData(NSData.FromArray(byteImage)); }
private void SetUpGameButtons() { var miniGames = ContentService.GetMiniGames(); for (int i = 0; i < miniGames.Count && i < gameButtons.Length; i++) { gameButtons[i].SetUp(miniGames[i]); } }
/// <summary> /// Initializes a new instance of the <see cref="CharacterServiceTestBase"/> class. /// </summary> protected CharacterServiceTestBase() { this.Commands = new CommandService(); var content = new ContentService(); this.Transformations = new TransformationService(content); this.Characters = new CharacterService(this.Commands, new OwnedEntityService(), content, this.Transformations); }
public async Task <ActionResult> Properties(string tabId, int parentId, int id, string successfulActionCode, bool?groupChanged = null) { var content = ContentService.Read(id); var model = ContentViewModel.Create(content, tabId, parentId); model.GroupChanged = groupChanged ?? false; model.SuccesfulActionCode = successfulActionCode; return(await JsonHtml("Properties", model)); }
public static void Initialize(ILayoutService ILayoutService, ISecurityService ISecurityService) { ServiceFactoryBase.Events = Events = new EventAggregator(); ServiceFactoryBase.SecurityService = SecurityService = ISecurityService; ResourceService = new ResourceService(); Layout = ILayoutService; LoginService = new LoginService(ClientType.Monitor, "Оперативная задача. Авторизация."); ContentService = new ContentService("Monitor"); }
public static void Do() { //内容(Content)发布(Publish)的时候检查其作者(Author)是否为空,如果为空抛出“参数为空”异常 User user = new User("哈哈", "asd*6j"); Content content = new Suggest(user); content.Author = null; ContentService.Publish(content); }
/// <summary> /// Get tasks app. /// </summary> /// <param name="app">The app to display.</param> /// <param name="query">An object with query parameters for search, paging etc.</param> public override ActionResult Get(Tasks app, Query query) { // get all tasks in app app.Result = ContentService.Search(new ContentQuery <TaskItem>(query) { AppId = app.Id, Depth = 1, OrderBy = "SortOrder, CreatedAt DESC", Count = true }); return(View(app)); }
public static void Initialize(ILayoutService layoutService, IValidationService validationService) { SaveService = new SaveService(); Layout = layoutService; ValidationService = validationService; ContentService = new ContentService("Administrator"); DragDropService = new DragDropService(); RibbonService = new RibbonService(); }
public ActionResult About() { var contentService = new ContentService(); var resultContent = contentService.DoCurlAsync().Result; ViewBag.Message = resultContent; return(View()); }
public int GetTreeFieldId() { if (ContentService.Read(ContentId).TreeField != null) { return(ContentService.Read(ContentId).TreeField.Id); } return(0); }
/// <summary> /// Initializes a new instance of the <see cref="DossierService"/> class. /// </summary> /// <param name="content">The content service.</param> /// <param name="database">The dossier database context.</param> public DossierService ( ContentService content, DossiersDatabaseContext database ) { _content = content; _database = database; }
public void Then_False_Is_Returned_If_No_Content( ContentService service) { //Act var actual = service.HasContent(new ApiResponse <CmsContent>(null, HttpStatusCode.OK, "")); //Assert actual.Should().BeFalse(); }
public ActionResult _Files( string tabId, int parentId, int gridParentId, int page, int pageSize, string orderBy, [ModelBinder(typeof(JsonStringModelBinder <LibraryFileFilter>))] LibraryFileFilter searchQuery) { var listCommand = GetListCommand(page, pageSize, orderBy); var serviceResult = ContentService.GetFileList(listCommand, gridParentId, searchQuery); return(new TelerikResult(serviceResult.Data, serviceResult.TotalRecords)); }
/// <summary> /// Initializes a new instance of the <see cref="SassService"/> class. /// </summary> /// <param name="content">The content service.</param> public SassService(ContentService content) { _content = content; _sass = new List <string>(); _sassNSFW = new List <string>(); _isSassLoaded = false; }
public ActionResult AddContentInfo(Syscontent model) { var resultMode = new ResponseBaseModel <Syscontent> { ResultCode = ResponceCodeEnum.Fail }; if (string.IsNullOrEmpty(model.Content)) { return(Json(resultMode, JsonRequestBehavior.AllowGet)); } if (string.IsNullOrEmpty(model.Introduction)) { var introduction = FilterHtmlHelper.NoHtml(model.Content); model.Introduction = introduction != null && introduction.Length > 200 ? introduction.Substring(0, 200) : introduction; } var server = new ContentService(); long id; if (model.Id > 0) { var oldModel = server.GetContentModel(model.Id); if (oldModel == null) { resultMode.Message = "不存在该内容记录"; return(Json(resultMode, JsonRequestBehavior.AllowGet)); } oldModel.Content = model.Content; oldModel.ContentSource = model.ContentSource; oldModel.ContentType = model.ContentType; oldModel.ContentFlag = model.ContentFlag; oldModel.Introduction = model.Introduction; oldModel.Title = model.Title; oldModel.ContentDisImage = model.ContentDisImage; oldModel.AttachmentFile = model.AttachmentFile; oldModel.AttachmentFileName = model.AttachmentFileName; oldModel.AttachmentFileSize = model.AttachmentFileSize; id = server.AddAndUpdateContentInfo(oldModel); } else { model.CreateTime = DateTime.Now; model.CreateUserId = CurrentModel.UserId; model.IsDel = FlagEnum.HadZore.GetHashCode(); id = server.AddAndUpdateContentInfo(model); } if (id > 0) { resultMode.ResultCode = ResponceCodeEnum.Success; resultMode.Message = "处理成功"; return(Json(resultMode, JsonRequestBehavior.AllowGet)); } resultMode.Message = "处理失败"; return(Json(resultMode, JsonRequestBehavior.AllowGet)); }
public virtual async Task <ActionResult> Index(int page = 1, String search = "", int?categoryId = null) { try { if (!IsModulActive(Type)) { Logger.Trace("Navigation Modul is not active:" + Type); return(HttpNotFound("Not Found")); } var newsPageDesignTask = PageDesignService.GetPageDesignByName(StoreId, PageDesingIndexPageName); var pageSize = GetSettingValueInt(Type + "IndexPageSize", StoreConstants.DefaultPageSize); var contentsTask = ContentService.GetContentsCategoryIdAsync(StoreId, categoryId, Type, true, page, pageSize, search); var categoriesTask = CategoryService.GetCategoriesByStoreIdAsync(StoreId, Type, true); var settings = GetStoreSettings(); ContentService2.ImageWidth = GetSettingValueInt(Type + "Index_ImageWidth", 50); ContentService2.ImageHeight = GetSettingValueInt(Type + "Index_ImageHeight", 50); await Task.WhenAll(newsPageDesignTask, contentsTask, categoriesTask); var contents = contentsTask.Result; var pageDesign = newsPageDesignTask.Result; var categories = categoriesTask.Result; if (pageDesign == null) { Logger.Error("PageDesing is null:" + PageDesingIndexPageName); throw new Exception("PageDesing is null:" + PageDesingIndexPageName); } var pageOutput = ContentService2.GetContentsIndexPage(contents, pageDesign, categories, Type); var pagingPageDesignTask = PageDesignService.GetPageDesignByName(StoreId, "Paging"); PagingService2.PageOutput = pageOutput; PagingService2.HttpRequestBase = this.Request; PagingService2.RouteData = this.RouteData; PagingService2.ActionName = this.ControllerContext.RouteData.Values["action"].ToString(); PagingService2.ControllerName = this.ControllerContext.RouteData.Values["controller"].ToString(); await Task.WhenAll(pagingPageDesignTask); var pagingDic = PagingService2.GetPaging(pagingPageDesignTask.Result); pagingDic.StoreSettings = settings; pageOutput.MyStore = this.MyStore; pageOutput.PageTitle = this.PageTitle; return(View(pagingDic)); } catch (Exception ex) { Logger.Error(ex, Type + "Controller:Index:" + ex.StackTrace, page); return(new HttpStatusCodeResult(500)); } }
protected override void OnThreadUnSafeEventFired(object source, CharacterSessionDataChangedEventArgs args) { if (Logger.IsInfoEnabled) { Logger.Info($"Starting process to download world."); } UnityAsyncHelper.UnityMainThreadContext.PostAsync(async() => { long worldId = 0; try { //TODO: Handle failure ProjectVersionStage.AssertAlpha(); //TODO: Handle throwing/error //We need to know the world the zone is it, so we can request a download URL for it. var worldConfig = await ZoneDataService.GetZoneWorldConfigurationAsync(args.ZoneIdentifier) .ConfigureAwaitFalse(); if (!worldConfig.isSuccessful) { throw new InvalidOperationException($"Failed to query World Configuration for ZoneId: {args.ZoneIdentifier}"); } worldId = worldConfig.Result.WorldId; //With the worldid we can get the download URL. ContentDownloadURLResponse urlDownloadResponse = await ContentService.RequestWorldDownloadUrl(worldId) .ConfigureAwaitFalse(); if (Logger.IsInfoEnabled) { Logger.Info($"World Download Url: {urlDownloadResponse.DownloadURL}"); } //Can't do web request not on the main thread, sadly. await new UnityYieldAwaitable(); WorldDownloader downloader = new WorldDownloader(Logger); await downloader.DownloadAsync(urlDownloadResponse.DownloadURL, urlDownloadResponse.Version, o => { OnWorldDownloadBegins?.Invoke(this, new WorldDownloadBeginEventArgs(o)); }); } catch (Exception e) { if (Logger.IsErrorEnabled) { Logger.Error($"Failed to query for Download URL for ZoneId: {args.ZoneIdentifier} WorldId: {worldId} (0 if never succeeded request). Error: {e.Message}"); } throw; } }); }
/// <summary> /// Initialize /// </summary> protected override void Initialize( ) { base.Initialize( ); _config = new ConfigurationService(_deviceMNG); _config.LoadConfiguration( ); _config.AssignIngameConfiguration( ); _canvas = new SpriteBatch(GraphicsDevice); _input = new InputService( ); _content = new ContentService(Content, GraphicsDevice, _canvas); // Console LOG.Add("Initializing console commands..."); _console = new GameConsole(_input, _content, _config); _console.Initialize(_content); _console.SetAction("hide", 0, (args) => _console.IsVisible = false); _console.SetAction("exit", 0, (args) => Exit( )); _console.SetAction("debug", 0, (args) => _config.Change("debug_mode", !_config.DebugMode)); _console.SetAction("translate", 1, (args) => LOG.Add(TranslationService.Get(args[0]), LogType.Success)); _console.SetAction("new_game", 0, (args) => { _state.ChangeState(GameStateType.Gameplay); ((GameplayState)_state.GetCurrentState( )).NewGame(args.Length >= 1 ? args[0] : null); MediaPlayer.Stop( ); }); // Content LOG.Add("Loading application's content"); DH.Content = _content; _content.LoadContent( ); _content.UpdateDynamicContent(_config); // States LOG.Add("Initializing states..."); _state = new StateService( ); _state.Register(GameStateType.MainMenu, new MainMenuState(_content, _input, _config, _state, _console)); _state.Register(GameStateType.Gameplay, new GameplayState(_content, _input, _config, _state, _console)); _state.Register(GameStateType.Credits, new CreditsState( )); _state.Register(GameStateType.Settings, new SettingsState(_content, _input, _config, _state)); _state.Register(GameStateType.Tutorial, new TutorialState( )); _state.Register(GameStateType.Pause, new PauseState(_content, _input, _config)); _state.ChangeState(GameStateType.MainMenu); // Audio LOG.Add("Initializing audio..."); MediaPlayer.IsRepeating = true; // Temporary AudioHelper.Music(_content.GetRandomSong( )); // Common LOG.Add("Finalizing initialization..."); RandomService.Random = new Random( ); TranslationService.LoadTranslations <LanguageModel>(_config.Language); LOG.Add($"App ready, version {VERSION}", LogType.Success); }
public void General_RetrieveItemsAndFieldsFromUmbraco_ReturnPopulatedClass() { const string fieldValue = "test field value"; const string name = "Target"; const string contentTypeAlias = "TestType"; const string contentTypeName = "Test Type"; const string contentTypeProperty = "TestProperty"; var context = WindsorContainer.GetContext(); var loader = new UmbracoAttributeConfigurationLoader("Glass.Mapper.Umb.Integration"); context.Load(loader); IContentType contentType = new ContentType(-1); contentType.Name = contentTypeName; contentType.Alias = contentTypeAlias; contentType.Thumbnail = string.Empty; ContentTypeService.Save(contentType); Assert.Greater(contentType.Id, 0); var definitions = DataTypeService.GetDataTypeDefinitionByControlId(new Guid("ec15c1e5-9d90-422a-aa52-4f7622c63bea")); var firstDefinition = definitions.FirstOrDefault(); DataTypeService.Save(firstDefinition); var propertyType = new PropertyType(firstDefinition) { Alias = contentTypeProperty }; contentType.AddPropertyType(propertyType); ContentTypeService.Save(contentType); Assert.Greater(contentType.Id, 0); var content = new Content(name, -1, contentType); content.SetPropertyValue(contentTypeProperty, fieldValue); ContentService.Save(content); var umbracoService = new UmbracoService(ContentService, context); //Act var result = umbracoService.GetItem <AttributeStub>(content.Id); //Assert Assert.IsNotNull(result); Assert.AreEqual(fieldValue, result.TestProperty); Assert.AreEqual(content.Id, result.Id); Assert.AreEqual(content.Key, result.Key); Assert.AreEqual(name, result.Name); Assert.AreEqual(contentTypeName, result.ContentTypeName); Assert.AreEqual(content.ParentId + "," + content.Id, result.Path); Assert.AreEqual(contentTypeAlias, result.ContentTypeAlias); Assert.AreEqual(content.Version, result.Version); }
/// <summary> /// Executes the specified request. /// </summary> /// <param name="request">The request.</param> /// <returns></returns> /// <exception cref="System.NotImplementedException"></exception> public override SaveWidgetResponse Execute(EditHtmlContentWidgetViewModel request) { if (request.Options != null) { OptionService.ValidateOptionKeysUniqueness(request.Options); } UnitOfWork.BeginTransaction(); var widgetContent = GetHtmlContentWidgetFromRequest(request); HtmlContentWidget widget = (HtmlContentWidget)ContentService.SaveContentWithStatusUpdate(widgetContent, request.DesirableStatus); Repository.Save(widget); UnitOfWork.Commit(); // Notify. if (widget.Status != ContentStatus.Preview) { if (request.Id == default(Guid)) { Events.PageEvents.Instance.OnWidgetCreated(widget); } else { Events.PageEvents.Instance.OnWidgetUpdated(widget); } } HtmlContentWidget modifiedWidget = widget; if (request.DesirableStatus == ContentStatus.Draft && widget.History != null) { var draft = widget.History.FirstOrDefault(h => h is HtmlContentWidget && !h.IsDeleted && h.Status == ContentStatus.Draft) as HtmlContentWidget; if (draft != null) { modifiedWidget = draft; } } return(new SaveWidgetResponse { Id = modifiedWidget.Id, OriginalId = widget.Id, WidgetName = modifiedWidget.Name, CategoryName = modifiedWidget.Category != null ? modifiedWidget.Category.Name : null, Version = modifiedWidget.Version, OriginalVersion = widget.Version, WidgetType = WidgetType.HtmlContent.ToString(), IsPublished = widget.Status == ContentStatus.Published, HasDraft = widget.Status == ContentStatus.Draft || widget.History != null && widget.History.Any(f => f.Status == ContentStatus.Draft), DesirableStatus = request.DesirableStatus, PreviewOnPageContentId = request.PreviewOnPageContentId }); }
public async Task InvalidURIThrowsError() { //Arrange var contentService = new ContentService(Mock.Of <ILogger <ContentService> >(), TestAppSettings.CMS.InvalidURI); //Act + Assert var exception = await Should.ThrowAsync <Exception>(() => contentService.GetAllItemsAsync()); exception.InnerException.ShouldBeOfType <WebException>(); }
/// <summary> /// Constructor /// </summary> /// <param name="content"><see cref="ContentService"/></param> /// <param name="input"><see cref="InputService"/></param> /// <param name="config"><see cref="ConfigurationService"/></param> /// <param name="state"><see cref="StateService"/></param> /// <param name="console"><see cref="GameConsole"/></param> public MainMenuState(ContentService content, InputService input, ConfigurationService config, StateService state, GameConsole console) { _console = console; _content = content; _config = config; _input = input; _state = state; Initialize(content); }
protected override PagedResult <IContent> GetDescendantContent(int id, long pageIndex = 0, int pageSize = 100) { long total; var items = ContentService.GetPagedDescendants(id, pageIndex, pageSize, out total); return(new PagedResult <IContent>(total, pageIndex + 1, pageSize) { Items = items }); }
public ActionResult Home() { var model = new HomeViewModel { Page = ContentService.Get <Page>("home"), Entries = ContentService.Get <BlogEntry>().ToList() }; return(View(model)); }
public ServicesController() { AuthorizationService = new AuthorizationService(); DatabaseService = new DatabaseService(); UserService = new UserService(); ScenesService = new ScenesService(); ContentService = new ContentService(); TimeService = new TimeService(); ShareService = new ShareService(); }
public ActionResult MultipleSelectForUnion(string tabId, int parentId, int[] IDs) { var result = ContentService.InitList(parentId); var model = new UnionContentViewModel(result, tabId, parentId, IDs) { IsMultiple = true }; return(JsonHtml("MultiSelectIndex", model)); }
public AdvancedPresenter(AdvancedView advancedView, ItemService itemService, ContentService contentService) { AdvancedView = advancedView; _itemService = itemService; _contentService = contentService; KaptureConfig = KaptureConfig.GetInstance(); Configuration = (Configuration)KaptureConfig.ConfigManager.Config; SetupItemsFilter(); SetupZonesFilter(); }
//2.0.0 changes public HomeTreksController(IOptions <DevTreks.Data.ContentURI> uri, ILogger <HomeTreksController> logger) { _uri = new DevTreks.Data.ContentURI(); _uri = new DevTreks.Data.ContentURI(uri.Value); _searchService = new SearchService(_uri); _memberService = new MemberService(_uri); _contentService = new ContentService(_uri); _logger = logger; }
public ActionResult Copy(int id, int?forceId, string forceFieldIds, string forceLinkIds) { var result = ContentService.Copy(id, forceId, forceFieldIds.ToIntArray(), forceLinkIds.ToIntArray()); PersistResultId(result.Id); PersistFromId(id); PersistFieldIds(result.FieldIds); PersistLinkIds(result.LinkIds); return(JsonMessageResult(result.Message)); }
public KasbahWebContextInitialisationMiddleware(RequestDelegate next, ILoggerFactory loggerFactory, ContentService contentService, SiteRegistry siteRegistry, TypeRegistry typeRegistry, KasbahWebApplication kasbahWebApplication, TypeMapper typeMapper) { _next = next; _log = loggerFactory.CreateLogger <KasbahWebContextInitialisationMiddleware>(); _contentService = contentService; _siteRegistry = siteRegistry; _typeRegistry = typeRegistry; _kasbahWebApplication = kasbahWebApplication; _typeMapper = typeMapper; }
/// <summary> /// Initializes a new instance of the <see cref="ContextConfigurationService"/> class. /// </summary> /// <param name="content">The content service.</param> /// <param name="schemaAwareDbContextService">The schema-aware database context service.</param> public ContextConfigurationService ( ContentService content, SchemaAwareDbContextService schemaAwareDbContextService ) { _content = content; _schemaAwareDbContextService = schemaAwareDbContextService; _knownSchemas = new Dictionary <Type, string>(); }
public ContentController( ICallContext callContext, AppConfig appConfig, ITelemetryLogger logger, ContentService contentService ) : base(callContext, appConfig, logger) { this.ContentService = contentService; }
public static void Initialize(ILayoutService ILayoutService, IProgressService IProgressService, IValidationService IValidationService) { SaveService = new SaveService(); Events = new EventAggregator(); ResourceService = new ResourceService(); Layout = ILayoutService; ProgressService = IProgressService; ValidationService = IValidationService; LoginService = new LoginService(ClientType.Administrator, "Администратор. Авторизация"); ContentService = new ContentService("Administrator"); DragDropService = new DragDropService(); RibbonService = new RibbonService(); }
public static string RenderIcon(Guid? source, int width, int height) { var contentService = new ContentService("Sergey_GKOPC"); Drawing drawing; if (source.HasValue) { drawing = contentService.GetDrawing(source.Value); if (drawing == null) { return string.Empty; } } else { return string.Empty; } drawing.Freeze(); return InternalConverter.XamlDrawingToPngBase64String(width, height, drawing); }
public BaseController() { ContentService = new ContentService(); TagService = new TagService(); RouteService = new RouteService(); }
static PlanElement() { _contentService = new ContentService("GKWEB"); }
public static void Initialize() { Events = new EventAggregator(); ResourceService = new ResourceService(); ContentService = new ContentService("Monitor"); }
public MsdnResolver () { msdnService = new ContentService(); msdnService.appIdValue = new appId(); msdnService.appIdValue.value = "Sandcastle"; msdnService.SoapVersion = SoapProtocolVersion.Soap11; }