コード例 #1
0
        public bool FindIntersectionRect(BaseDrawClass ourSand)
        {
            if (ourSand.Name == "Стена")
            {
                return(false);
            }

            Rectangle RectOur = new Rectangle();
            Rectangle myRect  = new Rectangle();

            myRect = new Rectangle((int)A.X,
                                   (int)A.Y,
                                   (int)ParentEl.Width,
                                   (int)ParentEl.Height);

            RectOur = new Rectangle((int)ourSand.X,
                                    (int)ourSand.Y,
                                    (int)ourSand.ParentEl.Width,
                                    (int)ourSand.ParentEl.Height);

            if (myRect.IntersectsWith(RectOur))
            {
                return(true);
            }
            return(false);
        }
コード例 #2
0
        public bool InterestWall(BaseDrawClass wall)
        {
            Rectangle RectOur = new Rectangle();
            Rectangle myRect  = new Rectangle();

            myRect = new Rectangle((int)X,
                                   (int)Y,
                                   (int)ParentEl.Width,
                                   (int)ParentEl.Height);



            RectOur = new Rectangle((int)wall.X,
                                    (int)wall.Y,
                                    (int)wall.ParentEl.Width,
                                    (int)wall.ParentEl.Height);


            if (RectOur.Contains(myRect))
            {
                return(true);
            }
            return(false);
        }
