//get the entry from the textbox private void runRenumbering(object obj) { handler.mode = selectionMode.Run; logic.setStartingParameterName(_selectedParamName); logic.setStartinParameterNumber(_startingStringEntryBase); exEvent.Raise(); }
private void buttonDuplicate_Click(object sender, RoutedEventArgs e) { try { if (null != selectedLink) { var catList = (List <CategoryProperties>)dataGridCategory.ItemsSource; var dictionary = catList.Distinct().ToDictionary(x => x.CategoryId, x => x); selectedLink.Categories = dictionary; m_handler.SelectedLink = selectedLink; var updateMode = UpdateMode.None; if ((bool)radioButtonLocation.IsChecked) { updateMode = UpdateMode.UpdateLocationOnly; } if ((bool)radioButtonReplace.IsChecked) { updateMode = UpdateMode.ReplaceElements; } m_handler.SelectedUpdateMode = updateMode; m_handler.MoverRequest.Make(RequestId.DuplicateElements); m_event.Raise(); SetFocus(); } } catch (Exception ex) { MessageBox.Show("Failed to duplicate elements.\n" + ex.Message, "Duplicate Elements", MessageBoxButton.OK, MessageBoxImage.Warning); } }
private void 创建实例ToolStripMenuItem_Click(object sender, EventArgs e) { if (listView.SelectedItems.Count > 0) { familyName = listView.SelectedItems[0].Text; var directory = Path.Combine(Path.GetTempPath(), "Bimcc"); Directory.CreateDirectory(directory); fileName = Path.Combine(directory, familyName + ".rfa"); if (File.Exists(fileName)) { // } else { var http = new WebClient(); http.DownloadFile("http://img01.pinming.cn/8a9b6c3d6209756f01621d38a19a01de.rfa?Expires=1532929251&OSSAccessKeyId=LTAI8ZbJOm3c5VVZ&Signature=dOA6DRrM2eQxtfg7qwjtYpvO73c%3D", fileName); } Hide(); exEvent.Raise(); } }
//------------------------------------------------------- private void Update_Click(object sender, RoutedEventArgs e) { try { int index = 0; index = data_update.SelectedIndex; Element_Change item = (Element_Change)data_update.Items[index]; if (item.changeORignore && item.color == Source.color_not_change) { ObservableCollection <Element_Change> element_Changes = new ObservableCollection <Element_Change>(); element_Changes.Add(item); my_change.element_Changes = element_Changes; my_change.my_element_change = my_element_change; my_change.doc_link = doc_link; my_change.data_update = data_update; my_change.link_file = link_file; e_change.Raise(); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void Hight_Lights_Filter(object sender, RoutedEventArgs e) { try { ids = new List <ElementId>(); if (my_parameters_value.Where(x => x.check == true).ToList().Count() > 0) { my_parameters_value.Where(x => x.check == true).Select(y => y.elements).ToList().ForEach(z => z.ForEach(i => ids.Add(i.Id))); } else if (my_parameters.Where(x => x.check == true).ToList().Count() > 0) { my_parameters.Where(x => x.check == true).Select(y => y.elements).ToList().ForEach(z => z.ForEach(i => ids.Add(i.Id))); } else if (my_type.Where(x => x.check == true).ToList().Count() > 0) { my_type.Where(x => x.check == true).Select(y => y.elements).ToList().ForEach(z => z.ForEach(i => ids.Add(i.Id))); } else if (my_family.Where(x => x.check == true).ToList().Count() > 0) { my_family.Where(x => x.check == true).Select(y => y.elements).ToList().ForEach(z => z.ForEach(i => ids.Add(i.Id))); } else if (my_category.Where(x => x.check == true).ToList().Count() > 0) { my_category.Where(x => x.check == true).Select(y => y.elements).ToList().ForEach(z => z.ForEach(i => ids.Add(i.Id))); } my_high_lights.ids = ids; e_high_lights.Raise(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void beamsFromWallsWindow_Closed(object sender, EventArgs e) { isShowned = false; beamFromWallsCurrentOperation = ExternalOperation.Unsubscribe; localExternalEvent.Raise(); base.Close(); }
private void dataGrid_MouseDoubleClick(object sender, MouseButtonEventArgs e) { m_ExEvent.Raise(); var instance = dataGrid.SelectedItem as FamilyData; Properties.Settings.Default.FamilyPath = instance.FullName; Properties.Settings.Default.FamilySymbol = instance.Name; }
private void JoinElementsWindow_Closed(object sender, EventArgs e) { isShowned = false; selectElementsSelectOperation = SelectElementsToJoin.unsubscribe; currentExternalEvent.Raise(); base.Close(); }
private void dataGrid_MouseDoubleClick(object sender, MouseButtonEventArgs e) { if (dataGrid.Items.Count <= 0) { return; } var instance = dataGrid.SelectedItem as FamilyData; SetProperty(instance); m_ExEvent.Raise(); }
//---------------------------------------------------------- public void Function_Draw() { try { Data_For_Extenal_Draw(); myExternal_Draw.command = "Draw By Revit"; Draw.Raise(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
/// <summary> /// Sets required <paramref name="func"/> as a body /// of <see cref="IExternalEventHandler.Execute(UIApplication)"/> /// method and raises related <see cref="Autodesk.Revit.UI.ExternalEvent"/> /// </summary> /// <param name="func">Any function that depends on /// <see cref="Autodesk.Revit.UI.UIApplication"/> /// and results in object of <see cref="TResult"/> type.</param> public Task <TResult> Run <TResult>(Func <UIApplication, TResult> func) { _tcs = new TaskCompletionSource <object>(); var task = Task.Run(async() => (TResult)await _tcs.Task); _handler.Func = (app) => func(app); _externalEvent.Raise(); //// var task = Task.FromResult((TResult)_tcs.Task.Result); return(task); }
private void CheckBasicInfo_Click(object sender, RoutedEventArgs e) { m_basicInfo.SelMethod = MtGlobals.BasicInfoMethods.MarkBasicInfo; m_basicInfoEventHandler.Raise(); MtLog.message = "Check BasicInfo Finished!"; MessageContent.Content = MtLog.message; }
// The action function for ConnectButtonAction /// <summary> /// Если в списке уже есть tagItem с таким ТЭГом, то заменяем его, если нет - добавляем в список /// </summary> private void ConnectButtonAction() { RevitModel.getTwoElements(); if (RevitModel.IsTwoElementsSelected) { connectEvent.Raise(); int idx; if (NewTag != null) { //внесение правки в существующий элемент списка или добавление нового if (TagItems.Any(i => i.ModelId == NewTag.ModelId)) { TagItem t = TagItems.Where(i => i.ModelId == NewTag.ModelId).First(); idx = TagItems.IndexOf(t); TagItems[idx] = NewTag; } else { TagItems.Add(NewTag); } } } }
private void FamiliesDataGrid_OnMouseLeave(object sender, MouseEventArgs e) { if (!string.IsNullOrEmpty(Properties.Settings.Default.FamilyType)) { m_ExEvent.Raise(); } }
//-------------------------------------------------------------------------------------------------------------------------------------------------------------- private void Draw_Opening(object sender, RoutedEventArgs e) { if (by_revit.IsChecked == true) { Data_For_ExtenalEvent(); myExampleDraw.command = "Draw By Revit"; Draw.Raise(); } else { Data_For_ExtenalEvent(); myExampleDraw.command = "Draw By CAD"; Draw.Raise(); } data_point.Clear(); }
private void MakeRequest(RequestId request) { m_Handler.Request.Make(request); m_ExEvent.Raise(); //Request.Make(request); //DozeOff(); }
public void SetAction(ElementId elementId, string tName = "DeleteElement", Document doc = null) { _elementId = elementId; _doc = doc; _tName = tName; _exEvent.Raise(); }
internal void Run(DocumentViewModel documentViewModel) { Result = string.Empty; IsRunning = Visibility.Visible; _scriptRunnerHandler.ScriptText = documentViewModel.Text; _externalEvent.Raise(); }
/// <summary> /// Trigger a modification tracker snapshot at /// regular intervals. Relinquish control and wait /// for the specified timeout period between each /// snapshot. This method runs in a separate thread. /// </summary> static void TriggerModificationLogger() { while (true) { ++_nSnapshots; Util.Log(string.Format( "TriggerModificationLogger snapshot {0}", _nSnapshots)); _event.Raise(); // Set focus to Revit for a moment. // Without this, Revit will not forward the // event Raise to the external event handler // Execute method until the Revit window is // activated. This causes the screen to flash. SetFocusToRevit(); // Wait and relinquish control // before next snapshot. Thread.Sleep(_timeout); } }
public void Run(Action doAction, Document doc = null, string transactionName = null) { this.doAction = doAction; this.doc = doc; this.transactionName = transactionName; exEvent.Raise(); }
/// <summary> /// Un metodo di supporto privato per effettuare una richiesta /// e allo stesso tempo mettere la finestra di dialogo in sospensione. /// </summary> /// <remarks> /// Ci si aspetta che il processo che esegue la richiesta /// (l'helper Idling in questo caso particolare) /// riattivi anche la finestra di dialogo dopo aver terminato l'esecuzione. /// </remarks> /// private void MakeRequest(RequestId request) { App.thisApp.DontShowFormTop(); m_Handler.Request.Make(request); m_ExEvent.Raise(); DozeOff(); }
//--------------------------------------------------------------------------------------------------- #region Clash Child Item private void Hight_Lights(object sender, MouseButtonEventArgs e) { my_Image = new ObservableCollection <Image_Solution>(); try { child item = (child)thong_tin_clash_child.SelectedItem; if (item != null) { foreach (ImageSource imageSource in item.bitmap) { my_Image.Add(new Image_Solution() { bitmap = imageSource }); } } hinh_anh_minh_hoa.ItemsSource = my_Image; my_focus.thong_tin_clash_child = thong_tin_clash_child; e_focus.Raise(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void Button_Click(object sender, RoutedEventArgs e) { //【03】执行命令 createWallCommand.wallHeight = Convert.ToDouble(this.textBox.Text); //属性传值1 createWallEvent.Raise(); }
void Button3Click(object sender, EventArgs e) { //throw new InvalidOperationException(); try { //throw new InvalidOperationException(); // using (Transaction t = new Transaction(doc, "Set a parameters")) // { // t.Start(); // doc.ProjectInformation.GetParameters("Project Name")[0].Set("Space Elevator"); //this needs to change in two places // t.Commit(); // } myEE7ActionParameter.Raise(); } #region catch and finally catch (Exception ex) { TaskDialog.Show("Catch", "Failed due to:" + Environment.NewLine + ex.Message); } finally { } #endregion }
/// <summary> /// Open a 3D View /// </summary> /// <param name="v"></param> private void doOpen3DView(VisualizationInfo v) { try { UIDocument uidoc = uiapp.ActiveUIDocument; Document doc = uidoc.Document; if (uidoc.ActiveView.ViewType == ViewType.ThreeD) { View3D view3D = (View3D)uidoc.ActiveView; if (view3D.IsPerspective) //ORTHO { MessageBox.Show("This operation is not allowed in a Perspective View.\nPlease close the current window(s) and retry.", "Warning!", MessageBoxButton.OK, MessageBoxImage.Warning); return; } } m_Handler.v = v; m_ExEvent.Raise(); } catch (System.Exception ex1) { TaskDialog.Show("Error!", "exception: " + ex1); } }
/// <summary> /// Open a 3D View /// </summary> /// <param name="v"></param> private void doOpen3DView(VisualizationInfo v) { try { UIDocument uidoc = uiapp.ActiveUIDocument; Document doc = uidoc.Document; if (uidoc.ActiveView.ViewType == ViewType.ThreeD) { View3D view3D = (View3D)uidoc.ActiveView; if (view3D.IsPerspective) //ORTHO { MessageBox.Show("This operation is not allowed in a Perspective View.\nPlease close the current window(s) and retry.", "Warning!", MessageBoxButton.OK, MessageBoxImage.Warning); return; } } m_Handler.v = v; //var touple = GetViewCoordinates(doc, v); //if (touple == null) //{ // MessageBox.Show("Viewpoint not formatted correctly.", "Viewpoint Error", MessageBoxButton.OK, MessageBoxImage.Error); // return; //} //m_Handler.touple = touple; m_ExEvent.Raise(); } catch (System.Exception ex1) { TaskDialog.Show("Error!", "exception: " + ex1); } }
/// <summary> /// Raises the External Event to accomplish a transaction in a modeless window /// http://help.autodesk.com/view/RVT/2014/ENU/?guid=GUID-0A0D656E-5C44-49E8-A891-6C29F88E35C0 /// http://matteocominetti.com/starting-a-transaction-from-an-external-application-running-outside-of-api-context-is-not-allowed/ /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void OnOpenView(object sender, ExecutedRoutedEventArgs e) { try { if (Bcfier.SelectedBcf() == null) { return; } var view = e.Parameter as ViewPoint; if (view == null) { return; } UIDocument uidoc = uiapp.ActiveUIDocument; if (uidoc.ActiveView.ViewType == ViewType.ThreeD) { var view3D = (View3D)uidoc.ActiveView; if (view3D.IsPerspective) { MessageBox.Show("This operation is not allowed in a Perspective View.\nPlease close the current window(s) and retry.", "Warning!", MessageBoxButton.OK, MessageBoxImage.Warning); return; } } Handler.v = view.VisInfo; ExtEvent.Raise(); } catch (System.Exception ex1) { TaskDialog.Show("Error opening a View!", "exception: " + ex1); } }
private void buttonApply_Click(object sender, RoutedEventArgs e) { try { if (null != comboBoxCategory.SelectedItem && null != comboBoxSourceFamily.SelectedItem && null != comboBoxTargetFamily.SelectedItem && null != comboBoxSourceType.SelectedItem && null != comboBoxTargetType.SelectedItem) { var sourceType = (ElementTypeInfo)comboBoxSourceType.SelectedItem; var targetType = (ElementTypeInfo)comboBoxTargetType.SelectedItem; if (null != sourceType && null != targetType) { familyInfo = new LinkedFamilyInfo(selectedLink.InstanceId, sourceType, targetType); m_handler.SelectedFamilyInfo = familyInfo; m_handler.MoverRequest.Make(RequestId.AddFamilyMapping); m_event.Raise(); SetFocus(); this.Close(); } } else { MessageBox.Show("Please make sure you select a category and source and target families", "Missing Information", MessageBoxButton.OK, MessageBoxImage.Information); return; } } catch (Exception ex) { MessageBox.Show("Failed to add/edit the selected family map.\n" + ex.Message, "Family Map", MessageBoxButton.OK, MessageBoxImage.Warning); } }
private static int RequestExecuteScript(ScriptData scriptData, ScriptRuntimeConfigs scriptRuntimeCfg, ScriptExecutorConfigs scriptExecConfigs) { if (extExecEventHandler != null) { extExecEventHandler.ScriptData = scriptData; extExecEventHandler.ScriptRuntimeConfigs = scriptRuntimeCfg; // request command exec now extExecEvent.Raise(); // wait until the script is executed if (scriptExecConfigs.WaitForResult) { while (extExecEvent.IsPending) { ; } return(extExecEventHandler.Result); } // otherwise return(ScriptExecutorResultCodes.DelayedExecutionRequested); } return(ScriptExecutorResultCodes.FailedDelayedExecutionRequest); }
private void MakeRequest(RequestId request, List <ICollection <ElementId> > ids) { //MessageBox.Show("You are in the Control.Request event."); handler.Request.SelectWarnings(ids); handler.Request.Make(request); exEvent.Raise(); }