Exemplo n.º 1
0
        private List <ShapeInfo> getAllConnectors(VisioDrawing v)
        {
            List <ShapeInfo> list = new List <ShapeInfo>();
            AxDrawingControl dc   = v.visioControl;

            Visio.Page currentPage = dc.Window.Application.ActivePage;
            foreach (Visio.Shape shp in currentPage.Shapes)
            {
                if (shp.NameU.Contains("Connector"))
                {
                    ShapeInfo si = new ShapeInfo();
                    si.NameU = shp.NameU;
                    si.Text  = shp.Text;
                    list.Add(si);
                }
            }
            return(list);
        }
Exemplo n.º 2
0
        /// <summary>
        /// public constructor
        /// </summary>
        /// <param name="aDwgCtrl">drawing control on which the core connections diagram should be drawn</param>
        public CoreConnectionsDiagram(AxDrawingControl aDwgCtrl)
        {
            mDwgCtrl = aDwgCtrl;
            Visio.Application _appl = aDwgCtrl.Document.Application;

            // convert constants from millimeters to inches
            mMargin = _appl.ConvertResult(MARGIN_MM, Visio.VisUnitCodes.visMillimeters, Visio.VisUnitCodes.visInches);
            mTableHeaderCellWidth = _appl.ConvertResult(TABLE_HEADER_CELL_HEIGHT_MM, Visio.VisUnitCodes.visMillimeters, Visio.VisUnitCodes.visInches);

            mSingleWidth  = _appl.ConvertResult(SINGLE_WIDTH_MM, Visio.VisUnitCodes.visMillimeters, Visio.VisUnitCodes.visInches);
            mSingleHeight = _appl.ConvertResult(SINGLE_HEIGHT_MM, Visio.VisUnitCodes.visMillimeters, Visio.VisUnitCodes.visInches);
            mInitialPosX  = _appl.ConvertResult(INITIAL_POS_X_MM, Visio.VisUnitCodes.visMillimeters, Visio.VisUnitCodes.visInches);
            mInitialPosY  = _appl.ConvertResult(INITIAL_POS_Y_MM, Visio.VisUnitCodes.visMillimeters, Visio.VisUnitCodes.visInches) - mMargin;

            mCablePosX  = _appl.ConvertResult(CABLE_CELL_POS_X_MM, Visio.VisUnitCodes.visMillimeters, Visio.VisUnitCodes.visInches) + mMargin;
            mCableWidth = _appl.ConvertResult(CABLE_CELL_WIDTH_MM, Visio.VisUnitCodes.visMillimeters, Visio.VisUnitCodes.visInches);

            mCoreWidth    = _appl.ConvertResult(CORE_CELL_WIDTH_MM, Visio.VisUnitCodes.visMillimeters, Visio.VisUnitCodes.visInches);
            mCoreHeight   = _appl.ConvertResult(CORE_CELL_HEIGHT_MM, Visio.VisUnitCodes.visMillimeters, Visio.VisUnitCodes.visInches);
            mElconnWidth  = _appl.ConvertResult(ELCONN_CELL_WIDTH_MM, Visio.VisUnitCodes.visMillimeters, Visio.VisUnitCodes.visInches);
            mEquiWidth    = _appl.ConvertResult(EQUI_CELL_WIDTH_MM, Visio.VisUnitCodes.visMillimeters, Visio.VisUnitCodes.visInches);
            mSpaceBetween = _appl.ConvertResult(SPACE_BETWEEN_CELLS_MM, Visio.VisUnitCodes.visMillimeters, Visio.VisUnitCodes.visInches);
        }
