Exemplo n.º 1
0
        void Client_SellStoneCompleted(object sender, Wcf.Clients.WebInvokeEventArgs <int> e)
        {
            App.BusyToken.CloseBusyWindow();
            if (e.Cancelled)
            {
                return;
            }

            if (e.Error != null)
            {
                MyMessageBox.ShowInfo("挂单出售矿石失败。");
                return;
            }
            if (e.Result != OperResult.RESULTCODE_TRUE)
            {
                MyMessageBox.ShowInfo("挂单出售矿石失败。原因为:" + OperResult.GetMsg(e.Result));
                return;
            }

            MyMessageBox.ShowInfo("挂单出售矿石成功。");
            App.UserVMObject.AsyncGetPlayerInfo();
            App.StoneOrderVMObject.AsyncGetAllNotFinishedSellOrders();

            this._syn.Post((o) =>
            {
                this.Close();
            }, null);
        }
Exemplo n.º 2
0
        private void btnOK_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                int count = (int)this.numMinersCount.Value;
                if (count == 0)
                {
                    MyMessageBox.ShowInfo("请输入有效" + Strings.Miner + "数");
                    return;
                }

                decimal money = count * GlobalData.GameConfig.GoldCoin_Miner;
                this.txtNeedMoney.Text = money.ToString();
                if (money > GlobalData.CurrentUser.GoldCoin)
                {
                    //MyMessageBox.ShowInfo("账户余额不足,请充值。");
                    return;
                }
                GlobalData.Client.BuyMiner(count, count);
            }
            catch (Exception exc)
            {
                LogHelper.Instance.AddErrorLog("Buy Miner Exception", exc);
                MyMessageBox.ShowInfo("购买矿工异常");
            }
        }
        private void btnPayOrder_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                StoneDelegateBuyOrderInfoUIModel buyOrder = ((Button)sender).DataContext as StoneDelegateBuyOrderInfoUIModel;

                MyWebPage.ShowMyWebPage(buyOrder.AlipayLink);
                MyMessageBox.ShowInfo("请在弹出的网页中,登录支付宝进行付款。");

                if (!AlipayPaySucceed)
                {
                    var payResult = MyMessageBox.ShowAlipayPayQuestion();
                    if (payResult == MessageBoxAlipayPayQuestionResult.Succeed)
                    {
                        App.UserVMObject.AsyncGetPlayerInfo();
                    }
                    else if (payResult == MessageBoxAlipayPayQuestionResult.Failed)
                    {
                        MyWebPage.ShowMyWebPage(buyOrder.AlipayLink);
                        MyMessageBox.ShowInfo("请在弹出的网页中,登录支付宝进行付款。");
                        return;
                    }
                }
            }
            catch (Exception exc)
            {
                LogHelper.Instance.AddErrorLog("Alipay Pay DelegateBuyStone Order Exception", exc);
            }
        }
Exemplo n.º 4
0
        void Client_ChangePasswordCompleted(object sender, Wcf.Clients.WebInvokeEventArgs <bool> e)
        {
            if (e.Cancelled)
            {
                return;
            }

            if (e.Error != null || !e.Result)
            {
                MyMessageBox.ShowInfo("密码修改失败。");
                return;
            }

            if (e.UserState != null)
            {
                string newPassword = Convert.ToString(e.UserState);
                GlobalData.CurrentUser.ParentObject.SimpleInfo.Password = newPassword;
            }

            MyMessageBox.ShowInfo("密码修改成功。");

            _syn.Post(p =>
            {
                this.DialogResult = true;
            }, null);
        }
