Esempio n. 1
0
        public PopupList(Font font, String[] names, int minWidth)
        {
            RectView back = new RectView(0, 0, 100, 100, Color.Gray, Color.Black);

            AddView(back);

            View contentView = new View(100, 100);

            int w = minWidth;

            items = new ListItem[names.Length];
            for (int i = 0; i < names.Length; ++i)
            {
                ListItem item = new ListItem(font, names[i], w, font.FontHeight());
                item.id             = i;
                item.buttonDelegate = OnItemSelected;
                contentView.AddView(item);
                items[i] = item;
            }

            contentView.LayoutVer(2);
            contentView.ResizeToFitViewsVer();

            AddView(contentView);

            back.width  = contentView.width;
            back.height = contentView.height;

            width  = contentView.width;
            height = contentView.height;
        }
Esempio n. 2
0
        private void AddBackground()
        {
            Color    color = Color.Black;
            RectView rect  = new RectView(0, 0, width, height, color, color);

            AddView(rect);
        }
        public BlockingScreen(View messageView, ButtonDelegate buttonDelegate = null)
        {
            AllowsDrawPrevious   = true;
            AllowsUpdatePrevious = true;

            m_delegate = buttonDelegate;

            View contentView = new RectView(0, 0, 366, 182, Color.Black, Color.White);

            contentView.x      = 0.5f * width;
            contentView.y      = 0.5f * height;
            contentView.alignX = contentView.alignY = View.ALIGN_CENTER;

            messageView.x      = 0.5f * contentView.width;
            messageView.y      = 0.5f * contentView.height;
            messageView.alignX = messageView.alignY = View.ALIGN_CENTER;
            contentView.AddView(messageView);

            Button cancelButton = new TempButton("Cancel");

            cancelButton.x              = 0.5f * contentView.width;
            cancelButton.y              = contentView.height - 12;
            cancelButton.alignX         = View.ALIGN_CENTER;
            cancelButton.alignY         = View.ALIGN_MAX;
            cancelButton.buttonDelegate = CancelButtonDelegate;
            SetCancelButton(cancelButton);

            contentView.AddView(cancelButton);

            AddView(contentView);
        }
        /// <summary>
        /// Prepares an UI, like button, dialog, etc.
        /// </summary>
        private void createUI()
        {
            mPictureButton = (Button)findViewById(R.id.picture);
            mPictureButton.OnClickListener = new OnClickListenerAnonymousInnerClassHelper(this);

            mTextureView = (AutoFitTextureView)findViewById(R.id.texture);
            mTextureView.SurfaceTextureListener = new SurfaceTextureListenerAnonymousInnerClassHelper(this);

            mPanoramaPreview  = (ImageView)findViewById(R.id.panorama_preview);
            mPanoramaRectView = (RectView)findViewById(R.id.panorama_rect);
        }
Esempio n. 5
0
        public ListItem(Font font, String text, int width, int height)
            : base(width, height)
        {
            this.text = text;

            backView         = new RectView(0, 0, width, height, Color.Black, Color.Black);
            backView.visible = false;
            AddView(backView);

            textView        = new TextView(font, text);
            textView.alignX = View.ALIGN_CENTER;
            textView.x      = 0.5f * width;
            AddView(textView);
        }
