コード例 #1
0
ファイル: Game.cs プロジェクト: Sander-Kastelein/NHL-Racegame
        public Game()
        {
            InitializeComponent();

            SetStyle(
                ControlStyles.UserPaint |
                ControlStyles.AllPaintingInWmPaint |
                ControlStyles.DoubleBuffer |
                ControlStyles.OptimizedDoubleBuffer |
                ControlStyles.AllPaintingInWmPaint,
                true
                );

            Image roadImage = Image.FromFile(Path.Combine(Environment.CurrentDirectory, "Racemap.bmp"));

            BackgroundImage = Image.FromFile(Path.Combine(Environment.CurrentDirectory, "Racemapv3.bmp"));
            roadBitmap      = new Bitmap(roadImage);
            //BackgroundImage = roadImage; //DEBUG

            player = new System.Media.SoundPlayer();
            player.SoundLocation = Path.Combine(Environment.CurrentDirectory, "music.wav");
            player.LoadAsync();

            nyanPlayer = new System.Media.SoundPlayer();
            nyanPlayer.SoundLocation = Path.Combine(Environment.CurrentDirectory, "nyan.wav");
            nyanPlayer.LoadAsync();

            Paint += new PaintEventHandler(PaintHandler);



            Init();
        }
コード例 #2
0
        /*用于点easy medium hard按钮后直接开始计算,单独构造成一个函数*/
        private void calculation( )
        {
            timer_show_result.Start();            //点击难度按钮后就开始7s倒计时
            //timer_remind.Interval = 10000;
            gamebeginplayer.LoadAsync();
            gamebeginplayer.PlayLooping();

            timer_rest.Stop();                          //300s到,进入对应的Tick事件,将定时器关掉(这句应该可以去掉了)
            //pictureBox2.SendToBack();           //除了开始按钮外的所有部分,SendToBack函数作用

            totaltime       = totaltime_org;      //240s
            score           = 0;                  //统计参数清零
            right_number    = 0;
            wrong_number    = 0;
            subresult_input = "";                   //输入结果清空
            Minuend         = 4000;
            timer_total.Stop();
            timer_1second.Stop();

            //button10.Enabled = true;
            timer_1second.Start();               //再次调用读秒定时器,用于做题时240s的读秒
            timer_total.Start();
            label_Minuend.Text   = Minuend.ToString();
            label_score.Text     = "Score: " + score.ToString();
            label_subresult.Text = subresult_input;

            subtrahend  = ran.Next(start_index, end_index);//产生初值
            label7.Text = subtrahend.ToString();

            begingtime = DateTime.Now.ToLocalTime().ToString();
            timer_remind.Start();                   //启动5s做题倒计时
        }
コード例 #3
0
ファイル: Game.cs プロジェクト: Sander-Kastelein/NHL-Racegame
        public Game()
        {
            InitializeComponent();

            SetStyle(
                ControlStyles.UserPaint |
                ControlStyles.AllPaintingInWmPaint |
                ControlStyles.DoubleBuffer |
                ControlStyles.OptimizedDoubleBuffer |
                ControlStyles.AllPaintingInWmPaint,
                true
            );

            Image roadImage = Image.FromFile(Path.Combine(Environment.CurrentDirectory, "Racemap.bmp"));
            BackgroundImage = Image.FromFile(Path.Combine(Environment.CurrentDirectory, "Racemapv3.bmp"));
            roadBitmap = new Bitmap(roadImage);
            //BackgroundImage = roadImage; //DEBUG

            player = new System.Media.SoundPlayer();
            player.SoundLocation = Path.Combine(Environment.CurrentDirectory, "music.wav");
            player.LoadAsync();

            nyanPlayer = new System.Media.SoundPlayer();
            nyanPlayer.SoundLocation = Path.Combine(Environment.CurrentDirectory, "nyan.wav");
            nyanPlayer.LoadAsync();

            Paint += new PaintEventHandler(PaintHandler);

            Init();
        }
