private void FixRemark(object sender, TextBoxEnterPressedEventArgs e) { var uiDoc = e.Application.ActiveUIDocument; var selected = uiDoc.Selection.GetElementIds(); var tb = sender as TextBox; if (selected.Count != 1) { LogError("Select one element"); } else if (!int.TryParse(tb.Value as string, out var position)) { LogError("Enter integer number"); } else { var element = uiDoc.Document .GetElement(selected.First()); var task = element.GetTask(); tb.Value = ""; if (task == null) { LogError("Element has no task"); } else { task.ToFixed(position - 1); element.SetTask(task); } } }
private static void EnterPressed(object sender, TextBoxEnterPressedEventArgs args) { TextBox textBox = sender as TextBox; string text = textBox.Value as string; var combotype = args.Application.GetComboData(); if (combotype == "Predictive") { combotype = "Masterformat"; } switch (combotype) { default: case "Run Command": combotype.ReadCommandInfo(text); break; case "Masterformat": args.Application.SetMasterformat(text); break; case "Occupant Load Factor": args.Application.SetOLF(text); break; case "Command Training": combotype.WriteCommandInfo(text); break; } }
private static void EnterPressed(object sender, TextBoxEnterPressedEventArgs args) { TextBox textBox = sender as TextBox; string text = textBox.Value as string; var combotype = GetComboData(args.Application); CreatePattern(args.Application.ActiveUIDocument.Document, combotype, text); }
private void AddRemark(object sender, TextBoxEnterPressedEventArgs e) { var tb = sender as TextBox; var uiDoc = e.Application.ActiveUIDocument; var selectedElements = uiDoc.GetSelectedElement(); foreach (var element in selectedElements) { element.UpdateTask(t => t.AddRemark(tb.Value as string)); } tb.Value = ""; }
private void TextBoxEnterClicked(object obj, TextBoxEnterPressedEventArgs args) { TextBox tb = obj as TextBox; double val = 0.0; bool status = double.TryParse(tb.Value.ToString(), out val); if (status) { PublicVariables.LowerValue = val; } else { tb.ToolTip = "Enter a nulmber"; } }
/// <summary> /// Handles the action of the text box user input. Checks if the input value is an /// acceptable double value and if it lies among the acceptable range of values; if /// it is it updates the corresponding field variable, if not it displays a warning /// message to the user and retains the previous value. /// </summary> /// <param name="sender"></param> /// <param name="e">The event arguments used by ComboBox's CurrentChanged event. /// </param> private void TextBoxEnterPressed(object sender, TextBoxEnterPressedEventArgs e) { //cast sender as TextBox to retrieve text value TextBox textBox = sender as TextBox; double value; if (double.TryParse(textBox.Value.ToString(), out value)) { if ((textBox.Name).Equals(periodBox.Name)) { if (value < 0.1 || value > 3) { TaskDialog.Show("TextBox Input", "The input value for " + textBox.Name + " has to be between 0.1 and 3.0"); } else { periodVal = value; } } else if ((textBox.Name).Equals(cyclesBox.Name)) { if (value <= 0) { TaskDialog.Show("TextBox Input", "The input value for " + textBox.Name + " has to be greater than zero."); } else { cyclesVal = value; } } else if ((textBox.Name).Equals(amplitudeBox.Name)) { if (value < -4 || value > 4) { TaskDialog.Show("TextBox Input", "The input value for " + textBox.Name + " has to be between -4.0 and 4.0"); } else { amplitudeVal = value; } } else { if (value <= 0) { TaskDialog.Show("TextBox Input", "The input value for " + textBox.Name + " has to be greater than zero."); } else { partitionsVal = value; } } } else { TaskDialog.Show("TextBox Input", "The input value for " + textBox.Name + " has to be a double."); } }
/// <summary> /// Bind to text box's EnterPressed Event, show a dialogue tells user value of test box changed. /// </summary> /// <param name="evnetArgs">Autodesk.Revit.UI.Events.TextBoxEnterPressedEventArgs</param> public void SetTextBoxValue(object sender, TextBoxEnterPressedEventArgs args) { TaskDialog.Show("TextBox EnterPressed Event", "New wall's mark changed."); }
/// <summary> /// Text Box Event handler /// </summary> /// <param name="sender"></param> /// <param name="args"></param> public void MyTextBoxEnter(object sender, TextBoxEnterPressedEventArgs args) { UIDocument uiDoc = args.Application.ActiveUIDocument; Document doc = uiDoc.Document; Autodesk.Revit.UI.TextBox textBox = sender as Autodesk.Revit.UI.TextBox; string message = textBox.Value.ToString(); string caseSwitch = "default"; if (message.Contains("babbo")) { caseSwitch = "christmas"; } if (message.Contains("leann says")) { caseSwitch = "leann"; } if (message.Contains("+")) { caseSwitch = "sum"; } if (message.StartsWith("*")) { caseSwitch = "select"; } if (message.StartsWith("/")) { caseSwitch = "selectAll"; } if (message.StartsWith("sheets")) { caseSwitch = "selectSheets"; } if (message.StartsWith("tblocks")) { caseSwitch = "selectTBlocks"; } if (message.StartsWith("-")) { caseSwitch = "delete"; } if (message.StartsWith("+viewset")) { caseSwitch = "createViewSet"; } switch (caseSwitch) { case "default": MessageBox.Show(textBox.Value.ToString(), "Command Line"); break; case "christmas": Helpers.Christams(); break; case "leann": Helpers.leannSays(); break; case "sum": Helpers.AddTwoIntegers(message); break; case "select": Helpers.SelectAllElementsInView(uiDoc, message); break; case "selectAll": Helpers.SelectAllElements(uiDoc, message); break; case "createViewSet": Helpers.CreateViewset(doc, message); break; case "delete": break; case "selectSheets": Helpers.HighlightSelectSheets(uiDoc, message); break; case "selectTBlocks": Helpers.HighlightSelectTitleBlocks(uiDoc, message); break; } }
/// <summary> /// Bind to text box's EnterPressed Event, show a dialogue tells user value of test box changed. /// </summary> /// <param name="evnetArgs">Autodesk.Revit.UI.Events.TextBoxEnterPressedEventArgs</param> public void SetTextBoxValue(object sender, TextBoxEnterPressedEventArgs args) { MessageBox.Show("New wall's mark changed.", "TextBox EnterPressed Event"); }