Esempio n. 6
0
        public DialogPopup(DialogPopupDelegate popupDelegate, String title, String message, PopupButton cancelButton, params PopupButton[] buttons)
        {
            this.popupDelegate = popupDelegate;

            AddView(new RectView(0, 0, width, height, new Color(0.0f, 0.0f, 0.0f, 0.25f), Color.Black));

            RectView frameView = new RectView(0, 0, 0.75f * width, 0, new Color(0.0f, 0.0f, 0.0f, 0.75f), Color.Black);

            View content = new View();

            content.width  = frameView.width - 2 * 50;
            content.alignX = content.alignY = View.ALIGN_CENTER;

            Font font = Helper.fontSystem;

            // title
            TextView titleView = new TextView(font, title);

            titleView.alignX = titleView.parentAlignX = View.ALIGN_CENTER;
            content.AddView(titleView);

            // message
            TextView messageView = new TextView(font, message, (int)content.width);

            messageView.alignX = messageView.parentAlignX = View.ALIGN_CENTER;
            content.AddView(messageView);

            // buttons
            Button button = new TempButton(cancelButton.title);

            button.id             = (int)cancelButton.id;
            button.buttonDelegate = OnButtonPress;
            button.alignX         = View.ALIGN_CENTER;
            button.parentAlignX   = View.ALIGN_CENTER;
            SetCancelButton(button);

            content.AddView(button);

            content.LayoutVer(10);
            content.ResizeToFitViewsVer();

            frameView.AddView(content);

            frameView.ResizeToFitViewsVer(20, 20);
            frameView.alignX = frameView.alignY = frameView.parentAlignX = frameView.parentAlignY = View.ALIGN_CENTER;
            AddView(frameView);

            content.x = 0.5f * frameView.width;
            content.y = 0.5f * frameView.height;
        }
        public PowerupView(TextureImage tex, int count)
            : base(tex.GetWidth(), tex.GetHeight())
        {
            ImageView view = new ImageView(tex);

            AddView(view);

            m_countTextView           = new TextView(Helper.fontSystem, "");
            m_countTextView.backColor = Color.Black;
            AddView(m_countTextView);

            m_dimmingView = new RectView(0, 0, width, height, new Color(0, 0, 0, 0.5f), Color.Black);
            AddView(m_dimmingView);

            SetCount(count);
        }
Esempio n. 8
0
        public FieldDataView(FieldData data, Style style)
            : base(style.width, style.height)
        {
            AddView(new RectView(0, 0, width, height, Color.Gray, Color.Black));

            float iw = style.iw;
            float ih = style.ih;

            RectView rect = new RectView(0.5f * (width - iw), 0.5f * (height - ih), iw, ih, Color.Green, Color.Green);

            AddView(rect);

            float cw = iw / data.GetWidth();
            float ch = ih / data.GetHeight();

            for (int y = 0; y < data.GetHeight(); ++y)
            {
                for (int x = 0; x < data.GetWidth(); ++x)
                {
                    FieldBlocks block = data.Get(x, y);
                    Color       color;

                    switch (block)
                    {
                    case FieldBlocks.Brick:
                        color = COLOR_BRICK;
                        break;

                    case FieldBlocks.Solid:
                        color = COLOR_SOLID;
                        break;

                    default:
                        continue;
                    }

                    float cx = x * cw;
                    float cy = y * ch;

                    rect.AddView(new RectView(cx, cy, cw, ch, color, color));
                }
            }
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            RequestWindowFeature(WindowFeatures.NoTitle);                                  //设置无标题
            Window.SetFlags(WindowManagerFlags.Fullscreen, WindowManagerFlags.Fullscreen); //设置全屏
            this.RequestedOrientation = Android.Content.PM.ScreenOrientation.Landscape;    //横屏

            base.OnCreate(savedInstanceState);

            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.activity_main);

            btn_line      = FindViewById <Button>(Resource.Id.btn_line);
            btn_rect      = FindViewById <Button>(Resource.Id.btn_rect);
            btn_img       = FindViewById <Button>(Resource.Id.btn_img);
            btn_reform    = FindViewById <Button>(Resource.Id.btn_reform);
            btn_modify    = FindViewById <Button>(Resource.Id.btn_modify);
            btn_cancel    = FindViewById <Button>(Resource.Id.btn_cancel);
            btn_rose      = FindViewById <Button>(Resource.Id.btn_rose);
            btn_statistic = FindViewById <Button>(Resource.Id.btn_statistic);

            rl        = FindViewById <RelativeLayout>(Resource.Id.relativeLayout1);
            imageView = FindViewById <ImageView>(Resource.Id.imageView1);

            rectView   = new RectView(this, null);
            planeView  = new StructPlaneView(this, null);
            picturView = new PicturView(this, null);
            roseView   = new RoseView(this, null);
            //statisticView = new StatisticView(this, null);



            CreateDirectoryForPictures();

            btn_rect.Click      += Btn_rect_Click;
            btn_img.Click       += Btn_img_Click;
            btn_reform.Click    += Btn_reform_Click;
            btn_modify.Click    += Btn_modify_Click;
            btn_line.Click      += Btn_line_Click;
            btn_cancel.Click    += Btn_cancel_Click;
            btn_rose.Click      += Btn_rose_Click;
            btn_statistic.Click += Btn_statistic_Click;
        }
