This commit is contained in:
Ilya 2020-04-24 22:19:19 +03:00
parent 2d887aab2a
commit 25233af20e
6 changed files with 49 additions and 45 deletions

1
.gitignore vendored
View File

@ -1,3 +1,4 @@
obj/
bin/
.vs/PhysFormuler/v16/Server/sqlite3/storage.ide
/.vs/PhysFormuler/v16

View File

@ -32,7 +32,7 @@
</TextBox.DataContext>
</TextBox>
<Label Content="Кулон/q/Заряд атома" HorizontalAlignment="Left" Margin="135,100,0,0" VerticalAlignment="Top"/>
<TextBox x:Name="t" HorizontalAlignment="Left" Height="23" Margin="281,13,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="120" TextChanged="TC">
<TextBox x:Name="time" HorizontalAlignment="Left" Height="23" Margin="281,13,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="120" TextChanged="TC">
<TextBox.DataContext>
<System:Double>0</System:Double>
</TextBox.DataContext>
@ -44,7 +44,7 @@
</TextBox.DataContext>
</TextBox>
<Label Content="Джоули/A/Работа тока" HorizontalAlignment="Left" Margin="135,131,0,0" VerticalAlignment="Top"/>
<TextBox x:Name="T" HorizontalAlignment="Left" Height="23" Margin="520,10,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="120" TextChanged="TC">
<TextBox x:Name="temp" HorizontalAlignment="Left" Height="23" Margin="520,10,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="120" TextChanged="TC">
<TextBox.DataContext>
<System:Double>0</System:Double>
</TextBox.DataContext>

View File

@ -18,7 +18,7 @@ namespace PhysFormuler
{
public static class Numbers
{
public static float I, U, R, q, A, S, p, l, t;
public static float I, U, R, q, A, S, p, l, temp;
}
/// <summary>
@ -33,32 +33,22 @@ namespace PhysFormuler
}
private bool IsReady(TextBox box, string type)
{
if(type != "T")
{
if (box.Text != "")
{
if (Convert.ToDouble(box.Text) != 0)
{
return true;
} else
}
else
{
return false;
}
} else
}
else
{
return false;
}
} else
{
if(box.Text != "")
{
return true;
} else
{
return false;
}
}
}
private void Update(string type)
@ -146,7 +136,7 @@ namespace PhysFormuler
if (!Math.Round(Numbers.R, 4).Equals(R.Text) && IsReady(R, type)) Numbers.R = (float)Convert.ToDouble(R.Text);
if (!Math.Round(Numbers.U, 4).Equals(U.Text) && IsReady(U, type)) Numbers.U = (float)Convert.ToDouble(U.Text);
if (!Math.Round(Numbers.q, 4).Equals(q.Text) && IsReady(q, type)) Numbers.q = (float)Convert.ToDouble(q.Text);
if (!Math.Round(Numbers.t, 4).Equals(t.Text) && IsReady(t, type)) Numbers.t = (float)Convert.ToDouble(t.Text);
if (!Math.Round(Numbers.temp, 4).Equals(temp.Text) && IsReady(temp, type)) Numbers.temp = (float)Convert.ToDouble(temp.Text);
if (IsReady(I, type))
{
if (IsReady(R, type))
@ -161,12 +151,12 @@ namespace PhysFormuler
}
if(IsReady(q, type))
{
Numbers.t = Numbers.q / Numbers.I;
t.Text = Math.Round(Numbers.t, 4).ToString();
Numbers.temp = Numbers.q / Numbers.I;
temp.Text = Math.Round(Numbers.temp, 4).ToString();
}
if(IsReady(t, type))
if(IsReady(temp, type))
{
Numbers.q = Numbers.I * Numbers.t;
Numbers.q = Numbers.I * Numbers.temp;
q.Text = Math.Round(Numbers.q, 4).ToString();
}
}
@ -175,7 +165,7 @@ namespace PhysFormuler
if (!Math.Round(Numbers.U, 4).Equals(U.Text) && IsReady(U, type)) Numbers.U = (float)Convert.ToDouble(U.Text);
if (!Math.Round(Numbers.q, 4).Equals(q.Text) && IsReady(q, type)) Numbers.q = (float)Convert.ToDouble(q.Text);
if (!Math.Round(Numbers.I, 4).Equals(I.Text) && IsReady(I, type)) Numbers.I = (float)Convert.ToDouble(I.Text);
if (!Math.Round(Numbers.t, 4).Equals(t.Text) && IsReady(t, type)) Numbers.t = (float)Convert.ToDouble(t.Text);
if (!Math.Round(Numbers.temp, 4).Equals(temp.Text) && IsReady(temp, type)) Numbers.temp = (float)Convert.ToDouble(temp.Text);
if (!Math.Round(Numbers.A, 4).Equals(A.Text) && IsReady(A, type)) Numbers.A = (float)Convert.ToDouble(A.Text);
if (IsReady(q, type))
{
@ -186,12 +176,12 @@ namespace PhysFormuler
}
if(IsReady(I, type))
{
Numbers.t = Numbers.q / Numbers.I;
t.Text = Math.Round(Numbers.t, 4).ToString();
Numbers.temp = Numbers.q / Numbers.I;
temp.Text = Math.Round(Numbers.temp, 4).ToString();
}
if(IsReady(t, type))
if(IsReady(temp, type))
{
Numbers.I = Numbers.q / Numbers.t;
Numbers.I = Numbers.q / Numbers.temp;
I.Text = Math.Round(Numbers.I, 4).ToString();
}
if(IsReady(A, type))
@ -219,20 +209,20 @@ namespace PhysFormuler
}
}
break;
case "t":
case "temp":
if (!Math.Round(Numbers.I, 4).Equals(I.Text) && IsReady(I, type)) Numbers.I = (float)Convert.ToDouble(I.Text);
if (!Math.Round(Numbers.t, 4).Equals(t.Text) && IsReady(t, type)) Numbers.t = (float)Convert.ToDouble(t.Text);
if (!Math.Round(Numbers.temp, 4).Equals(temp.Text) && IsReady(temp, type)) Numbers.temp = (float)Convert.ToDouble(temp.Text);
if (!Math.Round(Numbers.q, 4).Equals(q.Text) && IsReady(q, type)) Numbers.q = (float)Convert.ToDouble(q.Text);
if (IsReady(t, type))
if (IsReady(temp, type))
{
if(IsReady(I, type))
{
Numbers.q = Numbers.I * Numbers.t;
Numbers.q = Numbers.I * Numbers.temp;
q.Text = Math.Round(Numbers.q, 4).ToString();
}
if(IsReady(q, type))
{
Numbers.I = Numbers.q / Numbers.t;
Numbers.I = Numbers.q / Numbers.temp;
I.Text = Math.Round(Numbers.I, 4).ToString();
}
}

