This class contains the data for hosted sweep creation.
Пример #1
0
 /// <summary>
 /// Customize constructor.
 /// </summary>
 /// <param name="creationData"></param>
 public EdgeFetchForm(CreationData creationData)
     : this()
 {
     m_creationData = creationData;
     treeViewHost.StateImageList = imageListForCheckBox;
     m_trackBall = new TrackBall();
 }
Пример #2
0
        /// <summary>
        /// Create a hosted-sweep according to the CreationData parameter.
        /// </summary>
        /// <param name="creationData">CreationData parameter</param>
        /// <returns>ModificationData which contains the created hosted-sweep</returns>
        public ModificationData Create(CreationData creationData)
        {
            ReferenceArray refArr = new ReferenceArray();

            foreach (Edge edge in creationData.EdgesForHostedSweep)
            {
                refArr.Append(edge.Reference);
            }

            ModificationData modificationData = null;
            Transaction      transaction      = new Transaction(m_rvtDoc, "CreateHostedSweep");

            try
            {
                transaction.Start();
                HostedSweep createdHostedSweep = CreateHostedSweep(creationData.Symbol, refArr);

                if (transaction.Commit() == TransactionStatus.Committed)
                {
                    m_rvtUIDoc.ShowElements(createdHostedSweep);

                    // just only end transaction return true, we will create the hosted sweep.
                    modificationData =
                        new ModificationData(createdHostedSweep, creationData);
                    m_createdHostedSweeps.Add(modificationData);
                }
            }
            catch
            {
                transaction.RollBack();
            }
            return(modificationData);
        }
Пример #3
0
        /// <summary>
        /// Convert CreationData to string.
        /// </summary>
        /// <param name="context"></param>
        /// <param name="culture"></param>
        /// <param name="value"></param>
        /// <param name="destinationType"></param>
        /// <returns></returns>
        public override object ConvertTo(ITypeDescriptorContext context,
                                         System.Globalization.CultureInfo culture, object value, Type destinationType)
        {
            CreationData cd = value as CreationData;

            if (cd != null)
            {
                return("Total " + cd.EdgesForHostedSweep.Count + " Edges");
            }
            return(base.ConvertTo(context, culture, value, destinationType));
        }
Пример #4
0
        /// <summary>
        /// Show a form to fetch edges for hosted-sweep creation, and then create
        /// the hosted-sweep.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void buttonCreate_Click(object sender, EventArgs e)
        {
            HostedSweepCreator creator =
                comboBoxHostedSweepType.SelectedItem as HostedSweepCreator;

            CreationData creationData = new CreationData(creator);

            using (EdgeFetchForm createForm = new EdgeFetchForm(creationData))
            {
                if (createForm.ShowDialog() == DialogResult.OK)
                {
                    creator.Create(creationData);
                    RefreshListBox();
                }
            }
        }
Пример #5
0
        /// <summary>
        /// Constructor with HostedSweep and CreationData as parameters.
        /// </summary>
        /// <param name="elem">Element to modify</param>
        /// <param name="creationData">CreationData</param>
        public ModificationData(HostedSweep elem, CreationData creationData)
        {
            m_rvtDoc       = creationData.Creator.RvtDocument;
            m_rvtUIDoc     = creationData.Creator.RvtUIDocument;
            m_elemToModify = elem;
            m_creationData = creationData;

            m_transaction = new Transaction(m_rvtDoc, "External Tool");

            m_creationData.EdgeAdded +=
                new CreationData.EdgeEventHandler(m_creationData_EdgeAdded);
            m_creationData.EdgeRemoved +=
                new CreationData.EdgeEventHandler(m_creationData_EdgeRemoved);
            m_creationData.SymbolChanged +=
                new CreationData.SymbolChangedEventHandler(m_creationData_SymbolChanged);
        }
