示例#1
0
        public void CreateCellNull(AreaType at, List <BaseDrawClass> place)
        {
            List <VMRUVNPlace> listPlaces = new List <VMRUVNPlace>();

            foreach (var vari in place)
            {
                listPlaces.Add(vari as VMRUVNPlace);
            }
            CreateNullCell cnc = new CreateNullCell();
            var            vm  = cnc.DataContext as VMCreateNullCells;

            vm.SetDepth(listPlaces[0]);
            if (at == AreaType.HighVoltage)
            {
                vm.SetCorSize(SelectBMZ.InformationForBuild.Shkv);
            }
            else
            {
                vm.SetCorSize(SelectBMZ.InformationForBuild.Shmn);
            }
            if (listPlaces.Count == 1)
            {
                vm.SetSettingsWorkspace((int)listPlaces[0].Width, (int)listPlaces[0].Height);
            }
            else
            {
                if (at == AreaType.HighVoltage)
                {
                    vm.SetCorSize(SelectBMZ.InformationForBuild.Shkv);
                    vm.SetSettingsWorkspace((int)listPlaces[0].Width, (int)listPlaces[0].Height * 2 + SelectBMZ.InformationForBuild.Shkv / Constants.MainScale);
                    vm.SetSecondRows(true);
                }
                else
                {
                    vm.SetCorSize(SelectBMZ.InformationForBuild.Shmn);
                    vm.SetSettingsWorkspace((int)listPlaces.Find(x => x.Width == Math.Max(listPlaces[0].Width, listPlaces[1].Width)).Width, (int)listPlaces[0].Height * 2 + SelectBMZ.InformationForBuild.Shmn / Constants.MainScale);
                    vm.SetSecondRows(true);
                }
            }
            cnc.ShowDialog();
            if (vm.IsSucess == false)
            {
                return;
            }
            var md = vm.GetMainData();

            if (vm._VMMainBlock._rowViewModelList.Count != listPlaces.Count)
            {
                _mainBlockViewModel.IToastNotifications.ShowError(
                    "Вы загружаете не подходящую по рядам конфигурацию");
                return;
            }
            if (vm._VMMainBlock.CellsDataList.Count > 0)
            {
                _mainBlockViewModel.MainDataParsing(new CommonData()
                {
                    ProductType = ProductType.Untyped, MainData = md
                }, at);
                if (at == AreaType.HighVoltage)
                {
                    _mainBlockViewModel.ICommonData.RUVN_SetCommonData(new CommonData()
                    {
                        ProductType = ProductType.Untyped, MainData = md
                    });
                    (_mainBlockViewModel.BaseDrawElements.LastOrDefault() as PVMCell)._ruvnData = _mainBlockViewModel.ICommonData.RUVN_GetCommonData();
                }
                else
                {
                    _mainBlockViewModel.ICommonData.RUNN_SetCommonData(new CommonData()
                    {
                        ProductType = ProductType.Untyped, MainData = md
                    });
                    (_mainBlockViewModel.BaseDrawElements.LastOrDefault() as PVMCell)._runnData = _mainBlockViewModel.ICommonData.RUNN_GetCommonData();
                }
            }
        }
示例#2
0
        public void EditMak(CommonData cd, PVMCell cellForPlace, int width, int height)
        {
            if (cd is null)
            {
                throw new System.ArgumentNullException(nameof(cd));
            }

            CreateNullCell createNullCell    = new CreateNullCell();
            var            vmCreateNullCells = createNullCell.DataContext as VMCreateNullCells;

            if (cellForPlace.type == AreaType.HighVoltage)
            {
                vmCreateNullCells.SetCommonData(cellForPlace._ruvnData);
                vmCreateNullCells.SetCorSize(SelectBMZ.InformationForBuild.Shkv);
                if (cellForPlace._ruvnData.MainData.RowDataList.Count == 1)
                {
                    vmCreateNullCells.SetSettingsWorkspace(width, height);
                }
                else
                {
                    vmCreateNullCells.SetSettingsWorkspace(width, height * 2 + SelectBMZ.InformationForBuild.Shkv / Constants.MainScale);
                    vmCreateNullCells.SetSecondRows(true);
                }
            }
            else
            {
                vmCreateNullCells.SetCommonData(cellForPlace._runnData);
                vmCreateNullCells.SetCorSize(SelectBMZ.InformationForBuild.Shmn);
                if (cellForPlace._runnData.MainData.RowDataList.Count == 1)
                {
                    vmCreateNullCells.SetSettingsWorkspace(width, height);
                }
                else
                {
                    vmCreateNullCells.SetSettingsWorkspace(width, height * 2 + SelectBMZ.InformationForBuild.Shmn / Constants.MainScale);
                    vmCreateNullCells.SetSecondRows(true);
                }
            }

            vmCreateNullCells.SetQuant(vmCreateNullCells._VMMainBlock.CellsDataList.Count > 0 ? vmCreateNullCells._VMMainBlock.CellsDataList.Count : 1);
            createNullCell.ShowDialog();
            if (vmCreateNullCells.IsSucess == false)
            {
                return;
            }
            createNullCell.Close();
            if (vmCreateNullCells.IsSucess == false)
            {
                return;
            }
            var md = vmCreateNullCells.GetMainData();

            if (vmCreateNullCells._VMMainBlock.CellsDataList.Count > 0)
            {
                var finderLink = _mainBlockViewModel.BaseDrawElements.ToList().FindAll(x => (x is VMLink)).Find(x => (x as VMLink).elemId == cellForPlace.ElementId);
                _mainBlockViewModel.BaseDrawElements.Remove(cellForPlace.myLink);

                _mainBlockViewModel.DrawningFraemworkElements.Remove(finderLink.ParentEl);
                _mainBlockViewModel.BaseDrawElements.Remove(cellForPlace);
                _mainBlockViewModel.DrawningFraemworkElements.Remove(cellForPlace.ParentEl);

                _mainBlockViewModel.MainDataParsing(new CommonData()
                {
                    ProductType = ProductType.Untyped, MainData = md
                }, cellForPlace.type);
                if (cellForPlace.type == AreaType.HighVoltage)
                {
                    _mainBlockViewModel.ICommonData.RUVN_SetCommonData(new CommonData()
                    {
                        ProductType = ProductType.Untyped, MainData = md
                    });
                }
                else
                {
                    _mainBlockViewModel.ICommonData.RUNN_SetCommonData(new CommonData()
                    {
                        ProductType = ProductType.Untyped, MainData = md
                    });
                }
            }
        }