View File

@ -106,7 +106,7 @@
<GenerateManifests>true</GenerateManifests>
</PropertyGroup>
<PropertyGroup>
<SignManifests>true</SignManifests>
<SignManifests>false</SignManifests>
</PropertyGroup>
<PropertyGroup>
<NoWin32Manifest>true</NoWin32Manifest>

13
PhysFormuler.csproj.user Normal file
View File

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<PublishUrlHistory>publish\</PublishUrlHistory>
<InstallUrlHistory />
<SupportUrlHistory />
<UpdateUrlHistory />
<BootstrapperUrlHistory />
<ErrorReportUrlHistory />
<FallbackCulture>ru-RU</FallbackCulture>
<VerifyUploadedFiles>false</VerifyUploadedFiles>
</PropertyGroup>
</Project>

View File

@ -1,4 +1,4 @@
#pragma checksum "..\..\MainWindow.xaml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "905AB3A0E2CB9BB19DCE83B0EEF5E529632538E93829694E29FFE79AF854195F"
#pragma checksum "..\..\MainWindow.xaml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "E2B7F3ED7BDFD5270AF26D4431978FF6D274ED6379895ED40BA2A3745C88BE94"
//------------------------------------------------------------------------------
// <auto-generated>
// Этот код создан программой.
@ -75,7 +75,7 @@ namespace PhysFormuler {
#line 35 "..\..\MainWindow.xaml"
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
internal System.Windows.Controls.TextBox t;
internal System.Windows.Controls.TextBox time;
#line default
#line hidden
@ -91,7 +91,7 @@ namespace PhysFormuler {
#line 47 "..\..\MainWindow.xaml"
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
internal System.Windows.Controls.TextBox T;
internal System.Windows.Controls.TextBox temp;
#line default
#line hidden
@ -195,10 +195,10 @@ namespace PhysFormuler {
#line hidden
return;
case 5:
this.t = ((System.Windows.Controls.TextBox)(target));
this.time = ((System.Windows.Controls.TextBox)(target));
#line 35 "..\..\MainWindow.xaml"
this.t.TextChanged += new System.Windows.Controls.TextChangedEventHandler(this.TC);
this.time.TextChanged += new System.Windows.Controls.TextChangedEventHandler(this.TC);
#line default
#line hidden
@ -213,10 +213,10 @@ namespace PhysFormuler {
#line hidden
return;
case 7:
this.T = ((System.Windows.Controls.TextBox)(target));
this.temp = ((System.Windows.Controls.TextBox)(target));
#line 47 "..\..\MainWindow.xaml"
this.T.TextChanged += new System.Windows.Controls.TextChangedEventHandler(this.TC);
this.temp.TextChanged += new System.Windows.Controls.TextChangedEventHandler(this.TC);
#line default
#line hidden