void App_Startup(object sender, StartupEventArgs e) { DataPipeClient dataPipeClient; if (e.Args.Length == 4) { dataPipeClient = new DataPipeClient(e.Args[0], e.Args[1]); AutocadDataService.DataPipeClient = dataPipeClient; uibindings = new SpeckleUIBindingsAutoCAD(dataPipeClient); waitHandles = new WaitHandle[2]; waitHandles[SHOW_UI_SIGNAL] = EventWaitHandle.OpenExisting(e.Args[2]); waitHandles[AUTOCAD_SELECTION_CHANGED_SIGNAL] = EventWaitHandle.OpenExisting(e.Args[3]); eventProcessorThread = new Thread(ProcessEvent); eventProcessorThread.IsBackground = true; eventProcessorThread.Start(); } else { uibindings = new SpeckleUIBindingsAutoCAD(null); } //Create main application window var path = Directory.GetParent(Assembly.GetExecutingAssembly().Location); var indexPath = string.Format(@"{0}\app\index.html", path); indexPath = indexPath.Replace("\\", "/"); SpeckleWindow = new SpeckleUiWindow(uibindings, indexPath); SpeckleWindow.Show(); }
public static SpeckleObject GetObject(long handle) { var request = new Request { Operation = Operation.GetObject, Data = handle.ToString() }; var response = DataPipeClient.SendRequest(request); if (response.StatusCode != 200) { throw new Exception(response.Data); } var dto = JsonConvert.DeserializeObject <DTO>(response.Data); switch (dto.ObjectType) { case Constants.Line: var linePayload = JsonConvert.DeserializeObject <LinePayload>(dto.Data); return(linePayload.ToSpeckleLine()); case Constants.Arc: var arcPayload = JsonConvert.DeserializeObject <ArcPayload>(dto.Data); var arc = arcPayload.ToSpeckleArc(); return(arc); case Constants.Polyline: var polycurvePayload = JsonConvert.DeserializeObject <PolycurvePayload>(dto.Data); var polycurve = polycurvePayload.ToSpecklePolycurve(); return(polycurve); case Constants.Polyline3d: var polylinePayload = JsonConvert.DeserializeObject <PolylinePayload>(dto.Data); var polyline = polylinePayload.ToSpecklePolyline(); return(polyline); default: return(new SpeckleObject()); } }
public static List <SpeckleStream> GetStreams() { var streams = new List <SpeckleStream>(); if (DataPipeClient != null) { var request = new Request { Operation = Operation.LoadStreamState, Data = string.Empty }; var response = DataPipeClient.SendRequest(request); if (!string.IsNullOrEmpty(response.Data)) { streams = JsonConvert.DeserializeObject <List <SpeckleStream> >(response.Data); } } return(streams); }
public static List <dynamic> GetClients() { var clients = new List <dynamic>(); if (DataPipeClient != null) { var request = new Request { Operation = Operation.LoadClientState, Data = string.Empty }; var response = DataPipeClient.SendRequest(request); if (!string.IsNullOrEmpty(response.Data)) { clients = JsonConvert.DeserializeObject <List <dynamic> >(response.Data); } } return(clients); }
public SpeckleUIBindingsAutoCAD(DataPipeClient dataPipeClient) : base() { this.dataPipeClient = dataPipeClient; }