コード例 #4
0
ファイル: Form1.cs プロジェクト: xneo123/PictureLottery
        private void Start_Animals_Click(object sender, EventArgs e)
        {
            var strButton_Text=Start_Animals.Text;
            System.Media.SoundPlayer player = new System.Media.SoundPlayer();
            player.SoundLocation = "C:\\temp\\play.wav";
            if (strButton_Text == "Start_Animals")
            {
                player.LoadAsync();
                player.PlayLooping();
                Start_Animals.Text = "Stop";
                timer_animals.Enabled = true;
                //listfile[j].Remove(0);
                //animals.Image = Image.FromFile("c:\\temp\\dog.png");
                //anim
                //Timer timer = new Timer();
                //timer.Interval = 500;
                //timer.Enabled = true;
                //timer.Start();

            }
            else
            {
                player.Stop();
                Start_Animals.Text = "Start_Animals";
                timer_animals.Enabled = false;
            }
            //

            //animals.SizeMode = "StretchImage";
        }
コード例 #5
0
 public AracdeForm()
 {
     InitializeComponent();
     arcadeMusic.SoundLocation = "ArcadeSound.wav";
     arcadeMusic.LoadAsync();
     cGL = new cOGL(displayPanel);
     cGL.ScrollValue[10] = 5;
     cGL.ScrollValue[11] = 12;
     cGL.ScrollValue[12] = -5;
     //apply the bars values as cGL.ScrollValue[..] properties
     //!!!
     hScrollBarScroll(hScrollBar1, null);
     hScrollBarScroll(hScrollBar2, null);
     hScrollBarScroll(hScrollBar3, null);
     hScrollBarScroll(hScrollBar4, null);
     hScrollBarScroll(hScrollBar5, null);
     hScrollBarScroll(hScrollBar6, null);
     hScrollBarScroll(hScrollBar7, null);
     hScrollBarScroll(hScrollBar8, null);
     hScrollBarScroll(hScrollBar9, null);
     displayPanel.MouseWheel += Panel1_MouseWheel;
     displayPanel.MouseDown  += Panel1_MouseDown;
     displayPanel.MouseUp    += Panel1_MouseUp;
     displayPanel.MouseMove  += Panel1_MouseMove;
 }
コード例 #6
0
 public override void controllerActivated(Dictionary<int, Target> targets)
 {
     System.Media.SoundPlayer myPlayer = new System.Media.SoundPlayer();
     myPlayer.SoundLocation = @"C:\Users\jon\AppData\Local\Temp\Temp2_P3StarterCode.zip\P3StarterCode\coin.wav";
     myPlayer.LoadAsync();
     myPlayer.Play();
 }
コード例 #7
0
ファイル: StartBattleVM.cs プロジェクト: sunoru/PBO
 static StartBattleVM()
 {
     sound = new SoundPlayer("Resources\\challenged.wav");
       try
       {
     sound.LoadAsync();
       }
       catch { }
 }
コード例 #8
0
ファイル: Chat.xaml.cs プロジェクト: sunoru/PBO
 static Chat()
 {
     sound = new SoundPlayer("Resources\\chat.wav");
       try
       {
     sound.LoadAsync();
       }
       catch { }
 }
コード例 #9
0
        /*enter键按下后判断输入结果是否正确*/
        private void Judge_resull()
        {
            if (subresult_input != "")
            {
                subreslut_input_int = int.Parse(subresult_input);       //将键盘输出结果转化为int类型
                subresult_input     = "";                               //按下enter键,后面的结果都要清空,此句必须放在前面,不能放在此模块的最后面(暂时没找到原因)

                if (subreslut_input_int == Minuend - subtrahend)        //subtrahend应设置为随机数
                {
                    //判断正确
                    pictureBox1.Image = rightImage;                             //显示正误图形的box
                    score             = score + 5;                              //做对一题加5
                    right_number++;                                             //用于将做对提数记录在txt中

                    Minuend            = subreslut_input_int;                   //将新的结果显示在被减数标签中
                    label_Minuend.Text = Minuend.ToString();

                    rightplayer.LoadAsync();                                            //做题正确时声音
                    //rightplayer.Stop();
                    rightplayer.PlayLooping();
                }
                else
                {
                    //判断错误
                    pictureBox1.Image = wrongImage;
                    score             = score - 3;                                          //错一题减3分
                    wrong_number++;

                    wrongplayer.LoadAsync();
                    //wrongplayer.Stop();
                    wrongplayer.PlayLooping();
                }
                label_score.Text     = "Score: " + score.ToString();          //一轮计算完显示累计分数
                label_subresult.Text = subresult_input;                       //输入结果subresult_input显示在 label_subresult标签中
                timer_show_result.Start();                                    //无论结果正确与否,启动0.7s定时器,清除图片和停止声音播放

                timer_remind.Stop();                                          //无论做题正确与否,重新启动5s做题计时器
                timer_remind.Start();
            }

            subtrahend  = ran.Next(start_index, end_index);                //产生随机减数
            label7.Text = subtrahend.ToString();                           //将产生的随机数显示在减数标签中
        }
