Пример #1
0
        protected void OnParentViewModelChanged()
        {
            try
            {
                ParentModel = ParentViewModel.ToString().Split('_')[0];

                if (ParentModel.Equals("CoinTradingViewModel"))
                {
                    HeaderVisible = Visibility.Collapsed;
                }
                else if (ParentModel.Equals("TradeHistoryTradingViewModel"))
                {
                    HeaderVisible = Visibility.Collapsed;
                }
                else if (ParentModel.Equals("ExchangeDashboardViewModel"))
                {
                    HeaderVisible = Visibility.Visible;
                }
                else
                {
                    HeaderVisible = Visibility.Collapsed;
                }

                if (HeaderVisible == Visibility.Collapsed)
                {
                    HeaderHeight = 0;
                    AmtVisible   = false;
                }
            }
            catch (Exception ex)
            {
                SysLog.Error("Message[{0}], StackTrace[{1}]", ex.Message, ex.StackTrace);
            }
        }
Пример #2
0
        public void CmdSelectCoin(ResponseExchangeDashboardCoinListModel list)
        {
            try
            {
                DispatcherService.BeginInvoke(() =>
                {
                    if (list == null)
                    {
                        return;
                    }

                    if (ParentModel == null)
                    {
                        return;
                    }

                    //if (list.coinNm.Equals("VSTC"))
                    //{
                    //    Alert alert = new Alert(Localization.Resource.Common_Alert_1);
                    //    alert.ShowDialog();
                    //    return;
                    //}

                    if (tempCoinCd != list.curcyCd || HeaderName != tempPriceType)
                    {
                        tempCoinCd    = list.curcyCd;
                        tempPriceType = HeaderName;

                        if (HeaderName == list.coinNm || CoinPriceData.Any(x => x.coinNm == list.coinNm) == false)
                        {
                            SelectItem = CoinPriceData[0];
                        }
                        else
                        {
                            SelectItem = list;
                        }

                        if (HeaderVisible == Visibility.Visible)
                        {
                            img_main_coin = "/Images/img_ex_" + SelectItem.coinNm + ".png";
                            txt_Quotes    = SelectItem.coinPrc;
                            txt_Rate      = SelectItem.volume;
                            txt_Volume    = SelectItem.svcTranAmt;
                        }

                        SelectCoinCode = StringEnum.ToEnum <EnumLib.ExchangeCurrencyCode>(SelectItem.curcyCd);

                        if (ParentModel.Equals("ExchangeDashboardViewModel"))
                        {
                            ((ExchangeDashboardViewModel)ParentViewModel).ChangeCoin(HeaderName, HeaderCode, StringEnum.ToEnum <EnumLib.ExchangeCurrencyCode>(SelectItem.curcyCd));
                        }
                        else if (ParentModel.Equals("CoinTradingViewModel"))
                        {
                            ((CoinTradingViewModel)ParentViewModel).SetCoin(HeaderName, HeaderCode, SelectItem.curcyCd);
                        }
                        else if (ParentModel.Equals("TradeHistoryTradingViewModel"))
                        {
                            ((TradeHistoryTradingViewModel)ParentViewModel).SetCoinTradeHistory(HeaderName, SelectCoinCode);
                        }
                    }
                });
            }
            catch (Exception ex)
            {
                SysLog.Error("Message[{0}], StackTrace[{1}]", ex.Message, ex.StackTrace);
            }
        }