/// <inheritdoc/> internal override void Flatten(Collections.ArrayList <Vector3> vertices, Collections.ArrayList <int> strokeIndices, Collections.ArrayList <int> fillIndices) { _arcSegment.IsLargeArc = true; _arcSegment.Point1 = new Vector2F(RadiusX, 0); _arcSegment.Point2 = _arcSegment.Point1; _arcSegment.Radius = new Vector2F(RadiusX, RadiusY); _arcSegment.RotationAngle = 0; _arcSegment.SweepClockwise = false; var tempVertices = ResourcePools <Vector2F> .Lists.Obtain(); _arcSegment.Flatten(tempVertices, MaxNumberOfIterations, Tolerance); int numberOfVertices = tempVertices.Count; if (numberOfVertices < 2) { return; } int startIndex = vertices.Count; // Add 3D vertices. We skip the duplicated vertices. for (int i = 0; i < numberOfVertices; i += 2) { vertices.Add(new Vector3(tempVertices[i].X, tempVertices[i].Y, 0)); } // Add stroke indices. for (int i = 0; i < numberOfVertices - 1; i++) { strokeIndices.Add(startIndex + (i + 1) / 2); } // Closing stroke: strokeIndices.Add(startIndex); if (IsFilled) { // Add a center vertex. var centerIndex = vertices.Count; vertices.Add(new Vector3(0, 0, 0)); // Add one triangle per circle segment. for (int i = 0; i < numberOfVertices / 2 - 1; i++) { fillIndices.Add(centerIndex); fillIndices.Add(startIndex + i + 1); fillIndices.Add(startIndex + i); } // Last triangle: fillIndices.Add(centerIndex); fillIndices.Add(startIndex); fillIndices.Add(centerIndex - 1); } ResourcePools <Vector2F> .Lists.Recycle(tempVertices); }
private NSApplicationTerminateReply MonoApplication_ShouldTerminate(NSApplication sender) { bool shouldTerminate = true; var forms = new Collections.ArrayList(Application.OpenForms); forms.Reverse(); if (IsGoingToPowerOff && (DateTime.Now - IsGoingToPowerOfTime).TotalSeconds < IsGoingToPowerOfMaxDelay) { IsGoingToPowerOff = false; // For the case the shutdown is going to be cancelled foreach (Form form in forms) { if (IntPtr.Zero == XplatUI.SendMessage(form.Handle, Msg.WM_QUERYENDSESSION, (IntPtr)1, (IntPtr)ENDSESSION_LOGOFF)) { shouldTerminate = false; } } if (!shouldTerminate) { return(NSApplicationTerminateReply.Cancel); } foreach (Form form in forms) { XplatUI.SendMessage(form.Handle, Msg.WM_ENDSESSION, (IntPtr)1, (IntPtr)ENDSESSION_LOGOFF); } } if (Application.MessageLoop) { foreach (Form form in forms) { form.CloseReason = CloseReason.TaskManagerClosing; XplatUI.SendMessage(form.Handle, Msg.WM_CLOSE, IntPtr.Zero, IntPtr.Zero); if (form.IsHandleCreated) { return(NSApplicationTerminateReply.Cancel); } } } return(NSApplicationTerminateReply.Now); }