コード例 #10
0
 public CountDownForm()
 {
     InitializeComponent();
     Screen[] Screens = Screen.AllScreens;
     if (Screens.Length > 1)
     {
         Location = Screens[1].Bounds.Location;
     }
     Player.LoadAsync();
 }
コード例 #11
0
        public void Update(ref SwProperties p)
        {
            propertySet = p;
            LinkControls();
            ToggleFields(propertySet.cutlistData.OpType);

            if (Properties.Settings.Default.MakeSounds)
            {
                try {
                    sp.LoadAsync();
                } catch (Exception ex) {
                    propertySet.SwApp.SendMsgToUser2(ex.Message, (int)swMessageBoxIcon_e.swMbStop, (int)swMessageBoxBtn_e.swMbOk);
                }
            }
        }
コード例 #12
0
ファイル: start_form.cs プロジェクト: CDMMKY/fuzzy_core
        private void back_ground_process_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            #region visual code
            start_B.Visible                   = true;
            autosave_log_CHB.Enabled          = true;
            autosave_fuzzy_System_CHB.Enabled = true;
            progress_T.Enabled                = false;
            count_complete_L.Text             = "";
            back_ground_process_PB.Value      = 0;
            back_ground_process_PB.Visible    = false;
            string path2    = (new FileInfo(Application.ExecutablePath)).DirectoryName + "\\";
            string filename = "tada.wav";
            System.Media.SoundPlayer tada_player = new System.Media.SoundPlayer(path2 + filename);
            tada_player.LoadAsync();
            tada_player.PlaySync();
            if (!temp_result_form.Result_RTB.Text.Equals(Fuzzy_system.get_log, StringComparison.OrdinalIgnoreCase))
            {
                temp_result_form.Result_RTB.Text = Fuzzy_system.get_log;
                temp_result_form.Result_RTB.Select(temp_result_form.Result_RTB.Text.Length - 1, temp_result_form.Result_RTB.Text.Length - 1);
            }
            temp_result_form.ApproxLearnResult        = Fuzzy_system.ApproxLearnResult;
            temp_result_form.ApproxTestResult         = Fuzzy_system.ApproxTestResult;
            temp_result_form.ApproxLearnResultMSE     = Fuzzy_system.ApproxLearnResultMSE;
            temp_result_form.ApproxTestResultMSE      = Fuzzy_system.ApproxTestResultMSE;
            temp_result_form.ApproxLearnResultMSEdiv2 = Fuzzy_system.ApproxLearnResultMSEdiv2;
            temp_result_form.ApproxTestResultMSEdiv2  = Fuzzy_system.ApproxTestResultMSEdiv2;

            temp_result_form.ClassErLearn     = Fuzzy_system.ClassErLearn;
            temp_result_form.ClassErTest      = Fuzzy_system.ClassErTest;
            temp_result_form.ClassLearnResult = Fuzzy_system.ClassLearnResult;
            temp_result_form.ClassTestResult  = Fuzzy_system.ClassTestResult;

            if (temp_result_form.Visible == false)
            {
                temp_result_form.Show();
            }

            #endregion
            if (autosave_log_CHB.Checked)
            {
                temp_result_form.Result_RTB.SaveFile(path + fileName, RichTextBoxStreamType.UnicodePlainText);
            }



            #endregion
        }
コード例 #13
0
 static Chat()
 {
     NewChatCommand = new SimpleCommand((_u) =>
     {
         var u = (User)_u;
         if (PBOClient.Current != null && u != PBOClient.Current.User)
         {
             Current.NewChat(u);
         }
     });
     sound = new SoundPlayer(Application.GetResourceStream(new Uri("chat.wav", UriKind.Relative)).Stream);
     try
     {
         sound.LoadAsync();
     }
     catch { }
 }
コード例 #14
0
 static Chat()
 {
     NewChatCommand = new SimpleCommand((_u) =>
     {
         var u = (User)_u;
         if (PBOClient.Current != null && u != PBOClient.Current.User)
         {
             Current.NewChat(u);
         }
     });
     sound = new SoundPlayer(Application.GetResourceStream(new Uri(@"pack://application:,,,/PBO;component/images/chat.wav", UriKind.Absolute)).Stream);
     try
     {
         sound.LoadAsync();
     }
     catch { }
 }
