コード例 #1
0
        private void LoadMarketPageUI()
        {
            //This function will load the UI based on the data present
            CreateMarketsList();

            //Change the Sell and Buy labels
            Buy_Button.Text  = "Buy " + MainService.MarketList[MainService.exchange_market].trade_symbol;
            Sell_Button.Text = "Sell " + MainService.MarketList[MainService.exchange_market].trade_symbol;

            //Set the Recent trade list to our list
            Recent_Trade_List.HeightRequest = 100;
            Recent_Trade_List.ItemsSource   = MainService.RecentTradeList[MainService.exchange_market];
            Selling_View.ItemsSource        = Selling_View_List;
            Buying_View.ItemsSource         = Buying_View_List;

            //Load the re-useable boxviews for the chart
            chart_candles_line.Clear();
            chart_candles_rect.Clear();
            for (int i = 0; i < 100; i++)
            {
                //Add the line to the view
                BoxView bv = new BoxView();
                bv.IsVisible = false;
                Chart_Canvas.Children.Add(bv);
                chart_candles_line.Add(bv);

                //Add the rect to the view
                bv           = new BoxView();
                bv.IsVisible = false;
                Chart_Canvas.Children.Add(bv);
                chart_candles_rect.Add(bv);
            }

            //This will be ran in a separate thread due to SQLite access that may be slow
            //Update the Candles and populate the order lists
            Task.Run(() => {
                if (App.force_reload_marketdata == true)
                {
                    //This will only run if client has been out of sync (sleeping)
                    MainService.ClearMarketData(MainService.exchange_market);
                    MainService.GetCNMarketData(MainService.exchange_market);
                    App.force_reload_marketdata = false;
                }
                PopulateOrderList();
                UpdateCandles();
            });
        }
コード例 #2
0
        private void Change_Market(object sender, EventArgs e)
        {
            if (market_loading == true)
            {
                return;
            }

            PickerFixed pick = sender as PickerFixed;

            if (pick.SelectedIndex < 0)
            {
                return;
            }
            string market_string = pick.Items[pick.SelectedIndex];
            int    which_market  = Selected_Market(market_string);

            if (which_market == MainService.exchange_market)
            {
                return;
            }                                                           //We just selected the same market

            if (which_market > -1)
            {
                int oldmarket = MainService.exchange_market;
                MainService.exchange_market = which_market;

                pick.IsEnabled        = false;
                market_loading        = true;
                Chart_Last_Price.Text = "LOADING..."; //Put a loading status

                //Clear the old candles and charts and reload the market data for this market
                Task.Run(() => {
                    MainService.ClearMarketData(oldmarket);
                    MainService.GetCNMarketData(MainService.exchange_market);
                    MainService.NebliDex_Activity.RunOnUiThread(() =>
                    {
                        RefreshUI();
                        Market_Box.IsEnabled = true; //Re-enable the box
                        market_loading       = false;
                    });
                    MainService.Save_UI_Config(); //Save the UI Market Info
                    MainService.Load_UI_Config();
                });
            }
        }