public void ShowRemoveDialog() { confirmationDialog.Open("Remove package", "Are you sure you want to remove package " + packageTile.GetLabel() + "?", () => RemovePackage(), () => inputDialog.Close()); }
public async void NewScene(string name) { if (await Base.GameManager.Instance.NewScene(name)) { InputDialog.Close(); } }
public void ShowAddOrientationDialog() { inputDialog.Open("Create new named orientation", "Please set name of the new orientation", "Name", CurrentActionPoint.GetFreeOrientationName(), () => AddOrientation(inputDialog.GetValue(), (string)RobotsList.GetValue()), () => inputDialog.Close()); }
public void ShowRenameDialog() { inputDialog.Open("Rename action", "", "New name", CurrentAction.Data.Name, () => RenameAction(inputDialog.GetValue()), () => inputDialog.Close()); }
public void ShowRenameDialog() { inputDialog.Open("Rename project", "", "New name", projectTile.GetLabel(), () => RenameProject(inputDialog.GetValue()), () => inputDialog.Close()); }
public void ShowRenameDialog() { InputDialog.Open("Rename action object", "", "New name", CurrentObject.Data.Name, () => RenameObject(InputDialog.GetValue()), () => InputDialog.Close()); }
public void ShowRenameDialog() { inputDialog.Open("Rename scene", "", "New name", sceneTile.GetLabel(), () => RenameScene(inputDialog.GetValue()), () => inputDialog.Close()); }
public void ShowAddOrientationDialog() { inputDialog.Open("Create new named orientation", "Please set name of the new orientation", "Name", "", () => AddOrientation(inputDialog.GetValue()), () => inputDialog.Close()); }
public void ShowBuildPackageDialog() { inputDialog.Open("Build package", "", "Package name", Base.ProjectManager.Instance.ProjectMeta.Name + DateTime.Now.ToString("yyyy-dd-M--HH-mm-ss"), () => BuildPackage(inputDialog.GetValue()), () => inputDialog.Close()); }
public async void BuildPackage(string name) { try { await Base.GameManager.Instance.BuildPackage(name); InputDialog.Close(); Notifications.Instance.ShowToastMessage("Package was built sucessfully."); } catch (Base.RequestFailedException ex) { } }
public async void ShowRenameDialog() { if (!await WriteLockProjectOrScene(projectTile.ProjectId)) { return; } inputDialog.Open("Rename project", "", "New name", projectTile.GetLabel(), () => RenameProject(inputDialog.GetValue()), () => inputDialog.Close(), validateInput: ValidateProjectNameAsync); }
public void ShowAddActionPointDialog() { InputDialog.Open("Create action point", "Type action point name", "Name", ProjectManager.Instance.GetFreeAPName(CurrentObject.Data.Name), () => CreateNewAP(InputDialog.GetValue()), () => InputDialog.Close()); }
public static string InputBox(string prompt, string title, string defaultValue) { var inputDialog = new InputDialog {FormPrompt = prompt, FormCaption = title, DefaultValue = defaultValue}; inputDialog.ShowDialog(); string s = inputDialog.InputResponse; inputDialog.Close(); return s; }
public async void CloseProject() { GameManager.Instance.ShowLoadingScreen("Closing project.."); _ = await GameManager.Instance.CloseProject(true); inputDialog.Close(); MenuManager.Instance.MainMenu.Close(); GameManager.Instance.HideLoadingScreen(); }
private void Export_OnClick(object sender, RoutedEventArgs e) { //maybe change string filename = "\\BIM360_Custom_Template.csv"; //window for user to enter data var dialog = new InputDialog("Please enter the path for exporting the CSV:", Environment.GetFolderPath(Environment.SpecialFolder.Desktop)); dialog.ResizeMode = ResizeMode.NoResize; dialog.ShowDialog(); if (dialog.DialogResult != true) { return; } var exportpath = dialog.Answer; //move to conifg if (File.Exists(exportpath + filename)) { statusbar.Text = "Export Failed! File already exists!"; return; } if (!Directory.Exists((exportpath))) { try { Directory.CreateDirectory(exportpath); } catch (Exception ex) { statusbar.Text = ex.Message; return; } } //Hardcoded Name in here maybe user should be able to change //export the Projects try { AccProjectConfig.ExportBim360Projects(exportpath + filename); } catch (Exception ex) { statusbar.Text = ex.Message; return; } statusbar.Text = "Export successful"; dialog.Close(); }
public async void CreateNewAP(string name) { Debug.Assert(CurrentObject != null); /*IO.Swagger.Model.Position offset = new IO.Swagger.Model.Position(); * Vector3 aboveModel = CurrentObject.GetTopPoint(); * aboveModel.y += 0.1f; * offset = DataHelper.Vector3ToPosition(TransformConvertor.UnityToROS(CurrentObject.transform.InverseTransformPoint(aboveModel))); */ Vector3 abovePoint = SceneManager.Instance.GetCollisionFreePointAbove(CurrentObject.transform.localPosition); IO.Swagger.Model.Position offset = DataHelper.Vector3ToPosition(TransformConvertor.UnityToROS(CurrentObject.transform.InverseTransformPoint(abovePoint))); bool result = await GameManager.Instance.AddActionPoint(name, CurrentObject.Data.Id, offset); //Base.Scene.Instance.SpawnActionPoint(CurrentObject.GetComponent<Base.ActionObject>(), null); if (result) { inputDialog.Close(); } UpdateMenu(); }
public async void CreateNewAP(string name) { Debug.Assert(CurrentObject != null); IO.Swagger.Model.Position offset = new IO.Swagger.Model.Position(); if (CurrentObject.ActionObjectMetadata.ObjectModel != null) { switch (CurrentObject.ActionObjectMetadata.ObjectModel.Type) { case IO.Swagger.Model.ObjectModel.TypeEnum.Box: offset.Z = CurrentObject.ActionObjectMetadata.ObjectModel.Box.SizeY / 2m + 0.1m; break; case IO.Swagger.Model.ObjectModel.TypeEnum.Cylinder: offset.Z = CurrentObject.ActionObjectMetadata.ObjectModel.Cylinder.Height / 2m + 0.1m; break; case IO.Swagger.Model.ObjectModel.TypeEnum.Mesh: //TODO: how to handle meshes? do i know dimensions? break; case IO.Swagger.Model.ObjectModel.TypeEnum.Sphere: offset.Z = CurrentObject.ActionObjectMetadata.ObjectModel.Sphere.Radius / 2m + 0.1m; break; default: offset.Z = 0.15m; break; } } bool result = await GameManager.Instance.AddActionPoint(name, CurrentObject.Data.Id, offset); //Base.Scene.Instance.SpawnActionPoint(CurrentObject.GetComponent<Base.ActionObject>(), null); if (result) { inputDialog.Close(); } UpdateMenu(); }
public async void CreateNewAP(string name) { Debug.Assert(CurrentObject != null); Vector3 abovePoint = SceneManager.Instance.GetCollisionFreePointAbove(CurrentObject.transform, Vector3.one * 0.025f, Quaternion.identity); IO.Swagger.Model.Position offset = DataHelper.Vector3ToPosition(TransformConvertor.UnityToROS(abovePoint)); bool result = await GameManager.Instance.AddActionPoint(name, CurrentObject.Data.Id, offset); if (result) { InputDialog.Close(); } UpdateMenu(); }
/// <summary> /// Shows an input dialog and returns the string the user typed /// </summary> /// <param name="title">The title of the input box</param> /// <param name="message">The message to show</param> /// <param name="buttonText">The text of the submit button</param> /// <returns></returns> public static string showDialog(string title, string message, string buttonText) { InputDialog i = new InputDialog(); i.Text = title; i.messageLabel.Text = message; i.buttonSubmit.Text = buttonText; i.txtInput.MinimumSize = new Size(i.buttonSubmit.Location.X, 0); string result = null; i.buttonSubmit.Click += delegate { result = i.txtInput.Text; i.Close(); }; i.ShowDialog(); return result; }
private void CheckBoxservices_OnChecked(object sender, RoutedEventArgs e) { var dialog = new InputDialog("Please enter the Companyname:", "Example Company"); dialog.ResizeMode = ResizeMode.NoResize; dialog.ShowDialog(); if (dialog.DialogResult == true) { Company.Text = dialog.Answer; } else { CheckBoxservices.IsChecked = false; } dialog.Close(); }
public string InputBox(string prompt, string title, string defaultInput) { // we'll create a new instance of the class and set the given arguments as properties var ib = new InputDialog { FormPrompt = prompt, FormCaption = title, DefaultValue = defaultInput }; // show the actual dialog ib.ShowDialog(); // retrieve the response string, close the dialog and return the string var response = ib.InputResponse; ib.Close(); return response; }
private async void CloseRenameDialog() { inputDialog.Close(); }
// Select Faces boundaries public void rebarBeam_Form_Update() { UIDocument uiDoc = this.ActiveUIDocument; Document doc = uiDoc.Document; double factor = 4; double delta_1 = 50 / 304.8; double pitch_1 = 150 / 304.8; double pitch_2 = 300 / 304.8; double delta_3 = 50 / 304.8; double pitch_3 = 100 / 304.8; int N3 = 5; double myConvertFactor = 304.8; bool inputSuccess = false; while (!inputSuccess) { using (var myInputFormSetting = new InputDialog()) { myInputFormSetting.ShowDialog(); factor = Convert.ToDouble(myInputFormSetting.factorTb.Text); delta_1 = Convert.ToDouble(myInputFormSetting.delta_1Tb.Text) / myConvertFactor; pitch_1 = Convert.ToDouble(myInputFormSetting.pitch_1Tb.Text) / myConvertFactor; pitch_2 = Convert.ToDouble(myInputFormSetting.pitch_2Tb.Text) / myConvertFactor; delta_3 = Convert.ToDouble(myInputFormSetting.delta_3Tb.Text) / myConvertFactor; pitch_3 = Convert.ToDouble(myInputFormSetting.pitch_3Tb.Text) / myConvertFactor; N3 = Convert.ToInt32(myInputFormSetting.n3Tb.Text); //if the user hits cancel just drop out of macro if (myInputFormSetting.DialogResult == System.Windows.Forms.DialogResult.Cancel) { return; } { //else do all this :) myInputFormSetting.Close(); } if (myInputFormSetting.DialogResult == System.Windows.Forms.DialogResult.OK) { //else do all this :) inputSuccess = true; myInputFormSetting.Close(); } } } // Pick Rebar List <int> myListIdCategoryRebar = new List <int>(); myListIdCategoryRebar.Add((int)BuiltInCategory.OST_Rebar); // Select first Element (ex beam) Reference myRefRebar = uiDoc.Selection.PickObject(ObjectType.Element, new FilterByIdCategory(myListIdCategoryRebar), "Pick a Rebar..."); //Get rebar from ref Rebar myRebar = doc.GetElement(myRefRebar) as Rebar; //Set rebar single // using (Transaction myTrans = new Transaction(doc,"SET FIRST REBAR AS SINGLE")) // // { // myTrans.Start(); // myRebar.GetShapeDrivenAccessor().SetLayoutAsSingle(); // myTrans.Commit(); // } Element myBeam = doc.GetElement(myRebar.GetHostId()); //Get location curve of beam LocationCurve lc = myBeam.Location as LocationCurve; Line line = lc.Curve as Line; //Get vector of location cuver beam XYZ p1 = line.GetEndPoint(0); XYZ q = line.GetEndPoint(1); XYZ v = q - p1; // Vector equation of line XYZ p = p1 - 0.1 * v; //Set current Beam be Joined setBeJoined(myBeam); while (true) { //Pick Face end List <Reference> myListRef = uiDoc.Selection.PickObjects(ObjectType.Face) as List <Reference>; List <Face> myListFacePicked = new List <Face>(); foreach (Reference myRef in myListRef) { Element E = doc.GetElement(myRef); GeometryObject myGeoObj = E.GetGeometryObjectFromReference(myRef); Face myPickedFace = myGeoObj as Face; myListFacePicked.Add(myPickedFace); } if (myListFacePicked.Count != 2 && myListFacePicked.Count != 4) { TaskDialog.Show("Error!", "Chua ho tro lua chon: " + myListFacePicked.Count() + " mat, Chon 2 hoac 4 mat"); continue; } else { string caseDistributionRebar = "TH2: Co dam o giua"; List <double> myListSpace = new List <double>() { pitch_1, pitch_2, pitch_3, pitch_3, pitch_2, pitch_1 }; if (myListFacePicked.Count == 2) { myListSpace = new List <double>() { pitch_1, pitch_2, pitch_1, pitch_2, pitch_2, pitch_1 }; caseDistributionRebar = "TH1: Khong co dam o giua"; } TaskDialog.Show("Info", caseDistributionRebar); // List of boundaries faces List <double> myListEndPointDis = getAndSortDisOfEndFaces(myListFacePicked, p); myListEndPointDis.Sort(); Dictionary <double, int> myDicDisNumDetail = detailListDistance_Update(myListEndPointDis, factor, delta_1, pitch_1, pitch_2, delta_3, pitch_3, N3); List <ElementId> myListRebarCopyId = copyRebarByDistance2_Update(myRebar, myDicDisNumDetail); List <double> myDistances = myDicDisNumDetail.Keys.ToList(); myDistances.Sort(); List <int> myListNum = new List <int>(); foreach (double key in myDistances) { myListNum.Add(myDicDisNumDetail[key]); } //Layout // using transcation (edit DB) for (int i = 0; i < myListRebarCopyId.Count(); i++) { using (Transaction myTrans = new Transaction(doc, "CopyElementByCoordinate")) { myTrans.Start(); ElementId rebarId = myListRebarCopyId[i]; Rebar myRebarI = doc.GetElement(rebarId) as Rebar; if (myListNum[i] < -1) { myRebarI.GetShapeDrivenAccessor().SetLayoutAsNumberWithSpacing((myListNum[i]) * -1, myListSpace[i], true, true, true); } if (myListNum[i] == -1) { myRebarI.GetShapeDrivenAccessor().SetLayoutAsSingle(); } if (myListNum[i] == 0) { myRebarI.GetShapeDrivenAccessor().SetLayoutAsSingle(); } if (myListNum[i] == 1) { myRebarI.GetShapeDrivenAccessor().SetLayoutAsSingle(); } if (myListNum[i] > 1) { myRebarI.GetShapeDrivenAccessor().SetLayoutAsNumberWithSpacing(myListNum[i], myListSpace[i], false, true, true); } myTrans.Commit(); } } //delete element using (Transaction myTrans = new Transaction(doc, "Delete First ReBar")) { myTrans.Start(); //doc.Delete(myRebar.Id); myTrans.Commit(); } } } }