コード例 #15
0
ファイル: Sounds.cs プロジェクト: victorsalekseev/NetcodeLib
 /// <summary>
 /// Воспроизведение WAV-файлов
 /// </summary>
 /// <param name="file">Путь до файла</param>
 /// <param name="revers">Повтор (только для прямого воспроизведения) - true</param>
 public void PlayWAV(string file, bool revers)
 {
     try
     {
         //System.Media.SoundPlayer player = new System.Media.SoundPlayer();
         player.SoundLocation = file;
         player.LoadAsync();
         if (revers)
         {
             player.PlayLooping();
         }
         else
         {
             player.Play();
         }
     }
     catch { }
 }
コード例 #16
0
        void alert()
        {
            string intruder_Folder = "intruder_" + DateTime.Now.Day + "-" + DateTime.Now.Month + "-" + DateTime.Now.Year;

            if (!Directory.Exists(intruder_Folder))
            {
                Directory.CreateDirectory(intruder_Folder);
            }
            string date = DateTime.Now.Hour + "_" + DateTime.Now.Minute + "_" + DateTime.Now.Millisecond;
            Bitmap b    = (Bitmap)Fitems.intruder_img;
            Stream str  = new FileStream(intruder_Folder + "/" + date + ".jpg", FileMode.Create);

            b.Save(str, System.Drawing.Imaging.ImageFormat.Jpeg);

            Fitems.intruder_img.Dispose();
            sp.LoadAsync();
            sp.PlayLooping();
            sp.Dispose();
        }
コード例 #17
0
        /// <summary>
        /// Loads data from the specified stream and play the sound data.
        /// </summary>
        /// <param name="stream">The file stream object.</param>
        private void PlaySound(Stream stream)
        {
            try
            {
                lblPlaying.Visible = true;
                this.Height        = lblPlaying.Height + 74;
                btnClose.Text      = "Stop";

                // Load sound data from the stream.
                _soundPlayer.LoadAsync();
                _soundPlayer.Stream = stream;
                // Play it.
                _soundPlayer.Play();
            }
            catch (Exception ex)
            {
                _supportedFormat = false;
                Util.ShowError(ex, "Error: Unable to play the Sound File.");
                this.Close();
            }
        }
コード例 #18
0
ファイル: StartForm.cs プロジェクト: BioNoob/Schoolparse
        public StartForm()
        {
            InitializeComponent();
            smm.SoundLocation = ExPath;
            smm.LoadAsync();
            wc.Encoding = System.Text.Encoding.UTF8;
            StaticInfo.Ev_LoginTelegram += StaticInfo_Ev_LoginTelegram;
            StaticInfo.Ev_LoginSchool   += StaticInfo_Ev_LoginSchool;
            this.Visible = false;
            AutoSchoolAuth au = new AutoSchoolAuth();

            au.ShowDialog();
            stop_btn.Enabled   = false;
            see_btn.Enabled    = false;
            end_time_dtp.Value = DateTime.Now.AddDays(7);
            token = tokenSource.Token;
            time_filter_dtp.Checked = false;
            work_timer.Interval     = 100;
            work_timer.Tick        += Work_timer_Tick;
            this.FormClosed        += StartForm_FormClosed;
        }
コード例 #19
0
        public void GetPoints(IPoints creature)
        {
            _score   += creature.Value;
            _elScore += creature.Value;

            if (creature.Name == "Bird")
            {
                Console.ForegroundColor = ConsoleColor.Yellow;
                Console.WriteLine($"You have saved a {creature.Name}");
                Console.WriteLine($"+{creature.Value} points");
                System.Media.SoundPlayer sound =
                    new System.Media.SoundPlayer();
                sound.SoundLocation = @"\Drofsnar\munch_1.wav";
                sound.LoadAsync();
                sound.Play();
                Thread.Sleep(250);
                System.Media.SoundPlayer sound2 =
                    new System.Media.SoundPlayer();
                sound2.SoundLocation = @"\Drofsnar\munch_2.wav";
                sound2.LoadAsync();
                sound2.Play();
                Thread.Sleep(200);
            }
            else
            {
                Console.ForegroundColor = ConsoleColor.Magenta;
                Console.WriteLine($"You have saved a {creature.Name}");
                Console.WriteLine($"+{creature.Value} points");
                System.Media.SoundPlayer sound =
                    new System.Media.SoundPlayer();
                sound.SoundLocation = @"\Drofsnar\Pacman_Eating_Cherry_Sound_Effect.wav";
                sound.Load();
                sound.Play();
                Thread.Sleep(500);
            }
        }
