Lao Chen WPF

Source: Internet
Author: User

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;using System.io;namespace Lao Chen wpf{///<summary>//MainWindow.xaml interactive logic///</sum Mary> public partial class Mainwindow:window {public MainWindow () {Initializecompone        NT ();        } public static int Count = 0;        public static int right = 0;               int m = 0; private void Button1_Click (object sender, RoutedEventArgs e) {StreamWriter N1 = File.appendtext ("c:\\n1            . txt "); N1.            WriteLine (TextBox1.Text); N1.            Close ();            StreamWriter N2 = File.appendtext ("C:\\n2.txt"); N2.            WriteLine (TextBox2.Text); N2.     Close ();       StreamWriter n3 = File.appendtext ("C:\\n3.txt"); N3.            WriteLine (TextBox3.Text); N3.            Close ();            MessageBox.Show ("success of the title");            TextBox1.Text = "";            TextBox2.Text = "";        TextBox3.Text = ""; } private void Button2_Click (object sender, RoutedEventArgs e) {//Quiz string[] N1 = NE            W string[100];            N1 = File.ReadAllLines ("C:\\n1.txt");            TextBox1.Text = N1[m];            String[] N2 = new string[100];            N2 = File.ReadAllLines ("C:\\n2.txt");            TextBox2.Text = N2[m];            string[] n3 = new STRING[100];            N3 = File.ReadAllLines ("C:\\n3.txt");            TextBox3.Text = N3[m];        m++; }//End private void Button3_Click (object sender, RoutedEventArgs e) {textbox5.text = Main            Window.Count.ToString ();//Total number of topics Textbox6.text = MainWindow.right.ToString (); Textbox7.text = ((Mainwindow.rigHT/(double) (mainwindow.count)) * 100). ToString () + "%";//correct rate} private void Textbox4_keydown (object sender, KeyEventArgs e) {in t a = Int.            Parse (TextBox1.Text); int b = Int.            Parse (TextBox3.Text);            Char C = Convert.tochar (TextBox2.Text);            Class1 con = new Class1 ();            Con.chu (A, B, c); if (E.key = = Key.enter) {if (con.answer = = Int. Parse (Textbox4.text)) {MessageBox.Show ("answer right!") Next question, press the Start button!                    ");                    right++;                count++; } else {MessageBox.Show ("Answer Error! Next question, press the Start button!                    ");                count++;            } textbox4.clear (); }} private void Button1_click_1 (object sender, RoutedEventArgs e) {StreamWriter N1 = Fil            E.appendtext ("C:\\n1.txt"); N1.            WriteLine (TextBox1.Text); N1. Close ();            StreamWriter N2 = File.appendtext ("C:\\n2.txt"); N2.            WriteLine (TextBox2.Text); N2.            Close ();            StreamWriter n3 = File.appendtext ("C:\\n3.txt"); N3.            WriteLine (TextBox3.Text); N3.            Close ();            MessageBox.Show ("success of the title");            TextBox1.Text = "";            TextBox2.Text = "";        TextBox3.Text = ""; }    }}

Packaging

Using system;using system.collections.generic;using system.linq;using system.text;namespace Lao Chen wpf{    class Class1    {public        int sum;        public int answer        {            get            {                return sum;            }        }        public int chu (int n1, int n2, char Fuhao)        {            if (Fuhao = = ' + ')            {                return sum = n1 + n2;            }            else if (Fuhao = = '-')            {                return sum = n1-n2;            }            else if (Fuhao = = ' * ')            {                return sum = n1 * n2;            }            return sum;}}    }

The interface to run is as follows:

Lao Chen WPF

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.