Ejemplo n.º 1
0
        private void DesignerElementDoubleClick(object sender, ElementEventArgs e)
        {
            if (!(e.Element is DiagramBlock))
            {
                return;
            }
            var diagramBlock = (DiagramBlock)e.Element;
            var block        = (BlockBase)diagramBlock.State;

            block.CurrentDirectory = CurrentDirectory;

            BlockSetupBaseForm setupForm;

            if (block.ProcessingType == BlockBase.ProcessingTypeEnum.Export)
            {
                setupForm = new BlockSetupTextForm(ApplicationUtils.GetResourceString(block.Name), ref block);
            }
            else
            {
                setupForm = new BlockSetupPlotForm(ApplicationUtils.GetResourceString(block.Name), ref block);
            }
            setupForm.ShowDialog(this);
            if (setupForm.DialogResult != DialogResult.OK)
            {
                return;
            }

            _propertiesWindow.PropertyGrid.SelectedObject = setupForm.Block;
            _propertiesWindow.PropertyGrid.Refresh();
            _outputWindow.Block = setupForm.Block;
            _outputWindow.Refresh();
            diagramBlock.Refresh(ApplicationUtils.GetResourceImage("img" + setupForm.Block.GetAssemblyClassName() + "Mini", 30, 20), ApplicationUtils.GetResourceString(setupForm.Block.Name), setupForm.Block, setupForm.Block.InputNodes.ToArray(), setupForm.Block.OutputNodes.ToArray(), typeof(BlockOutputNode).GetProperty("ShortName"));
            if (setupForm.InputConnectionsChanged || setupForm.OutputConnectionsChanged)
            {
                var links = Designer.Document.Elements.GetArray();
                foreach (var element in links)
                {
                    var link = element as BaseLinkElement;
                    if (link == null)
                    {
                        continue;
                    }
                    if (link.Connector1.ParentElement == diagramBlock || link.Connector2.ParentElement == diagramBlock)  //if (setupForm.OutputConnectionsChanged && link.Connector1.ParentElement == diagramBlock || setupForm.InputConnectionsChanged && link.Connector2.ParentElement == diagramBlock)
                    {
                        Designer.Document.DeleteLink(link, false);
                    }
                }
            }
            diagramBlock.Invalidate();
            diagramBlock.State = setupForm.Block;
            DocumentModel.Touch();
        }
Ejemplo n.º 2
0
        private void RefreshSelectedDiagramBlock()
        {
            var diagramBlock = Designer.Document.SelectedElements[0] as DiagramBlock;

            if (diagramBlock == null)
            {
                return;
            }
            var block = (BlockBase)diagramBlock.State;

            block.CurrentDirectory = CurrentDirectory;
            diagramBlock.Refresh(ApplicationUtils.GetResourceImage("img" + block.GetAssemblyClassName() + "Mini", 30, 20), ApplicationUtils.GetResourceString(block.Name), block, block.InputNodes.ToArray(), block.OutputNodes.ToArray(), typeof(BlockOutputNode).GetProperty("ShortName"));
        }