示例#1
0
 private void InitializeListSize()
 {
     if (SelectBMZ.NameBMZ != null)
     {
         _VMRPMenuToolbar.NameComposite = SelectBMZ.NameBMZ.Remove(0, SelectBMZ.NameBMZ.IndexOf("("));
         var lst = GetInformBMZ.GetList().FindAll(x => (x.idBMZ == SelectBMZ.idBMZ));
         _VMRPMenuToolbar.AllCompositeSolution = new List <string>();
         foreach (var composite in lst)
         {
             _VMRPMenuToolbar.AllCompositeSolution.Add($"{composite.allLength}x{composite.allWidth} Высота = {composite.InformationForBuild.H} \nШГ1 = {composite.InformationForBuild.Shg1} ШКВ1 = {composite.InformationForBuild.Shkv}\nШКВ2 = {composite.InformationForBuild.Shkv2} ГН1 = {composite.InformationForBuild.Gn1}\nГН2 = {composite.InformationForBuild.Gn2} ШГ2 = {composite.InformationForBuild.Shg2}");
         }
         _VMRPMenuToolbar.SelectComposite = _VMRPMenuToolbar.AllCompositeSolution[0];
     }
 }
示例#2
0
        private void RebuildComposite()
        {
            var    toolBarVM       = (VMRPMenuToolbar)_RPMenuToolbar.DataContext;
            string selectComposite = toolBarVM.SelectComposite;
            string length          = selectComposite.Trim().Substring(0, selectComposite.IndexOf("x")).Trim();

            selectComposite = selectComposite.Replace($"{length}x", "");
            string width = selectComposite.Trim().Substring(0, selectComposite.IndexOf(" ")).Trim();

            selectComposite = selectComposite.Replace($"{width}", "").Trim();
            string h = selectComposite.Substring(selectComposite.IndexOf("Высота = "), selectComposite.IndexOf("\n")).Trim();

            selectComposite = selectComposite.Replace($"{h}", "").Trim();
            h = h.Replace("Высота = ", "");
            string shg1 = selectComposite.Substring(0, selectComposite.IndexOf("ШКВ1")).Trim();

            selectComposite = selectComposite.Replace($"{shg1}", "").Trim();
            shg1            = shg1.Replace("ШГ1 = ", "");

            string shkv1 = selectComposite.Substring(0, selectComposite.IndexOf("ШКВ2")).Trim();

            selectComposite = selectComposite.Replace($"{shkv1}", "").Trim();
            shkv1           = shkv1.Replace("ШКВ1 = ", "");

            string shkv2 = selectComposite.Substring(0, selectComposite.IndexOf("ГН1")).Trim();

            selectComposite = selectComposite.Replace($"{shkv2}", "").Trim();
            shkv2           = shkv2.Replace("ШКВ2 = ", "");

            string gn1 = selectComposite.Substring(0, selectComposite.IndexOf("ГН2")).Trim();

            selectComposite = selectComposite.Replace($"{gn1}", "").Trim();
            gn1             = gn1.Replace("ГН1 =", "").Trim();


            string gn2 = selectComposite.Substring(0, selectComposite.IndexOf("ШГ2")).Trim();

            selectComposite = selectComposite.Replace($"{gn2}", "").Trim();
            gn2             = gn2.Replace("ГН2 =", "").Trim();

            string shg2 = selectComposite.Substring(selectComposite.IndexOf("= ") + 1).Trim();

            var lstf = GetInformBMZ.GetList().Find(x => (x.idBMZ == SelectBMZ.idBMZ) &&
                                                   (x.allLength.ToString() == length) &&
                                                   (x.allWidth.ToString() == width) &&
                                                   (x.InformationForBuild.H.ToString() == h) &&
                                                   (x.InformationForBuild.Shg1.ToString() == shg1) &&
                                                   (x.InformationForBuild.Shkv.ToString() == shkv1) &&
                                                   (x.InformationForBuild.Shkv2.ToString() == shkv2) &&
                                                   (x.InformationForBuild.Shg2.ToString() == shg2) &&
                                                   (x.InformationForBuild.Gn1.ToString() == gn1) &&
                                                   (x.InformationForBuild.Gn2.ToString() == gn2));

            if (lstf != null)
            {
                Mouse.OverrideCursor    = Cursors.Wait;
                lstf.dOneSQuestParametr = GetInformBMZ.SelectBMZ().dOneSQuestParametr;
                lstf.elementFloor       = SelectBMZ.elementFloor;
                lstf.schemeRUVN         = SelectBMZ.schemeRUVN;
                lstf.schemeRUNN         = SelectBMZ.schemeRUNN;
                //ClearWorkspace();
                _RPMenuToolbar = null;

                GetInformBMZ.GetSelectBMZ(lstf);
                _mainBlockViewModel.BuildBMZ(GetInformBMZ.SelectBMZ());
                selectBMZ = null;
                var listPlace = _mainBlockViewModel.BaseDrawElements.ToList().FindAll(x => x is VMRUVNPlace);
                //var placeforHidesht = listPlace.Find(x =>
                //    string.Equals((x as VMRUVNPlace).namePlaceFrame, _mainBlockViewModel._placeforHide.namePlaceFrame, System.StringComparison.OrdinalIgnoreCase));
                //_mainBlockViewModel._placeforHide = (VMRUVNPlace)placeforHidesht;
                //_mainBlockViewModel.MainDataParsing(_mainBlockViewModel._iCommonData.RUVN_GetCommonData(), AreaType.HighVoltage);
                UpdateToolbar();
                Mouse.OverrideCursor = null;
            }
        }
        private void LoadDialog(double width, double depth)
        {
            var dw = new DialogWindow(
                "Загруженная конфигурация не подходит по размерам к шаблону. Попробуйте загрузить другую конфигурация или выбрать подходящий шаблон",
                "Неподходящий шаблон");

            if (dw.ShowDialog() != true)
            {
                switch (dw.GetSelection())
                {
                case Selection.None:
                    IToastNotifications.ShowError("Конфигурация не загружена");
                    break;
                }
            }


            switch (dw.GetSelection())
            {
            case Selection.LoadConfig:
                if (_roomType == RoomType.HighVoltage)
                {
                    FileLoad(Handler.RUVN, null);
                    MainDataParsing(_iCommonData.RUVN_GetCommonData(), AreaType.HighVoltage);
                }

                if (_roomType == RoomType.LowVoltage)
                {
                    FileLoad(Handler.RUNN, null);
                    MainDataParsing(_iCommonData.RUNN_GetCommonData(), AreaType.LowVoltage);
                }

                break;

            case Selection.ResizeComposite:
            {
                if (_roomType == RoomType.HighVoltage)
                {
                    List <ClassCompositeBMZ> lst = GetInformBMZ.GetList();
                    var listCell  = DrawningFraemworkElements.ToList().FindAll(x => x is CellAreaBlock);
                    var blockcell = listCell.Find(x =>
                                                  (x as CellAreaBlock)._cellAreaData.AreaType == AreaType.LowVoltage);
                    if (blockcell == null)
                    {
                        var lstf = lst.FindAll(x => (x.idBMZ == MyBMZ.idBMZ) &&
                                               (x.InformationForBuild.Gv1 == depth) &&
                                               (x.InformationForBuild.Dv1 + x.InformationForBuild.Dv2 > width));
                        if (lstf.Count != 0)
                        {
                            Mouse.OverrideCursor       = Cursors.Wait;
                            lstf[0].dOneSQuestParametr = GetInformBMZ.SelectBMZ().dOneSQuestParametr;
                            lstf[0].elementFloor       = MyBMZ.elementFloor;
                            lstf[0].schemeRUVN         = MyBMZ.schemeRUVN;
                            lstf[0].schemeRUNN         = MyBMZ.schemeRUNN;
                            GetInformBMZ.GetSelectBMZ(lstf[0]);
                            BuildBMZ(GetInformBMZ.SelectBMZ());
                            var listPlace       = BaseDrawElements.ToList().FindAll(x => x is VMRUVNPlace);
                            var placeforHidesht = listPlace.Find(x =>
                                                                 string.Equals((x as VMRUVNPlace).namePlaceFrame, _placeforHide.namePlaceFrame, System.StringComparison.OrdinalIgnoreCase));
                            _placeforHide = (VMRUVNPlace)placeforHidesht;
                            MainDataParsing(_iCommonData.RUVN_GetCommonData(), AreaType.HighVoltage);
                            Mouse.OverrideCursor = null;
                        }
                        else
                        {
                            DialogAfterNoFind();
                        }
                    }
                    else
                    {
                        var places = DrawningFraemworkElements.ToList().FindAll(x => x is CellAreaBlock);
                        var place  = places.Find(x =>
                                                 (x as CellAreaBlock)._cellAreaData.AreaType == AreaType.LowVoltage);
                        var goodLst   = BaseDrawElements.ToList().FindAll(x => x is PVMCell);
                        var goodCells = goodLst.Find(x => (x as PVMCell).type == AreaType.LowVoltage);



                        var lstf = lst.FindAll(x => (x.idBMZ == MyBMZ.idBMZ) &&
                                               (x.InformationForBuild.Gv1 == depth) &&
                                               (x.InformationForBuild.Dv1 + x.InformationForBuild.Dv2 > width) &&
                                               (x.InformationForBuild.Gn1 > (place as CellAreaBlock)._cellAreaData.Height) &&
                                               (x.InformationForBuild.Dn1 + x.InformationForBuild.Dn2 > (goodCells as PVMCell).WidthAllCell));
                        if (lstf.Count != 0)
                        {
                            Mouse.OverrideCursor       = Cursors.Wait;
                            lstf[0].dOneSQuestParametr = GetInformBMZ.SelectBMZ().dOneSQuestParametr;
                            lstf[0].schemeRUVN         = MyBMZ.schemeRUVN;
                            lstf[0].schemeRUNN         = MyBMZ.schemeRUNN;
                            GetInformBMZ.GetSelectBMZ(lstf[0]);
                            BuildBMZ(GetInformBMZ.SelectBMZ());
                            var listPlace       = BaseDrawElements.ToList().FindAll(x => x is VMRUVNPlace);
                            var placeforHidesht = listPlace.Find(x =>
                                                                 string.Equals((x as VMRUVNPlace).namePlaceFrame, _placeforHide.namePlaceFrame, System.StringComparison.OrdinalIgnoreCase));
                            _placeforHide = (VMRUVNPlace)placeforHidesht;
                            MainDataParsing(_iCommonData.RUVN_GetCommonData(), AreaType.HighVoltage);
                            Mouse.OverrideCursor = null;
                        }
                        else
                        {
                            DialogAfterNoFind();
                        }
                    }
                }

                if (_roomType == RoomType.LowVoltage)
                {
                    List <ClassCompositeBMZ> lst = GetInformBMZ.GetList();
                    var listCell  = DrawningFraemworkElements.ToList().FindAll(x => x is CellAreaBlock);
                    var blockcell = listCell.Find(x =>
                                                  (x as CellAreaBlock)._cellAreaData.AreaType == AreaType.HighVoltage);
                    if (blockcell == null)
                    {
                        var lstf = lst.FindAll(x => (x.idBMZ == MyBMZ.idBMZ) &&
                                               (x.InformationForBuild.Gn1 == depth) &&
                                               (x.InformationForBuild.Dn1 + x.InformationForBuild.Dn2 >
                                                width));
                        if (lstf.Count != 0)
                        {
                            Mouse.OverrideCursor       = Cursors.Wait;
                            lstf[0].dOneSQuestParametr = GetInformBMZ.SelectBMZ().dOneSQuestParametr;
                            lstf[0].schemeRUVN         = MyBMZ.schemeRUVN;
                            lstf[0].schemeRUNN         = MyBMZ.schemeRUNN;
                            lstf[0].elementFloor       = MyBMZ.elementFloor;
                            GetInformBMZ.GetSelectBMZ(lstf[0]);
                            BuildBMZ(GetInformBMZ.SelectBMZ());
                            var listPlace       = BaseDrawElements.ToList().FindAll(x => x is VMRUVNPlace);
                            var placeforHidesht = listPlace.Find(x =>
                                                                 string.Equals((x as VMRUVNPlace).namePlaceFrame, _placeforHide.namePlaceFrame, System.StringComparison.OrdinalIgnoreCase));
                            _placeforHide = (VMRUVNPlace)placeforHidesht;
                            MainDataParsing(_iCommonData.RUNN_GetCommonData(), AreaType.LowVoltage);
                            Mouse.OverrideCursor = null;
                        }
                        else
                        {
                            DialogAfterNoFind();
                        }
                    }
                    else
                    {
                        var places = DrawningFraemworkElements.ToList().FindAll(x => x is CellAreaBlock);
                        var place  = places.Find(x =>
                                                 (x as CellAreaBlock)._cellAreaData.AreaType == AreaType.HighVoltage);

                        var goodLst   = BaseDrawElements.ToList().FindAll(x => x is PVMCell);
                        var goodCells = goodLst.Find(x => (x as PVMCell).type == AreaType.HighVoltage);
                        var lstf      = lst.FindAll(x => (x.idBMZ == MyBMZ.idBMZ) &&
                                                    (x.InformationForBuild.Gn1 == depth) &&
                                                    (x.InformationForBuild.Dn1 + x.InformationForBuild.Dn2 >
                                                     width) &&
                                                    (x.InformationForBuild.Gv1 > (place as CellAreaBlock)._cellAreaData.Height) &&
                                                    (x.InformationForBuild.Dv1 + x.InformationForBuild.Dv2 > (goodCells as PVMCell).WidthAllCell));
                        if (lstf.Count != 0)
                        {
                            Mouse.OverrideCursor       = Cursors.Wait;
                            lstf[0].dOneSQuestParametr = GetInformBMZ.SelectBMZ().dOneSQuestParametr;
                            lstf[0].schemeRUVN         = MyBMZ.schemeRUVN;
                            lstf[0].schemeRUNN         = MyBMZ.schemeRUNN;
                            lstf[0].elementFloor       = MyBMZ.elementFloor;
                            GetInformBMZ.GetSelectBMZ(lstf[0]);
                            BuildBMZ(GetInformBMZ.SelectBMZ());
                            var listPlace       = BaseDrawElements.ToList().FindAll(x => x is VMRUVNPlace);
                            var placeforHidesht = listPlace.Find(x =>
                                                                 string.Equals((x as VMRUVNPlace).namePlaceFrame, _placeforHide.namePlaceFrame, System.StringComparison.OrdinalIgnoreCase));
                            _placeforHide = (VMRUVNPlace)placeforHidesht;
                            MainDataParsing(_iCommonData.RUNN_GetCommonData(), AreaType.LowVoltage);
                            Mouse.OverrideCursor = null;
                        }
                        else
                        {
                            DialogAfterNoFind();
                        }
                    }
                }
            }
            break;

            case Selection.RebuildConfig:

                if (_roomType == RoomType.HighVoltage)
                {
                    StartMaster(Handler.RUVN, AreaType.HighVoltage,
                                (int)_iCommonData.RUVN_GetCommonData().ProductType,
                                _iCommonData.RUVN_GetCommonData().FilePath);
                }
                if (_roomType == RoomType.LowVoltage)
                {
                    StartMaster(Handler.RUNN, AreaType.LowVoltage,
                                (int)_iCommonData.RUNN_GetCommonData().ProductType,
                                _iCommonData.RUNN_GetCommonData().FilePath);
                }
                return;

            case Selection.None:
                IToastNotifications.ShowError("Конфигурация не загружена");
                break;
            }
        }