void Initialize()
        {
            this.View.BackgroundColor = UIColor.Black;

            float ix = (this.View.Bounds.Right / 2) - 55.5f;

            UIGlassButton buttonSite = new UIGlassButton(new RectangleF((this.View.Bounds.Right / 2) - (105), 275f, 220f, 25f));

            buttonSite.SetTitle("http://www.steema.com", UIControlState.Normal);
            buttonSite.SetTitleColor(UIColor.White, UIControlState.Normal);
            buttonSite.SetValueForKey(UIColor.Black, "tintColor");
            this.View.AddSubview(buttonSite);

            buttonSite.TouchDown += delegate {             // trigger action
                NSUrl url = new NSUrl("http://www.steema.com");
                if (!UIApplication.SharedApplication.OpenUrl(url))
                {
                    var av = new UIAlertView("Not supported"
                                             , "Scheme 'tel:' is not supported on this device"
                                             , null
                                             , "Ok thanks"
                                             , null);
                    av.Show();
                }
            };

            var labelRect = new RectangleF((this.View.Bounds.Right / 2) - 90, 300f, 200f, 25f);

            using (var label = new UILabel(labelRect))
            {
                label.TextColor                 = UIColor.White;
                label.BackgroundColor           = UIColor.Black;
                label.AdjustsFontSizeToFitWidth = true;
                label.Text = "2011 CopyRight by Steema Software, S.L.";
                this.View.AddSubview(label);
            }

            var imageRect = new RectangleF(ix - 9, 30f, 127f, 80f);

            using (var myImage = new UIImageView(imageRect))
            {
                myImage.Image  = UIImage.FromFile("images/SteemaWhite127x80.png");
                myImage.Opaque = false;

                this.View.AddSubview(myImage);
            }

            var image2Rect = new RectangleF(ix, 140f, 111f, 80f);

            using (var logo = new UIImageView(image2Rect))
            {
                logo.Image  = UIImage.FromFile("images/TeeChartNETForIPhone111x80.png");
                logo.Opaque = false;

                this.View.AddSubview(logo);
            }
        }
		void Initialize ()
		{
			  this.View.BackgroundColor = UIColor.Black;
			 
 			  float ix = (this.View.Bounds.Right /2) - 55.5f;

			  UIGlassButton buttonSite = new UIGlassButton(new RectangleF((this.View.Bounds.Right /2)-(105), 275f,220f,25f));
		 	  buttonSite.SetTitle("http://www.steema.com", UIControlState.Normal);
			  buttonSite.SetTitleColor(UIColor.White, UIControlState.Normal);
			  buttonSite.SetValueForKey(UIColor.Black, "tintColor");
			  this.View.AddSubview(buttonSite);
			
		        buttonSite.TouchDown += delegate { // trigger action
		            NSUrl url = new NSUrl("http://www.steema.com");
		            if (!UIApplication.SharedApplication.OpenUrl(url))
		            {
		                var av = new UIAlertView("Not supported"
		                    , "Scheme 'tel:' is not supported on this device"
		                    , null
		                    , "Ok thanks"
		                    , null);
		                av.Show();
		            }
		        };			
						
			  var labelRect = new RectangleF((this.View.Bounds.Right /2)-90, 300f,200f,25f);
			    using (var label = new UILabel(labelRect))
			    {
			     label.TextColor = UIColor.White;
				 label.BackgroundColor = UIColor.Black;
				 label.AdjustsFontSizeToFitWidth=true;
			     label.Text = "2011 CopyRight by Steema Software, S.L.";
			     this.View.AddSubview(label);
			    }
			
			  var imageRect = new RectangleF(ix-9, 30f, 127f, 80f);
				using (var myImage = new UIImageView(imageRect))
				{  
				    myImage.Image = UIImage.FromFile("images/SteemaWhite127x80.png");
				    myImage.Opaque = false;
				
				    this.View.AddSubview(myImage);
				}
			
				var image2Rect = new RectangleF(ix, 140f, 111f, 80f);
				using (var logo = new UIImageView(image2Rect))
				{  
				    logo.Image = UIImage.FromFile("images/TeeChartNETForIPhone111x80.png");
				    logo.Opaque = false;
				
				    this.View.AddSubview(logo);
				}
		}