コード例 #20
0
ファイル: Sound.cs プロジェクト: tarkowr/Connect-4-Console
 /// <summary>
 /// Attach the audio file to the sound player and load it
 /// </summary>
 private void InitializeSound()
 {
     _soundPlayer.SoundLocation = _audioFile;
     _soundPlayer.LoadAsync();
 }
コード例 #21
0
ファイル: Form1.cs プロジェクト: xneo123/PictureLottery
        private void Start_Colors_Click(object sender, EventArgs e)
        {
            var strButton_Text = Start_Colors.Text;
            System.Media.SoundPlayer player = new System.Media.SoundPlayer();
            player.SoundLocation = "C:\\temp\\play.wav";
            if (strButton_Text == "Start_Colors")
            {

                player.LoadAsync();
                player.PlayLooping();
                Start_Colors.Text = "Stop";
                timer_colors.Enabled = true;

            }
            else
            {
                player.Stop();
                Start_Colors.Text = "Start_Colors";
                timer_colors.Enabled = false;
            }
        }
コード例 #22
0
ファイル: ConfigEdit.xaml.cs プロジェクト: AlCher2018/KDS
        public ConfigEdit()
        {
            InitializeComponent();

            this.Loaded += ConfigEdit_Loaded;

            _cfgValKeeper   = new CfgValueKeeper();
            _appNewSettings = new Dictionary <string, string>();

            // размеры окна
            double screenWidth  = (double)WpfHelper.GetAppGlobalValue("screenWidth");
            double screenHeight = (double)WpfHelper.GetAppGlobalValue("screenHeight");

            this.Width  = 0.67d * screenWidth;
            this.Height = 0.75d * screenHeight;


            // дополнтельные действия в зависимости от подтверджения готовности
            cbxState3.IsEnabled = KDSModeHelper.IsReadTakenDishes;
            // (bool)WpfHelper.GetAppGlobalValue("UseReadyConfirmedState", false)
            _useReadyConfirmedState = KDSModeHelper.UseReadyConfirmedState;
            if (_useReadyConfirmedState)
            {
                cbxState8.Visibility = Visibility.Visible;

                cbx18.Visibility = Visibility.Visible;
                cbx28.Visibility = Visibility.Visible;
                cbx83.Visibility = Visibility.Visible;
                cbx82.Visibility = Visibility.Visible;
                cbx81.Visibility = Visibility.Visible;
            }
            else
            {
                cbxState8.Visibility = Visibility.Collapsed;

                cbx18.Visibility = Visibility.Collapsed;
                cbx28.Visibility = Visibility.Collapsed;
                cbx83.Visibility = Visibility.Collapsed;
                cbx82.Visibility = Visibility.Collapsed;
                cbx81.Visibility = Visibility.Collapsed;
            }

            // заполнить комбобокс звуковых файлов
            _audioPath = AppEnvironment.GetAppDirectory("Audio");
            _wavPlayer = new System.Media.SoundPlayer();
            if (Directory.Exists(_audioPath))
            {
                DirectoryInfo dirInfo = new DirectoryInfo(_audioPath);
                List <string> files   = new List <string>();

                foreach (FileInfo fileInfo in dirInfo.GetFiles("*.wav", SearchOption.TopDirectoryOnly))
                {
                    files.Add(fileInfo.Name);
                }
                cbxSelectAudio.ItemsSource = files;

                var defFile = WpfHelper.GetAppGlobalValue("NewOrderAudioAttention");
                if ((defFile != null) && (files.Contains(defFile)))
                {
                    cbxSelectAudio.SelectedValue = defFile;
                    _wavPlayer.SoundLocation     = _audioPath + defFile;
                    _wavPlayer.LoadAsync();
                }
            }
            cbxSelectAudio.SelectionChanged += CbxSelectAudio_SelectionChanged;
        }
