Beispiel #1
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            //TheImage has a width constraint (.5*screen) and 2 center constraints (centerx and top=118)

            //Test AlignmentMode.
            //When fillMode is set to Fit and alignmentMode is set to something other than TopLeft (which is the default) and both fillWidthPixel/fillHeightPixel are non zero,
            //an image of fillWidthPixel x fillHeightPixel is created
            //and the svg is drawn inside, fitted either vertically or horizontally, and aligned (only centered currently) on the other dimension.
            //
            //This mimics the "gravity" attribute on Android
            //TheImage.Image = SvgFactory.FromBundle("res:images.logo_auchan", 200, 200, fillMode: SvgFillMode.Fit, alignmentMode: SvgAlignmentMode.Center);

            TheImage.BackgroundColor = UIColor.Green;
            TheImage.ContentMode     = UIViewContentMode.ScaleAspectFit;

            //Test CGImage to UIImage cut
            var bounds = SvgFactory.GetBounds("res:images.cosmo", 0, TheImage.Bounds.Width, SvgFillMode.Fill);
            var image  = SvgFactory.FromBundle("res:images.cosmo", 0, TheImage.Bounds.Width);

            TheImage.Image = image;

            //Test CGImage with button
            TheButton.Style     = UIButton2.ButtonStyle.Action;
            TheButton.LeftImage = "res:images.cosmo";
            //TheButton.IsImageOnly = true;
            TheButton.Text = "The button";
            TheButton.UpdateStyle();
        }
Beispiel #2
0
        public RotateLeftButton()
        {
            InitializeComponent();

            Loaded += delegate
            {
                TheButton.PreviewMouseLeftButtonDown += delegate
                {
                    PreviewMouseButtonDownAnim(RotateButtonBrush);
                };
                TheButton.MouseEnter += delegate
                {
                    ButtonMouseOverAnim(RotateButtonBrush, true);
                };
                TheButton.MouseLeave += delegate
                {
                    ButtonMouseLeaveAnimBgColor(RotateButtonBrush, false);
                };
                TheButton.Click += async delegate
                {
                    UILogic.TransformImage.Rotation.Rotate(false);
                    // Move cursor after rotating
                    await Task.Delay(15).ConfigureAwait(true); // Delay it, so that the move takes place after window has resized

                    var p = TheButton.PointToScreen(new System.Windows.Point(25, 25));
                    SystemIntegration.NativeMethods.SetCursorPos((int)p.X, (int)p.Y);
                };

                if (!Properties.Settings.Default.DarkTheme)
                {
                    AnimationHelper.LightThemeMouseEvent(this, IconBrush);
                }
            };
        }
Beispiel #3
0
        protected override void OnValidated(EventArgs e)
        {
            if (null != TheButton)
            {
                TheButton.Enabled = this.IsValidItemSelected;
                TheButton.Focus();
            }

            base.OnValidated(e);
        }
Beispiel #4
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();
            // Perform any additional setup after loading the view, typically from a nib.
            var clickCount = 0;

            TheButton.TouchUpInside += (sender, args) =>
            {
                TheButton.SetTitle($"Button Clicked {++clickCount} times.", UIControlState.Normal);
            };
        }
Beispiel #5
0
 void Start()
 {
     if (!cam)
     {
         cam = Camera.main;
     }
     if (!button)
     {
         button = FindObjectOfType <TheButton>();
     }
 }
Beispiel #6
0
 void ReleaseDesignerOutlets()
 {
     if (TheButton != null)
     {
         TheButton.Dispose();
         TheButton = null;
     }
     if (TheImageView != null)
     {
         TheImageView.Dispose();
         TheImageView = null;
     }
 }
Beispiel #7
0
        void ReleaseDesignerOutlets()
        {
            if (TheButton != null)
            {
                TheButton.Dispose();
                TheButton = null;
            }

            if (TheTable != null)
            {
                TheTable.Dispose();
                TheTable = null;
            }

            if (TheLog != null)
            {
                TheLog.Dispose();
                TheLog = null;
            }
        }
Beispiel #8
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            HNKCacheFormat format = (HNKCacheFormat)HNKCache.SharedCache().Formats["thumbnail"];

            if (format == null)
            {
                format = new HNKCacheFormat("thumbnail")
                {
                    Size               = new SizeF(320, 240),
                    ScaleMode          = HNKScaleMode.AspectFill,
                    CompressionQuality = 0.5f,
                    DiskCapacity       = 1 * 1024 * 1024,
                    PreloadPolicy      = HNKPreloadPolicy.LastSession
                };
            }


            TheImageView.SetCacheFormat(format);
            TheButton.SetBackgroundImage(new NSUrl("https://raw.githubusercontent.com/Haneke/Haneke/master/Assets/github-header.png"), UIControlState.Normal);
            TheImageView.SetImage(new NSUrl("https://raw.githubusercontent.com/Haneke/Haneke/master/Assets/github-header.png"));
        }