Exemplo n.º 5
0
        void Client_GoldCoinRechargeCompleted(object sender, Wcf.Clients.WebInvokeEventArgs <MetaData.Trade.TradeOperResult> e)
        {
            try
            {
                if (e.Cancelled)
                {
                    return;
                }

                if (e.Error != null)
                {
                    MyMessageBox.ShowInfo("访问服务器失败。");
                    return;
                }

                TradeOperResult result = e.Result;
                if (result.ResultCode != OperResult.RESULTCODE_TRUE)
                {
                    MyMessageBox.ShowInfo("金币充值失败。原因:" + OperResult.GetMsg(result.ResultCode));
                    return;
                }
                if (result.PayType == (int)PayType.Alipay)
                {
                    MyWebPage.ShowMyWebPage(result.AlipayLink);
                    MyMessageBox.ShowInfo("请在弹出的网页中,登录支付宝进行付款。");

                    if (!AlipayPaySucceed)
                    {
                        var payResult = MyMessageBox.ShowAlipayPayQuestion();
                        if (payResult == MessageBoxAlipayPayQuestionResult.Succeed)
                        {
                            if (!AlipayPaySucceed)
                            {
                                MyMessageBox.ShowInfo("没有接收到支付宝付款信息。如确实付款,请稍后查看购买记录,或联系客服。");
                            }
                        }
                        else if (payResult == MessageBoxAlipayPayQuestionResult.Failed)
                        {
                            MyWebPage.ShowMyWebPage(result.AlipayLink);
                            MyMessageBox.ShowInfo("请在弹出的网页中,登录支付宝进行付款。");
                            return;
                        }
                    }
                }

                App.UserVMObject.AsyncGetPlayerInfo();
                _syn.Post(p =>
                {
                    //this.DialogResult = true;
                    this.Close();
                }, null);
            }
            catch (Exception exc)
            {
                MyMessageBox.ShowInfo("充值金币,服务器回调处理异常。" + exc.Message);
            }
        }
        //private void BindPriceUI()
        //{
        //    Binding bind = null;
        //    bind = new Binding("Top5BuyOrderList")
        //    {
        //        Source = App.StackStoneVMObject.TodayStackInfo
        //    };
        //    this.lvBuy5Price.SetBinding(ListView.ItemsSourceProperty, bind);

        //    bind = new Binding("Top5SellOrderList")
        //    {
        //        Source = App.StackStoneVMObject.TodayStackInfo
        //    };
        //    this.lvSell5Price.SetBinding(ListView.ItemsSourceProperty, bind);
        //}

        private void btnBuyStone_Click(object sender, RoutedEventArgs e)
        {
            int buyStoneHandsCount = (int)this.numStoneHandCount.Value;

            if (buyStoneHandsCount <= 0)
            {
                MyMessageBox.ShowInfo("请输入要购买的矿石手数");
                return;
            }
            decimal price = Math.Round((decimal)this.sliderPrice.Value, 2);

            if (price <= 0)
            {
                MyMessageBox.ShowInfo("请输入要价格");
                return;
            }

            PayType paytype = (PayType)this.cmbPayType.SelectedValue;

            //if (this.cmbPayType.SelectedIndex == 0)
            //{
            //    paytype = PayType.RMB;
            //}
            //else if (this.cmbPayType.SelectedIndex == 1)
            //{
            //    paytype = PayType.Alipay;
            //}
            //else
            //{
            //    MyMessageBox.ShowInfo("请选择支付方式");
            //    return;
            //}

            if (paytype == PayType.RMB)
            {
                decimal money = buyStoneHandsCount * price;
                if (money > GlobalData.CurrentUser.RMB)
                {
                    MyMessageBox.ShowInfo("账户余额不足,请充值。");
                    return;
                }
            }
            else if (paytype == PayType.Diamand)
            {
                decimal valueDiamond = buyStoneHandsCount * price / GlobalData.GameConfig.Diamonds_RMB;
                if (valueDiamond > GlobalData.CurrentUser.StockOfDiamonds)
                {
                    MyMessageBox.ShowInfo("账户余额不足,请充值。");
                    return;
                }
            }
            this.AlipayPaySucceed = false;
            App.BusyToken.ShowBusyWindow("正在提交订单...");
            GlobalData.Client.DelegateBuyStone(buyStoneHandsCount, price, paytype, paytype);
        }
Exemplo n.º 7
0
 private void numRechargeRMB_ValueChanged(object sender, RoutedPropertyChangedEventArgs <double> e)
 {
     try
     {
         ComputeGainGoldcoin();
     }
     catch (Exception exc)
     {
         MyMessageBox.ShowInfo("充值金币,输入灵币时异常。" + exc.Message);
     }
 }
