public NumberInputView() { BackgroundColor = UIColor.Black.ColorWithAlpha(.5f); Add(numberPanel = new StackPanel{ Columns = 3, Padding = 5, }); Enumerable.Range(1,9).ForEach(x=> numberPanel.Add(createButton(x.ToString()))); numberPanel.Add(createButton(".")); numberPanel.Add(createButton("0")); numberPanel.Add(createButton("del")); done = new TintedButton { Layer = { CornerRadius = 5 }, BackgroundColor = UIColor.White, Frame = new RectangleF(0,0,44,44), Title = "Done", Font = UIFont.SystemFontOfSize(30), SelectedTintColor = UIColor.Black, TintColor = TintColor, }; done.TouchUpInside += (object sender, EventArgs e) =>{ EndEditing(); }; Add(done); }
public RootViewController() { var downloadButton = View = stackPanel = new StackPanel () { new SimpleButton { Title = "Simple ActionSheet", BackgroundColor = UIColor.Gray, Tapped = (btn) => { var popup = new SimpleActionSheet () { {"Red",UIColor.Red,()=> Console.WriteLine("red")}, {"Blue", UIColor.Blue, ()=> Console.WriteLine("Blue")}, {"Black", UIColor.Black, ()=> Console.WriteLine("Black")}, {"Green", UIColor.Green, ()=> Console.WriteLine("Green")}, {"Cancel",()=> Console.WriteLine("Cancel")} }; popup.ShowInView(View); } }, new SimpleButton{ Title = "I move on tilt", BackgroundColor = UIColor.Gray, }.AddMotion(-100,100), new SimpleButton{ Title = "Click to download", BackgroundColor = UIColor.Gray, Tapped = async (btn)=>{ btn.Enabled = false; var endPath = Path.Combine(DocumentsFolder,"test.zip"); if(File.Exists(endPath)) File.Delete(endPath); var downloader = new BackgroundDownload(); downloader.ProgressChanged += (float obj) => Device.EnsureInvokedOnMainThread(()=> btn.Title = obj.ToString()); await downloader.DownloadFileAsync(new Uri("http://ipv4.download.thinkbroadband.com/5MB.zip"),endPath ); btn.Title = "Click to download"; btn.Enabled = true; } }, new UIImageView(UIImage.FromBundle("monkey").Blur(30)) { ContentMode = UIViewContentMode.ScaleAspectFill }, }; }