public AisinoPrintLabel() { this._text = string.Empty; this._VerticalAlign = VerticalType.Center; this._font = new Font("宋体", 12f); this._DataBind = string.Empty; this._Format = string.Empty; this._PrintText = string.Empty; this._backgauge = 5.2f; }
/// <summary> /// Generates a signed "object" JWT. /// 1 REST call is made to pre-insert class. /// If this JWT only contains 1 object, usually isn't too long; can be used in Android intents/redirects. /// </summary> /// <param name="verticalType"> pass type to created</param> /// <param name="classId">the unique identifier for the class</param> /// <param name="objectId">the unique identifier for the object</param> /// <returns></returns> public string makeObjectJwt(VerticalType verticalType, string classId, string objectId) { ResourceDefinitions resourceDefinitions = ResourceDefinitions.getInstance(); RestMethods restMethods = RestMethods.getInstance(); // create JWT to put objects and class into JSON Web Token (JWT) format for Google Pay API for Passes Jwt googlePassJwt = new Jwt(); // get class, object definitions, insert class (check in Merchant center GUI: https://pay.google.com/gp/m/issuer/list) try { switch (verticalType) { case VerticalType.OFFER: OfferClass offerClass = resourceDefinitions.makeOfferClassResource(classId); OfferObject offerObject = resourceDefinitions.makeOfferObjectResource(objectId, classId); System.Console.WriteLine("\nMaking REST call to insert class"); OfferClass classResponse = restMethods.insertOfferClass(offerClass); System.Console.WriteLine("\nMaking REST call to get object to see if it exists."); OfferObject objectResponse = restMethods.getOfferObject(objectId); // check responses if (!(classResponse is null)) { System.Console.WriteLine($"classId: {classId} inserted."); } else { System.Console.WriteLine($"classId: {classId} insertion failed. See above Server Response for more information."); } if (!(objectResponse is null)) { System.Console.WriteLine($"objectId: {objectId} already exists."); } if (!(objectResponse is null) && objectResponse.ClassId != offerObject.ClassId) { System.Console.WriteLine($"the classId of inserted object is ({objectResponse.ClassId}). " + $"It does not match the target classId ({offerObject.ClassId}). The saved object will not " + "have the class properties you expect."); } // need to add only object because class was pre-inserted googlePassJwt.addOfferObject(offerObject); break; case VerticalType.LOYALTY: LoyaltyClass loyaltyClass = resourceDefinitions.makeLoyaltyClassResource(classId); LoyaltyObject loyaltyObject = resourceDefinitions.makeLoyaltyObjectResource(objectId, classId); System.Console.WriteLine("\nMaking REST call to insert class"); LoyaltyClass loyaltyClassResponse = restMethods.insertLoyaltyClass(loyaltyClass); System.Console.WriteLine("\nMaking REST call to get object to see if it exists."); LoyaltyObject loyaltyObjectResponse = restMethods.getLoyaltyObject(objectId); // check responses if (!(loyaltyClassResponse is null)) { System.Console.WriteLine($"classId: {classId} inserted."); }
private Vertical CreateEdgeVertical(Edge edge, VerticalType verticalType, MeterCalibration edgeMeter) { var taglinePosition = edge.Tagmark.ToNullableDouble() ?? 0; var depth = edge.Depth.ToNullableDouble() ?? 0; var area = edge.Area.ToNullableDouble() ?? 0; var velocity = edge.Velocity.ToNullableDouble() ?? 0; var discharge = edge.Discharge.ToNullableDouble() ?? 0; var width = edge.Width.ToNullableDouble() ?? 0; var percentFlow = edge.Flow.ToNullableDouble() ?? 0; var velocityObservation = new VelocityObservation { VelocityObservationMethod = PointVelocityObservationType.Surface, MeanVelocity = velocity, DeploymentMethod = DeploymentMethodType.Unspecified, MeterCalibration = edgeMeter, Observations = { new VelocityDepthObservation { Depth = depth, Velocity = velocity, ObservationInterval = 0, RevolutionCount = 0 }, }, }; return(new Vertical { VerticalType = verticalType, MeasurementTime = TimeHelper.CoerceDateTimeIntoUtcOffset(edge.Date, LocationInfo.UtcOffset), SequenceNumber = edge.panelId, TaglinePosition = taglinePosition, SoundedDepth = depth, EffectiveDepth = depth, MeasurementConditionData = new OpenWaterData(), FlowDirection = FlowDirectionType.Normal, VelocityObservation = velocityObservation, Segment = new Segment { Area = area, Discharge = discharge, Width = width, Velocity = velocity, TotalDischargePortion = percentFlow, } }); }
public void TestInsertTransitClassAndObject() { RestMethods restMethods = RestMethods.getInstance(); ResourceDefinitions resourceDefinitions = ResourceDefinitions.getInstance(); VerticalType verticalType = Services.VerticalType.TRANSIT; Config config = Config.getInstance(); string UUID = Guid.NewGuid().ToString(); string classUid = $"{verticalType.ToString()}_CLASS_{UUID}"; string classId = $"{config.getIssuerId()}.{classUid}"; string UUIDobj = Guid.NewGuid().ToString(); string objectUid = $"{verticalType.ToString()}_OBJECT_{UUIDobj}"; string objectId = $"{config.getIssuerId()}.{objectUid}"; TransitClass classResponse = restMethods.insertTransitClass(resourceDefinitions.makeTransitClassResource(classId)); TransitObject objectResponse = restMethods.insertTransitObject(resourceDefinitions.makeTransitObjectResource(objectId, classId)); Assert.NotNull(classResponse); Assert.NotNull(objectResponse); }
public void TestInsertOfferClassAndObject() { RestMethods restMethods = RestMethods.getInstance(); ResourceDefinitions resourceDefinitions = ResourceDefinitions.getInstance(); VerticalType verticalType = Services.VerticalType.OFFER; Config config = Config.getInstance(); string UUID = Guid.NewGuid().ToString(); string classUid = $"{verticalType.ToString()}_CLASS_{UUID}"; string classId = $"{config.getIssuerId()}.{classUid}"; string UUIDobj = Guid.NewGuid().ToString(); string objectUid = $"{verticalType.ToString()}_OBJECT_{UUIDobj}"; string objectId = $"{config.getIssuerId()}.{objectUid}"; OfferClass classResponse = restMethods.insertOfferClass(resourceDefinitions.makeOfferClassResource(classId)); OfferObject objectResponse = restMethods.insertOfferObject(resourceDefinitions.makeOfferObjectResource(objectId, classId)); Console.WriteLine("classResponse: " + classResponse); Console.WriteLine("objectResponse: " + objectResponse); }
public void CreateChartGrid(Grid Gr, VerticalType tmtype, GridInfoParams Gridinfo) { switch (tmtype) { case VerticalType.Major: MajorGR = Gr; break; case VerticalType.Minor: MinorGR = Gr; break; default: break; } Gr.IntervalType = Gridinfo.IntervalType;// need to set for lines to appear Gr.Interval = Gridinfo.Interval; Gr.LineColor = Gridinfo.LineColor; Gr.LineDashStyle = Gridinfo.LineDashStyle; Gr.LineWidth = Gridinfo.LineWidth; Gr.Enabled = true; }
public void CreateChartTickmark(TickMark TM, VerticalType tmtype, TickMarkInfoParams TMinfo) { switch (tmtype) { case VerticalType.Major: MajorTM = TM; break; case VerticalType.Minor: MinorTM = TM; break; default: break; } TM.Interval = TMinfo.Interval; TM.IntervalType = TMinfo.IntervalType; TM.TickMarkStyle = TMinfo.Style; TM.Size = TMinfo.Size; TM.LineColor = TMinfo.LineColor; TM.LineWidth = TMinfo.LineWidth; TM.Enabled = true; }
public T Y(VerticalType y) { this.y = y; return(this as T); }
public TextStyle Baseline(VerticalType baseline) { this.baseline = baseline; return(this); }
public static PointUV GetNoteLocation(INote note, HorizontalType horizontalType, VerticalType verticalType) { double U = 0, V = 0; if (horizontalType == HorizontalType.Left) U = note.GetLocation(TextPoint.LeftSide).U; else if (horizontalType == HorizontalType.Right) Debug.Fail("Note width not implemented"); else if (horizontalType == HorizontalType.Center) Debug.Fail("Note width not implemented"); else Debug.Fail("Case not handled"); if (verticalType == VerticalType.Bottom) V = note.GetLocation(TextPoint.BottomSide).V; else if (verticalType == VerticalType.Top) Debug.Fail("Note height not implemented"); else if (verticalType == VerticalType.Middle) Debug.Fail("Note height not implemented"); else Debug.Fail("Case not handled"); return PointUV.Create(U, V); }
public AisinoPrintLabel(XmlElement xmlElement_0) : base(xmlElement_0) { string str14; this._text = string.Empty; this._VerticalAlign = VerticalType.Center; this._font = new Font("宋体", 12f); this._DataBind = string.Empty; this._Format = string.Empty; this._PrintText = string.Empty; this._backgauge = 5.2f; string innerText = xmlElement_0.InnerText; string attribute = xmlElement_0.GetAttribute("Font"); string str3 = xmlElement_0.GetAttribute("DataBind"); string str4 = xmlElement_0.GetAttribute("Horizontal"); string str5 = xmlElement_0.GetAttribute("Vertical"); string str6 = xmlElement_0.GetAttribute("FontSpacing"); string str7 = xmlElement_0.GetAttribute("LineSpacing"); string str8 = xmlElement_0.GetAttribute("Format"); string str9 = xmlElement_0.GetAttribute("DataType"); string str10 = xmlElement_0.GetAttribute("Lenth"); string str11 = xmlElement_0.GetAttribute("Backgauge"); string str12 = xmlElement_0.GetAttribute("LineLength"); base._ID = xmlElement_0.GetAttribute("Id"); string str13 = str4; if (str13 != null) { if (!(str13 == "Right")) { if (!(str13 == "Center")) { goto Label_0137; } this.HorizontalAlign = HorizontalType.Center; } else { this.HorizontalAlign = HorizontalType.Right; } goto Label_013E; } Label_0137: this.HorizontalAlign = HorizontalType.Left; Label_013E: if ((str14 = str5) != null) { if (!(str14 == "Botton")) { if (!(str14 == "Center")) { goto Label_0173; } this.VerticalAlign = VerticalType.Center; } else { this.VerticalAlign = VerticalType.Botton; } goto Label_017A; } Label_0173: this.VerticalAlign = VerticalType.Top; Label_017A: this.Text = innerText; this.font = Common.ToFont(attribute); this.DataBind = str3; if (str6 == string.Empty) { this._FontSpacing = 0f; } else { this._FontSpacing = Common.ToFloat(str6); } if (str7 == string.Empty) { this._LineSpacing = 0f; } else { this._LineSpacing = Common.ToFloat(str7); } this._Format = str8; switch (str9) { case "Int": case "I": case "i": this._dataType = Aisino.Framework.Plugin.Core.Controls.PrintControl.DataType.Int; break; case "Double": case "D": case "d": this._dataType = Aisino.Framework.Plugin.Core.Controls.PrintControl.DataType.Double; break; case "DateTime": case "DT": case "dt": this._dataType = Aisino.Framework.Plugin.Core.Controls.PrintControl.DataType.DateTime; break; case null: break; default: this._dataType = Aisino.Framework.Plugin.Core.Controls.PrintControl.DataType.String; break; } if (!string.IsNullOrEmpty(str10)) { this._Length = Common.ToInt(str10); } if (!string.IsNullOrEmpty(str11)) { this._backgauge = Common.ToFloat(str11); } if (!string.IsNullOrEmpty(str12)) { this._LineLength = Common.ToInt(str12); } }
public static PointUV GetNoteLocation(INote note, HorizontalType horizontalType, VerticalType verticalType) { double U = 0, V = 0; if (horizontalType == HorizontalType.Left) { U = note.GetLocation(TextPoint.LeftSide).U; } else if (horizontalType == HorizontalType.Right) { Debug.Fail("Note width not implemented"); } else if (horizontalType == HorizontalType.Center) { Debug.Fail("Note width not implemented"); } else { Debug.Fail("Case not handled"); } if (verticalType == VerticalType.Bottom) { V = note.GetLocation(TextPoint.BottomSide).V; } else if (verticalType == VerticalType.Top) { Debug.Fail("Note height not implemented"); } else if (verticalType == VerticalType.Middle) { Debug.Fail("Note height not implemented"); } else { Debug.Fail("Case not handled"); } return(PointUV.Create(U, V)); }
private Vertical GetVertical(ManualGaugingRecord gauging, int sequenceNumber, VerticalType verticalType) { var measurementTime = CalculateMeasurementTime(); var velocityObservation = GetVelocityObservation(gauging); Log.Info($"Vertical: {sequenceNumber}"); return(new Vertical { SequenceNumber = sequenceNumber, FlowDirection = FlowDirectionType.Normal, IsSoundedDepthEstimated = false, MeasurementTime = measurementTime, SoundedDepth = gauging.SoundedDepth, TaglinePosition = gauging.TaglinePosition, EffectiveDepth = gauging.SoundedDepth, VerticalType = verticalType, MeasurementConditionData = new OpenWaterData(), VelocityObservation = velocityObservation }); }
/// <summary> /// Generates a signed "fat" JWT. /// No REST calls made. /// Use fat JWT in JS web button. /// Fat JWT is too long to be used in Android intents. /// Possibly might break in redirects. /// </summary> /// <param name="verticalType"> pass type to created</param> /// <param name="classId">the unique identifier for the class</param> /// <param name="objectId">the unique identifier for the object</param> /// <returns></returns> public string makeFatJwt(VerticalType verticalType, string classId, string objectId) { ResourceDefinitions resourceDefinitions = ResourceDefinitions.getInstance(); RestMethods restMethods = RestMethods.getInstance(); // create JWT to put objects and class into JSON Web Token (JWT) format for Google Pay API for Passes Jwt googlePassJwt = new Jwt(); // get class definition, object definition and see if Ids exist. for a fat JWT, first time a user hits the save button, the class and object are inserted try { switch (verticalType) { case VerticalType.OFFER: OfferClass offerClass = resourceDefinitions.makeOfferClassResource(classId); OfferObject offerObject = resourceDefinitions.makeOfferObjectResource(objectId, classId); System.Console.WriteLine("\nMaking REST call to get class and object to see if they exist."); OfferClass classResponse = restMethods.getOfferClass(classId); OfferObject objectResponse = restMethods.getOfferObject(objectId); // check responses if (!(classResponse is null)) { System.Console.WriteLine($"classId: {classId} already exists."); } if (!(objectResponse is null)) { System.Console.WriteLine($"objectId: {objectId} already exists."); } if (!(classResponse is null) && objectResponse.ClassId != offerObject.ClassId) { System.Console.WriteLine($"the classId of inserted object is ({objectResponse.ClassId}). " + $"It does not match the target classId ({offerObject.ClassId}). The saved object will not " + "have the class properties you expect."); } // need to add both class and object resource definitions into JWT because no REST calls made to pre-insert googlePassJwt.addOfferClass(offerClass); googlePassJwt.addOfferObject(offerObject); break; case VerticalType.LOYALTY: LoyaltyClass loyaltyClass = resourceDefinitions.makeLoyaltyClassResource(classId); LoyaltyObject loyaltyObject = resourceDefinitions.makeLoyaltyObjectResource(objectId, classId); System.Console.WriteLine("\nMaking REST call to get class and object to see if they exist."); LoyaltyClass loyaltyClassResponse = restMethods.getLoyaltyClass(classId); LoyaltyObject loyaltyObjectResponse = restMethods.getLoyaltyObject(objectId); // check responses if (!(loyaltyClassResponse is null)) { System.Console.WriteLine($"classId: {classId} already exists."); } if (!(loyaltyObjectResponse is null)) { System.Console.WriteLine($"objectId: {objectId} already exists."); } if (!(loyaltyClassResponse is null) && loyaltyObjectResponse.ClassId != loyaltyObject.ClassId) { System.Console.WriteLine($"the classId of inserted object is ({loyaltyObjectResponse.ClassId}). " + $"It does not match the target classId ({loyaltyObject.ClassId}). The saved object will not " + "have the class properties you expect."); } // need to add both class and object resource definitions into JWT because no REST calls made to pre-insert googlePassJwt.addLoyaltyClass(loyaltyClass); googlePassJwt.addLoyaltyObject(loyaltyObject); break; case VerticalType.GIFTCARD: GiftCardClass giftCardClass = resourceDefinitions.makeGiftCardClassResource(classId); GiftCardObject giftCardObject = resourceDefinitions.makeGiftCardObjectResource(objectId, classId); System.Console.WriteLine("\nMaking REST call to get class and object to see if they exist."); GiftCardClass giftCardClassResponse = restMethods.getGiftCardClass(classId); GiftCardObject giftCardObjectResponse = restMethods.getGiftCardObject(objectId); // check responses if (!(giftCardClassResponse is null)) { System.Console.WriteLine($"classId: {classId} already exists."); } if (!(giftCardObjectResponse is null)) { System.Console.WriteLine($"objectId: {objectId} already exists."); } if (!(giftCardClassResponse is null) && giftCardObjectResponse.ClassId != giftCardObject.ClassId) { System.Console.WriteLine($"the classId of inserted object is ({giftCardObjectResponse.ClassId}). " + $"It does not match the target classId ({giftCardObject.ClassId}). The saved object will not " + "have the class properties you expect."); } // need to add both class and object resource definitions into JWT because no REST calls made to pre-insert googlePassJwt.addGiftCardClass(giftCardClass); googlePassJwt.addGiftCardObject(giftCardObject); break; } // return "fat" JWT. Try putting it into JS web button // note button needs to be rendered in local web server who's domain matches the ORIGINS // defined in the JWT. See https://developers.google.com/pay/passes/reference/s2w-reference return(googlePassJwt.generateSignedJwt()); } catch (System.Exception e) { System.Console.WriteLine(e.Message); return(null); } }