Example #1
0
        private void EnsureCorrectDropDownPosition()
        {
            if (!IsActive ||
                !_targetReference.HasValue ||
                !_contentReference.HasValue)
            {
                return;
            }

            var posParent  = ElementService.GetPosition(_targetReference.Current);
            var posContent = ElementService.GetPosition(_contentReference.Current);

            if (posParent == null ||
                posContent == null)
            {
                return;
            }

            var currentAlignment = _alignContentLeftToRight;

            _alignContentLeftToRight = ((posParent.Right + posParent.Width - 30) >= posContent.Width);

            if (currentAlignment != _alignContentLeftToRight)
            {
                StateHasChanged();
            }
        }
        public object GetConditions(string ElementId, Guid ProcessId)
        {
            using (GatewayService gatewayService = new GatewayService())
            {
                sysBpmsGateway sysBpmsGateway = gatewayService.GetInfo(ElementId, ProcessId);

                using (SequenceFlowService sequenceFlowService = new SequenceFlowService())
                {
                    using (ElementService elementService = new ElementService())
                    {
                        using (ConditionService conditionService = new ConditionService())
                        {
                            List <sysBpmsSequenceFlow> SequenceFlows = sequenceFlowService.GetList(ProcessId, "", ElementId, "");
                            List <sysBpmsElement>      Elements      = elementService.GetList(SequenceFlows.Select(c => c.TargetElementID).ToArray(), ProcessId);

                            using (ProcessService processService = new ProcessService())
                                return new
                                       {
                                           SequenceFlows = SequenceFlows.Select(c => new
                                    {
                                        c.ID,
                                        Elements.FirstOrDefault(d => d.ID == c.TargetElementID).Name,
                                    }).ToList(),
                                           AllowEdit = processService.GetInfo(ProcessId).AllowEdit(),
                                           GatewayID = sysBpmsGateway.ID,
                                           GetList   = conditionService.GetList(sysBpmsGateway.ID, null, null).Select(c => new ConditionDTO(c)).ToList(),
                                       };
                        }
                    }
                }
            }
        }
Example #3
0
        public void ElementServiceAdd()
        {
            DateTime now        = DateTime.Now;
            var      elementDto = new ElementDto();

            elementDto.Id             = Guid.NewGuid();
            elementDto.Name           = "Elemento 1";
            elementDto.ExpirationDate = now;
            elementDto.EntryDate      = now;
            elementDto.Type           = "Tipo A";

            Mock <IRepository <Element> > elementRepository = new Mock <IRepository <Element> >();

            var elementService = new ElementService(elementRepository.Object, _mapper);

            var result = elementService.Add(elementDto);

            Assert.IsNotNull(result);
        }
Example #4
0
        protected override async Task OnAfterRenderAsync(bool firstRender)
        {
            if (firstRender)
            {
                // Register resize-handler to window
                await WindowService.EventManager
                .AddResizeHandlerAsync(WindowResizeHandler);
            }

            // Ensure that the dropdown isn't cut off
            EnsureCorrectDropDownPosition();

            if (_callbackId > -1)
            {
                // Ensure that callback is cleaned up
                await ElementService.RemoveClickOutsideOfElementHandlerAsync(_callbackId);

                _callbackId = -1;
            }

            if (IsActive)
            {
                // Register callback if user clicks outside of dropdown
                _callbackId = await ElementService.AddClickOutsideOfElementHandlerAsync(
                    new[]
                {
                    _targetReference.Current,
                    _contentReference.Current
                },
                    () =>
                {
                    _callbackId = -1;

                    IsActive = false;
                    IsActiveChanged.InvokeAsync(false);     // Notify parent that dropdown closed

                    StateHasChanged();
                });
            }
        }
Example #5
0
        protected override async Task OnAfterRenderAsync(bool firstRender)
        {
            if (_callbackId > -1)
            {
                // Ensure that callback is cleaned up
                await ElementService.RemoveClickOutsideOfElementHandlerAsync(_callbackId);

                _callbackId = -1;
            }

            if (EnableClickOutside &&
                Context != null &&
                Context.IsActive)
            {
                // Register callback if user clicks outside of dropdown
                _callbackId = await ElementService.AddClickOutsideOfElementHandlerAsync(
                    new[] { _modalReference },
                    () =>
                {
                    _callbackId = -1;
                    Context.Close();
                });
            }
        }
 public ElementController(ILogger <ElementController> logger, ElementService elementService)
 {
     this.logger         = logger;
     this.elementService = elementService;
 }
 public AddElementsSystem(Contexts contexts, Services services) : base(contexts.game)
 {
     _contexts       = contexts;
     _elementService = services.ElementService;
 }