mirror of
https://github.com/chylex/Query.git
synced 2025-09-17 18:24:47 +02:00
Compare commits
3 Commits
963f8da60c
...
main
Author | SHA1 | Date | |
---|---|---|---|
9a280e0d58
|
|||
6caf8c7eb2
|
|||
1c92d67fa3
|
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Numerics;
|
||||
using ExtendedNumerics;
|
||||
|
||||
@@ -72,8 +73,23 @@ public abstract record Number : IAdditionOperators<Number, Number, Number>,
|
||||
}
|
||||
|
||||
public override string ToString(IFormatProvider? formatProvider) {
|
||||
Fraction fraction = Value.GetImproperFraction();
|
||||
return fraction.Denominator == 1 ? fraction.Numerator.ToString(formatProvider) : AsDecimal.ToString(formatProvider);
|
||||
BigRational value = Fraction.ReduceToProperFraction(Value.GetImproperFraction());
|
||||
string wholePartStr = value.WholePart.ToString(formatProvider);
|
||||
|
||||
if (value.FractionalPart.IsZero) {
|
||||
return wholePartStr;
|
||||
}
|
||||
|
||||
decimal fractionalPart = (decimal) value.FractionalPart;
|
||||
|
||||
if (fractionalPart == 0) {
|
||||
return wholePartStr + ".0...";
|
||||
}
|
||||
|
||||
string decimalPartStr = fractionalPart.ToString(formatProvider);
|
||||
int decimalSeparatorIndex = decimalPartStr.TakeWhile(char.IsAsciiDigit).Count();
|
||||
|
||||
return wholePartStr + decimalPartStr[decimalSeparatorIndex..];
|
||||
}
|
||||
|
||||
public override int CompareTo(Number? other) {
|
||||
|
@@ -8,7 +8,7 @@
|
||||
|
||||
<PropertyGroup>
|
||||
<Authors>chylex</Authors>
|
||||
<Version>2.2.0.0</Version>
|
||||
<Version>2.3.0.0</Version>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
|
@@ -64,7 +64,7 @@ sealed partial class MainForm : System.Windows.Forms.Form {
|
||||
private bool isMoving = false;
|
||||
|
||||
private void FixLocation() {
|
||||
if (!isMoving && Screen.FromControl(this) is {} screen) {
|
||||
if (!isMoving && WindowState != FormWindowState.Minimized && Screen.FromControl(this) is {} screen) {
|
||||
Rectangle screenRect = screen.WorkingArea;
|
||||
isMoving = true;
|
||||
Location = new Point(screenRect.X + screenRect.Width - Width, screenRect.Y + screenRect.Height - Height);
|
||||
@@ -104,8 +104,10 @@ sealed partial class MainForm : System.Windows.Forms.Form {
|
||||
}
|
||||
|
||||
private void focusTimer_Tick(object? sender, EventArgs e) {
|
||||
WindowState = FormWindowState.Minimized;
|
||||
Show();
|
||||
Activate();
|
||||
WindowState = FormWindowState.Normal;
|
||||
|
||||
queryBox.Focus();
|
||||
focusTimer.Stop();
|
||||
|
Reference in New Issue
Block a user