コード例 #23
0
        private void Form1_Load(object sender, EventArgs e)
        {
            //pictureBox1.Refresh();
            notify.LoadAsync();
            secondTick.SynchronizingObject = this;
            muteTimer.SynchronizingObject  = this;
            muteTimer.Elapsed += delegate
            {
                textBox1.Enabled = true;
                richTextBox1.AppendText("You are now unmuted." + Environment.NewLine);
            };
            CheckForIllegalCrossThreadCalls = false; // you didn't see anything, this line doesn't exist
            pictureBox1.Image = new Bitmap(1024, 768);
            g      = Graphics.FromImage(pictureBox1.Image);
            Text   = "CollabVM .NET Client: " + Globals.vmip + "#" + Globals.vmname;
            socket = new WebSocket("ws://" + Globals.vmip, "guacamole")
            {
                Origin = "http://" + Globals.vmip.Split(':')[0]
            };
            socket.OnClose    += Socket_OnClose;
            socket.OnOpen     += Socket_OnOpen;
            socket.OnMessage  += Socket_OnMessage;
            socket.Compression = CompressionMethod.Deflate;
            //pictureBox1.Image = Properties.Resources.Loading;
            //pictureBox1.Refresh();
            socket.Connect();

            //topleftpicboxpos = new Point((int)(20 / (double)pictureBox1.Width), (int)(20 / (double)pictureBox1.Height));

            PictureBox1_SizeChanged(null, null);
            pictureBox1.MouseWheel += PictureBox1_MouseWheel;

            KeyDown     += Form1_KeyDown;
            KeyPress    += Form1_KeyPress;
            KeyUp       += Form1_KeyUp;
            FormClosing += Form1_FormClosing;

            turnTimer.Elapsed  += TurnTimer_Elapsed;
            secondTick.Elapsed += SecondTick_Elapsed;

            //audio = new WaveOutEvent(WaveFormat);
            //new BufferedWaveProvider(
            //var format = new WaveFormat(8000, 16, 1);
            //buffered = new BufferedWaveProvider(format);
            //client = new TcpClient("computernewb.com", vmname == "vm1" ? 7004 : vmname == "vm2" ? 7005 : vmname == "vm3" ? 7006 : vmname == "vm4" ? 7007 : vmname == "vm5" ? 7008 : 7010);

/*             Task.Run(() =>
 *          {
 *              var a = client.GetStream();
 *              //System.Threading.Thread.Sleep(500);
 *              byte[] info = new byte[6];
 *              a.Read(info, 0, info.Length);
 *              buffered = new BufferedWaveProvider(new WaveFormat(BitConverter.ToInt32(info.Take(4).ToArray(), 0), info[4], info[5]));
 *              buffered.BufferDuration = TimeSpan.FromSeconds(5);
 *              //buffered.DiscardOnBufferOverflow = true;
 *              audio.Init(buffered);
 *              audio.Play();
 *
 *              for (; ; )
 *              {
 *                  byte[] buffer = new byte[16];
 *                  a.Read(buffer, 0, buffer.Length);
 *                  buffered.AddSamples(buffer, 0, buffer.Length);
 *                  //Send(Console.ReadLine().Split('|'));
 *              };
 *          }); */
        }
コード例 #24
0
ファイル: Form1_BKP.cs プロジェクト: pichiliani/CoMusic
        public void Play(string fname, int SoundFlags)
        {
            fname = "\\MP3\\PIANO\\" + fname;
            fname = Application.StartupPath + fname;

            //PlaySound(fname, 0, SoundFlags);

            System.Media.SoundPlayer sound = new System.Media.SoundPlayer(fname);
            sound.LoadAsync();
            sound.Play();
        }