Exemplo n.º 8
0
        private void btnOK_Click(object sender, RoutedEventArgs e)
        {
            if (txtNewPassword.Password != txtConfirmNewPassword.Password)
            {
                MyMessageBox.ShowInfo("两次输入密码不一致,请重新输入。");
                return;
            }

            string oldPassword = txtOldPassword.Password;
            string newPassword = txtNewPassword.Password;

            GlobalData.Client.ChangePassword(oldPassword, newPassword, newPassword);
        }
Exemplo n.º 9
0
        private void ButtonBuyVirtualShopping_Click(object sender, RoutedEventArgs e)
        {
            Button btn = sender as Button;
            VirtualShoppingItemUIModel shoppingItem = btn.DataContext as VirtualShoppingItemUIModel;

            if (shoppingItem == null)
            {
                MyMessageBox.ShowInfo("请选择要购买的商品");
                return;
            }

            App.ShoppingVMObject.AsyncBuyVirtualShoppingItem(shoppingItem.ParentObject);
        }
Exemplo n.º 10
0
        private void btnUpdateAddress_Click(object sender, RoutedEventArgs e)
        {
            PostAddressUIModel address = this.lvPostAddress.SelectedItem as PostAddressUIModel;

            if (address == null)
            {
                MyMessageBox.ShowInfo("请选择要修改的地址");
                return;
            }

            EditPostAddressWindow win = new EditPostAddressWindow(address);

            win.ShowDialog();
        }
Exemplo n.º 11
0
        void StoneOrderVMObject_PayOrderSucceed()
        {
            try
            {
                App.UserVMObject.AsyncGetPlayerInfo();

                AlipayPaySucceed = true;
                this.Close();
            }
            catch (Exception exc)
            {
                MyMessageBox.ShowInfo("购买矿石,支付成功服务器回调处理异常。" + exc.Message);
            }
        }
Exemplo n.º 12
0
        private void DiamondShoppingItem_MouseDown(object sender, MouseButtonEventArgs e)
        {
            Border btn = sender as Border;
            DiamondShoppingItemUIModel shoppingItem = btn.DataContext as DiamondShoppingItemUIModel;

            if (shoppingItem == null)
            {
                MyMessageBox.ShowInfo("请选择要购买的商品");
                return;
            }

            DiamondShoppingItemDetailWindow win = new DiamondShoppingItemDetailWindow(shoppingItem);

            win.Show();
        }
Exemplo n.º 13
0
        void StoneOrderVMObject_ReleaseLockOrderCompleted(bool isOK)
        {
            try
            {
                _syn.Post(o =>
                {
                    App.UserVMObject.AsyncGetPlayerInfo();

                    this.btnOK.IsEnabled = false;
                    this.Close();
                }, null);
            }
            catch (Exception exc)
            {
                MyMessageBox.ShowInfo("购买矿石,锁定订单超时处理异常。" + exc.Message);
            }
        }
Exemplo n.º 14
0
        private void btnDeleteAddress_Click(object sender, RoutedEventArgs e)
        {
            if (this.lvPostAddress.SelectedItem == null)
            {
                MyMessageBox.ShowInfo("请选择要删除的地址");
                return;
            }

            if (MyMessageBox.ShowQuestionOKCancel("请确认要删除该地址?此操作不可恢复!") == System.Windows.Forms.DialogResult.OK)
            {
                PostAddressUIModel address = this.lvPostAddress.SelectedItem as PostAddressUIModel;
                if (address == null)
                {
                    MyMessageBox.ShowInfo("请选择要删除的地址");
                    return;
                }
                App.UserVMObject.AsyncDeletePostAddress(address.ParentObject.ID);
            }
        }
Exemplo n.º 15
0
        void StoneOrderVMObject_SetStoneOrderExceptionFinished(bool obj)
        {
            try
            {
                if (obj)
                {
                    App.UserVMObject.AsyncGetPlayerInfo();

                    _syn.Post(o =>
                    {
                        this.Close();
                    }, null);
                }
            }
            catch (Exception exc)
            {
                MyMessageBox.ShowInfo("购买矿石,申诉订单回调处理异常。" + exc.Message);
            }
        }
