private void _webView2Control_BrowserCreated(object sender, EventArgs e) { _settingsComponent = new SettingsComponent(_environment, _webView2Control); _fileComponent = new FileComponent(this, _webView2Control); _processComponent = new ProcessComponent(this, _webView2Control); _scriptComponent = new ScriptComponent(this, _webView2Control); _controlComponent = new ControlComponent(this, navigationToolBar, _webView2Control); _viewComponent = new ViewComponent(this, _webView2Control); if (_onWebViewFirstInitialized != null) { _onWebViewFirstInitialized.Invoke(); _onWebViewFirstInitialized = null; } if (!string.IsNullOrEmpty(_initialUrl)) { _webView2Control.Navigate(_initialUrl); } if (_newWindowRequestedEventArgs != null) { _newWindowRequestedEventArgs.NewWindow = _webView2Control.InnerWebView2WebView; _newWindowRequestedEventArgs.Handled = true; _newWindowDeferral.Complete(); _newWindowRequestedEventArgs = null; _newWindowDeferral = null; } }
public Entity AddView(UnityEngine.GameObject newGameObject) { var component = new ViewComponent(); component.gameObject = newGameObject; return(AddView(component)); }
/// <summary> /// Invokes a view component, and registeres section handlers /// </summary> /// <param name="componentName">The view component name</param> /// <param name="bodyHandler">Delegate to render the component's body. null if the component does not have a body</param> /// <param name="sectionHandlers">Delegates to render the component's sections, by the delegate names</param> /// <param name="parameters">The parameters to be passed to the component</param> protected void InvokeViewComponent(string componentName, ViewComponentSectionRendereDelegate bodyHandler, IEnumerable <KeyValuePair <string, ViewComponentSectionRendereDelegate> > sectionHandlers, params object[] parameters) { ViewComponentContext viewComponentContext = new ViewComponentContext( this, bodyHandler, componentName, parameters); if (sectionHandlers != null) { foreach (KeyValuePair <string, ViewComponentSectionRendereDelegate> pair in sectionHandlers) { viewComponentContext.RegisterSection(pair.Key, pair.Value); } } ViewComponent viewComponent = ((IViewComponentFactory)Context.GetService(typeof(IViewComponentFactory))).Create(componentName); viewComponent.Init(Context, viewComponentContext); viewComponent.Render(); if (viewComponentContext.ViewToRender != null) { OutputSubView("\\" + viewComponentContext.ViewToRender, viewComponentContext.ContextVars); } }
/// <summary> /// Дозволяє вибрати стрілками тип товару /// </summary> /// <returns>вибраний тип</returns> public GoodsType UpDownChoice() { ConsoleKeyInfo pressed; GoodsType choice = GoodsType.Unpacked; Console.Write(StringConstants.GoodsTypeUnpacked); do { pressed = Console.ReadKey(true); if (pressed.Key == ConsoleKey.UpArrow || pressed.Key == ConsoleKey.DownArrow) { if (choice == GoodsType.Unpacked) { choice = GoodsType.WeighedOut; ViewComponent.ClearStringFrom(Console.CursorTop, Console.CursorLeft - StringConstants.GoodsTypeUnpacked.Length); Console.Write(StringConstants.GoodsTypeWeighedOut); } else { choice = GoodsType.Unpacked; ViewComponent.ClearStringFrom(Console.CursorTop, Console.CursorLeft - StringConstants.GoodsTypeWeighedOut.Length); Console.Write(StringConstants.GoodsTypeUnpacked); } } } while (pressed.Key != ConsoleKey.Enter); Console.WriteLine(); return(choice); }
private void AddComponents() { SpriterReader reader = new SpriterReader(); SpriterImporter importer = new SpriterImporter(); var model = reader.Read(importer.Import(Path.Combine("Content\\Spriter", "player.scml")), null, game.Content, game.GraphicsDevice); Animator = new FarmPlayerAnimator(this, model, "player"); //Animator.AnimationEnded += Animator_AnimationEnded; Animator.Scale = 1.0f; animationComponent = new AnimationComponent(this, Animator, "idle_down"); Components.AddComponent(animationComponent); Components.AddComponent(new ExclamationMarkDrawer(game, this)); Components.AddComponent(new MessageBoxComponent(game, this)); Components.AddComponent(Inventory = new PlayerInventory(this)); Components.AddComponent(viewComponent = new ViewComponent(new Vector2(0, 1))); CreateTools(); WidgetManager widgets = new WidgetManager(game, this); widgets.AddWidget(new ItemWidget(game, this, widgets, "Tool widget")); widgets.AddWidget(new TimeWidget(game, this, widgets, "Time and date widget")); Components.AddComponent(widgets); }
public static string GetViewPath(this ViewComponent viewComponent, string viewName = "Default") { var theme = ""; viewComponent.HttpContext.Request.Cookies.TryGetValue("theme", out string previewingTheme); if (!string.IsNullOrWhiteSpace(previewingTheme)) { theme = previewingTheme; } else { var config = viewComponent.HttpContext.RequestServices.GetService <IConfiguration>(); theme = config["Theme"]; } var viewPath = $"/Modules/{viewComponent.GetType().Assembly.GetName().Name}/Views/Shared/Components/{viewComponent.ViewComponentContext.ViewComponentDescriptor.ShortName}/{viewName}.cshtml"; if (!string.IsNullOrWhiteSpace(theme) && !string.Equals(theme, "Generic", System.StringComparison.InvariantCultureIgnoreCase)) { var themeViewPath = $"/Themes/{theme}{viewPath}"; var viewEngine = viewComponent.ViewContext.HttpContext.RequestServices.GetRequiredService <ICompositeViewEngine>(); //var result = viewEngine.FindView(viewComponent.ViewContext, themeViewPath, isMainPage: false); var result = viewEngine.GetView("", themeViewPath, isMainPage: false); if (result.Success) { viewPath = themeViewPath; } } return(viewPath); }
private void CloseWebView() { if (_webView2Control != null) { _webView2Control.Close(); _webView2Control.EnvironmentCreated -= webView2Control1_EnvironmentCreated; _webView2Control.BrowserCreated -= _webView2Control_BrowserCreated; _webView2Control.ContainsFullScreenElementChanged -= _webView2Control_ContainsFullScreenElementChanged; _webView2Control.NewWindowRequested -= _webView2Control_NewWindowRequested; _environment.UnregisterNewVersionAvailable(_newVersionToken); _settingsComponent.CleanUp(); _settingsComponent = null; _fileComponent.CleanUp(); _fileComponent = null; _processComponent.CleanUp(); _processComponent = null; _scriptComponent.CleanUp(); _scriptComponent = null; _controlComponent.CleanUp(); _controlComponent = null; _viewComponent.CleanUp(); _viewComponent = null; tableLayoutPanel1.Controls.Remove(_webView2Control); _webView2Control.Dispose(); _webView2Control = null; } }
void destroyView(ViewComponent viewComponent) { var gameObject = viewComponent.gameObject; gameObject.Unlink(); UnityEngine.Object.Destroy(gameObject); }
protected override void CalcContentCoordination() { var column = -1; var maxY = 0; for (int index = 0, max = DataProvider.Count; index < max; index++) { var data = DataProvider[index]; var prefab = GetPrefab(data.PrefabName); var size = PrefabSizeByName[prefab.name]; var width = (int)size.x; var height = (int)size.y; if (column == -1) { column = (int)(ViewComponent.RectTransform.rect.width / width); } data.X = (index % column) * width; data.Y = (index / column) * height; data.Min = data.Y; data.Max = data.Y + height; maxY = data.Max; } ViewComponent.SetContentRectTransform(ViewComponent.Content.sizeDelta.x, maxY); base.CalcContentCoordination(); }
private void DestroyEntity(GameEntity entity) { ViewComponent view = entity.view; if (view == null) { entity.Destroy(); return; } var spriteRenderer = view.value.GetComponent <SpriteRenderer> (); spriteRenderer.transform.DetachChildren(); spriteRenderer.sortingOrder = 2; var collinder2D = view.value.GetComponent <Collider2D> (); if (collinder2D != null) { collinder2D.enabled = false; } spriteRenderer.DOFade(0, 0.45f); view.value.gameObject.transform .DOScale(Vector3.one * 1.5f, 0.5f) .OnComplete(() => { view.value.gameObject.Unlink(); Object.Destroy(view.value.gameObject); entity.Destroy(); }); }
public static ViewViewComponentResult WidgetView(this ViewComponent component, WidgetModel model) { var viewName = $"{TuxConfiguration.WidgetDefaultPath}{model.Placement.Widget.Name}/{TuxConfiguration.WidgetDefaultFileName}"; return(component.View(viewName, model)); }
public ViewComponent SaveOrUpdateMerge(ViewComponent viewComponent) { object mergedObj = Session.Merge(viewComponent); HibernateTemplate.SaveOrUpdate(mergedObj); return((ViewComponent)mergedObj); }
private void destroyView(ViewComponent viewComponent) { GameObject gameObject = viewComponent.gameObject; // TODO maybe we should add a tween here gameObject.Unlink(); Object.Destroy(gameObject); }
protected virtual void RecycleView(IEntity entity, ViewComponent viewComponent) { var view = viewComponent.View; ViewPool.ReleaseInstance(view); viewComponent.View = null; OnViewRecycled(view, entity); }
protected virtual object AllocateView(IEntity entity, ViewComponent viewComponent) { var viewToAllocate = ViewPool.AllocateInstance(); viewComponent.View = viewToAllocate; OnViewAllocated(viewToAllocate, entity); return(viewToAllocate); }
public static void WriteError(string message) { Console.Write(message); Console.ReadKey(true); ViewComponent.ClearTo(top, left); Console.CursorTop = top; Console.CursorLeft = left; }
internal void CreateViewComponent() { if ((viewComponentName == null) || (viewComponentName.Length < 1)) { throw new RailsException("You must specify the component name with 'blockcomponent' and 'component'."); } viewComponent = ((ViewComponentStringTemplateGroup)group).ViewComponentFactory.Create(viewComponentName); viewComponentContext = new StringTemplateViewContextAdapter(viewComponentName, this); }
public void ConstructAndBindViewComponent(ViewComponent vc, ModelBlock parent) { var modelPosition = new Vector3(vc.Position.x, vc.Position.y, vc.Position.z); var mc = new ModelComponent(vc.componentType, modelPosition, parent); var binding = new ComponentBinding(vc, mc, environmentChanged); componentBindings.Add(binding); me.AddComponent(mc); }
public ViewComponentDomainContext(ViewComponent viewComponent) : base(viewComponent.ViewContext) { if (viewComponent == null) { throw new ArgumentNullException(nameof(viewComponent)); } ViewComponent = viewComponent; }
public void ShowMessage(string message) { GTextField messageText = GetChild("n0").asTextField; Transition dongxiao = ViewComponent.GetTransition("message"); messageText.text = message; dongxiao.Play(); }
public AppsNavigationViewModel(ViewComponent viewComponent, Configuration.Config config, ISet <string> roles) { var area = viewComponent.RouteData.Values["Area"]?.ToString(); var controller = viewComponent.RouteData.Values["Controller"]?.ToString(); this.Config = config; this.App = this.Config.Apps.FirstOrDefault(x => x.Areas.Contains(area)); this.Roles = roles; }
static void Main(string[] args) { ViewComponent view = new ViewComponent(); Balance model = new Balance(); ControllerComponent controller = new ControllerComponent(view, model); controller.DoActions(); }
public ViewBuilderButton(Transform panel, ViewComponent _component) : base(panel, _component) { if (instance == null) { instance = this; } createButton(); createText(); }
public ViewComponent Save(ViewComponent viewComponent) { if (viewComponent.Id == Guid.Empty) { viewComponent.Id = Guid.NewGuid(); } HibernateTemplate.Save(viewComponent); return(viewComponent); }
public override void Release(ViewComponent instance) { if (kernel.HasComponent(instance.GetType())) { kernel.ReleaseComponent(instance); } else { base.Release(instance); } }
public Entity ReplaceView(UnityEngine.GameObject newGameObject) { ViewComponent component; if (hasView) { WillRemoveComponent(CoreComponentIds.View); component = view; } else { component = new ViewComponent(); } component.gameObject = newGameObject; return ReplaceComponent(CoreComponentIds.View, component); }
private void createText() { ViewComponent textComponent = new ViewComponent(); textComponent.id = component.id + "_text"; textComponent.groupId = component.id; textComponent.text = component.text; textComponent.textArray = component.textArray; textComponent.x = 0; textComponent.y = 0; text = new ViewBuilderText(container.transform, textComponent); }
public void Apply(IEntity entity) { var selfDestructComponent = new SelfDestructComponent { Lifetime = Random.Range(_minLifetime, _maxLifetime), StartingPosition = _startPosition }; var viewComponent = new ViewComponent(); entity.AddComponents(selfDestructComponent, viewComponent); }
/// <summary> /// Releases a ViewComponent instance /// </summary> /// <remarks> /// Not currently used /// </remarks> /// <param name="instance"></param> public virtual void Release(ViewComponent instance) { if (logger.IsDebugEnabled) { logger.Debug("Releasing view component instance " + instance); } if (instance is IDisposable) { ((IDisposable)instance).Dispose(); } }
public static LocationData GetLocationData <TModel>(this ViewComponent page) { // TODO: validate page, ViewContext, RouteData, Values // for: // not null, contain values return(new LocationData() { ActionName = (string)page.ViewContext.RouteData.Values["action"], ControllerName = (string)page.ViewContext.RouteData.Values["controller"] // TODO: get area name }); }
private void createText() { ViewComponent textComponent = new ViewComponent(); textComponent.id = component.id + "_text"; textComponent.groupId = ""; textComponent.text = component.text; textComponent.textArray = component.textArray; textComponent.x = 0; textComponent.y = 0; text = new ViewBuilderText(button.transform, textComponent); text.hideText(1); }
protected override void ProcessSubSections(ViewComponent component, NVelocityViewContextAdapter contextAdapter) { foreach(SubSectionDirective section in sectionsCreated) { if (!component.SupportsSection(section.Name)) { throw new ViewComponentException( String.Format("The section '{0}' is not supported by the ViewComponent '{1}'", section.Name, component.Context.ComponentName)); } contextAdapter.RegisterSection(section); section.ContextAdapter = contextAdapter; } }
public Entity AddView(ViewComponent component) { return AddComponent(CoreComponentIds.View, component); }
public Entity AddView(UnityEngine.GameObject newGameObject) { var component = new ViewComponent(); component.gameObject = newGameObject; return AddView(component); }
/// <summary> /// Releases a ViewComponent instance /// </summary> /// <remarks> /// Not currently used /// </remarks> /// <param name="instance"></param> public virtual void Release(ViewComponent instance) { if (logger.IsDebugEnabled) { logger.Debug("Releasing view component instance " + instance); } if (instance is IDisposable) { ((IDisposable) instance).Dispose(); } }
/// <summary> /// Releases a ViewComponent instance /// </summary> /// <remarks> /// Not currently used /// </remarks> /// <param name="instance"></param> public virtual void Release(ViewComponent instance) { if (logger.IsDebugEnabled) { logger.Debug("Releasing view component instance " + instance); } }