Пример #6
0
        /// <summary>
        /// Constructor with HostedSweep and CreationData as parameters.
        /// </summary>
        /// <param name="elem">Element to modify</param>
        /// <param name="creationData">CreationData</param>
        public ModificationData(HostedSweep elem, CreationData creationData)
        {
            m_rvtDoc = creationData.Creator.RvtDocument;
            m_rvtUIDoc = creationData.Creator.RvtUIDocument;
            m_elemToModify = elem;
            m_creationData = creationData;

            m_transaction = new Transaction(m_rvtDoc, "External Tool");

            m_creationData.EdgeAdded +=
                new CreationData.EdgeEventHandler(m_creationData_EdgeAdded);
            m_creationData.EdgeRemoved +=
                new CreationData.EdgeEventHandler(m_creationData_EdgeRemoved);
            m_creationData.SymbolChanged +=
                new CreationData.SymbolChangedEventHandler(m_creationData_SymbolChanged);
        }
Пример #7
0
        /// <summary>
        /// Show a form to add or remove edges from hosted sweep, and also can change the
        /// type of hosted sweep.
        /// </summary>
        /// <param name="context"></param>
        /// <param name="provider"></param>
        /// <param name="value"></param>
        /// <returns></returns>
        public override object EditValue(System.ComponentModel.ITypeDescriptorContext context,
                                         IServiceProvider provider, object value)
        {
            IWindowsFormsEditorService winSrv = (IWindowsFormsEditorService)provider.
                                                GetService(typeof(IWindowsFormsEditorService));

            CreationData creationData = value as CreationData;

            creationData.BackUp();
            using (EdgeFetchForm form = new EdgeFetchForm(creationData))
            {
                if (winSrv.ShowDialog(form) == System.Windows.Forms.DialogResult.OK)
                {
                    creationData.Update();
                }
                else
                {
                    creationData.Restore();
                }
            }
            return(creationData);
        }
Пример #8
0
        /// <summary>
        /// Show a form to fetch edges for hosted-sweep creation, and then create 
        /// the hosted-sweep.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void buttonCreate_Click(object sender, EventArgs e)
        {
            HostedSweepCreator creator =
                comboBoxHostedSweepType.SelectedItem as HostedSweepCreator;

            CreationData creationData = new CreationData(creator);

            using (EdgeFetchForm createForm = new EdgeFetchForm(creationData))
            {
                if (createForm.ShowDialog() == DialogResult.OK)
                {
                    creator.Create(creationData);
                    RefreshListBox();
                }
            }
        }
Пример #9
0
        /// <summary>
        /// Create a hosted-sweep according to the CreationData parameter.
        /// </summary>
        /// <param name="creationData">CreationData parameter</param>
        /// <returns>ModificationData which contains the created hosted-sweep</returns>
        public ModificationData Create(CreationData creationData)
        {
            ReferenceArray refArr = new ReferenceArray();
            foreach (Edge edge in creationData.EdgesForHostedSweep)
            {
                refArr.Append(edge.Reference);
            }

            ModificationData modificationData = null;
            Transaction transaction = new Transaction(m_rvtDoc, "CreateHostedSweep");
            try
            {
                transaction.Start();
                HostedSweep createdHostedSweep = CreateHostedSweep(creationData.Symbol, refArr);

                if (transaction.Commit() == TransactionStatus.Committed)
                {
                    m_rvtUIDoc.ShowElements(createdHostedSweep);

                    // just only end transaction return true, we will create the hosted sweep.
                    modificationData =
                        new ModificationData(createdHostedSweep, creationData);
                    m_createdHostedSweeps.Add(modificationData);
                }
            }
            catch
            {
                transaction.RollBack();
            }
            return modificationData;
        }
Пример #10
0
 /// <summary>
 /// Customize constructor.
 /// </summary>
 /// <param name="creationData"></param>
 public EdgeFetchForm(CreationData creationData)
     : this()
 {
     m_creationData = creationData;
     treeViewHost.StateImageList = imageListForCheckBox;
     m_trackBall = new TrackBall();
 }