private void CbxCategories_SelectionChangeCommitted(object sender, EventArgs e) { ClearComboBox(CbxSourceParameters); ClearComboBox(CbxTargetParameters); Category cat = CbxCategories.SelectedItem as Category; if (GetInstances(m_doc, cat).Count < 1) { using (UI.Info.Form_Info2 thisForm = new UI.Info.Form_Info2()) { thisForm.ShowDialog(); } LblParamTypeSource.Text = ""; LblParamTypeTarget.Text = ""; } else { if (RbtSourceParam.Checked == true) // if source param radio button checked, load sourceParam combo box { PopulateSourceComboBox(CbxSourceParameters, m_doc, cat); SetTypeParameterLabel(LblParamTypeSource, CbxSourceParameters); LblParamTypeTarget.Text = ""; } else // if element id checked, load target text parameters { try { PopulateTargetComboBoxTextParams(CbxTargetParameters, m_doc, cat); LblParamTypeTarget.Text = ""; // reset label before re-set SetTypeParameterLabel(LblParamTypeTarget, CbxTargetParameters); } catch (Exception) { } } } if (RbtElementId.Checked == true) { LblParamTypeSource.Text = "Element Id will always be transferred as Text"; // reset parameter type label } }
private void BtnOK_Click(object sender, EventArgs e) { // list of checked indices List <int> checkedIndices = new List <int>(); foreach (int index in LsvUnused.CheckedIndices) { checkedIndices.Add(index); } // message if there are no items selected if (LsvUnused.CheckedIndices.Count == 0) { using (UI.Info.Form_Info2 thisForm = new UI.Info.Form_Info2()) { thisForm.ShowDialog(); } } else // go ahead with deleting { // list of ElementIds of selected items List <ElementId> unusedItems = unusedTypesIds; List <ElementId> selectedItems = new List <ElementId>(); foreach (int index in checkedIndices) { selectedItems.Add(unusedItems[index]); } // delete items using (Transaction t = new Transaction(m_doc, "Purge Dimension Styles")) { t.Start(); foreach (ElementId eid in selectedItems) { try { infoList.Add(m_doc.GetElement(eid).Name); nOfItems += 1; m_doc.Delete(eid); } catch (Exception) { itemExceptList.Add(m_doc.GetElement(eid).Name); infoList.Remove(m_doc.GetElement(eid).Name); nOfItems -= 1; continue; } } t.Commit(); } // show results form using (UI.Info.Form_Results thisForm = new UI.Info.Form_Results()) { thisForm.ShowDialog(); } this.DialogResult = DialogResult.OK; //try //{ // Utilities.GetAnalyticsCSV(m_doc, m_app); //} //catch (Exception) //{ //} } }
private void BtnAddParameters_Click(object sender, EventArgs e) { #region get all checked parameters List <Definition> defList = new List <Definition>(); foreach (TreeNode n1 in TreeViewParameters.Nodes) { foreach (TreeNode n2 in n1.Nodes) { if (n2.Checked == true) { defList.Add(n2.Tag as Definition); } } } #endregion #region get all checked categories List <Category> catList = new List <Category>(); if (m_doc.IsFamilyDocument == true) { catList.Add(m_doc.OwnerFamily.FamilyCategory); } else { foreach (TreeNode c in TreeViewCategories.Nodes) { if (c.Checked == true) { catList.Add(c.Tag as Category); } } } #endregion // Check if selected: Shared Parameter FILE, Parameters and Categories if (m_app.OpenSharedParameterFile() == null | defList.Count == 0 | catList.Count == 0) { using (UI.Info.Form_Info1 thisForm = new UI.Info.Form_Info1()) { thisForm.ShowDialog(); } } // Load parameters else { // get parameter group KeyValuePair <BuiltInParameterGroup, string> groupKeyValuePair = (KeyValuePair <BuiltInParameterGroup, string>)CbxGroup.SelectedItem; BuiltInParameterGroup group = groupKeyValuePair.Key; // Bind the Definitions Data.Helpers.BindDefinitionsToCategories(m_doc, m_app, defList, catList, group, RbtInstance.Checked); // show Results Form using (UI.Info.Form_Results thisForm = new Info.Form_Results()) { thisForm.ShowDialog(); } // show form Do you want to load more parameters? using (UI.Info.Form_Info2 thisForm = new UI.Info.Form_Info2()) { thisForm.ShowDialog(); if (thisForm.DialogResult == DialogResult.No) { this.DialogResult = DialogResult.OK; } } // uncheck parameters foreach (TreeNode n in TreeViewParameters.Nodes) // parents { n.Checked = false; foreach (TreeNode c in n.Nodes) // children { c.Checked = false; } } // uncheck categories foreach (TreeNode n in TreeViewCategories.Nodes) { n.Checked = false; } } }
private void btnOK_Click(object sender, EventArgs e) { //get list of checked indices List <int> checkedIndices = new List <int>(); foreach (int indexChecked in clbViewFilters.CheckedIndices) { checkedIndices.Add(indexChecked); } //check if there are any boxes checked if (!checkedIndices.Any()) { using (UI.Info.Form_Info2 thisForm = new UI.Info.Form_Info2()) { thisForm.ShowDialog(); } } else { //get list of selected filter elements so they can be deleted List <ParameterFilterElement> AllUnusedFilters = DeleteUnusedFilters.Helpers.GetUnusedFilterElem(m_doc); List <ParameterFilterElement> SelectedFilters = new List <ParameterFilterElement>(); foreach (int index in checkedIndices) { SelectedFilters.Add(AllUnusedFilters[index]); } //deletes selected filters using (Transaction t = new Transaction(m_doc, "Delete filters")) { t.Start(); foreach (ParameterFilterElement pfe in SelectedFilters) { listInfo.Add(pfe.Name); info += pfe.Name + "\n"; nOfFilters += 1; m_doc.Delete(pfe.Id); } t.Commit(); } // show Results Form using (UI.Info.Form_Results thisForm = new UI.Info.Form_Results()) { thisForm.ShowDialog(); } //try //{ // Utilities.GetAnalyticsCSV(m_doc, m_app); //} //catch (Exception) //{ //} DialogResult = DialogResult.OK; Close(); } }
private void btnOK_Click(object sender, EventArgs e) { // get list of checked indices List <int> checkedIndices = new List <int>(); foreach (int index in clbUnused.CheckedIndices) { checkedIndices.Add(index); } // check if there are any boxes checked if (!checkedIndices.Any()) { using (UI.Info.Form_Info2 thisForm = new UI.Info.Form_Info2()) { thisForm.ShowDialog(); } } else { List <ElementId> unusedItems = Helpers.GetUnusedTextNoteTypes(m_doc).ToList(); List <ElementId> selectedItems = new List <ElementId>(); foreach (int index in checkedIndices) { selectedItems.Add(unusedItems[index]); } // delete selected filters using (Transaction t = new Transaction(m_doc, "Purge Text Note Types")) { t.Start(); foreach (ElementId eId in selectedItems) { try { infoList.Add(m_doc.GetElement(eId).Name); nOfItems += 1; m_doc.Delete(eId); } catch (Exception) { itemExceptList.Add(m_doc.GetElement(eId).Name); infoList.Remove(m_doc.GetElement(eId).Name); nOfItems -= 1; continue; } } t.Commit(); } // show Results Form using (UI.Info.Form_Results thisForm = new UI.Info.Form_Results()) { thisForm.ShowDialog(); } //try //{ // Utilities.GetAnalyticsCSV(m_doc, m_app); // //GetAnalyticsCSV(m_doc, m_app); //} //catch (Exception) //{ //} this.DialogResult = DialogResult.OK; Close(); } }