static void SubmitWorkitem(string inResource, ResourceKind inResourceKind) { //create a workitem var wi = new WorkItem() { Id = "", //must be set to empty Arguments = new Arguments(), ActivityId = "PlotToPDF" //PlotToPDF is a predefined activity }; wi.Arguments.InputArguments.Add(new Argument() { Name = "HostDwg",// Must match the input parameter in activity Resource = inResource, ResourceKind = inResourceKind, StorageProvider = StorageProvider.Generic //Generic HTTP download (as opposed to A360) }); wi.Arguments.OutputArguments.Add(new Argument() { Name = "Result", //must match the output parameter in activity StorageProvider = StorageProvider.Generic, //Generic HTTP upload (as opposed to A360) HttpVerb = HttpVerbType.POST, //use HTTP POST when delivering result Resource = null //use storage provided by AutoCAD.IO }); container.AddToWorkItems(wi); Console.WriteLine("Submitting workitem..."); container.SaveChanges(); pollWorkitem(wi, inResourceKind.ToString()); }
/// <summary> /// Gets the total resources still needed to complete construction /// </summary> /// <param name="resourceKind"></param> /// <returns>Resources needed to complete construction</returns> public double GetNeededResource(ResourceKind resourceKind) { double needed = 0; foreach (var requirement in unfilledResourceReqs) { if (requirement.name == resourceKind.ToString()) { needed += requirement.amount; } } foreach (var res in reservations) { if (res.resourceKind == resourceKind && !res.Released && !res.Cancelled) { needed -= res.amount; } } return(needed); }
public void SetResource(ResourceKind resourceKind) { GameObject resourceInstance = null; if (resourceKind != ResourceKind.NONE) { Destroy(resource.Instance); string resourceName = resourceKind.ToString(); resourceName = resourceName.First().ToString() + resourceName.Substring(1).ToLower(); resourceInstance = Instantiate(Resources.Load(resourceName, typeof(GameObject)), gameObject.transform) as GameObject; float offsetY = resourceInstance.GetComponentInChildren <MeshFilter>().mesh.bounds.size.y *resourceInstance.transform.localScale.y * 0.5f; resourceInstance.transform.Translate(new Vector3(0f, offsetY, 0f)); } else { Destroy(resource.Instance); } resource.Kind = resourceKind; resource.Instance = resourceInstance; }
public ResourceGroup(ResourceKind rp) { ResKind = rp; PathName = rp.ToString(); }