@@ -4,49 +4,38 @@ namespace SteamCurrency
44{
55 public partial class MainForm : Form
66 {
7- float USD_KZT_Qiwi ; // Покупка тенге за доллары (Qiwi)
8- float RUB_KZT_Qiwi ; // Покупка тенге за рубли (Qiwi)
9- float RUB_USD_Qiwi ; // Покупка долларов за рубли (Qiwi)
10-
117 float RUB_USD_Steam ; // Покупка рублей за доллары (Steam)
128 float KZT_USD_Steam ; // Покупка тенге за доллары (Steam)
139
1410 float RUB_USD_Web ; // Рублей за доллар (Webmoney)
1511 float RUB_USD_Web_Real ; // Рублей за доллар (Webmoney PtP)
1612
17- readonly float QiwiPercentUSD = 0.85024f ;
18- readonly float QiwiPercentKZT = 0.94091f ;
19- readonly float QiwiPercent = 1.07022f ;
20- readonly float WebPercent = 1.16f ;
13+ readonly float WebPercent = 0.1593f ;
2114
2215 public MainForm ( )
2316 {
2417 InitializeComponent ( ) ;
25- //ToolTip toolTip = new();
26- //toolTip.SetToolTip(CheckBoxLine, "Символы \"-\" и \"_\"");
2718
28- USD_KZT_Qiwi = Properties . Settings . Default . USD_KZT_Qiwi ;
29- RUB_KZT_Qiwi = Properties . Settings . Default . RUB_KZT_Qiwi ;
30- RUB_USD_Qiwi = Properties . Settings . Default . RUB_USD_Qiwi ;
3119 RUB_USD_Steam = Properties . Settings . Default . RUB_USD_Steam ;
3220 KZT_USD_Steam = Properties . Settings . Default . KZT_USD_Steam ;
3321 RUB_USD_Web = Properties . Settings . Default . RUB_USD_Web ;
3422 RUB_USD_Web_Real = Properties . Settings . Default . RUB_USD_Web_Real ;
3523
36- if ( USD_KZT_Qiwi > 0 && RUB_KZT_Qiwi > 0 && RUB_USD_Qiwi > 0 && RUB_USD_Steam > 0 && KZT_USD_Steam > 0 && RUB_USD_Web > 0 )
24+ if ( RUB_USD_Steam > 0 && KZT_USD_Steam > 0 && RUB_USD_Web > 0 )
3725 {
3826 if ( RUB_USD_Web_Real > 0 )
3927 textBoxUsdWeb . Text = RUB_USD_Web_Real . ToString ( CultureInfo . InvariantCulture ) ;
4028 else
4129 textBoxUsdWeb . Text = RUB_USD_Web . ToString ( CultureInfo . InvariantCulture ) ;
4230
43- pictureBoxQiwi . Image = Properties . Resources . warn_c ;
4431 pictureBoxWeb . Image = Properties . Resources . warn_c ;
4532 pictureBoxSteam . Image = Properties . Resources . warn_c ;
4633
34+ labelCurrencyWeb . Text = "Курс USD = " + Math . Round ( RUB_USD_Web , 2 ) ;
35+ labelCurrencySteam . Text = "Курс USD = " + Math . Round ( RUB_USD_Steam , 2 ) ;
36+ labelCurrencySteamKzt . Text = "Курс KZT = " + Math . Round ( KZT_USD_Steam , 2 ) ;
37+
4738 ButtonGetRates . Text = "Обновить" ;
48- textBoxInputQiwi1 . Enabled = true ;
49- textBoxInputQiwi2 . Enabled = true ;
5039 textBoxInputWeb . Enabled = true ;
5140 textBoxUsdWeb . Enabled = true ;
5241 }
@@ -56,8 +45,6 @@ public MainForm()
5645 private void ButtonGet_Click ( object sender , EventArgs e )
5746 {
5847 ButtonGetRates . Text = "Обновление" ;
59- textBoxInputQiwi1 . Enabled = true ;
60- textBoxInputQiwi2 . Enabled = true ;
6148 textBoxInputWeb . Enabled = true ;
6249 textBoxUsdWeb . Enabled = true ;
6350
@@ -80,35 +67,11 @@ private void ButtonGet_Click(object sender, EventArgs e)
8067 KZT_USD_Steam = steam2 ;
8168 Properties . Settings . Default [ "RUB_USD_Steam" ] = RUB_USD_Steam ;
8269 Properties . Settings . Default [ "KZT_USD_Steam" ] = KZT_USD_Steam ;
70+ labelCurrencySteam . Text = "Курс USD = " + Math . Round ( RUB_USD_Steam , 2 ) ;
71+ labelCurrencySteamKzt . Text = "Курс KZT = " + Math . Round ( KZT_USD_Steam , 2 ) ;
8372 pictureBoxSteam . Image = Properties . Resources . yes_c ;
8473 }
8574
86- // Qiwi
87- pictureBoxQiwi . Image = Properties . Resources . wait_c ;
88- QiwiJson qiwi = QiwiJson . GetData ( ) ;
89- // Покупка тенге за доллары (Qiwi)
90- float qiwi1 = qiwi . GetRate ( ( "840" , "398" ) ) ;
91- // Покупка тенге за рубли (Qiwi)
92- float qiwi2 = qiwi . GetRate ( ( "398" , "643" ) ) ;
93- // Покупка долларов за рубли (Qiwi)
94- float qiwi3 = qiwi . GetRate ( ( "643" , "840" ) ) ;
95-
96- if ( qiwi1 == 0 || qiwi2 == 0 || qiwi3 == 0 )
97- {
98- pictureBoxQiwi . Image = Properties . Resources . no_c ;
99- }
100- else
101- {
102- ok ++ ;
103- USD_KZT_Qiwi = qiwi1 ;
104- RUB_KZT_Qiwi = qiwi2 ;
105- RUB_USD_Qiwi = qiwi3 ;
106- Properties . Settings . Default [ "USD_KZT_Qiwi" ] = USD_KZT_Qiwi ;
107- Properties . Settings . Default [ "RUB_KZT_Qiwi" ] = RUB_KZT_Qiwi ;
108- Properties . Settings . Default [ "RUB_USD_Qiwi" ] = RUB_USD_Qiwi ;
109- pictureBoxQiwi . Image = Properties . Resources . yes_c ;
110- }
111-
11275 // Webmoney
11376 pictureBoxWeb . Image = Properties . Resources . wait_c ;
11477 // Рублей за доллар по курсу вебмани
@@ -123,102 +86,22 @@ private void ButtonGet_Click(object sender, EventArgs e)
12386 ok ++ ;
12487 RUB_USD_Web = usdWeb ;
12588 Properties . Settings . Default [ "RUB_USD_Web" ] = RUB_USD_Web ;
89+ labelCurrencyWeb . Text = "Курс USD = " + Math . Round ( RUB_USD_Web , 2 ) ;
12690 pictureBoxWeb . Image = Properties . Resources . yes_c ;
12791 }
12892
129- if ( ok == 3 )
93+ if ( ok == 2 )
13094 {
13195 Properties . Settings . Default . Save ( ) ;
13296 ButtonGetRates . Enabled = true ;
13397 ButtonGetRates . Text = "Обновить" ;
134- textBoxInputQiwi1 . Enabled = true ;
135- textBoxInputQiwi2 . Enabled = true ;
13698 textBoxInputWeb . Enabled = true ;
13799 textBoxUsdWeb . Enabled = true ;
138- textBoxInputQiwi1 . Focus ( ) ;
139100 }
140101
141102 ButtonGetRates . Text = "Обновить" ;
142103 }
143104
144- private void TextBoxInputQiwi1_TextChanged ( object sender , EventArgs e )
145- {
146- // Подготовка входных данных
147- string text = textBoxInputQiwi1 . Text ;
148- if ( text . Length < 2 )
149- return ;
150- try
151- {
152- Convert . ToSingle ( text , CultureInfo . InvariantCulture ) ;
153- }
154- catch
155- {
156- textBoxConvertQiwi1Kzt . Text = "0" ;
157- textBoxConvertQiwi1Usd . Text = "0" ;
158- textBoxOutputQiwi1RU . Text = "0" ;
159- textBoxOutputQiwi1KZ . Text = "0" ;
160- textBoxLostQiwi1RU . Text = "0" ;
161- return ;
162- }
163- text = text . Replace ( ',' , '.' ) ;
164- float input = Convert . ToSingle ( text , CultureInfo . InvariantCulture ) ;
165- float outputUsd , outputKzt ;
166- // Рубли в тенге
167- outputKzt = input * RUB_KZT_Qiwi * QiwiPercentKZT ;
168- textBoxConvertQiwi1Kzt . Text = Math . Round ( outputKzt , 2 ) . ToString ( CultureInfo . InvariantCulture ) ;
169- // Тенге в доллары
170- outputUsd = outputKzt * USD_KZT_Qiwi * QiwiPercentUSD ;
171- textBoxConvertQiwi1Usd . Text = Math . Round ( outputUsd , 2 ) . ToString ( CultureInfo . InvariantCulture ) ;
172- // В итоге отправляется сумма в долларах
173- float output , percent ;
174- // KZ аккаунт доллары в тенге
175- output = outputUsd * KZT_USD_Steam ;
176- textBoxOutputQiwi1KZ . Text = Math . Round ( output , 2 ) . ToString ( CultureInfo . InvariantCulture ) ;
177- // RU аккаунт доллары в рубли
178- output = outputUsd * RUB_USD_Steam ;
179- textBoxOutputQiwi1RU . Text = Math . Round ( output , 2 ) . ToString ( CultureInfo . InvariantCulture ) ;
180- textBoxLostQiwi1RU . Text = Math . Round ( input - output , 2 ) . ToString ( CultureInfo . InvariantCulture ) ;
181- percent = ( input / output - 1 ) * 100 ;
182- labelLostQiwi1RU . Text = "₽ (" + Math . Round ( percent , 2 ) . ToString ( CultureInfo . InvariantCulture ) + "%)" ;
183- }
184-
185- private void TextBoxInputQiwi2_TextChanged ( object sender , EventArgs e )
186- {
187- // Подготовка входных данных
188- string text = textBoxInputQiwi2 . Text ;
189- if ( text . Length < 2 )
190- return ;
191- try
192- {
193- Convert . ToSingle ( text , CultureInfo . InvariantCulture ) ;
194- }
195- catch
196- {
197- textBoxConvertQiwi2Usd . Text = "0" ;
198- textBoxOutputQiwi2RU . Text = "0" ;
199- textBoxOutputQiwi2KZ . Text = "0" ;
200- textBoxLostQiwi2RU . Text = "0" ;
201- return ;
202- }
203- text = text . Replace ( ',' , '.' ) ;
204- float input = Convert . ToSingle ( text , CultureInfo . InvariantCulture ) ;
205- float outputUsd ;
206- // Рубли в доллары
207- outputUsd = input / ( RUB_USD_Qiwi * QiwiPercent ) ;
208- textBoxConvertQiwi2Usd . Text = Math . Round ( outputUsd , 2 ) . ToString ( CultureInfo . InvariantCulture ) ;
209- // В итоге отправляется сумма в долларах
210- float output , percent ;
211- // KZ аккаунт доллары в тенге
212- output = outputUsd * KZT_USD_Steam ;
213- textBoxOutputQiwi2KZ . Text = Math . Round ( output , 2 ) . ToString ( CultureInfo . InvariantCulture ) ;
214- // RU аккаунт доллары в рубли
215- output = outputUsd * RUB_USD_Steam ;
216- textBoxOutputQiwi2RU . Text = Math . Round ( output , 2 ) . ToString ( CultureInfo . InvariantCulture ) ;
217- textBoxLostQiwi2RU . Text = Math . Round ( input - output , 2 ) . ToString ( CultureInfo . InvariantCulture ) ;
218- percent = ( input / output - 1 ) * 100 ;
219- labelLostQiwi2RU . Text = "₽ (" + Math . Round ( percent , 2 ) . ToString ( CultureInfo . InvariantCulture ) + "%)" ;
220- }
221-
222105 private void TextBoxInputWeb_TextChanged ( object sender , EventArgs e )
223106 {
224107 // Подготовка входных данных
@@ -241,7 +124,7 @@ private void TextBoxInputWeb_TextChanged(object sender, EventArgs e)
241124 float input = Convert . ToSingle ( text , CultureInfo . InvariantCulture ) ;
242125 float outputUsd ;
243126 // Рубли в доллары
244- outputUsd = input / ( RUB_USD_Web_Real * WebPercent ) ;
127+ outputUsd = ( input / RUB_USD_Web_Real ) - ( input / RUB_USD_Web_Real * WebPercent ) ;
245128 textBoxConvertWebUsd . Text = Math . Round ( outputUsd , 2 ) . ToString ( CultureInfo . InvariantCulture ) ;
246129 // В итоге отправляется сумма в долларах
247130 float output , percent ;
0 commit comments