Exemplo n.º 1
0
 public override bool OnOptionsItemSelected(IMenuItem item)
 {
     switch (item.ItemId)
       {
     case 0:
     ((TChartApplication)Application).Chart = chart;
     Intent editorIntent = new Intent(this.ApplicationContext, typeof(ChartEditor));
     StartActivityForResult(editorIntent, 1);
     return true;
     case 1:
     ThemesEditor themes = new ThemesEditor(chart.Chart, 0);
     themes.Choose(this);
     return true;
     case 2:
     //try
     //{
     //  DoExport();
     //}
     //catch (Java.IO.IOException e)
     //{
     //  e.PrintStackTrace();
     //  Toast
     //    .MakeText(this, "Cannot export Chart: " + e.Message, ToastLength.Short)
     //    .Show();
     //}
     return true;
     default:
     return base.OnOptionsItemSelected(item);
       }
 }
Exemplo n.º 2
0
        public override bool OnOptionsItemSelected(IMenuItem item)
        {
            switch (item.ItemId)
            {
            case 0:
                ((TChartApplication)Application).Chart = chart;
                Intent editorIntent = new Intent(this.ApplicationContext, typeof(ChartEditor));
                StartActivityForResult(editorIntent, 1);
                return(true);

            case 1:
                ThemesEditor themes = new ThemesEditor(chart.Chart, 0);
                themes.Choose(this);
                return(true);

            case 2:
                //try
                //{
                //  DoExport();
                //}
                //catch (Java.IO.IOException e)
                //{
                //  e.PrintStackTrace();
                //  Toast
                //    .MakeText(this, "Cannot export Chart: " + e.Message, ToastLength.Short)
                //    .Show();
                //}
                return(true);

            default:
                return(base.OnOptionsItemSelected(item));
            }
        }
Exemplo n.º 3
0
        public override bool OnOptionsItemSelected(IMenuItem item)
        {
            switch (item.ItemId)
            {
            case 0:
                ((TChartApplication)Application).Chart = chart;
                var editorIntent = new Intent(ApplicationContext, typeof(ChartEditor));
                StartActivityForResult(editorIntent, 1);
                return(true);

            case 1:
                var themes = new ThemesEditor(chart.Chart, 0);
                themes.Choose(this);
                return(true);

            case 2:
                Java.IO.File cache = ExternalCacheDir;
                if ((cache == null) || (!cache.CanWrite()))
                {
                    // no external cache
                    cache = CacheDir;
                }

                Android.Graphics.Bitmap _currentBitmap = chart.Bitmap;

                var tempFile = new Java.IO.File(cache, "temp.jpg");
                using (FileStream fileStream = File.OpenWrite(tempFile.AbsolutePath))
                {
                    _currentBitmap.Compress(Android.Graphics.Bitmap.CompressFormat.Jpeg, 85, fileStream);
                }

                var shareIntent = new Intent(Intent.ActionSend);
                shareIntent.PutExtra(Intent.ExtraStream, Android.Net.Uri.FromFile(tempFile));
                shareIntent.PutExtra(Intent.ExtraText, "Chart created with TeeChart Mono for Android by www.steema.com");//"Some text - appears in tweets, not on facebook");
                shareIntent.SetType("image/jpeg");

                StartActivity(Intent.CreateChooser(shareIntent, "Share Image"));

                return(true);

            default:
                return(base.OnOptionsItemSelected(item));
            }
        }