Exemplo n.º 16
0
        //void Client_ReleaseLockOrderCompleted(object sender, Wcf.Clients.WebInvokeEventArgs<bool> e)
        //{
        //    try
        //    {
        //        if (e.Cancelled)
        //        {
        //            return;
        //        }

        //        App.BusyToken.CloseBusyWindow();

        //        if (e.Error != null)
        //        {
        //            _syn.Post(o =>
        //            {
        //                MyMessageBox.ShowInfo("连接服务器失败。");
        //            }, null);
        //            return;
        //        }

        //        App.StoneOrderVMObject.AsyncGetAllNotFinishedSellOrders();

        //        this.Close();
        //    }
        //    catch (Exception exc)
        //    {
        //        MyMessageBox.ShowInfo("购买矿石,取消购买矿石订单,回调处理异常。" + exc.Message);
        //    }
        //}

        private void btnOK_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (chkPayType.IsChecked == true)//支付宝支付
                {
                    MyWebPage.ShowMyWebPage(this.LockedOrder.PayUrl);
                    MyMessageBox.ShowInfo("请在弹出的网页中,登录支付宝进行付款。");

                    if (!AlipayPaySucceed)
                    {
                        var payResult = MyMessageBox.ShowAlipayPayQuestion();
                        if (payResult == MessageBoxAlipayPayQuestionResult.Succeed)
                        {
                            App.UserVMObject.AsyncGetPlayerInfo();

                            if (!AlipayPaySucceed)
                            {
                                System.Windows.Forms.DialogResult result = MyMessageBox.ShowQuestionOKCancel("没有接收到支付宝付款信息。如确实付款,请点击【确定】,将对订单进行申诉,同时联系管理员进行处理,否则请点击【取消】。注意:三次恶意订单申诉,请被永久封号。");
                                if (result == System.Windows.Forms.DialogResult.OK)
                                {
                                    App.StoneOrderVMObject.AsyncSetStoneOrderPayException(LockedOrder.OrderNumber);
                                }
                            }
                        }
                        else if (payResult == MessageBoxAlipayPayQuestionResult.Failed)
                        {
                            MyWebPage.ShowMyWebPage(this.LockedOrder.PayUrl);
                            MyMessageBox.ShowInfo("请在弹出的网页中,登录支付宝进行付款。");
                            return;
                        }
                    }
                }
                else
                {
                    App.StoneOrderVMObject.AsyncPayOrderByRMB(LockedOrder.OrderNumber, LockedOrder.ValueRMB);
                }
            }
            catch (Exception exc)
            {
                MyMessageBox.ShowInfo("购买矿石,处理异常。" + exc.Message);
            }
        }
Exemplo n.º 17
0
        private void btnOK_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                int     count   = 1;
                PayType payType = PayType.Alipay;

                if (this.cmbPayType.SelectedIndex == 0)
                {
                    payType = PayType.RMB;
                }
                else if (this.cmbPayType.SelectedIndex == 1)
                {
                    payType = PayType.Credits;
                }

                if (payType == PayType.RMB)
                {
                    decimal money = count * GlobalData.GameConfig.RMB_Mine;
                    if (money > GlobalData.CurrentUser.RMB)
                    {
                        MyMessageBox.ShowInfo("账户余额不足,请充值。");
                        return;
                    }
                }
                else if (payType == PayType.Credits)
                {
                    decimal valueShoppingCredits = count * GlobalData.GameConfig.RMB_Mine * GlobalData.GameConfig.ShoppingCredits_RMB;
                    if (valueShoppingCredits > GlobalData.CurrentUser.ShoppingCreditsEnabled)
                    {
                        MyMessageBox.ShowInfo("账户余额不足,请充值。");
                        return;
                    }
                }
                GlobalData.Client.BuyMine(count, (int)payType);
            }
            catch (Exception exc)
            {
                LogHelper.Instance.AddErrorLog("Buy Mine Exception", exc);
                MyMessageBox.ShowInfo("勘探矿山失败");
            }
        }
