예제 #1
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            // Prepare the view
            SetContentView(Resource.Layout.StockChartActivityLayout);

            // Create and show the progress dialog
            _progressDialog = new ProgressDialog(this);
            _progressDialog.SetTitle("Retrieving Data...");
            _progressDialog.SetMessage("Please wait");
            _progressDialog.SetCancelable(false);
            _progressDialog.Show();

            // Manage the updates of the presenter and application
            var app = ShinobiStockChartApplication.GetApplication(this);

            app.CurrentActivity = this;
            _presenter          = app.Presenter as StockChartPresenter;
            _presenter.SetView(this);

            // Get the chart and configure it
            var chartFrag = FragmentManager.FindFragmentById <ChartFragment> (Resource.Id.chart);

            _chart = chartFrag.ShinobiChart;
            _chart.SetTrialKey("<PUT YOUR TRIAL KEY HERE>");

            _chart.XAxis = new DateTimeAxis();
            _chart.XAxis.EnableGestures();
            _chart.YAxis = new NumberAxis();
            _chart.YAxis.EnableGestures();

            // Set the style
            _chart.Style.BackgroundColor            = Resources.GetColor(Resource.Color.chart_background);
            _chart.Style.CanvasBackgroundColor      = Color.Transparent;
            _chart.Style.PlotAreaBackgroundColor    = Color.Transparent;
            _chart.XAxis.Style.LineColor            = Resources.GetColor(Resource.Color.chart_axis);
            _chart.YAxis.Style.LineColor            = Resources.GetColor(Resource.Color.chart_axis);
            _chart.XAxis.Style.TickStyle.LabelColor = Resources.GetColor(Resource.Color.chart_axis);
            _chart.YAxis.Style.TickStyle.LabelColor = Resources.GetColor(Resource.Color.chart_axis);
            _chart.XAxis.Style.TickStyle.LineColor  = Resources.GetColor(Resource.Color.chart_axis);
            _chart.YAxis.Style.TickStyle.LineColor  = Resources.GetColor(Resource.Color.chart_axis);

            // Set the title
            if (_chartTitle != null)
            {
                FindViewById <TextView> (Resource.Id.symbolTextView).Text = _chartTitle;
            }

            // Enable the home button
            ActionBar.SetDisplayHomeAsUpEnabled(true);
            ActionBar.SetHomeButtonEnabled(true);
            ActionBar.Title = _presenter.Title;
        }
 public StockChartViewController(StockChartPresenter presenter) : base("StockChartViewController", null)
 {
     Title = presenter.Title;
     presenter.SetView(this);
 }