Beispiel #3
0
        //public TChart chart= new Steema.TeeChart.TChart();
        //SettingsController controller;
        //ChartViewController controller;
        #region Constructors

        // The IntPtr and initWithCoder constructors are required for items that need
        // to be able to be created from a xib rather than from managed code
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            View.BackgroundColor = UIColor.Black;
            NavigationController.NavigationBar.TintColor = UIColor.Black;
            this.NavigationItem.RightBarButtonItem       = null;

            UIColor       tint   = UIColor.Black;
            UIGlassButton button = new UIGlassButton(new RectangleF(20, 265, 280, 48));

            button.SetTitle("Chart Features", UIControlState.Normal);
            button.SetTitleColor(UIColor.White, UIControlState.Normal);
            button.SetValueForKey(tint, "tintColor");
            this.View.AddSubview(button);

            button.TouchDown += delegate(object sender, EventArgs e) {
                NavigationController.SetNavigationBarHidden(false, true);
                // controller = new ChartViewController();
//				SeriesTypesController scontroller = new SeriesTypesController(controller.chart,controller,UITableViewStyle.Grouped);
                SeriesTypesController scontroller = new SeriesTypesController(UITableViewStyle.Grouped);
                NavigationController.PushViewController(scontroller, true);
            };

            UIGlassButton buttonStatistical = new UIGlassButton(new RectangleF(20, 315, 280, 48));

            buttonStatistical.SetTitle("Battery Level Demo", UIControlState.Normal);
            buttonStatistical.SetTitleColor(UIColor.White, UIControlState.Normal);
            buttonStatistical.SetValueForKey(tint, "tintColor");
            this.View.AddSubview(buttonStatistical);

            buttonStatistical.TouchDown += delegate(object sender, EventArgs e) {
                ChartViewController controller = new ChartViewController();
                NavigationController.PushViewController(controller, true);
            };

            UIGlassButton buttonAbout = new UIGlassButton(new RectangleF(20, 365, 280, 48));

            buttonAbout.SetTitle("About", UIControlState.Normal);
            buttonAbout.SetTitleColor(UIColor.White, UIControlState.Normal);
            buttonAbout.SetValueForKey(tint, "tintColor");
            this.View.AddSubview(buttonAbout);

            buttonAbout.TouchDown += delegate(object sender, EventArgs e) {
                AboutViewController controller = new AboutViewController();
                NavigationController.PushViewController(controller, true);
            };

            //float ix = (this.View.Bounds.Right /2) - 55.5f;

            var image2Rect = new RectangleF(0f, 20f, 234f, 225f);

            using (var myImage = new UIImageView(image2Rect))
            {
                myImage.Image  = UIImage.FromFile("images/Chart1.png");
                myImage.Opaque = false;

                this.View.AddSubview(myImage);
            }

            var imageRect = new RectangleF(190f, 10f, 111f, 80f);

            using (var myImage = new UIImageView(imageRect))
            {
                myImage.Image  = UIImage.FromFile("images/TeeChartNETForIPhone111x80.png");
                myImage.Opaque = false;

                this.View.AddSubview(myImage);
            }
        }
		//public TChart chart= new Steema.TeeChart.TChart();
		//SettingsController controller;
		//ChartViewController controller;
		#region Constructors

		// The IntPtr and initWithCoder constructors are required for items that need 
		// to be able to be created from a xib rather than from managed code
		public override void ViewDidLoad ()
		{
			base.ViewDidLoad ();
			
			  View.BackgroundColor=UIColor.Black;
			  NavigationController.NavigationBar.TintColor = UIColor.Black;
			  this.NavigationItem.RightBarButtonItem=null;
 
			  UIColor tint = UIColor.Black;
		 	  UIGlassButton button = new UIGlassButton(new RectangleF(20, 265, 280, 48));
		 	  button.SetTitle("Chart Features", UIControlState.Normal);
			  button.SetTitleColor(UIColor.White, UIControlState.Normal);
			  button.SetValueForKey(tint, "tintColor");
			  this.View.AddSubview(button);
			
     	      button.TouchDown += delegate(object sender, EventArgs e) {
				NavigationController.SetNavigationBarHidden(false,true);
               // controller = new ChartViewController();	
//				SeriesTypesController scontroller = new SeriesTypesController(controller.chart,controller,UITableViewStyle.Grouped); 		  
				SeriesTypesController scontroller = new SeriesTypesController(UITableViewStyle.Grouped); 		  
                NavigationController.PushViewController(scontroller,true);
              };

		 	  UIGlassButton buttonStatistical = new UIGlassButton(new RectangleF(20, 315, 280, 48));
		 	  buttonStatistical.SetTitle("Battery Level Demo", UIControlState.Normal);
			  buttonStatistical.SetTitleColor(UIColor.White, UIControlState.Normal);
			  buttonStatistical.SetValueForKey(tint, "tintColor");
			  this.View.AddSubview(buttonStatistical);
			
     	      buttonStatistical.TouchDown += delegate(object sender, EventArgs e) {
                ChartViewController controller = new ChartViewController();			  
                NavigationController.PushViewController(controller,true);
              };

			  UIGlassButton buttonAbout = new UIGlassButton(new RectangleF(20, 365, 280, 48));
		 	  buttonAbout.SetTitle("About", UIControlState.Normal);
			  buttonAbout.SetTitleColor(UIColor.White, UIControlState.Normal);
			  buttonAbout.SetValueForKey(tint, "tintColor");
			  this.View.AddSubview(buttonAbout);
			
     	      buttonAbout.TouchDown += delegate(object sender, EventArgs e) {
                AboutViewController controller = new AboutViewController();			  
                NavigationController.PushViewController(controller,true);
              };
			
			  //float ix = (this.View.Bounds.Right /2) - 55.5f;
			
			  var image2Rect = new RectangleF(0f, 20f, 234f, 225f);
				using (var myImage = new UIImageView(image2Rect))
				{  
				    myImage.Image = UIImage.FromFile("images/Chart1.png");
				    myImage.Opaque = false;
				
				    this.View.AddSubview(myImage);
				}

			  var imageRect = new RectangleF(190f, 10f, 111f, 80f);
				using (var myImage = new UIImageView(imageRect))
				{  
				    myImage.Image = UIImage.FromFile("images/TeeChartNETForIPhone111x80.png");
				    myImage.Opaque = false;
				
				    this.View.AddSubview(myImage);
				}
		}
        public override void ViewDidLoad()
        {
            base.ViewDidLoad ();
            // Set Tint Color
            UIColor tint = UIColor.FromHSBA(0.267f, 1.000f,0.667f,1.000f); // lime green
            //tint = UIColor.Red;

            // Regular iPad/iPhone button
            UIGlassButton glassButton = new UIGlassButton(new RectangleF(20, 50, 280, 48));
            glassButton.SetTitle(text, UIControlState.Normal);
            glassButton.TitleLabel.AdjustsFontSizeToFitWidth = true;
            glassButton.TitleLabel.MinimumFontSize = 10f;
            glassButton.TitleLabel.Font = UIFont.BoldSystemFontOfSize(16);
            glassButton.SetTitleColor(UIColor.White, UIControlState.Normal);
            glassButton.SetValueForKey(tint, "tintColor");

            // iPhone4 Retina display button
            UIGlassButton glassButton2x = new UIGlassButton(new RectangleF(20, 120, 560, 96));
            glassButton2x.SetTitle(text, UIControlState.Normal);
            glassButton2x.TitleLabel.AdjustsFontSizeToFitWidth = true;
            glassButton2x.TitleLabel.MinimumFontSize = 20f;
            glassButton2x.TitleLabel.Font = UIFont.BoldSystemFontOfSize(32);
            glassButton2x.SetTitleColor(UIColor.White, UIControlState.Normal);
            glassButton2x.SetValueForKey(tint, "tintColor");

            // This is our button at the bottom that does the generating
            UIGlassButton makeGlassButton = new UIGlassButton(new RectangleF(20, this.View.Bounds.Height - 68, 280, 48));
            UIColor tint2 = UIColor.Blue;
            makeGlassButton.SetTitle("Generate Glass Button", UIControlState.Normal);
            makeGlassButton.SetTitleColor(UIColor.White, UIControlState.Normal);
            makeGlassButton.SetValueForKey(tint2, "tintColor");
            makeGlassButton.AutoresizingMask = UIViewAutoresizing.FlexibleTopMargin;
            makeGlassButton.TouchUpInside += delegate
            {
                MakeButton (glassButton, "");
                var png = MakeButton (glassButton2x, "@2x");
                var saved = "Your UIGlassButton has been saved to -> " + png;
                if (IsSimulator)
                {
                    saved = "Your UIGlassButton has been saved to -> " +
                                    System.IO.Path.Combine(NSBundle.MainBundle.BundlePath, png);
                    Console.WriteLine (saved);
                }
                var alert = new UIAlertView("Saved!", saved, null, "Ok");
                alert.Show();
            };

            this.Add(glassButton);
            this.Add(glassButton2x);
            this.Add(makeGlassButton);
        }
        string MakeButton(UIGlassButton theButton, string fileExtension)
        {
            // Grab The Context The Size of the Button
            UIGraphics.BeginImageContext (theButton.Frame.Size);
            var ctx = UIGraphics.GetCurrentContext ();

            // Render the button in the context
            theButton.Layer.RenderInContext(ctx);

            // Lets grab a UIImage of the current graphics context
            UIImage i = UIGraphics.GetImageFromCurrentImageContext();

            Console.Write("model: "+UIDevice.CurrentDevice.Model);
            string png = "../Documents/"+filename+fileExtension+".png";
            if (IsSimulator)
            {
                png = "/Users/"+ yourname +"/Desktop/"+filename+fileExtension+".png";
            }

            // Get the Image as a PNG
            NSData imgData = i.AsPNG();
            NSError err = null;
            if (imgData.Save(png, false, out err))
            {
                Console.WriteLine("saved as " + png);
            }
            else
            {
             	Console.WriteLine("NOT saved as" + png +
                                " because" + err.LocalizedDescription);
            }

            UIGraphics.EndImageContext ();

            return png;
        }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad ();
            // Set Tint Color
            UIColor tint = UIColor.FromHSBA(0.267f, 1.000f,0.667f,1.000f); // lime green
            //tint = UIColor.Red;

            // UPDATE: There is now a very useful GlassButton class 'built-in' to MonoTouch via MonoTouch.Dialog
            // this code shows how to use it. See github for more info and the code:
            // https://github.com/migueldeicaza/MonoTouch.Dialog/blob/master/MonoTouch.Dialog/Utilities/GlassButton.cs
            // If you would still like to generate static images that code follows...
            UIColor clickedTint = UIColor.FromRGBA(42/255f, 95/255f, 34/255f,1.000f); // lime green

            var mtb = new MonoTouch.Dialog.GlassButton(new RectangleF(20,250,280,50));
            mtb.SetTitle("MT.D dynamic button", UIControlState.Normal);
            mtb.Font = UIFont.BoldSystemFontOfSize(14f);
            mtb.HighlightedColor= clickedTint;
            mtb.NormalColor = tint;
            mtb.DisabledColor = UIColor.Gray;
            Add (mtb);

            // IF you still want to embed generated image glassbuttons...
            // OLD STYLE static image generation code

            // Regular iPad/iPhone button
            UIGlassButton glassButton = new UIGlassButton(new RectangleF(20, 50, 280, 48));
            glassButton.SetTitle(text, UIControlState.Normal);
            glassButton.TitleLabel.AdjustsFontSizeToFitWidth = true;
            glassButton.TitleLabel.MinimumFontSize = 10f;
            glassButton.TitleLabel.Font = UIFont.BoldSystemFontOfSize(16);
            glassButton.SetTitleColor(UIColor.White, UIControlState.Normal);
            glassButton.SetValueForKey(tint, "tintColor");

            // iPhone4 Retina display button
            UIGlassButton glassButton2x = new UIGlassButton(new RectangleF(20, 120, 560, 96));
            glassButton2x.SetTitle(text, UIControlState.Normal);
            glassButton2x.TitleLabel.AdjustsFontSizeToFitWidth = true;
            glassButton2x.TitleLabel.MinimumFontSize = 20f;
            glassButton2x.TitleLabel.Font = UIFont.BoldSystemFontOfSize(32);
            glassButton2x.SetTitleColor(UIColor.White, UIControlState.Normal);
            glassButton2x.SetValueForKey(tint, "tintColor");

            // This is our button at the bottom that does the generating
            UIGlassButton makeGlassButton = new UIGlassButton(new RectangleF(20, this.View.Bounds.Height - 68, 280, 48));
            UIColor tint2 = UIColor.Blue;
            makeGlassButton.SetTitle("Generate Glass Button", UIControlState.Normal);
            makeGlassButton.SetTitleColor(UIColor.White, UIControlState.Normal);
            makeGlassButton.SetValueForKey(tint2, "tintColor");
            makeGlassButton.AutoresizingMask = UIViewAutoresizing.FlexibleTopMargin;
            makeGlassButton.TouchUpInside += delegate
            {
                MakeButton (glassButton, "");
                var png = MakeButton (glassButton2x, "@2x");
                var saved = "Your UIGlassButton has been saved to -> " + png;
                if (IsSimulator)
                {
                    saved = "Your UIGlassButton has been saved to -> " +
                                    System.IO.Path.Combine(NSBundle.MainBundle.BundlePath, png);
                    Console.WriteLine (saved);
                }
                var alert = new UIAlertView("Saved!", saved, null, "Ok");
                alert.Show();
            };

            this.Add(glassButton);
            this.Add(glassButton2x);
            this.Add(makeGlassButton);
        }