Esempio n. 10
0
 private void SelfChanges(object sender, EventArgs e)
 {
     doubleAnimation.From = lastValue;
     doubleAnimation.To   = Value;
     RectView.BeginAnimation(WidthProperty, doubleAnimation);
 }
Esempio n. 11
0
        public override void Run(ElmSharp.Box parent)
        {
            var scrollView = new ScrollView(parent)
            {
                WeightX    = 1,
                WeightY    = 1,
                AlignmentY = -1,
                AlignmentX = -1,
                VerticalScrollBarVisibility = ScrollBarVisibility.Always,
            };

            scrollView.Show();

            var content = new ElmSharp.Box(parent)
            {
                WeightX    = 1,
                WeightY    = 1,
                AlignmentY = -1,
                AlignmentX = -1,
            };

            scrollView.SetScrollCanvas(content);
            parent.PackEnd(scrollView);

            var rectText1 = new ElmSharp.Label(parent)
            {
                WeightX = 1,
                WeightY = 1,
                Text    = "RectView with SolidBrush"
            };

            rectText1.Show();
            var rect1 = new RectView(parent)
            {
                WeightX         = 1,
                WeightY         = 1,
                AlignmentY      = -1,
                AlignmentX      = -1,
                Stroke          = new SolidColorBrush(Color.Maroon),
                StrokeThickness = 5,
                Fill            = new SolidColorBrush(Color.Lavender),
                Aspect          = Stretch.Uniform,
            };

            rect1.Show();

            content.PackEnd(rectText1);
            content.PackEnd(rect1);

            var rectText2 = new ElmSharp.Label(parent)
            {
                WeightX = 1,
                WeightY = 1,
                Text    = "RectView with GradientBrush"
            };

            rectText2.Show();
            var rect2 = new RectView(parent)
            {
                WeightX    = 1,
                WeightY    = 1,
                AlignmentY = -1,
                AlignmentX = -1,
                Stroke     = new LinearGradientBrush(new System.Collections.Generic.List <GradientStop>()
                {
                    new GradientStop(Color.Lavender, 0.2f),
                    new GradientStop(Color.LightSkyBlue, 0.4f),
                    new GradientStop(Color.LightCyan, 0.6f),
                    new GradientStop(Color.LightPink, 0.8f),
                    new GradientStop(Color.YellowGreen, 1.0f),
                }),
                Fill = new RadialGradientBrush(new System.Collections.Generic.List <GradientStop>()
                {
                    new GradientStop(Color.YellowGreen, 0.2f),
                    new GradientStop(Color.LightPink, 0.4f),
                    new GradientStop(Color.LightCyan, 0.6f),
                    new GradientStop(Color.LightSkyBlue, 0.8f),
                    new GradientStop(Color.Lavender, 1.0f),
                }),
                StrokeThickness = 15,
                Aspect          = Stretch.Fill,
            };

            rect2.Show();
            content.PackEnd(rectText2);
            content.PackEnd(rect2);

            var rectText3 = new ElmSharp.Label(parent)
            {
                WeightX = 1,
                WeightY = 1,
                Text    = "RectView Aspect Test"
            };

            rectText3.Show();
            var rect3 = new RectView(parent)
            {
                WeightX         = 1,
                WeightY         = 1,
                AlignmentY      = -1,
                AlignmentX      = -1,
                Stroke          = new SolidColorBrush(Color.PaleGoldenrod),
                StrokeThickness = 5,
                Fill            = new SolidColorBrush(Color.MediumPurple),
                Aspect          = Stretch.Fill,
                RadiusX         = 120,
                RadiusY         = 120
            };

            rect3.Show();

            content.PackEnd(rectText3);
            content.PackEnd(rect3);
        }