问题项目WPF C#单击一下即可完成 [英] Problems Project WPF C# A CLICK to LATE
本文介绍了问题项目WPF C#单击一下即可完成的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的自动贩卖机小项目做得更好.
但是现在我遇到了一些错误.
每次如果我按下硬币按钮,都将导致单击延迟.
例如,当插入的硬币达到相同/更大的汇率时,您需要再次单击它才能禁用它.
My small project of a vending Machine i going better.
But now i got a few bugs.
each time if i press the coin button it disables a click to late.
Examle when the inserted coin reach the same/Bigger rate you need to click it one more time before it disables.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace Drankmaatje
{
/// <summary>
/// Interaction logic for Window1.xaml
/// </summary>
public partial class Window1 : Window
{
decimal cola;
decimal water;
decimal koffie;
decimal soep;
decimal tweeEuro;
decimal eenEuro;
decimal vijtigCent;
decimal twintigCent;
decimal tienCent;
decimal vijfCent;
decimal keuze;
decimal verschil;
decimal totaal;
public Window1()
{
InitializeComponent();
}
private void btnCola_Click(object sender, RoutedEventArgs e)
{
cola = 0.60M;
keuze = cola;
lblKeuze.Content = keuze;
gbGeldInworp.IsEnabled = true;
lblStatus.Content = "Betaal";
}
private void btnWater_Click(object sender, RoutedEventArgs e)
{
water = 0.50M;
keuze = water;
lblKeuze.Content = keuze;
gbGeldInworp.IsEnabled = true;
lblStatus.Content = "Betaal";
}
private void btnkoffie_Click(object sender, RoutedEventArgs e)
{
koffie = 1.50M;
keuze = koffie;
lblKeuze.Content = keuze;
gbGeldInworp.IsEnabled = true;
lblStatus.Content = "Betaal";
}
private void btnsoep_Click(object sender, RoutedEventArgs e)
{
soep = 4.50M;
keuze = soep;
lblKeuze.Content = keuze;
gbGeldInworp.IsEnabled = true;
lblStatus.Content = "Betaal";
}
private void btnTweeEuro_Click(object sender, RoutedEventArgs e)
{
btnCancel.IsEnabled = true;
tweeEuro = 2.00M;
if (keuze >= totaal)
totaal = totaal + tweeEuro;
else
btnKoop.IsEnabled = true;
lblTotaalInwerp.Content = totaal;
lblStatus.Content = "Koop";
}
private void btnEenEuro_Click(object sender, RoutedEventArgs e)
{
btnCancel.IsEnabled = true;
eenEuro = 1.00M;
if (keuze >= totaal)
totaal = totaal + eenEuro;
else
btnKoop.IsEnabled = true;
lblTotaalInwerp.Content = totaal;
lblStatus.Content = "Koop";
}
private void btnVijtigCent_Click(object sender, RoutedEventArgs e)
{
btnCancel.IsEnabled = true;
vijtigCent = 0.50M;
if (keuze >= totaal)
totaal = totaal + vijtigCent;
else
btnKoop.IsEnabled = true;
lblTotaalInwerp.Content = totaal;
lblStatus.Content = "Koop";
}
private void btnTwintigCent_Click(object sender, RoutedEventArgs e)
{
btnCancel.IsEnabled = true;
twintigCent = 0.20M;
if (keuze >= totaal)
totaal = totaal + twintigCent;
else
btnKoop.IsEnabled = true;
lblTotaalInwerp.Content = totaal;
lblStatus.Content = "Koop";
}
private void btnTienCent_Click(object sender, RoutedEventArgs e)
{
btnCancel.IsEnabled = true;
tienCent = 0.10M;
if (keuze >= totaal)
totaal = totaal + tienCent;
else
btnKoop.IsEnabled = true;
lblTotaalInwerp.Content = totaal;
lblStatus.Content = "Koop";
}
private void btnVijfCent_Click(object sender, RoutedEventArgs e)
{
btnCancel.IsEnabled = true;
vijfCent = 0.05M;
if (keuze >= totaal)
totaal = totaal + vijfCent;
else
btnKoop.IsEnabled = true;
lblTotaalInwerp.Content = totaal;
lblStatus.Content = "Koop";
}
private void btnKoop_Click(object sender, RoutedEventArgs e)
{
gbGeldInworp.IsEnabled = false;
gbKeuzeDrank.IsEnabled = false;
btnCancel.IsEnabled = false;
btnKoop.IsEnabled = false;
lblStatus.Content = "Neem";
int count2E = 0;
int count1E = 0;
int count50C = 0;
int count20C = 0;
int count10C = 0;
int count5C = 0;
verschil = totaal - keuze;
/* lblMelding.Content = verschil;*/
do
{
if (verschil >= 2M)
{
count2E++;
verschil = verschil - 2M;
}
else if (verschil >= 1M)
{
count1E++;
verschil = verschil - 1M;
}
else if (verschil >= 0.50M)
{
count50C++;
verschil = verschil - 0.50M;
}
else if (verschil >= 0.20M)
{
count20C++;
verschil = verschil - 0.20M;
}
else if (verschil >= 0.10M)
{
count10C++;
verschil = verschil - 0.10M;
}
else if (verschil >= 0.05M)
{
count5C++;
verschil = verschil - 0.05M;
}
else
{
}
} while (verschil != 0);
{
if (count2E != 0)
listBox1.Items.Add(count2E + " x 2 Euro ");
if (count1E != 0)
listBox1.Items.Add(count1E + " x 1 Euro ");
if (count50C != 0)
listBox1.Items.Add(count50C + " x 50Cent ");
if (count20C != 0)
listBox1.Items.Add(count20C + " x 20Cent ");
if (count10C != 0)
listBox1.Items.Add(count10C + " x 10Cent ");
if (count5C != 0)
listBox1.Items.Add(count5C + " x 5 Cent");
btnNeemDrank.Visibility = Visibility.Visible;
}
}
private void Window_Loaded(object sender, RoutedEventArgs e)
{
gbGeldInworp.IsEnabled = false;
btnCancel.IsEnabled = false;
btnKoop.IsEnabled = false;
btnNeemDrank.Visibility = Visibility.Hidden;
lblStatus.Content = "Kies";
}
private void btnCancel_Click(object sender, RoutedEventArgs e)
{
gbGeldInworp.IsEnabled = false;
btnCancel.IsEnabled = false;
btnKoop.IsEnabled = false;
lblKeuze.Content = "";
lblStatus.Content = "Kies";
lblTotaalInwerp.Content= "";
}
private void btnNeemDrank_Click(object sender, RoutedEventArgs e)
{
gbGeldInworp.IsEnabled = false;
gbKeuzeDrank.IsEnabled = true;
btnCancel.IsEnabled = false;
btnKoop.IsEnabled = false;
lblStatus.Content = "Kies";
lblKeuze.Content = "";
lblTotaalInwerp.Content = "";
btnNeemDrank.Visibility = Visibility.Hidden;
listBox1.Items.Clear();
}
}
}
推荐答案
让它开始工作:P
现在我需要简化代码
7天后该死的我开始梦见代码lmao
[url = http://img338.imageshack.us/img338/5613/softdrinkvend.jpg] PIC [/url]
名字在荷兰语中吗?我下次要用Universl Lang哈哈
[代码]
使用系统;
使用System.Collections.Generic;
使用System.Linq;
使用System.Text;
使用System.Windows;
使用System.Windows.Controls;
使用System.Windows.Data;
使用System.Windows.Documents;
使用System.Windows.Input;
使用System.Windows.Media;
使用System.Windows.Media.Imaging;
使用System.Windows.Navigation;
使用System.Windows.Shapes;
命名空间Drankmaatje
{
///< summary>
///Window1.xaml的交互逻辑
///</summary>
公共局部类Window1:Window
{
十进制可乐;
十进制水;
十进制科菲;
小数点哭泣;
十进制tweeEuro;
十进制eenEuro;
十进制vijtigCent;
十进制twintigCent;
十进制tienCent;
十进制vijfCent;
十进位法则;
十进制verschil;
十进制总和;
公共Window1()
{
InitializeComponent();
}
私有无效btnCola_Click(对象发送者,RoutedEventArgs e)
{
可乐= 60万;
keuze =可乐;
lblKeuze.Content =(€" + keuze +)";
gbGeldInworp.IsEnabled = true;
lblStatus.Content ="Betaal";
如果(keuze> totaal)
{
lblKeuze.Content =(€" + keuze +)";
lblStatus.Content ="Betaal";
}
其他
{
gbGeldInworp.IsEnabled = false;
lblStatus.Content =库普";
btnKoop.IsEnabled = true;
}
}
私有无效btnWater_Click(对象发送者,RoutedEventArgs e)
{
水= 0.50M;
keuze =水;
lblKeuze.Content =(€" + keuze +)";
gbGeldInworp.IsEnabled = true;
lblStatus.Content ="Betaal";
如果(keuze> totaal)
{
lblKeuze.Content =(€" + keuze +)";
lblStatus.Content ="Betaal";
}
其他
{
gbGeldInworp.IsEnabled = false;
lblStatus.Content =库普";
btnKoop.IsEnabled = true;
}
}
私有无效btnkoffie_Click(对象发送者,RoutedEventArgs e)
{
koffie = 1.50M;
keuze =科菲;
lblKeuze.Content =(€" + keuze +)";
gbGeldInworp.IsEnabled = true;
lblStatus.Content ="Betaal";
如果(keuze> totaal)
{
lblKeuze.Content =(€" + keuze +)";
lblStatus.Content ="Betaal";
}
其他
{
gbGeldInworp.IsEnabled = false;
lblStatus.Content =库普";
btnKoop.IsEnabled = true;
}
}
私有void btnsoep_Click(对象发送者,RoutedEventArgs e)
{
soep = 4.00M;
keuze = soep;
lblKeuze.Content =(€" + keuze +)";
gbGeldInworp.IsEnabled = true;
lblStatus.Content ="Betaal";
如果(keuze> totaal)
{
lblKeuze.Content =(€" + keuze +)";
lblStatus.Content ="Betaal";
}
其他
{
gbGeldInworp.IsEnabled = false;
lblStatus.Content =库普";
btnKoop.IsEnabled = true;
}
}
私有无效btnTweeEuro_Click(对象发送者,RoutedEventArgs e)
{
btnCancel.IsEnabled = true;
tweeEuro = 2.00M;
如果(keuze> = totaal)
totaal = totaal + tweeEuro;
其他
{
btnKoop.IsEnabled = true;
lblStatus.Content =库普";
}
lblTotaalInwerp.Content =€" + totaal;
如果(keuze< = totaal)
{
btnKoop.IsEnabled = true;
lblStatus.Content =库普";
gbGeldInworp.IsEnabled = false;
}
}
私有无效btnEenEuro_Click(对象发送者,RoutedEventArgs e)
{
btnCancel.IsEnabled = true;
eenEuro = 100万;
如果(totaal< = keuze)
totaal = totaal + eenEuro;
其他
{
btnKoop.IsEnabled = true;
lblStatus.Content =库普";
}
lblTotaalInwerp.Content =€" + totaal;
如果(keuze< = totaal)
{
btnKoop.IsEnabled = true;
lblStatus.Content =库普";
gbGeldInworp.IsEnabled = false;
}
}
私有void btnVijtigCent_Click(对象发送者,RoutedEventArgs e)
{
btnCancel.IsEnabled = true;
vijtigCent = 0.50M;
如果(keuze> = totaal)
totaal = totaal + vijtigCent;
其他
{
btnKoop.IsEnabled = true;
lblStatus.Content =库普";
}
lblTotaalInwerp.Content =€" + totaal;
如果(keuze< = totaal)
{
btnKoop.IsEnabled = true;
lblStatus.Content =库普";
gbGeldInworp.IsEnabled = false;
}
}
私有void btnTwintigCent_Click(对象发送者,RoutedEventArgs e)
{
btnCancel.IsEnabled = true;
twintigCent = 0.20M;
如果(keuze> = totaal)
totaal = totaal + twintigCent;
其他
{
btnKoop.IsEnabled = true;
lblStatus.Content =库普";
}
lblTotaalInwerp.Content =€" + totaal;
如果(keuze< = totaal)
{
btnKoop.IsEnabled = true;
lblStatus.Content =库普";
gbGeldInworp.IsEnabled = false;
}
}
私有void btnTienCent_Click(对象发送者,RoutedEventArgs e)
{
btnCancel.IsEnabled = true;
tienCent = 0.10M;
如果(keuze> = totaal)
totaal = totaal + tienCent;
其他
{
btnKoop.IsEnabled = true;
lblStatus.Content =库普";
}
lblTotaalInwerp.Content =€" + totaal;
如果(keuze< = totaal)
{
btnKoop.IsEnabled = true;
lblStatus.Content =库普";
gbGeldInworp.IsEnabled = false;
}
}
私有void btnVijfCent_Click(对象发送者,RoutedEventArgs e)
{
btnCancel.IsEnabled = true;
vijfCent = 0.05M;
如果(keuze> = totaal)
totaal = totaal + vijfCent;
其他
{
btnKoop.IsEnabled = true;
lblStatus.Content =库普";
}
lblTotaalInwerp.Content =总计;
如果(keuze< = totaal)
{
btnKoop.IsEnabled = true;
lblStatus.Content =库普";
gbGeldInworp.IsEnabled = false;
}
}
私有void btnKoop_Click(对象发送者,RoutedEventArgs e)
{
gbGeldInworp.IsEnabled = false;
gbKeuzeDrank.IsEnabled = false;
btnCancel.IsEnabled = false;
btnKoop.IsEnabled = false;
lblStatus.Content ="Neem";
如果(keuze ==可乐)
{
listBox1.Items.Add("Neem uw Cola");
}
如果(keuze ==水)
{
listBox1.Items.Add("Neem uw Water");
}
如果(keuze == koffie)
{
listBox1.Items.Add("Neem uw Koffie");
}
如果(keuze ==哭泣)
{
listBox1.Items.Add("Neem uw Soep");
}
int count2E = 0;
int count1E = 0;
int count50C = 0;
int count20C = 0;
int count10C = 0;
int count5C = 0;
verschil = totaal-keuze;
做
{
如果(verschil> = 2M)
{
count2E ++;
verschil = verschil-2M;
}
否则,如果(verschil> = 1M)
{
count1E ++;
verschil = verschil-1M;
}
否则,如果(verschil> = 0.50M)
{
count50C ++;
verschil = verschil-0.50M;
}
否则,如果(verschil> = 0.20M)
{
count20C ++;
verschil = verschil-0.20M;
}
否则,如果(verschil> = 0.10M)
{
count10C ++;
verschil = verschil-0.10M;
}
否则,如果(verschil> = 0.05M)
{
count5C ++;
verschil = verschil-0.05M;
}
其他
{
}
} while(verschil!= 0);
{
如果(count2E!= 0)
listBox1.Items.Add(count2E +"x 2 Euro");
如果(count1E!= 0)
listBox1.Items.Add(count1E +"x 1欧元");
如果(count50C!= 0)
listBox1.Items.Add(count50C +"x 50Cent");
如果(count20C!= 0)
listBox1.Items.Add(count20C +"x 20Cent");
如果(count10C!= 0)
listBox1.Items.Add(count10C +"x 10Cent");
如果(count5C!= 0)
listBox1.Items.Add(count5C +"x 5 Cent");
btnNeemDrank.Visibility = Visibility.Visible;
}
}
私有void Window_Loaded(对象发送者,RoutedEventArgs e)
{
gbGeldInworp.IsEnabled = false;
btnCancel.IsEnabled = false;
btnKoop.IsEnabled = false;
btnNeemDrank.Visibility = Visibility.Hidden;
lblStatus.Content =凯斯";
}
私有void btnCancel_Click(对象发送者,RoutedEventArgs e)
{
gbGeldInworp.IsEnabled = false;
btnCancel.IsEnabled = false;
btnKoop.IsEnabled = false;
lblKeuze.Content =";
lblStatus.Content =凯斯";
lblTotaalInwerp.Content =";
totaal = 0;
}
私有void btnNeemDrank_Click(对象发送者,RoutedEventArgs e)
{
gbGeldInworp.IsEnabled = false;
gbKeuzeDrank.IsEnabled = true;
btnCancel.IsEnabled = false;
btnKoop.IsEnabled = false;
lblStatus.Content =凯斯";
lblKeuze.Content =";
lblTotaalInwerp.Content =";
btnNeemDrank.Visibility = Visibility.Hidden;
listBox1.Items.Clear();
totaal = 0;
}
}
}
[/code]
Got it to work now :P
Now i need to simplify the code
Damn after 7days im starting to Dream code lmao
[url=http://img338.imageshack.us/img338/5613/softdrinkvend.jpg]PIC[/url]
Names are in dutch do''h i rembere for next time use Universl Lang lol
[code]
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace Drankmaatje
{
/// <summary>
/// Interaction logic for Window1.xaml
/// </summary>
public partial class Window1 : Window
{
decimal cola;
decimal water;
decimal koffie;
decimal soep;
decimal tweeEuro;
decimal eenEuro;
decimal vijtigCent;
decimal twintigCent;
decimal tienCent;
decimal vijfCent;
decimal keuze;
decimal verschil;
decimal totaal;
public Window1()
{
InitializeComponent();
}
private void btnCola_Click(object sender, RoutedEventArgs e)
{
cola = 0.60M;
keuze = cola;
lblKeuze.Content = "(€" + keuze + ")";
gbGeldInworp.IsEnabled = true;
lblStatus.Content = "Betaal";
if (keuze > totaal)
{
lblKeuze.Content = "(€" + keuze + ")";
lblStatus.Content = "Betaal";
}
else
{
gbGeldInworp.IsEnabled = false;
lblStatus.Content = "Koop";
btnKoop.IsEnabled = true;
}
}
private void btnWater_Click(object sender, RoutedEventArgs e)
{
water = 0.50M;
keuze = water;
lblKeuze.Content = "(€" + keuze + ")";
gbGeldInworp.IsEnabled = true;
lblStatus.Content = "Betaal";
if (keuze > totaal)
{
lblKeuze.Content = "(€" + keuze + ")";
lblStatus.Content = "Betaal";
}
else
{
gbGeldInworp.IsEnabled = false;
lblStatus.Content = "Koop";
btnKoop.IsEnabled = true;
}
}
private void btnkoffie_Click(object sender, RoutedEventArgs e)
{
koffie = 1.50M;
keuze = koffie;
lblKeuze.Content = "(€" + keuze + ")";
gbGeldInworp.IsEnabled = true;
lblStatus.Content = "Betaal";
if (keuze > totaal)
{
lblKeuze.Content = "(€" + keuze + ")";
lblStatus.Content = "Betaal";
}
else
{
gbGeldInworp.IsEnabled = false;
lblStatus.Content = "Koop";
btnKoop.IsEnabled = true;
}
}
private void btnsoep_Click(object sender, RoutedEventArgs e)
{
soep = 4.00M;
keuze = soep;
lblKeuze.Content = "(€" + keuze + ")";
gbGeldInworp.IsEnabled = true;
lblStatus.Content = "Betaal";
if (keuze > totaal)
{
lblKeuze.Content = "(€" + keuze + ")";
lblStatus.Content = "Betaal";
}
else
{
gbGeldInworp.IsEnabled = false;
lblStatus.Content = "Koop";
btnKoop.IsEnabled = true;
}
}
private void btnTweeEuro_Click(object sender, RoutedEventArgs e)
{
btnCancel.IsEnabled = true;
tweeEuro = 2.00M;
if (keuze >= totaal)
totaal = totaal + tweeEuro;
else
{
btnKoop.IsEnabled = true;
lblStatus.Content = "Koop";
}
lblTotaalInwerp.Content = "€" + totaal;
if (keuze <= totaal)
{
btnKoop.IsEnabled = true;
lblStatus.Content = "Koop";
gbGeldInworp.IsEnabled = false;
}
}
private void btnEenEuro_Click(object sender, RoutedEventArgs e)
{
btnCancel.IsEnabled = true;
eenEuro = 1.00M;
if (totaal <= keuze)
totaal = totaal + eenEuro;
else
{
btnKoop.IsEnabled = true;
lblStatus.Content = "Koop";
}
lblTotaalInwerp.Content = "€" + totaal;
if (keuze <= totaal)
{
btnKoop.IsEnabled = true;
lblStatus.Content = "Koop";
gbGeldInworp.IsEnabled = false;
}
}
private void btnVijtigCent_Click(object sender, RoutedEventArgs e)
{
btnCancel.IsEnabled = true;
vijtigCent = 0.50M;
if (keuze >= totaal)
totaal = totaal + vijtigCent;
else
{
btnKoop.IsEnabled = true;
lblStatus.Content = "Koop";
}
lblTotaalInwerp.Content = "€" + totaal;
if (keuze <= totaal)
{
btnKoop.IsEnabled = true;
lblStatus.Content = "Koop";
gbGeldInworp.IsEnabled = false;
}
}
private void btnTwintigCent_Click(object sender, RoutedEventArgs e)
{
btnCancel.IsEnabled = true;
twintigCent = 0.20M;
if (keuze >= totaal)
totaal = totaal + twintigCent;
else
{
btnKoop.IsEnabled = true;
lblStatus.Content = "Koop";
}
lblTotaalInwerp.Content = "€" + totaal;
if (keuze <= totaal)
{
btnKoop.IsEnabled = true;
lblStatus.Content = "Koop";
gbGeldInworp.IsEnabled = false;
}
}
private void btnTienCent_Click(object sender, RoutedEventArgs e)
{
btnCancel.IsEnabled = true;
tienCent = 0.10M;
if (keuze >= totaal)
totaal = totaal + tienCent;
else
{
btnKoop.IsEnabled = true;
lblStatus.Content = "Koop";
}
lblTotaalInwerp.Content = "€" + totaal;
if (keuze <= totaal)
{
btnKoop.IsEnabled = true;
lblStatus.Content = "Koop";
gbGeldInworp.IsEnabled = false;
}
}
private void btnVijfCent_Click(object sender, RoutedEventArgs e)
{
btnCancel.IsEnabled = true;
vijfCent = 0.05M;
if (keuze >= totaal)
totaal = totaal + vijfCent;
else
{
btnKoop.IsEnabled = true;
lblStatus.Content = "Koop";
}
lblTotaalInwerp.Content = totaal;
if (keuze <= totaal)
{
btnKoop.IsEnabled = true;
lblStatus.Content = "Koop";
gbGeldInworp.IsEnabled = false;
}
}
private void btnKoop_Click(object sender, RoutedEventArgs e)
{
gbGeldInworp.IsEnabled = false;
gbKeuzeDrank.IsEnabled = false;
btnCancel.IsEnabled = false;
btnKoop.IsEnabled = false;
lblStatus.Content = "Neem";
if (keuze == cola)
{
listBox1.Items.Add("Neem uw Cola");
}
if (keuze == water)
{
listBox1.Items.Add("Neem uw Water");
}
if (keuze == koffie)
{
listBox1.Items.Add("Neem uw Koffie");
}
if (keuze == soep)
{
listBox1.Items.Add("Neem uw Soep");
}
int count2E = 0;
int count1E = 0;
int count50C = 0;
int count20C = 0;
int count10C = 0;
int count5C = 0;
verschil = totaal - keuze;
do
{
if (verschil >= 2M)
{
count2E++;
verschil = verschil - 2M;
}
else if (verschil >= 1M)
{
count1E++;
verschil = verschil - 1M;
}
else if (verschil >= 0.50M)
{
count50C++;
verschil = verschil - 0.50M;
}
else if (verschil >= 0.20M)
{
count20C++;
verschil = verschil - 0.20M;
}
else if (verschil >= 0.10M)
{
count10C++;
verschil = verschil - 0.10M;
}
else if (verschil >= 0.05M)
{
count5C++;
verschil = verschil - 0.05M;
}
else
{
}
} while (verschil != 0);
{
if (count2E != 0)
listBox1.Items.Add(count2E + " x 2 Euro ");
if (count1E != 0)
listBox1.Items.Add(count1E + " x 1 Euro ");
if (count50C != 0)
listBox1.Items.Add(count50C + " x 50Cent ");
if (count20C != 0)
listBox1.Items.Add(count20C + " x 20Cent ");
if (count10C != 0)
listBox1.Items.Add(count10C + " x 10Cent ");
if (count5C != 0)
listBox1.Items.Add(count5C + " x 5 Cent");
btnNeemDrank.Visibility = Visibility.Visible;
}
}
private void Window_Loaded(object sender, RoutedEventArgs e)
{
gbGeldInworp.IsEnabled = false;
btnCancel.IsEnabled = false;
btnKoop.IsEnabled = false;
btnNeemDrank.Visibility = Visibility.Hidden;
lblStatus.Content = "Kies";
}
private void btnCancel_Click(object sender, RoutedEventArgs e)
{
gbGeldInworp.IsEnabled = false;
btnCancel.IsEnabled = false;
btnKoop.IsEnabled = false;
lblKeuze.Content = "";
lblStatus.Content = "Kies";
lblTotaalInwerp.Content = "";
totaal = 0;
}
private void btnNeemDrank_Click(object sender, RoutedEventArgs e)
{
gbGeldInworp.IsEnabled = false;
gbKeuzeDrank.IsEnabled = true;
btnCancel.IsEnabled = false;
btnKoop.IsEnabled = false;
lblStatus.Content = "Kies";
lblKeuze.Content = "";
lblTotaalInwerp.Content = "";
btnNeemDrank.Visibility = Visibility.Hidden;
listBox1.Items.Clear();
totaal = 0;
}
}
}
[/code]
这篇关于问题项目WPF C#单击一下即可完成的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文