示例#1
0
 public void Redraw()
 {
     Logger.Info("Redraw in Cabinet");
     RedrawCabinetElements();
     // TODO  dodac wszelkie przeliczenia w klasie cabinet
     VerticalBarrier   = _mapper.Map <List <ElementModel> >(VerticalBarrierFactory.ReCount());
     HorizontalBarrier = _mapper.Map <List <ElementModel> >(HorizontalBarrierFactory.ReCount());
     FrontList         = _mapper.Map <List <ElementModel> >(FrontFactory.ReCount());
 }
示例#2
0
        // TODO dodac dodatkowe logowanie i prawidłowe - w fabryce zmiany elementow
        public ElementModel ChangeElemenet(ElementModel element, EnumElementParameter parameter, string text)
        {
            Logger.Info("ChangeElemenet(ElementModel element, EnumElementParameter parameter, string text) in Cabinet");

            if (int.TryParse(text, out int result) || parameter == EnumElementParameter.Description)
            {
                bool find = false;

                foreach (var item in CabinetElements)
                {
                    if (item.GetGuid() == element.GetGuid())
                    {
                        find = true;
                        SwitchChange(parameter, text, result, item);

                        if (element.GetEnumName() == EnumCabinetElement.Leftside && parameter == EnumElementParameter.Width)
                        {
                            CabinetElements.Find(x => x.GetEnumName() == EnumCabinetElement.Top).SetHeight(_width - CabinetElements.Find(x => x.GetEnumName() == EnumCabinetElement.Leftside).Width - CabinetElements.Find(x => x.GetEnumName() == EnumCabinetElement.Rightside).Width, false);
                            CabinetElements.Find(x => x.GetEnumName() == EnumCabinetElement.Bottom).SetHeight(_width - CabinetElements.Find(x => x.GetEnumName() == EnumCabinetElement.Leftside).Width - CabinetElements.Find(x => x.GetEnumName() == EnumCabinetElement.Rightside).Width, false);
                            CabinetElements.Find(x => x.GetEnumName() == EnumCabinetElement.Top).SetX(CabinetElements.Find(x => x.GetEnumName() == EnumCabinetElement.Leftside).Width, false);
                            CabinetElements.Find(x => x.GetEnumName() == EnumCabinetElement.Bottom).SetX(CabinetElements.Find(x => x.GetEnumName() == EnumCabinetElement.Leftside).Width, false);
                        }
                        if (element.GetEnumName() == EnumCabinetElement.Rightside && parameter == EnumElementParameter.Width)
                        {
                            CabinetElements.Find(x => x.GetEnumName() == EnumCabinetElement.Top).SetHeight(_width - CabinetElements.Find(x => x.GetEnumName() == EnumCabinetElement.Leftside).Width - CabinetElements.Find(x => x.GetEnumName() == EnumCabinetElement.Rightside).Width, false);
                            CabinetElements.Find(x => x.GetEnumName() == EnumCabinetElement.Bottom).SetHeight(_width - CabinetElements.Find(x => x.GetEnumName() == EnumCabinetElement.Leftside).Width - CabinetElements.Find(x => x.GetEnumName() == EnumCabinetElement.Rightside).Width, false);
                            CabinetElements.Find(x => x.GetEnumName() == EnumCabinetElement.Rightside).SetX(_width - CabinetElements.Find(x => x.GetEnumName() == EnumCabinetElement.Rightside).Width, false);
                        }
                        if (element.GetEnumName() == EnumCabinetElement.Top && parameter == EnumElementParameter.Width)
                        {
                            CabinetElements.Find(x => x.GetEnumName() == EnumCabinetElement.Top).SetY(_height - CabinetElements.Find(x => x.GetEnumName() == EnumCabinetElement.Top).Width, false);
                        }

                        HorizontalBarrier = _mapper.Map <List <ElementModel> >(HorizontalBarrierFactory.ReCount());
                        VerticalBarrier   = _mapper.Map <List <ElementModel> >(VerticalBarrierFactory.ReCount());
                        FrontList         = _mapper.Map <List <ElementModel> >(FrontFactory.ReCount());
                    }

                    if (find)
                    {
                        break;
                    }
                }

                foreach (var item in VerticalBarrier)
                {
                    if (item.GetGuid() == element.GetGuid())
                    {
                        find            = true;
                        VerticalBarrier = _mapper.Map <List <ElementModel> >(VerticalBarrierFactory.Update(parameter, text, result, _mapper.Map <ElementModelDTO>(item)));
                        element         = VerticalBarrier.Find(x => x.GetGuid() == element.GetGuid());
                    }
                }

                foreach (var item in HorizontalBarrier)
                {
                    if (item.GetGuid() == element.GetGuid())
                    {
                        find = true;
                        HorizontalBarrier = _mapper.Map <List <ElementModel> >(HorizontalBarrierFactory.Update(parameter, text, result, _mapper.Map <ElementModelDTO>(item)));
                        element           = HorizontalBarrier.Find(x => x.GetGuid() == element.GetGuid());
                    }
                }

                foreach (var item in FrontList)
                {
                    if (item.GetGuid() == element.GetGuid())
                    {
                        find      = true;
                        FrontList = _mapper.Map <List <ElementModel> >(FrontFactory.Update(parameter, text, result, _mapper.Map <ElementModelDTO>(item)));
                        element   = FrontList.Find(x => x.GetGuid() == element.GetGuid());
                        break;
                    }
                }
            }

            return(element);
        }
示例#3
0
 private void RecalculateVerticalBarrier()
 {
     Logger.Info("Recalculate Vertical Barrier in Cabinet");
     VerticalBarrier = _mapper.Map <List <ElementModel> >(VerticalBarrierFactory.ReCount());
 }