Exemplo n.º 18
0
 private void numMinersCount_ValueChanged(object sender, RoutedPropertyChangedEventArgs <double> e)
 {
     try
     {
         this.txtError.Visibility = System.Windows.Visibility.Collapsed;
         int     count = (int)this.numMinersCount.Value;
         decimal money = count * GlobalData.GameConfig.GoldCoin_Miner;
         this.txtNeedMoney.Text = money.ToString();
         if (money > GlobalData.CurrentUser.GoldCoin)
         {
             decimal allGoldcoin = GlobalData.CurrentUser.GoldCoin + GlobalData.CurrentUser.RMB * GlobalData.GameConfig.RMB_GoldCoin;
             if (money > allGoldcoin)
             {
                 this.txtError.Visibility = System.Windows.Visibility.Visible;
             }
         }
     }
     catch (Exception exc)
     {
         MyMessageBox.ShowInfo(exc.Message);
     }
 }
Exemplo n.º 19
0
        void Client_BuyMinerCompleted(object sender, Wcf.Clients.WebInvokeEventArgs <int> e)
        {
            try
            {
                if (e.Cancelled)
                {
                    return;
                }

                if (e.Error != null)
                {
                    MyMessageBox.ShowInfo("访问服务器失败。");
                    return;
                }

                int result = e.Result;
                if (result == OperResult.RESULTCODE_TRUE)
                {
                    MyMessageBox.ShowInfo("购买矿工成功");
                    App.UserVMObject.AsyncGetPlayerInfo();
                    _syn.Post(p =>
                    {
                        this.Close();
                    }, null);
                }
                else
                {
                    MyMessageBox.ShowInfo("购买失败。原因:" + OperResult.GetMsg(result));
                    return;
                }
            }
            catch (Exception exc)
            {
                MyMessageBox.ShowInfo("购买矿工,服务器回调处理异常。" + exc.Message);
            }
        }
Exemplo n.º 20
0
        private void btnSell_Click(object sender, RoutedEventArgs e)
        {
            int sellStoneCount = (int)this.numSellStones.Value;

            if (sellStoneCount < 1000)
            {
                MyMessageBox.ShowInfo("每次至少要出售1000块矿石");
                return;
            }

            decimal rmb     = GetAllRMB();
            decimal expense = GetExpense(rmb);
            decimal getRMB  = rmb - expense;

            if (getRMB <= 0)
            {
                MyMessageBox.ShowInfo("出售" + Strings.Stone + "最少手续费为:" + GlobalData.GameConfig.ExchangeExpenseMinNumber.ToString()
                                      + ", 您当前出售的矿石不够支付,无法出售。");
                return;
            }

            App.BusyToken.ShowBusyWindow("正在提交服务器...");
            GlobalData.Client.SellStone(sellStoneCount, null);
        }
Exemplo n.º 21
0
        private void btnOK_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                PayType payType = GetPayType();

                //该值可能是灵币,也可能是钻石
                int payMoney = (int)this.numRechargeRMB.Value;
                if (payMoney == 0)
                {
                    MyMessageBox.ShowInfo("请输入有效值");
                    return;
                }

                decimal GainGoldCoin = 0;
                int     spendRMB     = 0;

                if (payType == PayType.RMB)
                {
                    spendRMB     = payMoney;
                    GainGoldCoin = spendRMB * GlobalData.GameConfig.RMB_GoldCoin;
                    this.txtGainGoldCoin.Text = GainGoldCoin.ToString();

                    if (payMoney > GlobalData.CurrentUser.RMB)
                    {
                        MyMessageBox.ShowInfo("账户余额不足,请选择其它支付方式。");
                        return;
                    }
                }
                else if (payType == PayType.Diamand)
                {
                    spendRMB     = (int)Math.Ceiling(payMoney / GlobalData.GameConfig.Diamonds_RMB);
                    GainGoldCoin = spendRMB * GlobalData.GameConfig.RMB_GoldCoin;
                    this.txtGainGoldCoin.Text = GainGoldCoin.ToString();

                    if (payMoney > GlobalData.CurrentUser.StockOfDiamonds)
                    {
                        MyMessageBox.ShowInfo("账户余额不足,请选择其它支付方式。");
                        return;
                    }
                }
                else if (payType == PayType.Alipay)
                {
                    spendRMB     = payMoney;
                    GainGoldCoin = spendRMB * GlobalData.GameConfig.RMB_GoldCoin;
                    this.txtGainGoldCoin.Text = GainGoldCoin.ToString();
                }
                else if (payType == PayType.Credits)
                {
                    spendRMB     = payMoney;
                    GainGoldCoin = spendRMB * GlobalData.GameConfig.RMB_GoldCoin;
                    this.txtGainGoldCoin.Text = GainGoldCoin.ToString();

                    if (payMoney > GlobalData.CurrentUser.ShoppingCreditsEnabled)
                    {
                        MyMessageBox.ShowInfo("账户余额不足,请选择其它支付方式。");
                        return;
                    }
                }

                GlobalData.Client.GoldCoinRecharge((int)GainGoldCoin, (int)payType);
            }
            catch (Exception exc)
            {
                LogHelper.Instance.AddErrorLog("Buy GoldCoin Exception", exc);
                MyMessageBox.ShowInfo("充值金币异常");
            }
        }