コード例 #3
0
        public void CellAreaContextMenu(PVMCell cell)
        {
            if (!(_selectedBlock is CellAreaBlock))
            {
                return;
            }

            var contextMenu = new ContextMenu();

            var showObjectInfoMenu = new MenuItem {
                Header = "Просмотреть информацию об объекте"
            };

            var showUserInfoMenu = new MenuItem {
                Header = "Просмотреть информацию о пользователях"
            };

            var showFillDateMenu = new MenuItem {
                Header = "Просмотреть дату заполнения"
            };

            var startMasterMenu = new MenuItem();
            var loadFileMenu    = new MenuItem();
            var unloadFileMenu  = new MenuItem();

            if (((CellAreaBlock)_selectedBlock).CellAreaData.AreaType == AreaType.HighVoltage)
            {
                if (_iCommonData.RUVN_GetCommonData().ProductType == ProductType.Untyped)
                {
                    startMasterMenu.Header = $"Редактировать макет";
                    var           findPlace  = BaseDrawElements.ToList().FindAll(x => (x is VMRUVNPlace));
                    BaseDrawClass allMyPlace = findPlace.Find(x => (x as VMRUVNPlace).idmyCell == cell.idCell); //ТОЛЬКО ОДНОРЯДКИ!!!!!!!!!!!!!
                    _placeforHide          = allMyPlace as VMRUVNPlace;
                    startMasterMenu.Click += delegate { EditMaket(_iCommonData.RUVN_GetCommonData(), cell, (int)allMyPlace.Width, (int)allMyPlace.Height); };
                    loadFileMenu.Header    = "Сменить на конфигурацию";
                    loadFileMenu.Click    += delegate
                    {
                        if (!FileLoad(Handler.RUVN, null))
                        {
                            return;
                        }
                        ClearCellArea(cell);
                        MainDataParsing(_iCommonData.RUVN_GetCommonData(), AreaType.HighVoltage);
                    };
                }
                else
                {
                    loadFileMenu.Header = "Сменить конфигурацию";
                    loadFileMenu.Click += delegate
                    {
                        if (!FileLoad(Handler.RUVN, null))
                        {
                            return;
                        }
                        ClearCellArea(cell);
                        MainDataParsing(_iCommonData.RUVN_GetCommonData(), AreaType.HighVoltage);
                    };
                    showObjectInfoMenu.Click += delegate
                    {
                        Wrapper.ShowNotify($"Запрос: { _iCommonData.RUVN_GetCommonData().ObjectRequest }" +
                                           $"\nНаименование: { _iCommonData.RUVN_GetCommonData().ObjectTitle }" +
                                           $"\nОбъект: { _iCommonData.RUVN_GetCommonData().ObjectInfo }", Constants.AppName);
                    };
                    showUserInfoMenu.Click += delegate
                    {
                        Wrapper.ShowNotify($"Разработал: { _iCommonData.RUVN_GetCommonData().Developer }" +
                                           $"\nУтвердил: { _iCommonData.RUVN_GetCommonData().Approver }", Constants.AppName);
                    };
                    showFillDateMenu.Click += delegate
                    {
                        Wrapper.ShowNotify($"Дата заполнения: { _iCommonData.RUVN_GetCommonData().FillDate }", Constants.AppName);
                    };
                    startMasterMenu.Header = $"Редактировать в {Constants.RUVN_AppName}";
                    startMasterMenu.Click += delegate
                    {
                        StartMaster(Handler.RUVN, AreaType.HighVoltage,
                                    (int)_iCommonData.RUVN_GetCommonData().ProductType,
                                    _iCommonData.RUVN_GetCommonData().FilePath, cell);
                    };
                }

                unloadFileMenu.Header = "Выгрузить конфигурацию";
                unloadFileMenu.Click += delegate { MyBMZ.schemeRUVN = "";  _iCommonData.RUVN_SetCommonData(null); ClearCellArea(cell); ReDrawSubstation(); };
                if (_iCommonData.RUVN_GetCommonData().ProductType != ProductType.Untyped)
                {
                    contextMenu.Items.Add(showObjectInfoMenu);
                    contextMenu.Items.Add(showUserInfoMenu);
                    contextMenu.Items.Add(showFillDateMenu);
                    contextMenu.Items.Add(new Separator());
                }
            }

            if (((CellAreaBlock)_selectedBlock).CellAreaData.AreaType == AreaType.LowVoltage)
            {
                showObjectInfoMenu.Click += delegate
                {
                    Wrapper.ShowNotify($"Запрос: {_iCommonData.RUNN_GetCommonData().ObjectRequest}" +
                                       $"\nНаименование: {_iCommonData.RUNN_GetCommonData().ObjectTitle}" +
                                       $"\nОбъект: {_iCommonData.RUNN_GetCommonData().ObjectInfo}", Constants.AppName);
                };

                showUserInfoMenu.Click += delegate
                {
                    Wrapper.ShowNotify($"Разработал: {_iCommonData.RUNN_GetCommonData().Developer}" +
                                       $"\nУтвердил: {_iCommonData.RUNN_GetCommonData().Approver}", Constants.AppName);
                };

                showFillDateMenu.Click += delegate
                {
                    Wrapper.ShowNotify($"Дата заполнения: {_iCommonData.RUNN_GetCommonData().FillDate}",
                                       Constants.AppName);
                };
                if (_iCommonData.RUNN_GetCommonData().ProductType == ProductType.Untyped)
                {
                    startMasterMenu.Header = $"Редактировать макет";

                    var findPlace  = BaseDrawElements.ToList().FindAll(x => (x is VMRUVNPlace));
                    var allMyPlace = findPlace.Find(x => (x as VMRUVNPlace).idmyCell == cell.idCell); //ТОЛЬКО ОДНОРЯДКИ!!!!!!!!!!!!!
                    startMasterMenu.Click += delegate { EditMaket(_iCommonData.RUNN_GetCommonData(), cell, (int)allMyPlace.Width, (int)allMyPlace.Height); };
                    loadFileMenu.Header    = "Сменить на конфигурацию";
                    loadFileMenu.Click    += delegate
                    {
                        FileLoad(Handler.RUNN, null);
                        ClearCellArea(cell);
                        MainDataParsing(_iCommonData.RUNN_GetCommonData(), AreaType.LowVoltage);
                    };
                }
                else
                {
                    loadFileMenu.Header = "Сменить конфигурацию";
                    loadFileMenu.Click += delegate
                    {
                        FileLoad(Handler.RUNN, null);
                        ClearCellArea(cell);
                        MainDataParsing(_iCommonData.RUNN_GetCommonData(), AreaType.LowVoltage);
                    };
                    startMasterMenu.Header = $"Редактировать в {Constants.RUNN_AppName}";
                    startMasterMenu.Click += delegate
                    {
                        StartMaster(Handler.RUNN, AreaType.LowVoltage,
                                    (int)_iCommonData.RUNN_GetCommonData().ProductType,
                                    _iCommonData.RUNN_GetCommonData().FilePath, cell);
                    };
                }



                unloadFileMenu.Header = "Выгрузить конфигурацию";

                unloadFileMenu.Click += delegate
                {
                    MyBMZ.schemeRUNN = "";
                    _iCommonData.RUNN_SetCommonData(null);
                    ClearCellArea(cell);
                    ReDrawSubstation();
                };


                if (_iCommonData.RUNN_GetCommonData().ProductType != ProductType.Untyped)
                {
                    contextMenu.Items.Add(showObjectInfoMenu);
                    contextMenu.Items.Add(showUserInfoMenu);
                    contextMenu.Items.Add(showFillDateMenu);
                    contextMenu.Items.Add(new Separator());
                }
            }

            contextMenu.Items.Add(startMasterMenu);
            contextMenu.Items.Add(loadFileMenu);
            contextMenu.Items.Add(unloadFileMenu);
            contextMenu.IsOpen = true;
        }