private void StepLB_SelectionChanged(object sender, SelectionChangedEventArgs e) { ProjectLocation loc = ProjectListLB.SelectedItem as ProjectLocation; if (loc == null) { return; } int step = StepLB.SelectedIndex; if (step == 0) { PromptTB.Text = "Input project description in the text box."; ProjectDescTB.IsReadOnly = false; ProjectDescTB.Focus(); ProjectDescTB.SelectAll(); ProjectDescTB.Visibility = System.Windows.Visibility.Visible; _gLayer.Graphics.Clear(); } else if (step == 1) { PromptTB.Text = "Drop the project location on the map."; ProjectDescTB.Visibility = System.Windows.Visibility.Hidden; AddProjectLocationOnMap(loc); } }
CollectEvent(object sender, CollectorEventArgs e) { // cast the sender object to the SnoopCollector we are expecting Collector snoopCollector = sender as Collector; if (snoopCollector == null) { Debug.Assert(false); // why did someone else send us the message? return; } // see if it is a type we are responsible for City city = e.ObjToSnoop as City; if (city != null) { Stream(snoopCollector.Data(), city); return; } ProjectLocation projLoc = e.ObjToSnoop as ProjectLocation; if (projLoc != null) { Stream(snoopCollector.Data(), projLoc); return; } ProjectPosition projPos = e.ObjToSnoop as ProjectPosition; if (projPos != null) { Stream(snoopCollector.Data(), projPos); return; } SiteLocation siteLoc = e.ObjToSnoop as SiteLocation; if (siteLoc != null) { Stream(snoopCollector.Data(), siteLoc); return; } }
void MyMapView_Loaded(object sender, RoutedEventArgs e) { if (Projects == null) { LoadProjectList(); // switch to the default project if (Projects != null) { ProjectLocation loc = Projects.Locations.ToList().Find(i => i.Default == true); if ((loc != null)) { App app = Application.Current as App; IS3MainWindow mw = (IS3MainWindow)app.MainWindow; mw.SwitchToMainFrame(loc.ID); } projectBox.ItemsSource = Projects.Locations; } } if (Projects != null) { Envelope projectExtent = new Envelope(Projects.XMin, Projects.YMin, Projects.XMax, Projects.YMax); AddProjectsToMap(); //Map.ZoomTo(ProjectExtent); } }
void SetSiteLocationToCity1(Document doc) { Autodesk.Revit.DB.CitySet cities = doc.Application.Cities; int nCount = cities.Size; try { CitySetIterator item = cities.ForwardIterator(); while (item != null) { item.MoveNext(); City city = item.Current as City; if (city.Name.Contains("中国") || city.Name.Contains("China")) { Transaction transaction = new Transaction(doc, "Create Wall"); transaction.Start(); ProjectLocation projectLocation = doc.ActiveProjectLocation; SiteLocation site = projectLocation.SiteLocation; // site.PlaceName = city.Name; site.Latitude = city.Latitude; // latitude information site.Longitude = city.Longitude; // longitude information site.TimeZone = city.TimeZone; // TimeZone information transaction.Commit(); break; } } } catch (Exception ret) { Debug.Print(ret.Message); } }
private static void SaveProjectDetailedLocations(ProjectLocationDetailViewModel viewModel, Project project) { //update the editable ProjectLocations if (viewModel.ProjectLocationJsons != null) { foreach (var projectLocationJson in viewModel.ProjectLocationJsons.Where(x => !x.ArcGisObjectID.HasValue)) { var projectLocationGeometry = DbGeometry.FromText(projectLocationJson.ProjectLocationGeometryWellKnownText, FirmaWebConfiguration.GeoSpatialReferenceID); var projectLocation = new ProjectLocation(project, projectLocationJson.ProjectLocationName, projectLocationGeometry, projectLocationJson.ProjectLocationTypeID, projectLocationJson.ProjectLocationNotes); project.ProjectLocations.Add(projectLocation); } } //update arcGIS ProjectLocations for the notes foreach (var matched in viewModel.ArcGisProjectLocationJsons.Where(x => x.ArcGisObjectID.HasValue) .Join(project.ProjectLocations, plj => plj.ProjectLocationID, pl => pl.ProjectLocationID, (lhs, rhs) => new { ProjectLocationJson = lhs, ProjectLocation = rhs })) { matched.ProjectLocation.ProjectLocationNotes = matched.ProjectLocationJson.ProjectLocationNotes; } }
public async Task <Response> DeleteItemAsync(ProjectLocation item) { item.IsDelete = true; item.UserId = App.LogUser.Id.ToString(); using (HttpClient client = new HttpClient()) { client.BaseAddress = new Uri(App.AzureBackendUrl); client.DefaultRequestHeaders.Accept.Clear(); client.DefaultRequestHeaders.Accept.Add( new MediaTypeWithQualityHeaderValue("application/json")); using (HttpResponseMessage response = await client.PostAsJsonAsync($"api/ProjectLocation/DeleteProjectLocation", item)) { var responseBody = await response.Content.ReadAsStringAsync(); Response result = JsonConvert.DeserializeObject <Response>(responseBody); response.EnsureSuccessStatusCode(); //if (response.IsSuccessStatusCode == false) //{ // throw new ApiException // { // StatusCode = (int)response.StatusCode, // Content = result.Message // }; //} return(await Task.FromResult(result)); } } }
public async Task LoadProjectListData() { try { myProjectList = new ProjectList(); myProjectList.Locations = await new RepositoryForProject().RetrieveProjectList(); // switch to the default project if (myProjectList != null) { ProjectLocation loc = myProjectList.Locations.ToList().Find(i => i.Default == true); if ((loc != null)) { //App app = Application.Current as App; //IS3MainWindow mw = (IS3MainWindow)app.MainWindow; //mw.SwitchToMainFrame(loc.CODE); } projectBox.ItemsSource = myProjectList.Locations; } if (myProjectList != null) { Envelope projectExtent = new Envelope(myProjectList.XMin, myProjectList.YMin, myProjectList.XMax, myProjectList.YMax); AddProjectsToMap(); //Map.ZoomTo(ProjectExtent); } } catch (Exception ex) { } }
////[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Reliability", "CA2000:Dispose objects before losing scope")] public static void PlaceFamilyAtCoordinate(Document doc, FamilySymbol family, XYZ location, bool useSharedCoordinates) { if (doc == null || family == null) { return; } ProjectLocation currentLocation = doc.ActiveProjectLocation; var origin = new XYZ(0, 0, 0); #if REVIT2018 || REVIT2019 || REVIT2020 ProjectPosition projectPosition = currentLocation.GetProjectPosition(origin); #else ProjectPosition projectPosition = currentLocation.get_ProjectPosition(origin); #endif XYZ newLocation = ToMGA(projectPosition, location.X, location.Y, location.Z, useSharedCoordinates); using (var t = new Transaction(doc, "Place Family at Coordinate.")) { if (t.Start() == TransactionStatus.Started) { if (!family.IsActive) { family.Activate(); doc.Regenerate(); } doc.Create.NewFamilyInstance( newLocation, family, Autodesk.Revit.DB.Structure.StructuralType.NonStructural); t.Commit(); } } }
private void CollectProjectLocaiton() { try { ProjectLocationSet locationSet = m_doc.ProjectLocations; ProjectLocationSetIterator iter = locationSet.ForwardIterator(); while (iter.MoveNext()) { ProjectLocation location = iter.Current as ProjectLocation; ProjectLocationProperties plp = new ProjectLocationProperties(location); projectLocations.Add(plp); } comboBoxSite1.ItemsSource = null; comboBoxSite1.ItemsSource = projectLocations; comboBoxSite2.ItemsSource = null; comboBoxSite2.ItemsSource = projectLocations; if (projectLocations.Count > 0) { comboBoxSite1.SelectedIndex = 0; comboBoxSite2.SelectedIndex = 0; } } catch (Exception ex) { string message = ex.Message; } }
public void FromFolder_should_raise_a_DirectoryNotFoundException_when_no_folder_is_found() { Action action = () => ProjectLocation.FromFolder("non-existent-folder"); action.ShouldThrow <DirectoryNotFoundException>() .WithMessage(_rootPath); }
public void FromFolder_should_raise_a_SolutionNotFoundException_when_no_solution_is_found() { File.Delete(_solutionFile); Action action = () => ProjectLocation.FromFolder(_webAppName); action.ShouldThrow <SelenoException>(); }
void SetSiteLocationToCity2(Document doc) { CitySet cities = doc.Application.Cities; foreach (City city in cities) { string s = city.Name; if (s.Contains("中国") || s.Contains("China")) { using (Transaction t = new Transaction(doc)) { t.Start("Set Site Location to City"); ProjectLocation projectLocation = doc.ActiveProjectLocation; //SiteLocation site = projectLocation.SiteLocation; // 2017 SiteLocation site = projectLocation.GetSiteLocation(); // 2018 // site.PlaceName = city.Name; site.Latitude = city.Latitude; // latitude information site.Longitude = city.Longitude; // longitude information site.TimeZone = city.TimeZone; // TimeZone information // SiteLocation property is read-only: //projectLocation.SiteLocation = site; t.Commit(); } break; } } }
void MyMapView_MouseDown(object sender, MouseButtonEventArgs e) { ProjectLocation loc = ProjectListLB.SelectedItem as ProjectLocation; if (loc == null) { return; } int step = StepLB.SelectedIndex; if (step != 1) { return; } Point screenPoint = e.GetPosition(MyMapView); MapPoint coord = MyMapView.ScreenToLocation(screenPoint); _gLayer.Graphics.Clear(); loc.X = coord.X; loc.Y = coord.Y; AddProjectLocationOnMap(loc); }
public async Task <Response> AddItemAsync(ProjectLocation item) { Response result = new Response(); Dictionary <string, string> parameters = new Dictionary <string, string>(); parameters.Add("Id", item.Id); parameters.Add("Name", item.Name); parameters.Add("Description", item.Description); parameters.Add("ProjectId", item.ProjectId); parameters.Add("UserID", App.LogUser.Id.ToString()); parameters.Add("ImageName", item.ImageName); parameters.Add("ImageUrl", item.ImageUrl); parameters.Add("ImageDescription", item.ImageDescription); //Regex UrlMatch = new Regex(@"(?i)(http(s)?:\/\/)?(\w{2,25}\.)+\w{3}([a-z0-9\-?=$-_.+!*()]+)(?i)", RegexOptions.Singleline); //if (item.ImageUrl == "blank.png" || UrlMatch.IsMatch(item.ImageUrl)) //{ // item.ImageUrl = null; //} string ImageUrl = HttpUtil.GetImageUrl(item.ImageUrl).Result; result = await HttpUtil.UploadSingleImage(item.Name, ImageUrl, "api/ProjectLocation/AddEdit", parameters); return(await Task.FromResult(result)); }
//MOVES THE CAMERA ACCORDING TO THE PROJECT BASE LOCATION +++++++++++++++++++++++++++++++++++++++++++ BASE POINT ++++++++++++++++++++ /// <summary> /// changes the coordinates accordingly to the project base location to an absolute location (for BCF export) /// if the value negative is set to true, does the opposite (for opening BCF views) /// </summary> /// <param name="c"></param> /// <param name="view"></param> /// <param name="up"></param> /// <param name="negative"></param> /// <returns></returns> private ViewOrientation3D ConvertBasePoint(XYZ c, XYZ view, XYZ up, bool negative) { UIDocument uidoc = uiapp.ActiveUIDocument; Document doc = uidoc.Document; double angle = 0; double x = 0; double y = 0; double z = 0; //VERY IMPORTANT //BuiltInParameter.BASEPOINT_EASTWEST_PARAM is the value of the BASE POINT LOCATION //position is the location of the BPL related to Revit's absolute origini! //if BPL is set to 0,0,0 not always it corresponds to Revit's origin ProjectLocation projectLocation = doc.ActiveProjectLocation; XYZ origin = new XYZ(0, 0, 0); ProjectPosition position = projectLocation.get_ProjectPosition(origin); int i = (negative) ? -1 : 1; x = i * position.EastWest; y = i * position.NorthSouth; z = i * position.Elevation; angle = i * position.Angle; if (negative) // I do the addition BEFORE { c = new XYZ(c.X + x, c.Y + y, c.Z + z); } //rotation double centX = (c.X * Math.Cos(angle)) - (c.Y * Math.Sin(angle)); double centY = (c.X * Math.Sin(angle)) + (c.Y * Math.Cos(angle)); XYZ newC = new XYZ(); if (negative) // already done the addition { newC = new XYZ(centX, centY, c.Z); } else // I do the addition AFTERWARDS { // if (includeZ) newC = new XYZ(centX + x, centY + y, c.Z + z); } double viewX = (view.X * Math.Cos(angle)) - (view.Y * Math.Sin(angle)); double viewY = (view.X * Math.Sin(angle)) + (view.Y * Math.Cos(angle)); XYZ newView = new XYZ(viewX, viewY, view.Z); double upX = (up.X * Math.Cos(angle)) - (up.Y * Math.Sin(angle)); double upY = (up.X * Math.Sin(angle)) + (up.Y * Math.Cos(angle)); XYZ newUp = new XYZ(upX, upY, up.Z); return(new ViewOrientation3D(newC, newUp, newView)); }
public static Dictionary <string, object> ProjectPosition(dynamic Document_RevitLinkInstance) { var doc = DocumentManager.Instance.CurrentDBDocument; Dictionary <string, object> appversion = ApplicationVersion(); int version = 0; ProjectPosition pData; SiteLocation lData; string dispsym; if (appversion.TryGetValue("Version Number", out object value)) { version = Convert.ToInt32(value); } if (Document_RevitLinkInstance != null && Document_RevitLinkInstance.GetType().FullName.ToString() != "Revit.Application.Document") { doc = Document_RevitLinkInstance.InternalElement.Document; } ProjectLocation pLoc = doc.ActiveProjectLocation; if (version > 2017) { pData = pLoc.GetProjectPosition(XYZ.Zero); lData = pLoc.GetSiteLocation(); } else { pData = pLoc.GetProjectPosition(XYZ.Zero); lData = pLoc.SiteLocation; } double angle = pData.Angle * (180 / Math.PI); double elevation = Math.Round(pData.Elevation, 8); double ew = Math.Round(pData.EastWest, 8); double ns = Math.Round(pData.NorthSouth, 8); UnitType unittype = UnitType.UT_Length; FormatOptions formatoptions = doc.GetUnits().GetFormatOptions(unittype); DisplayUnitType dispunits = formatoptions.DisplayUnits; UnitSymbolType symtype = formatoptions.UnitSymbol; if (symtype == UnitSymbolType.UST_NONE) { dispsym = "none"; } else { dispsym = LabelUtils.GetLabelFor(symtype); } elevation = UnitUtils.ConvertFromInternalUnits(elevation, dispunits); ew = UnitUtils.ConvertFromInternalUnits(ew, dispunits); ns = UnitUtils.ConvertFromInternalUnits(ns, dispunits); return(new Dictionary <string, object> { { "Angle", angle }, { "NorthSouth", ns }, { "EastWest", ew }, { "Elevation", elevation } }); }
private static void originPosition(Document doc, out double originElev) { ProjectLocation projectLocation = doc.ActiveProjectLocation; XYZ origin = new XYZ(0, 0, 0); ProjectPosition position = projectLocation.get_ProjectPosition(origin); originElev = position.Elevation; }
/// <summary> /// Handles the UpdateCommand event of the gvLocations control. /// </summary> /// <param name="source">The source of the event.</param> /// <param name="e">The <see cref="Telerik.Web.UI.GridCommandEventArgs"/> instance containing the event data.</param> protected void gvLocations_UpdateCommand(object source, Telerik.Web.UI.GridCommandEventArgs e) { if (!PageBase.StopProcessing && Page.IsValid) { //Get the GridEditableItem of the RadGrid GridEditableItem editedItem = e.Item as GridEditableItem; //string name = (editedItem["Name"].Controls[0] as TextBox).Text; //string location = (editedItem["Location"].Controls[0] as TextBox).Text; TextBox name = (TextBox)editedItem.FindControl("tbName"); TextBox location = (TextBox)editedItem.FindControl("tbLocation"); if (name.Text.Trim() != string.Empty || location.Text.Trim() != string.Empty) { if (ProjectID == 0) { ProjectLocation projectLocation = LocationList[editedItem.ItemIndex]; projectLocation.Location = location.Text.Trim(); projectLocation.Name = name.Text.Trim(); projectLocation.LastUpdatedByUserId = UserID; projectLocation.LastUpdatedDate = Now; } else { int projectLocationID = (int)editedItem.OwnerTableView.DataKeyValues[editedItem.ItemIndex]["ProjectLocationId"]; DateTime originalLastUpdatedDate = (DateTime)editedItem.OwnerTableView.DataKeyValues[editedItem.ItemIndex]["LastUpdatedDate"]; ProjectLocation projectLocation = (from pl in DataContext.ProjectLocations where pl.ProjectLocationId == projectLocationID && pl.LastUpdatedDate == originalLastUpdatedDate select pl).FirstOrDefault(); if (projectLocation == null) { StageBitzException.ThrowException(new ConcurrencyException(ExceptionOrigin.ProjectDetails, ProjectID)); } #region Project Notification if (projectLocation.Location != location.Text.Trim() || projectLocation.Name != name.Text.Trim()) { DataContext.Notifications.AddObject(CreateNotification(Support.GetCodeIdByCodeValue("OperationType", "EDIT"), string.Format("{0} edited a Project Location.", Support.UserFullName))); } #endregion Project Notification projectLocation.Location = location.Text.Trim(); projectLocation.Name = name.Text.Trim(); projectLocation.LastUpdatedByUserId = UserID; projectLocation.LastUpdatedDate = Now; DataContext.SaveChanges(); } gvLocations.EditIndexes.Clear(); gvLocations.MasterTableView.IsItemInserted = false; gvLocations.Rebind(); } } }
/// <summary> /// Creates or populates Revit elements based on the information contained in this class. /// </summary> /// <param name="doc">The document.</param> protected override void Create(Document doc) { // Only set the project location for the site that contains the building. bool hasBuilding = false; foreach (IFCObjectDefinition objectDefinition in ComposedObjectDefinitions) { if (objectDefinition is IFCBuilding) { hasBuilding = true; break; } } if (hasBuilding) { ProjectLocation projectLocation = doc.ActiveProjectLocation; if (projectLocation != null) { SiteLocation siteLocation = projectLocation.SiteLocation; if (siteLocation != null) { if (RefLatitude.HasValue) { siteLocation.Latitude = RefLatitude.Value * Math.PI / 180.0; } if (RefLongitude.HasValue) { siteLocation.Longitude = RefLongitude.Value * Math.PI / 180.0; } } if (ObjectLocation != null) { XYZ projectLoc = (ObjectLocation.RelativeTransform != null) ? ObjectLocation.RelativeTransform.Origin : XYZ.Zero; // Get true north from IFCProject. double trueNorth = 0.0; IList <double> trueNorthList = IFCImportFile.TheFile.IFCProject.TrueNorthDirection; if (trueNorthList != null && trueNorthList.Count >= 2) { trueNorth = Math.Atan2(trueNorthList[1], trueNorthList[0]); } ProjectPosition projectPosition = new ProjectPosition(projectLoc.X, projectLoc.Y, RefElevation, trueNorth); XYZ origin = new XYZ(0, 0, 0); projectLocation.set_ProjectPosition(origin, projectPosition); // Now that we've set the project position, remove the site relative transform. IFCLocation.RemoveRelativeTransformForSite(this); } } } base.Create(doc); }
internal void NewSession(ProjectLocation location) { Home(); if (location != null) { SetProjectLocation(location); } }
public async Task <bool> UpdateItemAsync(ProjectLocation item) { var oldItem = items.Where((ProjectLocation arg) => arg.Id == item.Id).FirstOrDefault(); items.Remove(oldItem); items.Add(item); return(await Task.FromResult(true)); }
private void StartIisExpress() { int PortNumber = int.Parse(this.BaseUrl.Substring(this.BaseUrl.LastIndexOf(':') + 1, 5)); var app = new WebApplication(ProjectLocation.FromFolder("PPCRental"), PortNumber); app.AddEnvironmentVariable("UITests"); WebServer = new IisExpressWebServer(app); WebServer.Start("Release"); }
private async Task Save() { if (string.IsNullOrEmpty(ProjectLocation.Name)) { await Shell.Current.DisplayAlert("Alert", "Location name is required", "OK"); return; } IsBusyProgress = true; Response result = await Task.Run(Running); if (result.Status == ApiResult.Success) { IsBusyProgress = false; // await Shell.Current.Navigation.PopAsync().ConfigureAwait(false); ProjectLocation location = JsonConvert.DeserializeObject <ProjectLocation>(result.Data.ToString()); // DependencyService.Get<ILodingPageService>().HideLoadingPage(); // await Shell.Current.Navigation.PushAsync(new ProjectDetail() { BindingContext = new ProjectDetailViewModel() { Project = Project } }); await Shell.Current.Navigation.PopAsync(); if (Shell.Current.Navigation.NavigationStack[Shell.Current.Navigation.NavigationStack.Count - 1].GetType() != typeof(ProjectLocationDetail)) { await Shell.Current.Navigation.PushAsync(new ProjectLocationDetail() { BindingContext = new ProjectLocationDetailViewModel() { ProjectLocation = location } }).ConfigureAwait(false); } ; //await Shell.Current.Navigation.PopAsync().ConfigureAwait(true); ; } //if (string.IsNullOrEmpty(ProjectLocation.Id)) //{ // // ProjectLocation.Id = Guid.NewGuid().ToString(); // ProjectLocation.ProjectId = Project.Id; // // ProjectLocation.CreatedOn = DateTime.Now.ToString("MMM dd,yyyy"); // await ProjectLocationDataStore.AddItemAsync(ProjectLocation); // await Shell.Current.Navigation.PopAsync(); // await Shell.Current.Navigation.PushAsync(new ProjectLocationDetail() { BindingContext = new ProjectLocationDetailViewModel() { ProjectLocation = ProjectLocation } }); //} //else //{ // await ProjectLocationDataStore.AddItemAsync(ProjectLocation); // await Shell.Current.Navigation.PopAsync(); //} // Project.ProjectCommanLocations.Add(ProjectLocation); //await Shell.Current.Navigation.PushAsync(new ProjectLocationDetail()); // await Shell.Current.Navigation.PopAsync(); }
public static XYZ ConvertToFromSharedCoordinate(Document doc, XYZ c, bool negative) { double angle = 0; double x = 0; double y = 0; double z = 0; //VERY IMPORTANT //BuiltInParameter.BASEPOINT_EASTWEST_PARAM is the value of the BASE POINT LOCATION //position is the location of the BPL related to Revit's absolute origini! //if BPL is set to 0,0,0 not always it corresponds to Revit's origin ProjectLocation projectLocation = doc.ActiveProjectLocation; XYZ origin = new XYZ(0, 0, 0); #if REVIT2019 ProjectPosition position = projectLocation.GetProjectPosition(origin); #else ProjectPosition position = projectLocation.get_ProjectPosition(origin); #endif int i = (negative) ? -1 : 1; //foreach (Element element in elements) //{ // MessageBox.Show(UnitUtils.ConvertFromInternalUnits(position.EastWest, DisplayUnitType.DUT_METERS).ToString() + " " + element.get_Parameter(BuiltInParameter.BASEPOINT_EASTWEST_PARAM).AsValueString() + "\n" + // UnitUtils.ConvertFromInternalUnits(position.NorthSouth, DisplayUnitType.DUT_METERS).ToString() + " " + element.get_Parameter(BuiltInParameter.BASEPOINT_NORTHSOUTH_PARAM).AsValueString() + "\n" + // UnitUtils.ConvertFromInternalUnits(position.Elevation, DisplayUnitType.DUT_METERS).ToString() + " " + element.get_Parameter(BuiltInParameter.BASEPOINT_ELEVATION_PARAM).AsValueString() + "\n" + // position.Angle.ToString() + " " + element.get_Parameter(BuiltInParameter.BASEPOINT_ANGLETON_PARAM).AsDouble().ToString()); //} x = i * position.EastWest; y = i * position.NorthSouth; z = i * position.Elevation; angle = i * position.Angle; if (negative) // I do the addition BEFORE { c = new XYZ(c.X + x, c.Y + y, c.Z + z); } //rotation double centX = (c.X * Math.Cos(angle)) - (c.Y * Math.Sin(angle)); double centY = (c.X * Math.Sin(angle)) + (c.Y * Math.Cos(angle)); XYZ newC = new XYZ(); if (negative) { newC = new XYZ(centX, centY, c.Z); } else // I do the addition AFTERWARDS { newC = new XYZ(centX + x, centY + y, c.Z + z); } return(newC); }
internal void NewSession(ProjectLocation location) { Home(); if (location != null) { ViewModel.OutputFolderPath = location.FolderPath; ViewModel.FixedOutputFolder = true; ViewModel.TargetProjectLocation = location; } }
public void SetUp() { var app = new WebApplication(ProjectLocation.FromFolder("ContosoUniversity"), 12365); app.AddEnvironmentVariable("FunctionalTests"); WebServer = new IisExpressWebServer(app); WebServer.Start("Release"); Browser = Browsers.Chrome; _mvcUrlHelper = new MvcUrlHelper(RouteConfig.RegisterRoutes(new RouteCollection())); }
private void StartIisExpress() { //int PortNumber = int.Parse(SeleniumController.BaseUrl.Substring(SeleniumController.BaseUrl.LastIndexOf(':') + 1, 5)); int PortNumber = int.Parse(BaseUrl.Substring((BaseUrl.LastIndexOf(':') + 1), (BaseUrl.LastIndexOf('/') - (BaseUrl.LastIndexOf(':') + 1)))); var app = new WebApplication(ProjectLocation.FromFolder("PPC_Rental"), PortNumber); app.AddEnvironmentVariable("UITests"); WebServer = new IisExpressWebServer(app); WebServer.Start("Release"); }
Stream(ArrayList data, ProjectLocation projLoc) { data.Add(new Snoop.Data.ClassSeparator(typeof(ProjectLocation))); data.Add(new Snoop.Data.String("Name", projLoc.Name)); data.Add(new Snoop.Data.Object("Site location", projLoc.SiteLocation)); XYZ pt = new XYZ(); data.Add(new Snoop.Data.Object("Project position", projLoc.get_ProjectPosition(pt))); data.Add(new Snoop.Data.Xyz("Project position (pt)", pt)); }
private void ProjectTitleTB_TextChanged(object sender, TextChangedEventArgs e) { ProjectLocation loc = ProjectListLB.SelectedItem as ProjectLocation; if (loc == null) { return; } loc.Description = ProjectDescTB.Text; }
/// <summary> /// Get ProjectLocation details for both Survey Point and Project Base Point /// It will try to duplicate a SiteLocation if it is not good (e.g. NonConformal) in some of the old data /// </summary> /// <param name="doc"></param> /// <param name="svPosition"></param> /// <param name="pbPosition"></param> /// <returns></returns> public static (double svNorthings, double svEastings, double svElevation, double svAngle, double pbNorthings, double pbEastings, double pbElevation, double pbAngle) ProjectLocationInfo (Document doc, XYZ svPosition, XYZ pbPosition) { double svNorthings = 0.0; double svEastings = 0.0; double svAngle = 0.0; double svElevation = 0.0; double pbNorthings = 0.0; double pbEastings = 0.0; double pbElevation = 0.0; double pbAngle = 0.0; try { ProjectPosition surveyPos = doc.ActiveProjectLocation.GetProjectPosition(svPosition); svNorthings = surveyPos.NorthSouth; svEastings = surveyPos.EastWest; svElevation = surveyPos.Elevation; svAngle = surveyPos.Angle; ProjectPosition projectBasePos = doc.ActiveProjectLocation.GetProjectPosition(pbPosition); pbNorthings = projectBasePos.NorthSouth; pbEastings = projectBasePos.EastWest; pbElevation = projectBasePos.Elevation; pbAngle = projectBasePos.Angle; } catch (Autodesk.Revit.Exceptions.InvalidOperationException) { // If the exception is due to not good data that causes Transform not formed correctly, duplicating it may actually solve the problem try { ProjectLocation duplProjectLocation = doc.ActiveProjectLocation.Duplicate(doc.ActiveProjectLocation.Name + "-Copy"); doc.ActiveProjectLocation = duplProjectLocation; ProjectPosition surveyPos = doc.ActiveProjectLocation.GetProjectPosition(svPosition); svNorthings = surveyPos.NorthSouth; svEastings = surveyPos.EastWest; svAngle = surveyPos.Angle; svElevation = surveyPos.Elevation; ProjectPosition projectBasePos = doc.ActiveProjectLocation.GetProjectPosition(pbPosition); pbNorthings = projectBasePos.NorthSouth; pbEastings = projectBasePos.EastWest; pbAngle = projectBasePos.Angle; pbElevation = projectBasePos.Elevation; } catch { } } return(svNorthings, svEastings, svElevation, svAngle, pbNorthings, pbEastings, pbElevation, pbAngle); }
private void Stream(ArrayList data, ProjectLocation projLoc) { data.Add(new Snoop.Data.ClassSeparator(typeof(ProjectLocation))); data.Add(new Snoop.Data.String("Name", projLoc.Name)); data.Add(new Snoop.Data.Object("Site location", projLoc.SiteLocation)); XYZ pt = new XYZ(); data.Add(new Snoop.Data.Object("Project position", projLoc.get_ProjectPosition(pt))); data.Add(new Snoop.Data.Xyz("Project position (pt)", pt)); }
/// <summary> /// Initializes a new instance of the <see cref="ManagedProjectBase"/> class. /// </summary> /// <param name="solution">The solution.</param> /// <param name="projectPath">The project path.</param> /// <param name="xmlDefinition">The XML definition.</param> /// <param name="solutionTask">The solution task.</param> /// <param name="tfc">The TFC.</param> /// <param name="gacCache">The gac cache.</param> /// <param name="refResolver">The reference resolver.</param> /// <param name="outputDir">The output dir.</param> /// <exception cref="System.ArgumentNullException"> /// projectPath /// or /// xmlDefinition /// </exception> protected ManagedProjectBase(SolutionBase solution, string projectPath, XmlElement xmlDefinition, SolutionTask solutionTask, TempFileCollection tfc, GacCache gacCache, ReferencesResolver refResolver, DirectoryInfo outputDir) : base(xmlDefinition, solutionTask, tfc, gacCache, refResolver, outputDir) { if (projectPath == null) { throw new ArgumentNullException("projectPath"); } if (xmlDefinition == null) { throw new ArgumentNullException("xmlDefinition"); } _references = new ArrayList(); _neutralResources = new ArrayList(); _localizedResources = new ArrayList(); _sourceFiles = CollectionsUtil.CreateCaseInsensitiveHashtable(); _projectPath = projectPath; _projectLocation = DetermineProjectLocation(xmlDefinition); if (!IsWebProject) { _projectDirectory = new FileInfo(projectPath).Directory; } else { string projectDirectory = projectPath.Replace(":", "_"); projectDirectory = projectDirectory.Replace("/", "_"); projectDirectory = projectDirectory.Replace("\\", "_"); _projectDirectory = new DirectoryInfo(FileUtils.CombinePaths( TemporaryFiles.BasePath, projectDirectory)); // ensure project directory exists if (!_projectDirectory.Exists) { _projectDirectory.Create(); _projectDirectory.Refresh(); } _webProjectBaseUrl = projectPath.Substring(0, projectPath.LastIndexOf("/")); } _projectSettings = new ProjectSettings(xmlDefinition, (XmlElement) xmlDefinition.SelectSingleNode("//Build/Settings"), this); XmlNodeList nlConfigurations = xmlDefinition.SelectNodes("//Config"); foreach (XmlElement elemConfig in nlConfigurations) { ConfigurationSettings cs = new ConfigurationSettings(this, elemConfig, OutputDir); ProjectConfigurations[Configuration.Parse(cs.Name)] = cs; } XmlNodeList nlReferences = xmlDefinition.SelectNodes("//References/Reference"); foreach (XmlElement elemReference in nlReferences) { ReferenceBase reference = CreateReference(solution, elemReference); _references.Add(reference); } XmlNodeList nlFiles = xmlDefinition.SelectNodes("//Files/Include/File"); foreach (XmlElement elemFile in nlFiles) { string buildAction = StringUtils.ConvertEmptyToNull(elemFile.GetAttribute("BuildAction")); string sourceFile; if (!String.IsNullOrEmpty(elemFile.GetAttribute("Link"))) { sourceFile = FileUtils.GetFullPath(FileUtils.CombinePaths( ProjectDirectory.FullName, elemFile.GetAttribute("Link"))); } else { sourceFile = FileUtils.GetFullPath(FileUtils.CombinePaths( ProjectDirectory.FullName, elemFile.GetAttribute("RelPath"))); } if (IsWebProject) { WebDavClient wdc = new WebDavClient(new Uri(_webProjectBaseUrl)); wdc.DownloadFile(sourceFile, elemFile.Attributes["RelPath"].Value); switch (buildAction) { case "Compile": _sourceFiles[sourceFile] = null; break; case "EmbeddedResource": RegisterEmbeddedResource(sourceFile, elemFile); break; case null: if (string.Compare(Path.GetExtension(sourceFile), FileExtension, true, CultureInfo.InvariantCulture) == 0) { _sourceFiles[sourceFile] = null; } break; } } else { switch (buildAction) { case "Compile": _sourceFiles[sourceFile] = null; break; case "EmbeddedResource": RegisterEmbeddedResource(sourceFile, elemFile); break; case null: if (string.Compare(Path.GetExtension(sourceFile), FileExtension, true, CultureInfo.InvariantCulture) == 0) { _sourceFiles[sourceFile] = null; } break; } // check if file is "App.config" (using case-insensitive comparison) if (string.Compare("App.config", elemFile.GetAttribute("RelPath"), true, CultureInfo.InvariantCulture) == 0) { // App.config is only an output file for executable projects if (ProjectSettings.OutputType == ManagedOutputType.Executable || ProjectSettings.OutputType == ManagedOutputType.WindowsExecutable) { ExtraOutputFiles[sourceFile] = ProjectSettings.OutputFileName + ".config"; } } } } }