Exemplo n.º 22
0
 private void btnOK_Click(object sender, RoutedEventArgs e)
 {
     Clipboard.SetText(this.txtInvitationCode.Text);
     MyMessageBox.ShowInfo("已复制到剪切版");
 }
Exemplo n.º 23
0
        void Client_DelegateBuyStoneCompleted(object sender, Wcf.Clients.WebInvokeEventArgs <MetaData.OperResultObject> e)
        {
            try
            {
                App.BusyToken.CloseBusyWindow();

                if (e.Error != null)
                {
                    LogHelper.Instance.AddErrorLog("Client_DelegateBuyStone Server Exception", e.Error);
                    return;
                }
                if (e.UserState == null)
                {
                    return;
                }
                PayType paytype = (PayType)e.UserState;

                App.StackStoneVMObject.AsyncGetAllNotFinishedBuyOrders();
                App.UserVMObject.AsyncGetPlayerInfo();

                if (e.Result.OperResultCode == OperResult.RESULTCODE_TRUE)
                {
                    if (paytype == PayType.Alipay)
                    {
                        MyWebPage.ShowMyWebPage(e.Result.Message);
                        MyMessageBox.ShowInfo("请在弹出的网页中,登录支付宝进行付款。");

                        if (!AlipayPaySucceed)
                        {
                            var payResult = MyMessageBox.ShowAlipayPayQuestion();
                            if (payResult == MessageBoxAlipayPayQuestionResult.Succeed)
                            {
                                App.UserVMObject.AsyncGetPlayerInfo();

                                //if (!AlipayPaySucceed)
                                //{
                                //    System.Windows.Forms.DialogResult result = MyMessageBox.ShowQuestionOKCancel("没有接收到支付宝付款信息。如确实付款,请点击【确定】,将对订单进行申诉,同时联系管理员进行处理,否则请点击【取消】。注意:三次恶意订单申诉,请被永久封号。");
                                //    if (result == System.Windows.Forms.DialogResult.OK)
                                //    {
                                //        App.StoneOrderVMObject.AsyncSetStoneOrderPayException(LockedOrder.OrderNumber);
                                //    }
                                //}
                            }
                            else if (payResult == MessageBoxAlipayPayQuestionResult.Failed)
                            {
                                MyWebPage.ShowMyWebPage(e.Result.Message);
                                MyMessageBox.ShowInfo("请在弹出的网页中,登录支付宝进行付款。");
                                return;
                            }
                        }
                    }
                    else
                    {
                        MyMessageBox.ShowInfo("挂单成功");
                    }
                }
                else
                {
                    MyMessageBox.ShowInfo("挂单失败,原因为:" + OperResult.GetMsg(e.Result.OperResultCode));
                }
            }
            catch (Exception exc)
            {
                LogHelper.Instance.AddErrorLog("Client_DelegateBuyStone Exception", exc);
            }
        }