Beispiel #1
0
        /// <summary>
        /// Adds an RDT event wrapper to the grid.
        /// </summary>
        /// <param name="ev"></param>
        public void AddEventToGrid(GenericEvent ev)
        {
            if (ev == null)
            {
                return;
            }

            int             n   = eventGrid.Rows.Add();
            DataGridViewRow row = eventGrid.Rows[n];

            row.Cells["Event"].Value   = ev.EventName;
            row.Cells["Moniker"].Value = ev.DocumentName;
            row.Tag = ev;
        }
Beispiel #2
0
        /// <summary>
        /// Track the event associated with selected grid row in the Properties window.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void eventGrid_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            // Ignore click on header row.
            if (e.RowIndex < 0)
            {
                return;
            }

            // Find the selected row.
            DataGridViewRow row = eventGrid.Rows[e.RowIndex];
            // Recover the associated event object.
            GenericEvent ev = (GenericEvent)row.Tag;

            // Create an array of one event object and track it in the Properties window.
            ArrayList listObjects = new ArrayList();

            listObjects.Add(ev);
            SelectList(listObjects);
        }
        public int OnAfterSave(uint docCookie)
        {
            //For SaveAll, OnAfterSave will be called individually
            if (EDMXFileTools.EdmxTools.RefreshOnSaveEnabled)
            {
                try
                {
                    var ev = new GenericEvent(rdt, "OnAfterSave", docCookie);
                    var document = ev.DocumentName;
                    var extension = System.IO.Path.GetExtension(document);

                    //We'll make assumuption that the extension won't change.
                    if (extension.Equals(".edmx"))
                    {
                        DTE dte = Package.GetGlobalService(typeof(DTE)) as DTE;
                        foreach (Document doc in dte.Documents)
                        {
                            //Using a full path comparision, the match wil be unique.
                            if (doc.FullName.Equals(ev.DocumentMoniker))
                            {
                                closingDocument = ev.DocumentMoniker;
                                doc.Close();
                                return VSConstants.S_OK;
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                    throw new Exception(String.Format("EdmxFileTools Error reactivating {0}, {1}", closingDocument, ex.Message));
                }
            }
            return VSConstants.S_OK;
        }
        /// <summary>
        /// Adds an RDT event wrapper to the grid.
        /// </summary>
        /// <param name="ev"></param>
        public void AddEventToGrid(GenericEvent ev)
        {
            if (ev == null) return;

            int n = eventGrid.Rows.Add();
            DataGridViewRow row = eventGrid.Rows[n];
            row.Cells["Event"].Value = ev.EventName;
            row.Cells["Moniker"].Value = ev.DocumentName;
            row.Tag = ev;
        }