Exemplo n.º 3
0
        public MainForm()
        {
            InitializeComponent();

            //Create LINQ classes for database
            db = new rbacLINQ2SQLDataContext();

            //Create bindings to rbacDataSet (local in-memory copy for rbac.mdf, IMHO)
            dataGV_Tables.DataSource = bindingSource_Tables;

            /////combobox_Tables initialization with Table names in <dbo.Table_name> format
            //var q = from t in db.Mapping.GetTables()
            //        select t.TableName;
            //cb_Tables.Items.AddRange(q.ToArray());

            /////testing auto-generated forms for tables
            //new Form1().Show();
            /////1. testing TableAdapterManager for the Role-table edit procedure
            //roleTableAdapter1.Fill(rbacDataSet.Role);

            //axDrawing
            axDrawingControl = axDrawingControl1;
        }
        /// <summary>
        /// public constructor
        /// </summary>
        /// <param name="aDwgCtrl">drawing control on which the core connections diagram should be drawn</param>
        public CoreConnectionsDiagram( AxDrawingControl aDwgCtrl )
        {
            mDwgCtrl = aDwgCtrl;
            Visio.Application _appl = aDwgCtrl.Document.Application;

            // convert constants from millimeters to inches
            mMargin = _appl.ConvertResult( MARGIN_MM, Visio.VisUnitCodes.visMillimeters, Visio.VisUnitCodes.visInches );
            mTableHeaderCellWidth = _appl.ConvertResult( TABLE_HEADER_CELL_HEIGHT_MM, Visio.VisUnitCodes.visMillimeters, Visio.VisUnitCodes.visInches );

            mSingleWidth = _appl.ConvertResult( SINGLE_WIDTH_MM, Visio.VisUnitCodes.visMillimeters, Visio.VisUnitCodes.visInches );
            mSingleHeight = _appl.ConvertResult( SINGLE_HEIGHT_MM, Visio.VisUnitCodes.visMillimeters, Visio.VisUnitCodes.visInches );
            mInitialPosX = _appl.ConvertResult( INITIAL_POS_X_MM, Visio.VisUnitCodes.visMillimeters, Visio.VisUnitCodes.visInches );
            mInitialPosY = _appl.ConvertResult( INITIAL_POS_Y_MM, Visio.VisUnitCodes.visMillimeters, Visio.VisUnitCodes.visInches ) - mMargin;

            mCablePosX = _appl.ConvertResult( CABLE_CELL_POS_X_MM, Visio.VisUnitCodes.visMillimeters, Visio.VisUnitCodes.visInches ) + mMargin;
            mCableWidth = _appl.ConvertResult( CABLE_CELL_WIDTH_MM, Visio.VisUnitCodes.visMillimeters, Visio.VisUnitCodes.visInches );

            mCoreWidth = _appl.ConvertResult( CORE_CELL_WIDTH_MM, Visio.VisUnitCodes.visMillimeters, Visio.VisUnitCodes.visInches );
            mCoreHeight = _appl.ConvertResult( CORE_CELL_HEIGHT_MM, Visio.VisUnitCodes.visMillimeters, Visio.VisUnitCodes.visInches );
            mElconnWidth = _appl.ConvertResult( ELCONN_CELL_WIDTH_MM, Visio.VisUnitCodes.visMillimeters, Visio.VisUnitCodes.visInches );
            mEquiWidth = _appl.ConvertResult( EQUI_CELL_WIDTH_MM, Visio.VisUnitCodes.visMillimeters, Visio.VisUnitCodes.visInches );
            mSpaceBetween = _appl.ConvertResult( SPACE_BETWEEN_CELLS_MM, Visio.VisUnitCodes.visMillimeters, Visio.VisUnitCodes.visInches );
        }
Exemplo n.º 5
0
        public override void Execute()
        {
            // if is already executing do nothing
            if (mExecuting)
            {
                return;
            }

            mExecuting = true;

            try
            {
                AxDrawingControl _activeCtrl = null;

                //get drawing for which the core connections diagram should be generated
                DrawingControlWindow _wnd = diagApp.GetCurrentDrawingControl();
                if (_wnd != null)
                {
                    _activeCtrl = _wnd.mVisioDrawingControl.ActiveXDrawingControl;
                }

                ArrayList _cableList = new ArrayList();

                // if drawing is found
                if (_activeCtrl != null)
                {
                    // get active window
                    Visio.Window _actWindow = _activeCtrl.Document.Application.ActiveWindow;
                    // get selection
                    Visio.Selection _selection = _actWindow.Selection;
                    _selection.IterationMode &= ~(int)Visio.VisSelectMode.visSelModeSkipSub;

                    // get cables from selection or from all document (if nothing is selected)
                    if (_selection.Count > 0)
                    {
                        foreach (Visio.Shape _shape in _selection)
                        {
                            CheckAddShape(_shape, _cableList);
                        }
                    }
                    else
                    {
                        foreach (Visio.Page _page in ((AxDrawingControl)_activeCtrl).Document.Pages)
                        {
                            foreach (Visio.Shape _shape in _page.Shapes)
                            {
                                CheckAddShape(_shape, _cableList);
                            }
                        }
                    }
                }

                if (_cableList.Count == 0)
                {
                    System.Windows.Forms.MessageBox.Show("Cannot get cables for Core Connections Diagram!", "Core Connections Diagram");
                    return;
                }

                //create new empty diagram
                DrawingControlWindow _dwgInstance = new DrawingControlWindow();
                AxDrawingControl     _newDwgCtrl  = null;

                if (_dwgInstance != null)
                {
                    _newDwgCtrl = _dwgInstance.NewDiagram();
                }

                if (_newDwgCtrl != null)
                {
                    CoreConnectionsDiagram _diag = new CoreConnectionsDiagram(_newDwgCtrl);
                    _diag.DrawSchema(_cableList);
                    DrawingManager.SaveNewDrawingToDb(_dwgInstance);
                }
            }
            catch (Exception _ex)
            {
                Console.WriteLine(_ex.ToString());
            }
            finally
            {
                mExecuting = false;
            }
        }