//Spawns an apple on the board and displays it private void SpawnApple() { var random = new Random(); var appleOnSnake = false; while (!appleOnSnake) { appleOnSnake = true; int x = random.Next(_view.GetWidth()); int y = random.Next(_view.GetHeight()); _apple = PointFactory.Create(x, y); foreach (var p in _snake) { if (p == _apple) { appleOnSnake = false; } } } }
/// <summary> /// This method produces instances of type <see cref="MultiPoint"/>. /// </summary> /// <returns>The created geometries</returns> internal override Collection <Geometry> CreateGeometries(List <IFeature> features) { IPathNode multiPointNode = new PathNode(Gmlns, "MultiPoint", (NameTable)XmlReader.NameTable); IPathNode pointMemberNode = new PathNode(Gmlns, "pointMember", (NameTable)XmlReader.NameTable); var labelValues = new Dictionary <string, string>(); var geomFound = false; try { // Reading the entire feature's node makes it possible to collect label values that may appear before or after the geometry property while ((FeatureReader = GetSubReaderOf(XmlReader, null, FeatureNode)) != null) { while ( (GeomReader = GetSubReaderOf(FeatureReader, labelValues, multiPointNode, pointMemberNode)) != null) { using GeometryFactory geomFactory = new PointFactory(GeomReader, FeatureTypeInfo) { AxisOrder = AxisOrder };; var points = geomFactory.CreateGeometries(features).Cast <Point>(); Geoms.Add(new MultiPoint(points.ToArray())); geomFound = true; } if (geomFound) { features.Add(AddLabel(labelValues, Geoms[Geoms.Count - 1])); } geomFound = false; } } catch (Exception ex) { Trace.TraceError("An exception occured while parsing a multi-point geometry: " + ex.Message); throw; } return(Geoms); }
public Form1() { InitializeComponent(); // This issue can be solved using Factory Method.. ProblemSolved objProb = new ProblemSolved(12, 1, 1); // Method 1 without interface.. var point1 = PointProgram.NewCartesianPoint(1.0, Math.PI / 2); var point2 = PointProgram.NewPolarsPoint(2, 3); ///////////////////////////// // Method 2 with interface.. Creator class(This calls the factory).. PointFactory ptFact = new PointFactory(); var objPoint1 = ptFact.CreateFactory(1); objPoint1.Draw(1.0, Math.PI / 2); var objPoint2 = ptFact.CreateFactory(2); objPoint2.Draw(2, 3); ///////////////////////////// }
// 儲存月卡資料 public ActionResult SaveMonthlyCard(string m_id, string bmc_id, string bmc_Name, int bmc_Date, int bmc_Price) { PointFactory factory = new PointFactory(); PointModel p = new PointModel(); p.m_id = m_id; p.bmc_id = bmc_id; p.bmc_Name = bmc_Name; p.bmc_Date = bmc_Date; p.bmc_Price = bmc_Price; int 使用者剩餘點數 = factory.回傳目前此會員的剩餘點數(m_id); if (使用者剩餘點數 > bmc_Price) { factory.儲存月卡資料(p); } else { // 使用者錢不夠 } return(RedirectToAction("ShopMonthlyCard", new { m_id = p.m_id })); }
public static Quadrilateral ConstructDefaultRectangle() { int length = Figure.DefaultSideLength(); int width = Figure.DefaultSideLength(); // Ensure we don't have a square. while (width == length) { length = Figure.DefaultSideLength(); width = Figure.DefaultSideLength(); } Point topLeft = PointFactory.GeneratePoint(0, width); Point topRight = PointFactory.GeneratePoint(length, width); Point bottomRight = PointFactory.GeneratePoint(length, 0); Segment left = new Segment(origin, topLeft); Segment top = new Segment(topLeft, topRight); Segment right = new Segment(topRight, bottomRight); Segment bottom = new Segment(bottomRight, origin); return(new Rectangle(left, right, top, bottom)); }
public ActionResult ShopBook(PointModel p) { PointFactory factory = new PointFactory(); int 使用者剩餘點數 = factory.回傳目前此會員的剩餘點數(p.m_id); if (使用者剩餘點數 > Convert.ToInt32(Request.Form["msd_CostPoint"])) { p.m_id = Request.Form["m_id"]; p.b_id = Request.Form["b_id"]; p.b_DatePrice = Convert.ToInt32(Request.Form["b_DatePrice"]); p.msd_CostPoint = Convert.ToInt32(Request.Form["msd_CostPoint"]); p.購買天數 = factory.判斷使用者購買書籍天數(p); } else { // 使用者錢不夠 } factory.儲存消費資料(p); return(RedirectToAction("BookPage", "CV", new { bid = p.b_id })); }
public void Search_With_Location() { var sessionMock = new Mock <ISession>(); var nHbernateContextMock = new Mock <NHibernateContext>(sessionMock.Object, UserName); var services = GetSampleServices(); nHbernateContextMock.Setup(c => c.ExecuteQuery(It.IsAny <IQuery <IEnumerable <Service> > >())) .Returns(services); var categories = GetSampleCategories(); nHbernateContextMock.Setup(c => c.ExecuteQuery(It.IsAny <Func <ISession, IList <Category> > >())) .Returns(categories); var fileSystemMock = new Mock <IFileSystem>(); var geoCodingServicemMock = new Mock <IGeoCodingService>(); const string location = "Bar"; var locationCood = PointFactory.Create(6.9419444, 79.8977778); geoCodingServicemMock.Setup(g => g.GetCoordinates(It.Is <string>(v => v == location))) .Returns(locationCood); var userLocation = PointFactory.Create(6.9319444, 79.8877778); var controller = new ServicesController(nHbernateContextMock.Object, fileSystemMock.Object, geoCodingServicemMock.Object); controller.SetFakeControllerContext(MvcMockHelpers.FakeAuthenticatedHttpContext("~/Services/Search", UserName)); controller.SetUserInfoWitLocation(userLocation); var model = new SearchModel { Terms = "Foo", Location = location }; controller.Search(model); Assert.AreEqual(model, controller.ViewData.Model); Assert.AreEqual(locationCood, controller.ViewData[ViewDataKeys.UserLocation]); }
public void Should_ThrowArgumentException_When_XStringIsValidAndYStringIsNotANumber() { var pointFactory = new PointFactory(); var point = pointFactory.CreatePoint("24", "abc"); }
public void Should_ThrowArgumentException_When_XStringIsNullAndYStringIsValid() { var pointFactory = new PointFactory(); var point = pointFactory.CreatePoint(null, "34"); }
public System.Collections.ObjectModel.Collection <SharpMap.Geometries.Geometry> GetGeometriesInView(SharpMap.Geometries.BoundingBox bbox) { if (_FeatureTypeInfo == null) { return(null); } System.Collections.ObjectModel.Collection <Geometry> geoms = new System.Collections.ObjectModel.Collection <Geometry>(); string geometryTypeString = _FeatureTypeInfo.Geometry._GeometryType; GeometryFactory geomFactory = null; if (!string.IsNullOrEmpty(_Label)) { _LabelInfo = new FeatureDataTable(); _LabelInfo.Columns.Add(_Label); // Turn off quick geometries, if a label is applied... _QuickGeometries = false; } // Configuration for GetFeature request */ WFSClientHTTPConfigurator config = new WFSClientHTTPConfigurator(_TextResources); config.configureForWfsGetFeatureRequest(_HttpClientUtil, _FeatureTypeInfo, _Label, bbox, _OGCFilter, _GetFeatureGETRequest); try { switch (geometryTypeString) { /* Primitive geometry elements */ // GML2 case "PointPropertyType": geomFactory = new PointFactory(_HttpClientUtil, _FeatureTypeInfo, _LabelInfo); break; // GML2 case "LineStringPropertyType": geomFactory = new LineStringFactory(_HttpClientUtil, _FeatureTypeInfo, _LabelInfo); break; // GML2 case "PolygonPropertyType": geomFactory = new PolygonFactory(_HttpClientUtil, _FeatureTypeInfo, _LabelInfo); break; // GML3 case "CurvePropertyType": geomFactory = new LineStringFactory(_HttpClientUtil, _FeatureTypeInfo, _LabelInfo); break; // GML3 case "SurfacePropertyType": geomFactory = new PolygonFactory(_HttpClientUtil, _FeatureTypeInfo, _LabelInfo); break; /* Aggregate geometry elements */ // GML2 case "MultiPointPropertyType": if (_MultiGeometries) { geomFactory = new MultiPointFactory(_HttpClientUtil, _FeatureTypeInfo, _LabelInfo); } else { geomFactory = new PointFactory(_HttpClientUtil, _FeatureTypeInfo, _LabelInfo); } break; // GML2 case "MultiLineStringPropertyType": if (_MultiGeometries) { geomFactory = new MultiLineStringFactory(_HttpClientUtil, _FeatureTypeInfo, _LabelInfo); } else { geomFactory = new LineStringFactory(_HttpClientUtil, _FeatureTypeInfo, _LabelInfo); } break; // GML2 case "MultiPolygonPropertyType": if (_MultiGeometries) { geomFactory = new MultiPolygonFactory(_HttpClientUtil, _FeatureTypeInfo, _LabelInfo); } else { geomFactory = new PolygonFactory(_HttpClientUtil, _FeatureTypeInfo, _LabelInfo); } break; // GML3 case "MultiCurvePropertyType": if (_MultiGeometries) { geomFactory = new MultiLineStringFactory(_HttpClientUtil, _FeatureTypeInfo, _LabelInfo); } else { geomFactory = new LineStringFactory(_HttpClientUtil, _FeatureTypeInfo, _LabelInfo); } break; // GML3 case "MultiSurfacePropertyType": if (_MultiGeometries) { geomFactory = new MultiPolygonFactory(_HttpClientUtil, _FeatureTypeInfo, _LabelInfo); } else { geomFactory = new PolygonFactory(_HttpClientUtil, _FeatureTypeInfo, _LabelInfo); } break; // .e.g. 'gml:GeometryAssociationType' or 'GeometryPropertyType' //It's better to set the geometry type manually, if it is known... default: geomFactory = new UnspecifiedGeometryFactory_WFS1_0_0_GML2(_HttpClientUtil, _FeatureTypeInfo, _MultiGeometries, _QuickGeometries, _LabelInfo); geoms = geomFactory.createGeometries(); return(geoms); } geoms = _QuickGeometries ? geomFactory.createQuickGeometries(geometryTypeString) : geomFactory.createGeometries(); geomFactory.Dispose(); return(geoms); } // Free resources (net connection of geometry factory) finally { geomFactory.Dispose(); } }
public static void SetUserInfoWitLocation(this Controller controller) { SetUserInfoWitLocation(controller, PointFactory.Create(6.9319444, 79.8877778)); }
static void Main(string[] args) { var myPoint = PointFactory.NewCartesianPoint(3, 4); }
public void Run() { var point = PointFactory.NewPolarPoint(1.0, Math.PI / 2); WriteLine(point); }
// // C // /) // / ) // / ) // / ) // A /)_________ B // // Tangent(Circle(O), Segment(AB)), Intersection(Segment(AC), Segment(AB)) -> 2 * Angle(CAB) = Arc(C, B) // public static List <EdgeAggregator> InstantiateTheorem(Intersection inter, Tangent tangent, GroundedClause original) { List <EdgeAggregator> newGrounded = new List <EdgeAggregator>(); CircleSegmentIntersection tan = tangent.intersection as CircleSegmentIntersection; // // Does this tangent apply to this intersection? // if (!inter.intersect.StructurallyEquals(tangent.intersection.intersect)) { return(newGrounded); } Segment secant = null; Segment tanSegment = null; if (tan.HasSegment(inter.lhs)) { secant = inter.rhs; tanSegment = inter.lhs; } else if (tan.HasSegment(inter.rhs)) { secant = inter.lhs; tanSegment = inter.rhs; } else { return(newGrounded); } // // Acquire the angle and intercepted arc. // Segment chord = tan.theCircle.GetChord(secant); if (chord == null) { return(newGrounded); } //Segment chord = tan.theCircle.ContainsChord(secant); // Arc // We want the MINOR ARC only! if (tan.theCircle.DefinesDiameter(chord)) { Arc theArc = null; Point midpt = PointFactory.GeneratePoint(tan.theCircle.Midpoint(chord.Point1, chord.Point2)); Point opp = PointFactory.GeneratePoint(tan.theCircle.OppositePoint(midpt)); Point tanPoint = tanSegment.OtherPoint(inter.intersect); if (tanPoint != null) { // Angle; the smaller angle is always the chosen angle Angle theAngle = new Angle(chord.OtherPoint(inter.intersect), inter.intersect, tanPoint); theArc = new Semicircle(tan.theCircle, chord.Point1, chord.Point2, midpt, chord); newGrounded.Add(CreateClause(inter, original, theAngle, theArc)); theArc = new Semicircle(tan.theCircle, chord.Point1, chord.Point2, opp, chord); newGrounded.Add(CreateClause(inter, original, theAngle, theArc)); } else { // Angle; the smaller angle is always the chosen angle Angle theAngle = new Angle(chord.OtherPoint(inter.intersect), inter.intersect, tanSegment.Point1); theArc = new Semicircle(tan.theCircle, chord.Point1, chord.Point2, midpt, chord); newGrounded.Add(CreateClause(inter, original, theAngle, theArc)); theArc = new Semicircle(tan.theCircle, chord.Point1, chord.Point2, opp, chord); newGrounded.Add(CreateClause(inter, original, theAngle, theArc)); // Angle; the smaller angle is always the chosen angle theAngle = new Angle(chord.OtherPoint(inter.intersect), inter.intersect, tanSegment.Point2); theArc = new Semicircle(tan.theCircle, chord.Point1, chord.Point2, midpt, chord); newGrounded.Add(CreateClause(inter, original, theAngle, theArc)); theArc = new Semicircle(tan.theCircle, chord.Point1, chord.Point2, opp, chord); newGrounded.Add(CreateClause(inter, original, theAngle, theArc)); } } else { Arc theArc = new MinorArc(tan.theCircle, chord.Point1, chord.Point2); // Angle; the smaller angle is always the chosen angle Point endPnt = (inter.intersect.StructurallyEquals(tanSegment.Point1)) ? tanSegment.Point2 : tanSegment.Point1; Angle theAngle = new Angle(chord.OtherPoint(inter.intersect), inter.intersect, endPnt); if (theAngle.measure > 90) { //If the angle endpoint was already set to Point2, or if the intersect equals Point2, then the smaller angle does not exist //In this case, should we create a major arc or return nothing? if (endPnt.StructurallyEquals(tanSegment.Point2) || inter.intersect.StructurallyEquals(tanSegment.Point2)) { return(newGrounded); } theAngle = new Angle(chord.OtherPoint(inter.intersect), inter.intersect, tanSegment.Point2); } Multiplication product = new Multiplication(new NumericValue(2), theAngle); GeometricAngleArcEquation angArcEq = new GeometricAngleArcEquation(product, theArc); // For hypergraph List <GroundedClause> antecedent = new List <GroundedClause>(); antecedent.Add(original); antecedent.Add(inter); antecedent.Add(theArc); antecedent.Add(theAngle); newGrounded.Add(new EdgeAggregator(antecedent, angArcEq, annotation)); } return(newGrounded); }
/// <summary> /// This method detects the geometry type from 'GetFeature' response and uses a geometry factory to create the /// appropriate geometries. /// </summary> /// <returns></returns> internal override Collection <Geometry> CreateGeometries(List <IFeature> features) { GeometryFactory?geomFactory = null; var geometryTypeString = string.Empty; if (_quickGeometries) { _multiGeometries = false; } IPathNode pointNode = new PathNode(Gmlns, "Point", (NameTable)XmlReader.NameTable); IPathNode lineStringNode = new PathNode(Gmlns, "LineString", (NameTable)XmlReader.NameTable); IPathNode polygonNode = new PathNode(Gmlns, "Polygon", (NameTable)XmlReader.NameTable); IPathNode multiPointNode = new PathNode(Gmlns, "MultiPoint", (NameTable)XmlReader.NameTable); IPathNode multiLineStringNode = new PathNode(Gmlns, "MultiLineString", (NameTable)XmlReader.NameTable); IPathNode multiCurveNode = new PathNode(Gmlns, "MultiCurve", (NameTable)XmlReader.NameTable); IPathNode multiLineStringNodeAlt = new AlternativePathNodesCollection(multiLineStringNode, multiCurveNode); IPathNode multiPolygonNode = new PathNode(Gmlns, "MultiPolygon", (NameTable)XmlReader.NameTable); IPathNode multiSurfaceNode = new PathNode(Gmlns, "MultiSurface", (NameTable)XmlReader.NameTable); IPathNode multiPolygonNodeAlt = new AlternativePathNodesCollection(multiPolygonNode, multiSurfaceNode); while (XmlReader.Read()) { if (XmlReader.NodeType == XmlNodeType.Element) { if (_multiGeometries) { if (multiPointNode.Matches(XmlReader)) { geomFactory?.Dispose(); geomFactory = new MultiPointFactory(_httpClientUtil, FeatureTypeInfo); geometryTypeString = "MultiPointPropertyType"; break; } if (multiLineStringNodeAlt.Matches(XmlReader)) { geomFactory?.Dispose(); geomFactory = new MultiLineStringFactory(_httpClientUtil, FeatureTypeInfo); geometryTypeString = "MultiLineStringPropertyType"; break; } if (multiPolygonNodeAlt.Matches(XmlReader)) { geomFactory?.Dispose(); geomFactory = new MultiPolygonFactory(_httpClientUtil, FeatureTypeInfo); geometryTypeString = "MultiPolygonPropertyType"; break; } } if (pointNode.Matches(XmlReader)) { geomFactory?.Dispose(); geomFactory = new PointFactory(_httpClientUtil, FeatureTypeInfo); geometryTypeString = "PointPropertyType"; break; } if (lineStringNode.Matches(XmlReader)) { geomFactory?.Dispose(); geomFactory = new LineStringFactory(_httpClientUtil, FeatureTypeInfo); geometryTypeString = "LineStringPropertyType"; break; } if (polygonNode.Matches(XmlReader)) { geomFactory?.Dispose(); geomFactory = new PolygonFactory(_httpClientUtil, FeatureTypeInfo); geometryTypeString = "PolygonPropertyType"; break; } if (ServiceExceptionNode?.Matches(XmlReader) ?? false) { var serviceException = XmlReader.ReadInnerXml(); Trace.TraceError("A service exception occured: " + serviceException); throw new Exception("A service exception occured: " + serviceException); } } } FeatureTypeInfo.Geometry.GeometryType = geometryTypeString; if (geomFactory == null) { return(Geoms); } geomFactory.AxisOrder = AxisOrder; geomFactory.CreateGeometries(features); return(Geoms); }
private static LinearRing CreateSimplestRing() { return(new LinearRing { Points = new List <Point> { PointFactory.CreatePoint(0, 0), PointFactory.CreatePoint(0, 1), PointFactory.CreatePoint(1, 1), PointFactory.CreatePoint(1, 0), PointFactory.CreatePoint(0, 0), } }); }
public Features ExecuteIntersectionQuery(BoundingBox bbox) { if (_featureTypeInfo == null) { return(null); } var features = new Features(); string geometryTypeString = _featureTypeInfo.Geometry.GeometryType; GeometryFactory geomFactory = null; if (!string.IsNullOrEmpty(_label)) { _featureTypeInfo.LableField = _label; _quickGeometries = false; } // Configuration for GetFeature request */ var config = new WFSClientHttpConfigurator(_textResources); config.ConfigureForWfsGetFeatureRequest(_httpClientUtil, _featureTypeInfo, _label, bbox, _ogcFilter, _getFeatureGetRequest); try { switch (geometryTypeString) { /* Primitive geometry elements */ // GML2 case "PointPropertyType": geomFactory = new PointFactory(_httpClientUtil, _featureTypeInfo); break; // GML2 case "LineStringPropertyType": geomFactory = new LineStringFactory(_httpClientUtil, _featureTypeInfo); break; // GML2 case "PolygonPropertyType": geomFactory = new PolygonFactory(_httpClientUtil, _featureTypeInfo); break; // GML3 case "CurvePropertyType": geomFactory = new LineStringFactory(_httpClientUtil, _featureTypeInfo); break; // GML3 case "SurfacePropertyType": geomFactory = new PolygonFactory(_httpClientUtil, _featureTypeInfo); break; /* Aggregate geometry elements */ // GML2 case "MultiPointPropertyType": if (_multiGeometries) { geomFactory = new MultiPointFactory(_httpClientUtil, _featureTypeInfo); } else { geomFactory = new PointFactory(_httpClientUtil, _featureTypeInfo); } break; // GML2 case "MultiLineStringPropertyType": if (_multiGeometries) { geomFactory = new MultiLineStringFactory(_httpClientUtil, _featureTypeInfo); } else { geomFactory = new LineStringFactory(_httpClientUtil, _featureTypeInfo); } break; // GML2 case "MultiPolygonPropertyType": if (_multiGeometries) { geomFactory = new MultiPolygonFactory(_httpClientUtil, _featureTypeInfo); } else { geomFactory = new PolygonFactory(_httpClientUtil, _featureTypeInfo); } break; // GML3 case "MultiCurvePropertyType": if (_multiGeometries) { geomFactory = new MultiLineStringFactory(_httpClientUtil, _featureTypeInfo); } else { geomFactory = new LineStringFactory(_httpClientUtil, _featureTypeInfo); } break; // GML3 case "MultiSurfacePropertyType": if (_multiGeometries) { geomFactory = new MultiPolygonFactory(_httpClientUtil, _featureTypeInfo); } else { geomFactory = new PolygonFactory(_httpClientUtil, _featureTypeInfo); } break; // .e.g. 'gml:GeometryAssociationType' or 'GeometryPropertyType' //It's better to set the geometry type manually, if it is known... default: geomFactory = new UnspecifiedGeometryFactory_WFS1_0_0_GML2(_httpClientUtil, _featureTypeInfo, _multiGeometries, _quickGeometries); break; } var geoms = geomFactory.CreateGeometries(features); geomFactory.Dispose(); return(features); } // Free resources (net connection of geometry factory) finally { if (geomFactory != null) { geomFactory.Dispose(); } } }
public string Generate(Ticket ticket) { var templatePath = Path.Combine(Directory.GetCurrentDirectory(), "Content", "TicketTemplate", ticket.Template); if (!File.Exists(templatePath)) { throw new FileNotFoundException($"Template {ticket.Template} does not exist"); } var points = PointFactory.Get(ticket.Template); Bitmap bitmap = (Bitmap)Image.FromFile(templatePath); using (Graphics graphics = Graphics.FromImage(bitmap)) { Font arialFont = new Font("Gill Sans Nova", 24); TryDrawingThePoint(graphics, GetFullName(ticket), arialFont, points.Name); TryDrawingThePoint(graphics, GetBoardingTime(ticket.FlightTime), arialFont, points.BoardingTime); TryDrawingThePoint(graphics, ticket.FirstName, arialFont, points.FirstName); TryDrawingThePoint(graphics, ticket.LastName, arialFont, points.LastName); TryDrawingThePoint(graphics, ticket.FromName, arialFont, points.FromName); TryDrawingThePoint(graphics, ticket.FlightTime, arialFont, points.FlightTime); TryDrawingThePoint(graphics, ticket.FlightDate, arialFont, points.FlightDate); TryDrawingThePoint(graphics, ticket.FlightNumber, arialFont, points.FlightNumber); TryDrawingThePoint(graphics, ticket.Gate, arialFont, points.Gate); TryDrawingThePoint(graphics, ticket.Seat, arialFont, points.Seat); TryDrawingThePoint(graphics, ticket.Class, arialFont, points.Class); TryDrawingThePoint(graphics, ticket.ToName, arialFont, points.ToName); TryDrawingThePoint(graphics, ticket.FromCode, arialFont, points.FromCode); TryDrawingThePoint(graphics, ticket.ToCode, arialFont, points.ToCode); TryDrawingThePoint(graphics, GetFullName(ticket), arialFont, points.Side_Name); TryDrawingThePoint(graphics, GetBoardingTime(ticket.FlightTime), arialFont, points.Side_BoardingTime); TryDrawingThePoint(graphics, ticket.FirstName, arialFont, points.Side_FirstName); TryDrawingThePoint(graphics, ticket.LastName, arialFont, points.Side_LastName); TryDrawingThePoint(graphics, ticket.FromName, arialFont, points.Side_FromName); TryDrawingThePoint(graphics, ticket.FlightTime, arialFont, points.Side_FlightTime); TryDrawingThePoint(graphics, ticket.FlightDate, arialFont, points.Side_FlightDate); TryDrawingThePoint(graphics, ticket.FlightNumber, arialFont, points.Side_FlightNumber); TryDrawingThePoint(graphics, ticket.Gate, arialFont, points.Side_Gate); TryDrawingThePoint(graphics, ticket.Seat, arialFont, points.Side_Seat); TryDrawingThePoint(graphics, ticket.Class, arialFont, points.Side_Class); TryDrawingThePoint(graphics, ticket.ToName, arialFont, points.Side_ToName); TryDrawingThePoint(graphics, ticket.FromCode, arialFont, points.Side_FromCode); TryDrawingThePoint(graphics, ticket.ToCode, arialFont, points.Side_ToCode); arialFont.Dispose(); } if (points.AirlineLogo != null) { bitmap = AddAirlineLogo(bitmap, ticket, points.AirlineLogo.Value); } if (points.Side_AirlineLogo != null) { bitmap = AddAirlineLogo(bitmap, ticket, points.Side_AirlineLogo.Value); } var fileName = $"{Guid.NewGuid()}.png"; var filePath = Path.Combine(Directory.GetCurrentDirectory(), "Content", "GeneratedTickets", fileName); bitmap.Save(filePath, ImageFormat.Png); return(fileName); }