Beispiel #1
0
        private void updateInformation_Click(object sender, RoutedEventArgs e)
        {
            string       order_id     = string.Empty;
            string       status       = string.Empty;
            string       remark       = string.Empty;
            string       merchant_id  = string.Empty;
            string       tmp          = string.Empty;
            string       msg          = string.Empty;
            PayInterface payInterface = new PayInterface();
            DataRowView  dr           = OrderQueryPage.SelectedItem as DataRowView;

            Dictionary <string, string> result = new Dictionary <string, string>();

            //bool bret = PayApi.ApiGet_all_OrderStatus(Var.ltoken, out msg, out Var.g_all_payment_Order_Status);
            //if (!bret)
            //{
            //    MessageBox.Show("获取状态失败!");
            //}

            if (dr != null)
            {
                order_id    = (dr["order_id"].ToString());
                merchant_id = (dr["merchant_id"].ToString());

                if (payInterface.ApiOrderStatusQuery(order_id, merchant_id, out result) == false)
                {
                    MessageBox.Show("查询失败", "错误提示", MessageBoxButton.OK, MessageBoxImage.Error);
                    return;
                }

                result.TryGetValue("status", out tmp);
                result.TryGetValue("msg", out remark);
                Var.g_all_payment_Order_Status.TryGetValue(tmp, out status);
                dr["_status"] = status;
                dr["remark"]  = remark;

                MessageBox.Show(remark, "系统提示", MessageBoxButton.OK, MessageBoxImage.None);
            }
            else
            {
                MessageBox.Show("操作失败", "错误提示", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
Beispiel #2
0
        //private void PlayVoice(string uriString, UriKind uriKind)
        //{
        //    media.Open(new Uri(uriString, uriKind));

        //    media.Play();
        //}

        private void GetPayMentStatus(object obj)
        {
            string order_id = obj as string;
            string msg      = string.Empty;
            string tmp      = string.Empty;
            string status   = string.Empty;

            MediaPlayer media = new MediaPlayer();
            //int i = 3;

            //Dictionary<string, string> describe = new Dictionary<string, string>();

            Dictionary <string, string> result = new Dictionary <string, string>();

            PayInterface payInterface = new PayInterface();

            while (close_Flag)
            {
                Thread.Sleep(5000);

                if (payInterface.ApiOrderStatusQuery(order_id, Var.merchant_id, out result) == false)
                {
                    if (Var.sound == 1)
                    {
                        media.Open(new Uri("./prompt/查询订单状态失败,请手工查询.mp3", UriKind.Relative));
                        media.Play();
                    }
                    execute_Flag = true;
                    MessageBox.Show("查询订单状态失败,请手工查询", "错误提示", MessageBoxButton.OK, MessageBoxImage.Error);
                    return;
                }

                result.TryGetValue("status", out tmp);
                result.TryGetValue("msg", out msg);

                Var.g_all_payment_Order_Status.TryGetValue(tmp, out status);

                Dispatcher.Invoke(new Action(() =>
                {
                    Pay_Status.Content = status;
                }));


                if (status.Contains("支付成功") || status.Contains("支付失败"))
                {
                    execute_Flag = true;
                    if (Var.sound == 1)
                    {
                        if (status.Contains("支付成功"))
                        {
                            //PlayVoice("./prompt/支付成功.mp3", UriKind.Relative);
                            //MyPlay.Source = new Uri("./prompt/支付成功.mp3", UriKind.Relative);
                            //MyPlay.Play();

                            media.Open(new Uri("./prompt/支付成功.mp3", UriKind.Relative));
                        }
                        else
                        {
                            //PlayVoice("./prompt/支付失败.mp3", UriKind.Relative);
                            //MyPlay.Source = new Uri("./prompt/支付失败.mp3", UriKind.Relative);
                            //MyPlay.Play();

                            media.Open(new Uri("./prompt/支付失败.mp3", UriKind.Relative));
                        }

                        media.Play();
                    }

                    break;
                }
            }

            execute_Flag = true;
            close_Flag   = false;
            Dispatcher.Invoke(new Action(() =>
            {
                Pay_Status.Content = status;
            }));

            //获取焦点,为支付成功关窗口做准备
            this.Dispatcher.BeginInvoke(DispatcherPriority.Background, (Action)(() => { Keyboard.Focus(tBoxBarCode); }));
        }