private bool Check() { var list = PanelContent.Controls.OfType <TextBox>().Where(x => x.Visible).ToList(); foreach (var item in list) { if (item.Text == "" || (item.ForeColor == System.Drawing.Color.LightSlateGray)) { item.Focus(); Utility.BeheshtMBox.Show(" لطفا " + item.Name + " را وارد کنید ! ", "اطلاع", Utility.BeheshtMBox.Icon.Info, Utility.BeheshtMBox.MessageType.OK); return(false); } } //foreach (ArisaButtonEntity AB in PanelContent.Controls.OfType<ArisaButtonEntity>()) //{ // if (AB.Image == null) // { // AB.Focus(); // Utility.BeheshtMBox.Show(" لطفا " + AB.Name + " را انتخاب کنید ! ", "اطلاع", Utility.BeheshtMBox.Icon.Info, Utility.BeheshtMBox.MessageType.OK); // return false; // } //} foreach (ArisaButtonImage AB in PanelContent.Controls.OfType <ArisaButtonImage>()) { if (AB.FileStream == null) { AB.Focus(); Utility.BeheshtMBox.Show(" لطفا " + AB.Name + " را انتخاب کنید ! ", "اطلاع", Utility.BeheshtMBox.Icon.Info, Utility.BeheshtMBox.MessageType.OK); return(false); } } return(true); }
protected override void OnCompile() { this.Add(new UI16(base.CharacterID)); this.Add(this._Bounds); AB item = new AB(2); item.Append(new UB(1, 1)); item.Append(new UB(1, Convert.ToInt32(this.WordWrap))); item.Append(new UB(1, Convert.ToInt32(this.Multitile))); item.Append(new UB(1, Convert.ToInt32(this.PasswordFiled))); item.Append(new UB(1, Convert.ToInt32(this.ReadOnly))); item.Append(new UB(1, 1)); item.Append(new UB(1, 0)); item.Append(new UB(1, 1)); item.Append(new UB(2, 0)); item.Append(new UB(1, 0)); item.Append(new UB(1, Convert.ToInt32(!this.Selectable))); item.Append(new UB(1, Convert.ToInt32(this.HasBorder))); item.Append(new UB(2, 0)); item.Append(new UB(1, 0)); this.Add(item); this.Add(new UI16(this.FontID)); this.Add(new UI16(this.Height)); RGBA rgba = new RGBA(this.TextColor.Red, this.TextColor.Green, this.TextColor.Blue, 0); this.Add(rgba); this.Add(new STRING(this.VarName)); this.Add(new STRING(this.Text)); base.OnCompile(); }
/// <summary> /// Checks if a point lies within this triangle. /// </summary> public bool Encloses(Vector2 point) { if (point.X < BoundsLT.X || point.Y < BoundsLT.Y || point.X > BoundsRB.X || point.Y > BoundsRB.Y) { return(false); } // Point lies on a vertex if (HasVertex(point)) { return(true); } // Triangle having zero area -> two points equal if (Denominator == 0) { return(AB.Contains(point) || BC.Contains(point)); } var a = LineSegment.EpsilonUnitInterval((s1 * (point.X - C.Point.X) + s3 * (point.Y - C.Point.Y)) / Denominator); var b = LineSegment.EpsilonUnitInterval((s4 * (point.X - C.Point.X) + s2 * (point.Y - C.Point.Y)) / Denominator); var c = LineSegment.EpsilonUnitInterval(1 - a - b); return(0 <= a && a <= 1 && 0 <= b && b <= 1 && 0 <= c && c <= 1); }
public void ImprovingDefaultMessagesWithAKnownExpectation() { var labeled = Label(AB, "'A' followed by 'B'"); //When p succeeds after consuming input, Label(p) is the same as p. AB.Parses(Tokenize("AB")).WithNoMessage().WithValue("AB"); labeled.Parses(Tokenize("AB")).WithNoMessage().WithValue("AB"); //When p fails after consuming input, Label(p) is the same as p. AB.FailsToParse(Tokenize("A!")).LeavingUnparsedTokens("!").WithMessage("(1, 2): B expected"); labeled.FailsToParse(Tokenize("A!")).LeavingUnparsedTokens("!").WithMessage("(1, 2): B expected"); //When p succeeds but does not consume input, Label(p) still succeeds but the potential failure is included. var succeedWithoutConsuming = new MonadicUnitParser <Token>(new Token(null, new Position(0, 0), "$")); succeedWithoutConsuming .PartiallyParses(Tokenize("!")) .LeavingUnparsedTokens("!") .WithNoMessage() .WithValue(Lexeme("$")); Label(succeedWithoutConsuming, "nothing") .PartiallyParses(Tokenize("!")) .LeavingUnparsedTokens("!") .WithMessage("(1, 1): nothing expected") .WithValue(Lexeme("$")); //When p fails but does not consume input, Label(p) fails with the given expectation. AB.FailsToParse(Tokenize("!")).LeavingUnparsedTokens("!").WithMessage("(1, 1): A expected"); labeled.FailsToParse(Tokenize("!")).LeavingUnparsedTokens("!").WithMessage("(1, 1): 'A' followed by 'B' expected"); }
public void Perform() { // narrow the timespam from which we retrieve the transactions AB.AB_JobGetTransactions_SetFromTime(AqJobHandle, AqHelper.convertToGwenTime(FromTime)); AB.AB_JobGetTransactions_SetToTime(AqJobHandle, AqHelper.convertToGwenTime(ToTime)); // create a new aqbanking job for transaction retrieving SWIGTYPE_p_AB_JOB_LIST2 list = AB.AB_Job_List2_new(); AB.AB_Job_List2_PushBack(list, this.AqJobHandle); var ctx = AB.AB_ImExporterContext_new(); int rv = AB.AB_Banking_ExecuteJobs(abHandle, list, ctx); if (rv < 0) { throw new Exception("Aqbanking ExecuteJobs() failed with return code: " + rv); } var accinfo = AB.AB_ImExporterContext_GetAccountInfo(ctx, Account.BankIdentifier, Account.AccountIdentifier); // fill our transactions list from aqbanking var trans = AB.AB_ImExporterAccountInfo_GetFirstTransaction(accinfo); while (trans != null) { AqTransaction transaction = new AqTransaction(trans); this.Transactions.Add((ITransaction)transaction); trans = AB.AB_ImExporterAccountInfo_GetNextTransaction(accinfo); } }
// 总结就是两个点:GUID、HASH文件目录的使用。 /// <summary> /// 现在遇到的问题:自动插入数据库,如果失败自动回滚。包含附件。 /// 首先验证各个待插入对象,再保存文件,如果保存失败,返回错误,成功则提交更改。 /// 涉及到多个文件的情况下。 /// 附件使用一张新表有无必要的问题。解决了什么,为什么要这么做? /// 可以解决文件引用次数的问题,从而在个人删除文件的时候确定是不是要把文件删除,还是仅仅删除引用。 /// 还可以保留文件名。 /// 统一查看文件 /// 坏处呢? /// 插入数据库多了一步。 /// 浪费空间? /// </summary> /// <returns></returns> public string AB() { var p = Request.QueryString["P"] + Request.Form["P"]; var aa = Request.Params["P"]; using (var ctx = new TempDataContext()) { var a = new A() { GUID = Guid.NewGuid().ToString("N").ToUpper() }; ctx.A.InsertOnSubmit(a); var b = new B() { GUID = Guid.NewGuid().ToString("N").ToUpper() }; ctx.B.InsertOnSubmit(b); var ab = new AB() { AGUID = a.ID.ToString(), BGUID = b.GUID }; ctx.AB.InsertOnSubmit(ab); var file = Request.Files[0]; var ent = CreateFile(file); file.SaveAs(ent.Url); ctx.File.InsertOnSubmit(ent); ctx.SubmitChanges(); return("OK"); } }
public AqTransaction(SWIGTYPE_p_AB_TRANSACTION aqTransactionHandle) { this.aqTransaction = aqTransactionHandle; var val = AB.AB_Transaction_GetValue(aqTransaction); this.Amount = (float)AB.AB_Value_GetValueAsDouble(val); this.Currency = AB.AB_Value_GetCurrency(val); this.ValutaDate = AqHelper.fromGwenTimeToDateTime(AB.AB_Transaction_GetValutaDate(aqTransaction)); this.Date = AqHelper.fromGwenTimeToDateTime(AB.AB_Transaction_GetDate(aqTransaction)); // populate ToAccount this.AqToAccount = new AqBankAccount(); // AccountNumber & IBAN this.AqToAccount.IBAN = AB.AB_Transaction_GetRemoteIban(aqTransaction); this.AqToAccount.AccountNumber = AB.AB_Transaction_GetRemoteAccountNumber(aqTransaction); // BankCode & BIC this.AqToAccount.BLZ = AB.AB_Transaction_GetRemoteBankCode(aqTransaction); this.AqToAccount.BIC = AB.AB_Transaction_GetRemoteBic(aqTransaction); this.AqToAccount.OwnerName = AqHelper.fromGwenStringList(AB.AB_Transaction_GetRemoteName(aqTransaction)); this.AqToAccount.BankName = AB.AB_Transaction_GetRemoteBankName(aqTransaction); // populate FromAccount this.AqFromAccount = new AqBankAccount(); this.AqFromAccount.AccountNumber = AB.AB_Transaction_GetLocalAccountNumber(aqTransaction); this.AqFromAccount.IBAN = AB.AB_Transaction_GetLocalIban(aqTransaction); this.AqFromAccount.BLZ = AB.AB_Transaction_GetLocalBankCode(aqTransaction); this.AqFromAccount.BIC = AB.AB_Transaction_GetLocalBic(aqTransaction); this.AqFromAccount.AccountIdentifier = AB.AB_Transaction_GetLocalAccountNumber(aqTransaction); this.AqFromAccount.OwnerName = new List <string> (); this.AqFromAccount.OwnerName.Add(AB.AB_Transaction_GetLocalName(aqTransaction)); this.Purposes = AqHelper.fromGwenStringList(AB.AB_Transaction_GetPurpose(aqTransaction)); }
static void Main() { AB ab = new AB(); ab.AMethod(); ab.BMethod(); }
protected override void CleanUpNativeResource() { base.CleanUpNativeResource(); AB.AB_Banking_OnlineFini(abHandle); AB.AB_Banking_Fini(abHandle); AB.AB_Banking_free(abHandle); }
public static void Main() { AB ab = new AB(); ab.Method1(); ab.Method2(); }
public void Perform() { SWIGTYPE_p_AB_JOB_LIST2 list = AB.AB_Job_List2_new(); AB.AB_Job_List2_PushBack(list, this.AqJobHandle); var ctx = AB.AB_ImExporterContext_new(); int rv = AB.AB_Banking_ExecuteJobs(abHandle, list, ctx); if (rv < 0) { throw new Exception("Aqbanking ExecuteJobs() failed with returncode: " + rv); } var accinfo = AB.AB_ImExporterContext_GetAccountInfo(ctx, Account.BankIdentifier, Account.AccountIdentifier); var accstatus = AB.AB_ImExporterAccountInfo_GetFirstAccountStatus(accinfo); if (accstatus == null) { throw new Exception("Could not get balance for account"); } var bal = AB.AB_AccountStatus_GetBookedBalance(accstatus); var val = AB.AB_Balance_GetValue(bal); this.RequestedBalance = (float)AB.AB_Value_GetValueAsDouble(val); }
/// <summary> /// Test if a circle is colliding with the polygon /// Also works with concave polygons /// </summary> /// <param name="body1">Circle</param> /// <param name="body2">Polygon</param> /// <param name="result"></param> /// <param name="distance"></param> /// <returns></returns> private static bool CirclePolygonIntersects(Body body1, Body body2, ref Vector2 result, ref float distance) { //A bounding box test around our polygon and circle //Very quick and reduces most calculations that are guaranteed to be false if (body1.Centre.X + body1.Radius < body2.Left || body1.Centre.X - body1.Radius > body2.Right || body1.Centre.Y - body1.Radius > body2.Bottom || body1.Centre.Y + body1.Radius < body2.Top || body2.Static && body1.Static) { return(false); } for (var i = 0; i < body2.Vertices.Count; i++) { Vector2 AP, AB, A, B; //loop over each line of the polygon to test against the circle if (i == body2.Vertices.Count - 1) { A = body2.Vertices.Last(); B = body2.Vertices.First(); AP = body1.Centre - A; AB = B - A; } else { A = body2.Vertices[i]; B = body2.Vertices[i + 1]; AP = body1.Centre - A; AB = B - A; } float magnitudeAB = AB.LengthSquared(); float ABAPproduct = Vector2.Dot(AP, AB); distance = ABAPproduct / magnitudeAB; //check if beyond or before the line entirely to get the closest point on the line if (distance < 0) { result = A; } else if (distance > 1) { result = B; } else { result = A + AB * distance; } //Test if our point is further than the radius if (Vector2.Distance(body1.Centre, result) < body1.Radius) { //Currently resolves as structure is not currently capable of returning each line where it intersects, which may be multiple var line = new Line(A, B, Color.White, game, body2.Friction); SeparateCircleLine(body1, line.Body, ref result); } } return(false); }
static void Main(string[] args) { Console.WriteLine("Hello World!"); AB ab = new AB(); ab.Amethod(); }
static void Main(string[] args) { Base B = GetObject(); if (B is AB) { AB DevClass =(AB) B; } }
protected override void CleanUpNativeResource() { base.CleanUpNativeResource(); if (aqTransaction == null || aqTransaction.Equals(IntPtr.Zero)) { AB.AB_Transaction_free(aqTransaction); } }
public Object LoadAsset(string assetPath, Type type) { if (!IsFinished) { Load(); } return(AB.LoadAsset(assetPath, type)); }
protected override void OnCompile() { bool flag = false; bool flag2 = false; bool flag3 = false; bool flag4 = false; bool flag5 = false; if (this._matrix != null) { flag = true; } if (this._character != null) { flag3 = true; } if (this.Name != null) { flag2 = true; } if (this.ColorTransform != null) { flag4 = true; } AB item = new AB(1); item.Append(new UB(2, 0)); item.Append(new UB(1, Convert.ToInt32(flag2))); item.Append(new UB(1, Convert.ToInt32(flag5))); item.Append(new UB(1, Convert.ToInt32(flag4))); item.Append(new UB(1, Convert.ToInt32(flag))); item.Append(new UB(1, Convert.ToInt32(flag3))); item.Append(new UB(1, 0)); this.Add(item); this.Add(new UI16(this._character.Depth)); if (flag3) { this.Add(new UI16(this._character.CharacterID)); } if (flag) { this.Add(this._matrix); } if (flag4) { this.Add(this.ColorTransform); } if (flag5) { this.Add(new UI16(this.Ratio)); } if (flag2) { this.Add(new STRING(this.Name)); } base.OnCompile(); }
public void TestOperatorsAndIndexersHiding() { // var r = new AA() + new AB(); // ambiguous invocation var res = new AB()[1, 2]; var res2 = new AB()[1]; // works fine }
/// <summary> /// 回答する。 /// </summary> /// <param name="answer"></param> /// <returns>true:まだ続きがある。false:終わり</returns> private bool Answer(AB answer) { m_testInfoList[m_testInfoList.Count - 1].answer = answer; if (10 == m_testInfoList.Count) { return(false); } return(true); }
private void button1_Click(object sender, EventArgs e) { float x_A, x_B, y_A, y_B1, y_B2, AB; try { x_A = float.Parse(textBox1.Text); y_A = float.Parse(textBox2.Text); x_B = float.Parse(textBox4.Text); AB = float.Parse(textBox3.Text); if (AB < 0) { throw new System.FormatException(); } } catch (System.FormatException) { MessageBox.Show("Неверно заполнены поля.", "Ошибка ввода!", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } string solution; string task; string given; string search; task = "Найдите $y$, если известно что: $|\\vec{AB}|=" + AB.ToString() + "; A(" + x_A.ToString() + "; " + y_A.ToString() + "); B(" + x_B.ToString() + "; y)$."; given = "$|\\vec{AB}|=" + AB.ToString() + "; A(" + x_A.ToString() + "; " + y_A.ToString() + "); B(" + x_B.ToString() + "; y)$."; search = "$y$"; solution = "Так как $|\\vec{AB}|=\\sqrt{(x_B-x_A)^2+(y_B-y_A)^2}$, то \\\\"; solution += "$" + AB.ToString() + "=\\sqrt{(" + x_B.ToString() + "-" + x_A.ToString() + ")^2+(y-" + y_A.ToString() + ")^2} \\Rightarrow " + AB.ToString() + "=\\sqrt{" + ((x_B - x_A) * (x_B - x_A)).ToString() + " + (y-" + y_A.ToString() + ")^2} \\Rightarrow " + (AB * AB).ToString() + " = " + ((x_B - x_A) * (x_B - x_A)).ToString() + " + (y-" + y_A.ToString() + ")^2 \\Rightarrow $\\\\"; string str = ""; float t; t = -x_B * x_B + 2 * x_B * x_A - x_A * x_A + AB * AB; if (t < 0) { str = "Действительных корней нет!"; solution += str; } else { t = (float)Math.Sqrt((double)(t)); y_B1 = y_A - t; y_B2 = y_A + t; solution += "$y_1= " + y_B1.ToString() + "; y_2=" + y_B2.ToString() + "$"; } GeneratorTexText generator = new GeneratorTexText(); generator.Finish(task, given, search, solution); }
private void PrepareNextTest() { byte[] r = new byte[1]; gen.GetBytes(r); AB x = ((r[0] & 1) == 0) ? AB.A : AB.B; TestInfo ti = new TestInfo(x); m_testInfoList.Add(ti); }
void ShowAll() { A.SetActive(true); B.SetActive(true); C.SetActive(true); AB.SetActive(true); AC.SetActive(true); BC.SetActive(true); ABC.SetActive(true); }
void HideAll() { A.SetActive(false); B.SetActive(false); C.SetActive(false); AB.SetActive(false); AC.SetActive(false); BC.SetActive(false); ABC.SetActive(false); }
public static void Main(string[] args) { ICustomer c = new Customer(); c.print(); AB ab = new AB(); ab.AMethod(); ab.BMethod(); }
static void Main(string[] args) { AB ab = new AB(new A(), new B()); ab.f1(); ab.f2(); ab.f3(); ab.f4(); Console.ReadLine(); }
/*public static string[] fromGwenStringListToStringArray(IntPtr stringlist){ * ArrayList arr = new ArrayList(); * arr = fromGwenStringListToArrayList(stringlist); * return (string[]) arr.ToArray(typeof(string)); * } * public static IntPtr fromArrayListToGwenStringList(ArrayList list) * { * IntPtr sl = Gwen.StringList_new(); * foreach(string str in list){ * IntPtr entry = Gwen.StringListEntry_new(str , 0); * Gwen.StringList_AppendEntry(sl, entry); * } * return sl; * } * public static IntPtr fromStringArrayToGwenStringList(string[] list){ * ArrayList arr = new ArrayList(); * foreach(string s in list) * arr.Add(s); * return fromArrayListToGwenStringList(arr); * } * public static string fromGwenStringListToLineBreakString(IntPtr stringlist) * { * // returns a string with each entry in a separate line * ArrayList l = fromGwenStringListToArrayList(stringlist); * string newstring = ""; * foreach(string entry in l) * newstring = newstring + entry + "\n"; * return newstring; * } */ public static DateTime fromGwenTimeToDateTime(SWIGTYPE_p_GWEN_TIME gwentime) { if (gwentime.Equals(IntPtr.Zero)) { return(new DateTime(1970, 1, 1, 0, 0, 0, 0)); } DateTime unixepoch = new DateTime(1970, 1, 1, 0, 0, 0, 0); DateTime retval = unixepoch.AddSeconds(AB.GWEN_Time_Seconds(gwentime)); return(retval); }
public void SqlCommandToTSQLTextTest() { SqlCommand c = new SqlCommand(GeneratorMsSql.CombinedWhere(AB.Get("a", "b"), AB.Get("1", 2))); //"select * from table where @a = " //c.Parameters.AddWithValue(); //c.Parameters.AddWithValue(); var d = SqlServerHelper.SqlCommandToTSQLText(c); int i = 0; }
/// <summary> /// Populates account data from an aqbanking accHandle for local predefined (self-owned) accounts from the /// aqbanking config files /// </summary> /// <param name="accHandle"> /// A <see cref="SWIGTYPE_p_AB_ACCOUNT"/> /// </param> public AqBankAccount(SWIGTYPE_p_AB_ACCOUNT accHandle) : this() { this.AccHandle = accHandle; /* directly populates data from aqbanking accountHandle */ this.BLZ = AB.AB_Account_GetBankCode(accHandle); this.BIC = AB.AB_Account_GetBIC(accHandle); this.AccountNumber = AB.AB_Account_GetAccountNumber(accHandle); this.IBAN = AB.AB_Account_GetIBAN(accHandle); this.BankName = AB.AB_Account_GetBankName(accHandle); this.AccountName = AB.AB_Account_GetAccountName(accHandle); this.Currency = AB.AB_Account_GetCurrency(accHandle); }
private void buttonPlayY_Click(object sender, RoutedEventArgs e) { AB x = GetX(); if (x == AB.A) { buttonPlayB_Click(sender, e); } else { buttonPlayA_Click(sender, e); } }
public static void Main(string[] args) { Program p = new Program(); p.Print1(); // This is possible because the class Program is inherting from class AB p.Print2(); AB ab = new AB(); ab.Print1(); ab.Print2(); Console.ReadLine(); }
public TestInfo(AB x) { this.x = x; answer = AB.Unknown; }
public void SetAnswer(AB answer) { this.answer = answer; }
public void TestFixtureDerive() { AB ab = new AB(); Assert.IsFalse(ab is IAB); }
/// <summary> /// 回答する。 /// </summary> /// <param name="answer"></param> /// <returns>true:まだ続きがある。false:終わり</returns> private bool Answer(AB answer) { m_testInfoList[m_testInfoList.Count - 1].answer = answer; if (10 == m_testInfoList.Count) { return false; } return true; }