public AreaWindow(UIApplication uiapp, Dictionary <string, RevitDocumentProperties> models, Dictionary <string, AreaProperties> dictionary)
        {
            app             = uiapp;
            doc             = app.ActiveUIDocument.Document;
            modelDictionary = models;
            AreaDictionary  = dictionary;

            InitializeComponent();

            Title = "Create Mass v." + System.Reflection.Assembly.GetExecutingAssembly().GetName().Version;

            var documents = modelDictionary.Values.OrderBy(o => o.DocumentTitle).ToList();

            comboBoxModel.ItemsSource = documents;

            //area elements only in host doc
            var index = documents.FindIndex(o => o.IsLinked == false);

            if (index > -1)
            {
                comboBoxModel.SelectedIndex = index;
            }

            massConfig = MassConfigDataStorageUtil.GetMassConfiguration(doc, SourceType.Areas);
            massConfig.MassSourceType = SourceType.Areas;
            massConfig.HostCategory   = "Areas";
            massConfig.MassCategory   = "Mass";
            if (massConfig.UpdateType == ParameterUpdateType.FromHostToMass)
            {
                expanderParameter.Header = "Linked Parameters - (Areas to Masses)";
            }
            else if (massConfig.UpdateType == ParameterUpdateType.FromMassToHost)
            {
                expanderParameter.Header = "Linked Parameters - (Masses to Areas)";
            }
            dataGridParameters.ItemsSource = null;
            dataGridParameters.ItemsSource = massConfig.MassParameters;
        }
示例#2
0
        private void buttonApply_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if ((bool)radioButtonHostToMass.IsChecked)
                {
                    massConfig.UpdateType = ParameterUpdateType.FromHostToMass;
                }
                else if ((bool)radioButtonMassToHost.IsChecked)
                {
                    massConfig.UpdateType = ParameterUpdateType.FromMassToHost;
                }

                massConfig.MassParameters = mapInfoList;

                bool stored = MassConfigDataStorageUtil.StoreMassConfiguration(m_doc, massConfig);
                this.DialogResult = true;
            }
            catch (Exception ex)
            {
                MessageBox.Show("Failed to set the configuration.\n" + ex.Message, "Mass Configuration", MessageBoxButton.OK, MessageBoxImage.Warning);
            }
        }