public override List <Spoke> GetSpokes() { if (SpokeNum == 0) { return(new List <Spoke>()); } var result = new List <Spoke>(); var angleStep = 360 / SpokeNum; var currentAngle = angleStep + Angle; var center = Point.Parse($"{Radius},{Radius}"); var smallRadius = SmallDiameter / 2; var bigRadius = Radius; for (var i = 0; i < SpokeNum; i++) { var spoke = new Spoke(); var startLine = new Point(center.X + smallRadius * Utils.GetCos(currentAngle), center.Y + smallRadius * Utils.GetSin(currentAngle)); var endLine = new Point(center.X + bigRadius * Utils.GetCos(currentAngle), center.Y + bigRadius * Utils.GetSin(currentAngle)); spoke.X1 = startLine.X; spoke.Y1 = startLine.Y; spoke.X2 = endLine.X; spoke.Y2 = endLine.Y; result.Add(spoke); currentAngle += angleStep; } return(result); }
/// <summary> /// Calculate the Spoke Points and store them /// </summary> private void CalculateSpokesPoints() { spokes = new List <Spoke>(); // Calculate the angle between adjacent spokes angleIncrement = (360 / (double)TickCount); // Calculate the change in alpha between adjacent spokes alphaChange = (int)((double)(255 - LowestAlpha) / (double)((AlphaTicksPercentage / 100.0) * TickCount)); // Set the start angle for rendering renderStartAngle = StartAngle; // Calculate the location around which the spokes will be drawn double width = (this.Width < this.Height) ? this.Width : this.Height; centerPoint = new Point(this.Width / 2, this.Height / 2); // Calculate the inner and outer radii of the control. The radii should not be less than the // Minimum values innerRadius = (int)(width * INNER_RADIUS_FACTOR); if (innerRadius < MINIMUM_INNER_RADIUS) { innerRadius = MINIMUM_INNER_RADIUS; } outerRadius = (int)(width * OUTER_RADIUS_FACTOR); if (outerRadius < MINIMUM_OUTER_RADIUS) { outerRadius = MINIMUM_OUTER_RADIUS; } double angle = 0; for (int i = 0; i < TickCount; i++) { Point pt1 = new Point(innerRadius * (float)Math.Cos(ConvertDegreesToRadians(angle)), innerRadius * (float)Math.Sin(ConvertDegreesToRadians(angle))); Point pt2 = new Point(outerRadius * (float)Math.Cos(ConvertDegreesToRadians(angle)), outerRadius * (float)Math.Sin(ConvertDegreesToRadians(angle))); // Create a spoke based on the points generated Spoke spoke = new Spoke(pt1, pt2); // Add the spoke to the List spokes.Add(spoke); // If it is not it Indeterminate state, // ensure that the spokes are drawn in clockwise manner if (!IsIndeterminate) { angle += angleIncrement; } else { if (Rotation == Direction.CLOCKWISE) { angle -= angleIncrement; } else if (Rotation == Direction.ANTICLOCKWISE) { angle += angleIncrement; } } } }
/// <summary> /// Calculate the Spoke Points and store them /// </summary> private void CalculateSpokesPoints() { m_Spokes = new List <Spoke>(); // Calculate the angle between adjacent spokes m_AngleIncrement = (360 / (float)m_SpokesCount); // Calculate the change in alpha between adjacent spokes m_AlphaChange = (int)((255 - m_AlphaLowerLimit) / m_SpokesCount); // Calculate the location around which the spokes will be drawn int width = (this.Width < this.Height) ? this.Width : this.Height; m_CentrePt = new PointF(this.Width / 2, this.Height / 2); // Calculate the width of the pen which will be used to draw the spokes m_Pen.Width = (int)(width / 15); if (m_Pen.Width < MINIMUM_PEN_WIDTH) { m_Pen.Width = MINIMUM_PEN_WIDTH; } // Calculate the inner and outer radii of the control. The radii should not be less than the // Minimum values m_InnerRadius = (int)(width * INNER_RADIUS_FACTOR); if (m_InnerRadius < MINIMUM_INNER_RADIUS) { m_InnerRadius = MINIMUM_INNER_RADIUS; } m_OuterRadius = (int)(width * OUTER_RADIUS_FACTOR); if (m_OuterRadius < MINIMUM_OUTER_RADIUS) { m_OuterRadius = MINIMUM_OUTER_RADIUS; } float angle = 0; for (int i = 0; i < m_SpokesCount; i++) { PointF pt1 = new PointF(m_InnerRadius * (float)Math.Cos(ConvertDegreesToRadians(angle)), m_InnerRadius * (float)Math.Sin(ConvertDegreesToRadians(angle))); PointF pt2 = new PointF(m_OuterRadius * (float)Math.Cos(ConvertDegreesToRadians(angle)), m_OuterRadius * (float)Math.Sin(ConvertDegreesToRadians(angle))); pt1.X += m_CentrePt.X; pt1.Y += m_CentrePt.Y; pt2.X += m_CentrePt.X; pt2.Y += m_CentrePt.Y; // Create a spoke based on the points generated Spoke spoke = new Spoke(pt1, pt2); // Add the spoke to the List m_Spokes.Add(spoke); if (Rotation == Direction.CLOCKWISE) { angle -= m_AngleIncrement; } else if (Rotation == Direction.ANTICLOCKWISE) { angle += m_AngleIncrement; } } }
void InitSpokes() { spokes = new Spoke[spokeCount]; for (int i = 0; i < spokeCount; i++) { spokes[i] = new Spoke(60); } }
/// <summary> /// Calculate the Spoke Points and store them /// </summary> private void CalculateSpokesPoints() { _spokes = new List <Spoke>(); // Calculate the angle between adjacent spokes _angleIncrement = (360 / (double)TickCount); // Calculate the change in alpha between adjacent spokes _alphaChange = (int)((255 - LowestAlpha) / ((AlphaTicksPercentage / 100.0) * TickCount)); // Set the start angle for rendering _renderStartAngle = StartAngle; // Calculate the location around which the spokes will be drawn var width = (Width < Height) ? Width : Height; _centerPoint = new Point(Width / 2, Height / 2); // Calculate the inner and outer radii of the control. The radii should not be less than the // Minimum values //_innerRadius = (int)(width * INNER_RADIUS_FACTOR); //if (_innerRadius < MINIMUM_INNER_RADIUS) // _innerRadius = MINIMUM_INNER_RADIUS; //_outerRadius = (int)(width * OUTER_RADIUS_FACTOR); //if (_outerRadius < MINIMUM_OUTER_RADIUS) // _outerRadius = MINIMUM_OUTER_RADIUS; _innerRadius = (int)(width * InnerRadius);; _outerRadius = (int)(width * OuterRadius);; double angle = 0; for (var i = 0; i < TickCount; i++) { var pt1 = new Point(_innerRadius * (float)Math.Cos(ConvertDegreesToRadians(angle)), _innerRadius * (float)Math.Sin(ConvertDegreesToRadians(angle))); var pt2 = new Point(_outerRadius * (float)Math.Cos(ConvertDegreesToRadians(angle)), _outerRadius * (float)Math.Sin(ConvertDegreesToRadians(angle))); // Create a spoke based on the points generated var spoke = new Spoke(pt1, pt2); // Add the spoke to the List _spokes.Add(spoke); // If it is not it Indeterminate state, // ensure that the spokes are drawn in clockwise manner if (!IsIndeterminate && IsLoaded) { angle += _angleIncrement; } else { if (Rotation == Direction.CLOCKWISE) { angle -= _angleIncrement; } else if (Rotation == Direction.ANTICLOCKWISE) { angle += _angleIncrement; } } } }
public async stt::Task GetSpokeResourceNamesAsync() { moq::Mock <HubService.HubServiceClient> mockGrpcClient = new moq::Mock <HubService.HubServiceClient>(moq::MockBehavior.Strict); mockGrpcClient.Setup(x => x.CreateOperationsClient()).Returns(new moq::Mock <lro::Operations.OperationsClient>().Object); GetSpokeRequest request = new GetSpokeRequest { SpokeName = SpokeName.FromProjectLocationSpoke("[PROJECT]", "[LOCATION]", "[SPOKE]"), }; Spoke expectedResponse = new Spoke { SpokeName = SpokeName.FromProjectLocationSpoke("[PROJECT]", "[LOCATION]", "[SPOKE]"), CreateTime = new wkt::Timestamp(), UpdateTime = new wkt::Timestamp(), Labels = { { "key8a0b6e3c", "value60c16320" }, }, Description = "description2cf9da67", HubAsHubName = HubName.FromProjectHub("[PROJECT]", "[HUB]"), UniqueId = "unique_idee0c0869", LinkedVpnTunnelsAsVpnTunnelNames = { VpnTunnelName.FromProjectRegionResource("[PROJECT]", "[REGION]", "[RESOURCE_ID]"), }, LinkedInterconnectAttachmentsAsInterconnectAttachmentNames = { InterconnectAttachmentName.FromProjectRegionResource("[PROJECT]", "[REGION]", "[RESOURCE_ID]"), }, LinkedRouterApplianceInstances = { new RouterApplianceInstance(), }, State = State.Active, }; mockGrpcClient.Setup(x => x.GetSpokeAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <Spoke>(stt::Task.FromResult(expectedResponse), null, null, null, null)); HubServiceClient client = new HubServiceClientImpl(mockGrpcClient.Object, null); Spoke responseCallSettings = await client.GetSpokeAsync(request.SpokeName, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None)); xunit::Assert.Same(expectedResponse, responseCallSettings); Spoke responseCancellationToken = await client.GetSpokeAsync(request.SpokeName, st::CancellationToken.None); xunit::Assert.Same(expectedResponse, responseCancellationToken); mockGrpcClient.VerifyAll(); }
public override List <Spoke> GetSpokes() { var result = new List <Spoke>(); var currentAngle = Angle; var center = Point.Parse($"{Radius},{Radius}"); var angleStep = 45; for (var i = 0; i < 8; i++) { var spoke = new Spoke(); var endLine = new Point(center.X + Radius * Utils.GetCos(currentAngle), center.Y + Radius * Utils.GetSin(currentAngle)); spoke.X1 = center.X; spoke.Y1 = center.Y; spoke.X2 = endLine.X; spoke.Y2 = endLine.Y; result.Add(spoke); currentAngle += angleStep; } if (SpokeNum == 16) { currentAngle = 45 / 2 + Angle; var point1 = new Point(center.X + Radius * Utils.GetCos(0), center.Y + Radius * Utils.GetSin(0)); var point2 = new Point(center.X + Radius * Utils.GetCos(45), center.Y + Radius * Utils.GetSin(45)); var a = Math.Sqrt((point1.X - point2.X) * (point1.X - point2.X) + (point1.Y - point2.Y) * (point1.Y - point2.Y)); var innerRadius = a * (1 + Math.Sqrt(2.0)) / 2; for (var i = 0; i < 8; i++) { var spoke = new Spoke(); var endLine = new Point(center.X + innerRadius * Utils.GetCos(currentAngle), center.Y + innerRadius * Utils.GetSin(currentAngle)); spoke.X1 = center.X; spoke.Y1 = center.Y; spoke.X2 = endLine.X; spoke.Y2 = endLine.Y; result.Add(spoke); currentAngle += angleStep; } } return(result); }
public override List <Spoke> GetSpokes() { var result = new List <Spoke>(); var currentAngle = Angle; var center = Point.Parse($"{Radius},{Radius}"); var smallRadius = SmallDiameter / 2; var angleStep = 90; for (var i = 0; i < 4; i++) { var spoke = new Spoke(); var startLine = new Point(center.X + smallRadius * Utils.GetCos(currentAngle), center.Y + smallRadius * Utils.GetSin(currentAngle)); var endLine = new Point(center.X + SquareHeight / 2 * Utils.GetCos(currentAngle), center.Y + SquareHeight / 2 * Utils.GetSin(currentAngle)); spoke.X1 = startLine.X; spoke.Y1 = startLine.Y; spoke.X2 = endLine.X; spoke.Y2 = endLine.Y; result.Add(spoke); currentAngle += angleStep; } if (SpokeNum == 8) { currentAngle = 45 + Angle; for (var i = 0; i < 4; i++) { var spoke = new Spoke(); var startLine = new Point(center.X + smallRadius * Utils.GetCos(currentAngle), center.Y + smallRadius * Utils.GetSin(currentAngle)); var endLine = new Point(center.X + Diameter / 2 * Utils.GetCos(currentAngle), center.Y + Diameter / 2 * Utils.GetSin(currentAngle)); spoke.X1 = startLine.X; spoke.Y1 = startLine.Y; spoke.X2 = endLine.X; spoke.Y2 = endLine.Y; result.Add(spoke); currentAngle += angleStep; } } return(result); }
public void GetSpokeResourceNames() { moq::Mock <HubService.HubServiceClient> mockGrpcClient = new moq::Mock <HubService.HubServiceClient>(moq::MockBehavior.Strict); mockGrpcClient.Setup(x => x.CreateOperationsClient()).Returns(new moq::Mock <lro::Operations.OperationsClient>().Object); GetSpokeRequest request = new GetSpokeRequest { SpokeName = SpokeName.FromProjectLocationSpoke("[PROJECT]", "[LOCATION]", "[SPOKE]"), }; Spoke expectedResponse = new Spoke { SpokeName = SpokeName.FromProjectLocationSpoke("[PROJECT]", "[LOCATION]", "[SPOKE]"), CreateTime = new wkt::Timestamp(), UpdateTime = new wkt::Timestamp(), Labels = { { "key8a0b6e3c", "value60c16320" }, }, Description = "description2cf9da67", HubAsHubName = HubName.FromProjectHub("[PROJECT]", "[HUB]"), UniqueId = "unique_idee0c0869", State = State.Active, LinkedVpnTunnels = new LinkedVpnTunnels(), LinkedInterconnectAttachments = new LinkedInterconnectAttachments(), LinkedRouterApplianceInstances = new LinkedRouterApplianceInstances(), }; mockGrpcClient.Setup(x => x.GetSpoke(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse); HubServiceClient client = new HubServiceClientImpl(mockGrpcClient.Object, null); Spoke response = client.GetSpoke(request.SpokeName); xunit::Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }
/// <summary> /// Calculate the Spoke Points and store them /// </summary> private void CalculateSpokesPoints() { spokes = new List<Spoke>(); // Calculate the angle between adjacent spokes angleIncrement = (360 / (double)TickCount); // Calculate the change in alpha between adjacent spokes alphaChange = (int)((255 - ALPHA_LOWER_LIMIT) / (double)TickCount); // Set the startTime angle for rendering renderStartAngle = StartAngle; // Calculate the location around which the spokes will be drawn double width = (this.Width < this.Height) ? this.Width : this.Height; centerPoint = new Point(this.Width / 2, this.Height / 2); // Calculate the inner and outer radii of the control. The radii should not be less than the // Minimum values innerRadius = (int)(width * INNER_RADIUS_FACTOR); if (innerRadius < MINIMUM_INNER_RADIUS) innerRadius = MINIMUM_INNER_RADIUS; outerRadius = (int)(width * OUTER_RADIUS_FACTOR); if (outerRadius < MINIMUM_OUTER_RADIUS) outerRadius = MINIMUM_OUTER_RADIUS; double angle = 0; for (int i = 0; i < TickCount; i++) { Point pt1 = new Point( innerRadius * (float)Math.Cos(ConvertDegreesToRadians(angle)), innerRadius * (float)Math.Sin(ConvertDegreesToRadians(angle))); Point pt2 = new Point( outerRadius * (float)Math.Cos(ConvertDegreesToRadians(angle)), outerRadius * (float)Math.Sin(ConvertDegreesToRadians(angle))); // Create a spoke based on the points generated Spoke spoke = new Spoke(pt1, pt2); // Add the spoke to the List spokes.Add(spoke); // If it is not it Indeterminate state, // ensure that the spokes are drawn in clockwise manner if (!IsIndeterminate) { angle += angleIncrement; } else { if (Rotation == Direction.CLOCKWISE) { angle -= angleIncrement; } else if (Rotation == Direction.ANTICLOCKWISE) { angle += angleIncrement; } } } }
/// <summary> /// Calculate the Spoke Points and store them /// </summary> private void CalculateSpokesPoints() { mSpokes = new List <Spoke>(); // Calculate the angle between adjacent spokes mAngleIncrement = (360 / (double)TickCount); // Calculate the change in alpha between adjacent spokes mAlphaChange = (int)((255 - ALPHA_LOWER_LIMIT) / TickCount); // Set the start angle for rendering mRenderStartAngle = StartAngle; // Calculate the location around which the spokes will be drawn double width = (Width < Height) ? Width : Height; mCenterPoint = new Point(Width / 2, Height / 2); // Calculate the inner and outer radii of the control. The radii should not be less than the // Minimum values mInnerRadius = (int)(width * INNER_RADIUS_FACTOR); if (mInnerRadius < MINIMUM_INNER_RADIUS) { mInnerRadius = MINIMUM_INNER_RADIUS; } mOuterRadius = (int)(width * OUTER_RADIUS_FACTOR); if (mOuterRadius < MINIMUM_OUTER_RADIUS) { mOuterRadius = MINIMUM_OUTER_RADIUS; } double angle = 0; for (int i = 0; i < TickCount; i++) { Point pt1 = new Point(mInnerRadius * (float)Math.Cos(ConvertDegreesToRadians(angle)), mInnerRadius * (float)Math.Sin(ConvertDegreesToRadians(angle))); Point pt2 = new Point(mOuterRadius * (float)Math.Cos(ConvertDegreesToRadians(angle)), mOuterRadius * (float)Math.Sin(ConvertDegreesToRadians(angle))); // Create a spoke based on the points generated Spoke spoke = new Spoke(pt1, pt2); // Add the spoke to the List mSpokes.Add(spoke); // If it is not it Indeterminate state, // ensure that the spokes are drawn in clockwise manner if (!IsIndeterminate) { angle += mAngleIncrement; } else { if (Rotation == Direction.ClockWise) { angle -= mAngleIncrement; } else if (Rotation == Direction.AntiClockWise) { angle += mAngleIncrement; } } } }
/// <summary> /// Calculate the Spoke Points and store them /// </summary> private void CalculateSpokesPoints() { _spokes = new List<Spoke>(); // Calculate the angle between adjacent spokes _angleIncrement = (360 / (double)TickCount); // Calculate the change in alpha between adjacent spokes _alphaChange = (int)((255 - LowestAlpha) / ((AlphaTicksPercentage / 100.0) * TickCount)); // Set the start angle for rendering _renderStartAngle = StartAngle; // Calculate the location around which the spokes will be drawn var width = (Width < Height) ? Width : Height; _centerPoint = new Point(Width / 2, Height / 2); // Calculate the inner and outer radii of the control. The radii should not be less than the // Minimum values //_innerRadius = (int)(width * INNER_RADIUS_FACTOR); //if (_innerRadius < MINIMUM_INNER_RADIUS) // _innerRadius = MINIMUM_INNER_RADIUS; //_outerRadius = (int)(width * OUTER_RADIUS_FACTOR); //if (_outerRadius < MINIMUM_OUTER_RADIUS) // _outerRadius = MINIMUM_OUTER_RADIUS; _innerRadius = (int)(width * InnerRadius); ; _outerRadius = (int)(width * OuterRadius); ; double angle = 0; for (var i = 0; i < TickCount; i++) { var pt1 = new Point(_innerRadius * (float)Math.Cos(ConvertDegreesToRadians(angle)), _innerRadius * (float)Math.Sin(ConvertDegreesToRadians(angle))); var pt2 = new Point(_outerRadius * (float)Math.Cos(ConvertDegreesToRadians(angle)), _outerRadius * (float)Math.Sin(ConvertDegreesToRadians(angle))); // Create a spoke based on the points generated var spoke = new Spoke(pt1, pt2); // Add the spoke to the List _spokes.Add(spoke); // If it is not it Indeterminate state, // ensure that the spokes are drawn in clockwise manner if (!IsIndeterminate) { angle += _angleIncrement; } else { if (Rotation == Direction.CLOCKWISE) { angle -= _angleIncrement; } else if (Rotation == Direction.ANTICLOCKWISE) { angle += _angleIncrement; } } } }
protected void OnSpoke(SpokeEventArgs e) { Spoke?.Invoke(this, e); }
/// <summary> /// Calculate the Spoke Points and store them /// </summary> private void CalculateSpokesPoints() { m_Spokes = new List<Spoke>(); // Calculate the angle between adjacent spokes m_AngleIncrement = (360 / (float)m_SpokesCount); // Calculate the change in alpha between adjacent spokes m_AlphaChange = (int)((255 - m_AlphaLowerLimit) / m_SpokesCount); m_StartAngle = StartAngle; // Calculate the location around which the spokes will be drawn double width = (this.Width < this.Height) ? this.Width : this.Height; m_CentrePt = new Point(this.Width / 2, this.Height / 2); // Calculate the width of the pen which will be used to draw the spokes m_PenThickness = width / 15; if (m_PenThickness < MINIMUM_PEN_WIDTH) m_PenThickness = MINIMUM_PEN_WIDTH; // Calculate the inner and outer radii of the control. The radii should not be less than the // Minimum values m_InnerRadius = (int)(width * INNER_RADIUS_FACTOR); if (m_InnerRadius < MINIMUM_INNER_RADIUS) m_InnerRadius = MINIMUM_INNER_RADIUS; m_OuterRadius = (int)(width * OUTER_RADIUS_FACTOR); if (m_OuterRadius < MINIMUM_OUTER_RADIUS) m_OuterRadius = MINIMUM_OUTER_RADIUS; double angle = 0; for (int i = 0; i < m_SpokesCount; i++) { Point pt1 = new Point(m_InnerRadius * (float)Math.Cos(ConvertDegreesToRadians(angle)), m_InnerRadius * (float)Math.Sin(ConvertDegreesToRadians(angle))); Point pt2 = new Point(m_OuterRadius * (float)Math.Cos(ConvertDegreesToRadians(angle)), m_OuterRadius * (float)Math.Sin(ConvertDegreesToRadians(angle))); // Create a spoke based on the points generated Spoke spoke = new Spoke(pt1, pt2); // Add the spoke to the List m_Spokes.Add(spoke); if (Rotation == Direction.CLOCKWISE) { angle -= m_AngleIncrement; } else if (Rotation == Direction.ANTICLOCKWISE) { angle += m_AngleIncrement; } } }
public void Start(string url) { #region NanoSetup var exitEvent = new ManualResetEvent(false); Console.CancelKeyPress += (sender, eventArgs) => { eventArgs.Cancel = true; exitEvent.Set(); }; var validatedUrls = ValidateUrls(url); var config = new NanoConfiguration(); config.EnableCorrelationId(); config.AddDirectory("/", Debugger.IsAttached ? "../../www" : "www", returnHttp404WhenFileWasNotFound: true); #endregion //you will need to provide a connection string in your app.config for this to produce any events. //constructor will set default hardcoded values, you can then override any of those values here ( below values listed are the default values ) var spokeConfig = new Spoke.SpokeConfiguration { DefaultAbortAfterMinutes = 60, LiveRetryAbortAfterMinutes = 60, EventProcessingMutexTimeToLiveMinutes = 2, EventSubscriptionMutexTimeToLiveMinutes = 2, FailedEventsLookbackMinutes = 1440, FailedEventsThresholdMinutes = 60, FailedNotificationsThresholdMinutes = 60, MutexAcquisitionWaitTime = 1, ClockBackfillTotalMinutes = 10, ClockBackfillOffsetMinutes = 2, ClockBackfillMutexTimeToLiveMinutes = 2, ClockSleepMilliseconds = 10000, SendClockMessages = true, AppName = $"{Environment.MachineName}-{AppDomain.CurrentDomain.FriendlyName}", UserName = WindowsIdentity.GetCurrent()?.Name, GetApiUri = x => x.Uri, WasApiCallSuccessfulHandlers = new Dictionary <string, Func <Spoke.Models.WasApiCallSuccessfulInput, bool> > { { "DEFAULT", response => response.HttpResponse.Exception == null && response.HttpResponse.Response != null && response.HttpResponse.Response.StatusCode == HttpStatusCode.OK } }, JsonSerializer = new Spoke.Utils.JsonSerializer(), Database = () => new Spoke.DatabaseIO.SpokeSqlDatabase(), DatabaseConnectionString = () => ConfigurationManager.ConnectionStrings["spoke"].ConnectionString, SchemaName = "Spoke" }; //you can add support for "service types" by adding WasApiCallSuccessfulHandlers instead of the default. spokeConfig.WasApiCallSuccessfulHandlers.Add( "OTHER_SERVICE_TYPE", //the key for the new service type response => response.HttpResponse.Exception == null //func to evaluate if the service call was successful or not. ); var spoke = new Spoke(spokeConfig); spoke.Start(); config.AddMethods <Spoke.ExternalApi>("/Api/Events"); config.AddMethods <Spoke.InternalApi>("/Api/Events/Internal"); #region NanoSetup config.AddBackgroundTask("GCCollect", 30000, () => { GC.Collect(); return(null); }); config.GlobalEventHandler.UnhandledExceptionHandlers.Add((exception, context) => { try { if (!EventLog.SourceExists(_applicationName)) { EventLog.CreateEventSource(_applicationName, "Application"); } var msg = new StringBuilder() .AppendLine("Nano Error:") .AppendLine("-----------").AppendLine() .AppendLine("URL: " + context.Request.Url).AppendLine() .AppendLine("Message: " + exception.Message).AppendLine() .AppendLine("StackTrace:") .AppendLine(exception.StackTrace) .ToString(); EventLog.WriteEntry(_applicationName, msg, EventLogEntryType.Error); } catch (Exception) { // Gulp: Never throw an exception in the unhandled exception handler } }); _server = HttpListenerNanoServer.Start(config, validatedUrls); if (Debugger.IsAttached) { Process.Start(_server.HttpListenerConfiguration.GetFirstUrlBeingListenedOn().TrimEnd('/') + "/ApiExplorer/"); } Console.WriteLine("Nano Server is running on: " + _server.HttpListenerConfiguration.GetFirstUrlBeingListenedOn()); #endregion }