コード例 #25
0
        public void SignUpHandler()
        {
            System.Media.SoundPlayer player = new System.Media.SoundPlayer();
            while (true)
            {
                IDCardReader cardRead = new IDCardReader();
                //初始化
                if (cardRead.Initialize() == false)
                {
                    //LogHelper.WriteWarnLog("身份证读卡器初始化失败");
                    Thread.Sleep(500);
                    continue;
                }

                if (cardRead.Authenticate() == -1)
                {
                    //LogHelper.WriteWarnLog("身份证读卡器注册失败");
                    Thread.Sleep(500);
                    cardRead.CloseComm();
                    continue;
                }

                if (cardRead.ReadContent() == -1)
                {
                    //LogHelper.WriteWarnLog("获取身份证信息失败");
                    Thread.Sleep(500);
                    cardRead.CloseComm();
                    continue;
                }

                if (mClassCourse == null)
                {
                    try
                    {
                        player.SoundLocation = @".\Voice\selectCourse.wav";
                        player.LoadAsync();
                        player.Play();
                    } catch (Exception err)
                    {
                        LogHelper.WriteWarnLog(err.Message);
                    }
                    continue;
                }

                LogHelper.WriteInfoLog("获取身份证信息成功");
                string name  = "";
                string IDNum = "";
                cardRead.GetNameGBK(ref name);
                cardRead.GetIDNumGBK(ref IDNum);
                cardRead.CloseComm();

                string outMessage = "";
                string response   = RESTClient.SignUp(mClassCourse, IDNum, mClassStauts, ref outMessage);
                if (response == null || response == "")
                {
                    if (outMessage == "")
                    {
                        outMessage = "签到失败,服务器错误";
                    }
                    this.Dispatcher.Invoke(() => {
                        broder_back.Visibility = Visibility.Collapsed;
                        _loading.Visibility    = Visibility.Collapsed;
                        //WarningTipWindow tipDialog = new WarningTipWindow(outMessage);
                        //tipDialog.ShowDialog();
                    });
                    LogHelper.WriteWarnLog(outMessage);
                    try {
                        if (mClassStauts == 1)
                        {
                            player.SoundLocation = @".\Voice\signUpInFail.wav";
                        }
                        else
                        {
                            player.SoundLocation = @".\Voice\signUpOutFail.wav";
                        }
                        player.LoadAsync();
                        player.Play();
                    } catch (Exception err) {
                        LogHelper.WriteWarnLog(err.Message);
                    }
                    LogHelper.WriteWarnLog(outMessage);
                    continue;
                }

                try
                {
                    JObject jResp  = (JObject)JsonConvert.DeserializeObject(response);
                    String  status = (String)jResp.SelectToken("status", true);
                    if (status != "success")
                    {
                        string message = (String)jResp.SelectToken("message", true);
                        this.Dispatcher.Invoke(() => {
                            broder_back.Visibility = Visibility.Collapsed;
                            _loading.Visibility    = Visibility.Collapsed;
                            //WarningTipWindow tipDialog = new WarningTipWindow("签到失败:" + message);
                            //tipDialog.ShowDialog();
                        });

                        LogHelper.WriteWarnLog(message);
                        try {
                            if (mClassStauts == 1)
                            {
                                player.SoundLocation = @".\Voice\signUpInFail.wav";
                            }
                            else
                            {
                                player.SoundLocation = @".\Voice\signUpOutFail.wav";
                            }
                            player.LoadAsync();
                            player.Play();
                        } catch (Exception err) {
                            LogHelper.WriteWarnLog(err.Message);
                        }
                        LogHelper.WriteWarnLog("签到失败:" + message);
                        continue;
                    }

                    LogHelper.WriteInfoLog("签到成功");
                    this.Dispatcher.Invoke(() => {
                        broder_back.Visibility = Visibility.Collapsed;
                        _loading.Visibility    = Visibility.Collapsed;
                    });
                    try {
                        if (mClassStauts == 1)
                        {
                            player.SoundLocation = @".\Voice\signUpInSucc.wav";
                        }
                        else
                        {
                            player.SoundLocation = @".\Voice\signUpOutSucc.wav";
                        }
                        player.LoadAsync();
                        player.Play();
                    } catch (Exception err) {
                        LogHelper.WriteWarnLog(err.Message);
                    }
                    QuerySignUp();
                    continue;
                }
                catch (Exception err)
                {
                    this.Dispatcher.Invoke(() => {
                        broder_back.Visibility = Visibility.Collapsed;
                        _loading.Visibility    = Visibility.Collapsed;
                        //WarningTipWindow tipDialog = new WarningTipWindow("签到失败," + err.Message);
                        //tipDialog.ShowDialog();
                    });
                    LogHelper.WriteWarnLog(err.Message);
                    try {
                        if (mClassStauts == 1)
                        {
                            player.SoundLocation = @".\Voice\signUpInFail.wav";
                        }
                        else
                        {
                            player.SoundLocation = @".\Voice\signUpOutFail.wav";
                        }
                        player.LoadAsync();
                        player.Play();
                    } catch (Exception errSub) {
                        LogHelper.WriteWarnLog(errSub.Message);
                    }
                    continue;
                }
            }
        }