コード例 #1
0
        public MovableDrawView() : base("", false)
        {
            drawView = new DrawView();

            Remove(textview);
            Attach(drawView, 1, 1, 1, 2);
        }
コード例 #2
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            // Inflate the layout for this fragment
            var v = inflater.Inflate(Resource.Layout.fragment_exhibitpage_image, container, false);

            if (savedInstanceState?.GetString(INSTANCE_STATE_PAGE) != null)
            {
                var pageId = savedInstanceState.GetString(INSTANCE_STATE_PAGE);
                page = PageManager.GetImagePage(pageId);
            }

            drawView = (DrawView)v.FindViewById(Resource.Id.fragment_exhibitpage_image_imageview);
            drawView.SetImageDrawable(page.Image.GetDrawable(Context, drawView.Width, drawView.Height));
            if (page.Areas != null && page.Areas.Count > 0)
            {
                drawView.Rectangles.AddRange(page.Areas);
            }
            else
            {
                //There are no areas to highlight, don't show button
                var button = (Button)v.FindViewById(Resource.Id.fragment_exhibitpage_image_button);
                button.Visibility = ViewStates.Invisible;
            }
            drawView.OriginalImageDimensions = new [] { page.Image.Width, page.Image.Height };

            InitListeners(v);

            return(v);
        }
コード例 #3
0
        void ReleaseDesignerOutlets()
        {
            if (DrawView != null)
            {
                DrawView.Dispose();
                DrawView = null;
            }

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

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

            if (SliderToControlItems != null)
            {
                SliderToControlItems.Dispose();
                SliderToControlItems = null;
            }
        }
コード例 #4
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();
            DrawView.SliderPosition = SliderToControlItems.Value;
            DrawView.MaxSize        = SliderToControlItems.MaxValue;

            var tapGesture = new UITapGestureRecognizer(Tap);

            DrawView.AddGestureRecognizer(tapGesture);

            var panGesture = new UIPanGestureRecognizer(Pan);

            DrawView.AddGestureRecognizer(panGesture);

            SelectDrawFigure.ValueChanged += (sender, e) =>
            {
                DrawView.DrawableFigure = (int)SelectDrawFigure.SelectedSegment;
            };

            SliderToControlItems.ValueChanged += (sender, e) =>
            {
                DrawView.MaxSize        = SliderToControlItems.MaxValue;
                DrawView.SliderPosition = SliderToControlItems.Value;
            };
        }
コード例 #5
0
ファイル: View.cs プロジェクト: kpalosaa/cross2d
        protected override void OnDraw(Canvas canvas)
        {
            base.OnDraw(canvas);

            DrawView?.Invoke(this, new DrawViewEventArgs()
            {
                Canvas = canvas
            });
        }
コード例 #6
0
        public CasCalcView(Evaluator Eval)
        {
            this.eval = Eval;

            drawView = new DrawView();

            Attach(input, 1, 1, 1, 1);
            Attach(output, 1, 3, 1, 1);
            Attach(drawView, 1, 4, 1, 1);
            ShowAll();
        }
コード例 #7
0
 public override void TouchesMoved(NSSet touches, UIEvent evt)
 {
     base.TouchesMoved(touches, evt);
     foreach (UITouch touch in touches.Cast <UITouch>())
     {
         var point = touch.LocationInView(DrawView);
         DrawView.Lines[DrawView.Lines.Count - 1].strokeWidth = BrushSize.Value;
         DrawView.Lines[DrawView.Lines.Count - 1].color       = uIColors[selectedColor];
         DrawView.Lines[DrawView.Lines.Count - 1].point.Add(point);
     }
     DrawView.SetNeedsDisplay();
 }
コード例 #8
0
ファイル: Program.cs プロジェクト: prozum/cas.net
    public Calculator() : base("MainWindow")
    {
        DeleteEvent += (o, a) => Application.Quit();

        SetSizeRequest(500, 500);

        Grid = new Grid();
        Add(Grid);

        InputView = new TextView();
        Grid.Attach(InputView, 0, 0, 1, 1);

        EvalButton          = new Button("Evaluate");
        EvalButton.Clicked += (o, a) => EvaluateInput();
        EvalButton.Clicked += (o, a) => UpdateDefinitions();
        Grid.Attach(EvalButton, 0, 1, 1, 1);


        OutputView          = new TextView();
        OutputView.Expand   = true;
        OutputView.Editable = false;
        var sw = new ScrolledWindow();

        sw.Add(OutputView);
        Grid.Attach(sw, 0, 2, 1, 1);
        Buffer = OutputView.Buffer;

        DrawView = new DrawView();
        Grid.Attach(DrawView, 0, 3, 1, 1);

        WidgetView          = new WidgetView();
        WidgetView.Changed += (object sender, System.EventArgs e) => UpdateDefinitions();
        Grid.Attach(WidgetView, 0, 4, 1, 1);

        var infoTag = new TextTag("debug");

        infoTag.Foreground = "blue";
        var errorTag = new TextTag("error");

        errorTag.Foreground = "red";
        Buffer.TagTable.Add(infoTag);
        Buffer.TagTable.Add(errorTag);


        CreateDefTree();
        Grid.Attach(DefinitionTree, 1, 0, 1, 3);

        Eval = new Evaluator();
        UpdateDefinitions();

        ShowAll();
    }
コード例 #9
0
ファイル: GlobalManager.cs プロジェクト: lh36/asv-upper
        //绑定主视图和绘画视图,初始化Ship对象池,并绑定控制器
        public void Init(MainView main_view, DrawView draw_view)
        {
            Main_View = main_view;
            Draw_View = draw_view;

            ShipController ship1Controller = new ShipController(Constant.Byte_Ship_1);
            ShipController ship2Controller = new ShipController(Constant.Byte_Ship_2);
            ShipController ship3Controller = new ShipController(Constant.Byte_Ship_3);

            AddShip(new Ship(ship1Controller));
            AddShip(new Ship(ship2Controller));
            AddShip(new Ship(ship3Controller));
        }
コード例 #10
0
 public App()
 {
     drawView = new DrawView {
         VerticalOptions   = LayoutOptions.FillAndExpand,
         HorizontalOptions = LayoutOptions.FillAndExpand,
         BackgroundColor   = Color.White,
         DrawColor         = Color.Red
     };
     // The root page of your application
     MainPage = new ContentPage {
         Content = drawView
     };
 }
コード例 #11
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            _drawField = new DrawView(this);
            SetContentView(Resource.Layout.FieldView);
            var frame = FindViewById <FrameLayout>(Resource.Id.frFieldView);

            _drawField.LayoutParameters = new LinearLayout.LayoutParams(frame.LayoutParameters);
            frame.AddView(_drawField);
            _sheepView = new SheepView(this);
            frame.AddView(_sheepView);
            _webService = new WebService();
            CheckStep();
        }
コード例 #12
0
        public override void Draw(CGRect rect)
        {
            base.Draw(rect);

            var width  = Bounds.Size.Width;
            var height = Bounds.Size.Height;

            using (var context = UIGraphics.GetCurrentContext())
            {
                DrawView?.Invoke(this, new DrawViewEventArgs()
                {
                    Context = context, Rect = rect
                });
            }
        }
コード例 #13
0
        public override void TouchesBegan(NSSet touches, UIEvent evt)
        {
            base.TouchesBegan(touches, evt);
            foreach (UITouch touch in touches.Cast <UITouch>())
            {
                var point   = touch.LocationInView(DrawView);
                var newline = new FingerPaint.Line();

                newline.point.Add(point);
                newline.strokeWidth = BrushSize.Value;
                newline.color       = uIColors[selectedColor];

                DrawView.Lines.Add(newline);
            }
            DrawView.SetNeedsDisplay();
        }
コード例 #14
0
 protected override void OnElementChanged(ElementChangedEventArgs <Page> e)
 {
     base.OnElementChanged(e);
     page = Element as DrawView;
     if (page != null)
     {
         var    imageCopy = page.Image;
         Bitmap bitmap    = BitmapFactory.DecodeByteArray(App.CroppedImage, 0, App.CroppedImage.Length);
         canvas = new Canvas(bitmap);
         AnalyzePredictions(page.rootObject);
         this.canvas.Save();
         App.CroppedImage = this.canvas.ToArray <byte>();
         page.DidDraw     = true;
         page.Navigation.PopModalAsync();
     }
 }
コード例 #15
0
        void New_Click(object sender, RoutedEventArgs e)
        {
            OptionButton opt = sender as OptionButton;

            switch (opt.Tag)
            {
            case "Note":
                TextEditorView text = new TextEditorView(VM.VMTab);
                break;

            case "Draw":
                DrawView draw = new DrawView(VM.VMTab);
                break;
            }

            this.Hide();
        }
コード例 #16
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            uIColors.Add(UIColor.Black);
            uIColors.Add(UIColor.DarkGray);
            uIColors.Add(UIColor.LightGray);
            uIColors.Add(UIColor.White);
            uIColors.Add(UIColor.Blue);
            uIColors.Add(UIColor.Red);
            uIColors.Add(UIColor.Yellow);
            uIColors.Add(UIColor.Magenta);
            uIColors.Add(UIColor.Green);
            uIColors.Add(UIColor.Cyan);

            BrushColor.ThumbTintColor = uIColors[selectedColor];

            undoBT.TouchUpInside += (sender, e) =>
            {
                DrawView.Undoline();
            };
            ClearBT.TouchUpInside += (sender, e) =>
            {
                DrawView.Clear();
            };

            BrushColor.ValueChanged += (sender, e) =>
            {
                if (BrushColor.Value > 0)
                {
                    selectedColor             = (int)Math.Ceiling(BrushColor.Value / BrushColor.MaxValue * uIColors.Count - 1);
                    BrushColor.ThumbTintColor = uIColors[selectedColor];
                }
            };
            BrushSize.TouchUpInside += (sender, e) =>
            {
                infoBrushSize.Hidden = true;
            };
            BrushSize.ValueChanged += (sender, e) =>
            {
                infoBrushSize.Text   = ((int)BrushSize.Value).ToString();
                infoBrushSize.Hidden = false;
            };
        }
コード例 #17
0
        void ReleaseDesignerOutlets()
        {
            if (ContentView != null)
            {
                ContentView.Dispose();
                ContentView = null;
            }

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

            if (ImageView != null)
            {
                ImageView.Dispose();
                ImageView = null;
            }
        }
コード例 #18
0
ファイル: View.cs プロジェクト: shusso/Strategy-Game
        public View()
        {
            // Delegate for updating the view (Game is running on different thread)
            _drawView = new DrawView(this.drawView);

            _pen = new Pen(_brush, 2);

            _renderer = new RenderSystem(this);

            InitializeComponent();

            this.SetStyle(
               ControlStyles.UserPaint |
               ControlStyles.AllPaintingInWmPaint |
               ControlStyles.OptimizedDoubleBuffer, true);

            // Start game thread
            _game = new Game(this);
            ThreadStart start = new ThreadStart(_game.Start);
            _thread = new Thread(start);
            _thread.Start();
        }
コード例 #19
0
        void ReleaseDesignerOutlets()
        {
            if (BrushColor != null)
            {
                BrushColor.Dispose();
                BrushColor = null;
            }

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

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

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

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

            if (undoBT != null)
            {
                undoBT.Dispose();
                undoBT = null;
            }
        }
コード例 #20
0
ファイル: App.cs プロジェクト: Roel1l/Full-Adder
 public App()
 {
     _reader = new FileReader();
     _view   = new DrawView();
 }
コード例 #21
0
        private void Reset()
        {
            TurningButtonPressed(true);

            foreach (var view in View.Subviews)
            {
                view.RemoveFromSuperview();
            }

            _gridView = new GridView
            {
                Frame           = new CGRect(0, 0, View.Frame.Width, View.Frame.Height),
                BackgroundColor = UIColor.White
            };
            View.AddSubview(_gridView);

            _drawView = new DrawView
            {
                Frame           = new CGRect(0, 0, View.Frame.Width, View.Frame.Height),
                BackgroundColor = UIColor.FromWhiteAlpha(0.0f, 0.0f)
            };
            View.AddSubview(_drawView);

            _commentView = new UILabel(new CGRect(50, 50, 200, 150))
            {
                TextColor = UIColor.FromRGB(139, 0, 0)
            };
            View.AddSubview(_commentView);

            DrawPilots();
            DrawRevKites();

            _viewModel.Team.Pilots.Clear();
            _viewModel.AddPilot(new Pilot
            {
                Name        = "Vienna",
                PlaceInLine = 1,
                Position    = new Position
                {
                    X = (float)_pilotVienna.Frame.X,
                    Y = (float)_pilotVienna.Frame.Y
                },
                Kite = new Kite
                {
                    Rotation = GetRotationValueOfView(_kiteVienna),
                    Position = new Position
                    {
                        X = (float)_kiteVienna.Frame.X,
                        Y = (float)_kiteVienna.Frame.Y
                    }
                }
            });

            _viewModel.AddPilot(new Pilot
            {
                Name        = "Tim",
                PlaceInLine = 2,
                Position    = new Position
                {
                    X = (float)_pilotTim.Frame.X,
                    Y = (float)_pilotTim.Frame.Y
                },
                Kite = new Kite
                {
                    Rotation = GetRotationValueOfView(_kiteTim),
                    Position = new Position
                    {
                        X = (float)_kiteTim.Frame.X,
                        Y = (float)_kiteTim.Frame.Y
                    }
                }
            });

            _viewModel.AddPilot(new Pilot
            {
                Name        = "Mario",
                PlaceInLine = 3,
                Position    = new Position
                {
                    X = (float)_pilotMario.Frame.X,
                    Y = (float)_pilotMario.Frame.Y
                },
                Kite = new Kite
                {
                    Rotation = GetRotationValueOfView(_kiteMario),
                    Position = new Position
                    {
                        X = (float)_kiteMario.Frame.X,
                        Y = (float)_kiteMario.Frame.Y
                    }
                }
            });

            _viewModel.AddPilot(new Pilot
            {
                Name        = "Twan",
                PlaceInLine = 4,
                Position    = new Position
                {
                    X = (float)_pilotTwan.Frame.X,
                    Y = (float)_pilotTwan.Frame.Y
                },
                Kite = new Kite
                {
                    Rotation = GetRotationValueOfView(_kiteTwan),
                    Position = new Position
                    {
                        X = (float)_kiteTwan.Frame.X,
                        Y = (float)_kiteTwan.Frame.Y
                    }
                }
            });

            _viewModel.AddPilot(new Pilot
            {
                Name        = "Judith",
                PlaceInLine = 5,
                Position    = new Position
                {
                    X = (float)_pilotJudith.Frame.X,
                    Y = (float)_pilotJudith.Frame.Y
                },
                Kite = new Kite
                {
                    Rotation = GetRotationValueOfView(_kiteJudith),
                    Position = new Position
                    {
                        X = (float)_kiteJudith.Frame.X,
                        Y = (float)_kiteJudith.Frame.Y
                    }
                }
            });

            _viewModel.AddPilot(new Pilot
            {
                Name        = "Sanne",
                PlaceInLine = 6,
                Position    = new Position
                {
                    X = (float)_pilotSanne.Frame.X,
                    Y = (float)_pilotSanne.Frame.Y
                },
                Kite = new Kite
                {
                    Rotation = GetRotationValueOfView(_kiteSanne),
                    Position = new Position
                    {
                        X = (float)_kiteSanne.Frame.X,
                        Y = (float)_kiteSanne.Frame.Y
                    }
                }
            });

            _drawView.UpdateTeam(_viewModel.Team);
            _drawView.SetNeedsDisplay();
        }
コード例 #22
0
 public void Draw(DrawView drawView)
 {
     drawView.DrawActorInventory();
 }
コード例 #23
0
        void ReleaseDesignerOutlets()
        {
            if (CleanAllButton != null)
            {
                CleanAllButton.Dispose();
                CleanAllButton = null;
            }

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

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

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

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

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

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

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

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

            if (YellowButton != null)
            {
                YellowButton.Dispose();
                YellowButton = null;
            }
        }
コード例 #24
0
 public void Draw(DrawView drawView)
 {
     drawView.DrawMap();
 }
コード例 #25
0
ファイル: MainActivity.cs プロジェクト: acmaarts/Rev-Trainer
        private void Reset()
        {
            TurningButtonPressed(true);

            _root.RemoveAllViews();

            _gridView = new GridView(this);
            _root.AddView(_gridView);

            _drawView = new DrawView(this);
            _root.AddView(_drawView);

            _commentView = new TextView(this);
            _commentView.SetTextColor(Color.DarkRed);
            var layoutParams = new RelativeLayout.LayoutParams(400, 250)
            {
                LeftMargin = 100,
                TopMargin  = 100
            };

            _commentView.LayoutParameters = layoutParams;
            _root.AddView(_commentView);

            DrawPilots();
            DrawRevKites();

            _root.Post(() =>
            {
                _viewModel.Team.Pilots.Clear();
                _viewModel.AddPilot(new Pilot
                {
                    Name        = "Vienna",
                    PlaceInLine = 1,
                    Position    = new Position
                    {
                        X = _pilotVienna.GetX(),
                        Y = _pilotVienna.GetY()
                    },
                    Kite = new Kite
                    {
                        Rotation = _kiteVienna.Rotation,
                        Position = new Position
                        {
                            X = _kiteVienna.GetX(),
                            Y = _kiteVienna.GetY()
                        }
                    }
                });

                _viewModel.AddPilot(new Pilot
                {
                    Name        = "Tim",
                    PlaceInLine = 2,
                    Position    = new Position
                    {
                        X = _pilotTim.GetX(),
                        Y = _pilotTim.GetY()
                    },
                    Kite = new Kite
                    {
                        Rotation = _kiteTim.Rotation,
                        Position = new Position
                        {
                            X = _kiteTim.GetX(),
                            Y = _kiteTim.GetY()
                        }
                    }
                });

                _viewModel.AddPilot(new Pilot
                {
                    Name        = "Mario",
                    PlaceInLine = 3,
                    Position    = new Position
                    {
                        X = _pilotMario.GetX(),
                        Y = _pilotMario.GetY()
                    },
                    Kite = new Kite
                    {
                        Rotation = _kiteMario.Rotation,
                        Position = new Position
                        {
                            X = _kiteMario.GetX(),
                            Y = _kiteMario.GetY()
                        }
                    }
                });

                _viewModel.AddPilot(new Pilot
                {
                    Name        = "Twan",
                    PlaceInLine = 4,
                    Position    = new Position
                    {
                        X = _pilotTwan.GetX(),
                        Y = _pilotTwan.GetY()
                    },
                    Kite = new Kite
                    {
                        Rotation = _kiteTwan.Rotation,
                        Position = new Position
                        {
                            X = _kiteTwan.GetX(),
                            Y = _kiteTwan.GetY()
                        }
                    }
                });

                _viewModel.AddPilot(new Pilot
                {
                    Name        = "Judith",
                    PlaceInLine = 5,
                    Position    = new Position
                    {
                        X = _pilotJudith.GetX(),
                        Y = _pilotJudith.GetY()
                    },
                    Kite = new Kite
                    {
                        Rotation = _kiteJudith.Rotation,
                        Position = new Position
                        {
                            X = _kiteJudith.GetX(),
                            Y = _kiteJudith.GetY()
                        }
                    }
                });

                _viewModel.AddPilot(new Pilot
                {
                    Name        = "Sanne",
                    PlaceInLine = 6,
                    Position    = new Position
                    {
                        X = _pilotSanne.GetX(),
                        Y = _pilotSanne.GetY()
                    },
                    Kite = new Kite
                    {
                        Rotation = _kiteSanne.Rotation,
                        Position = new Position
                        {
                            X = _kiteSanne.GetX(),
                            Y = _kiteSanne.GetY()
                        }
                    }
                });

                _drawView.UpdateTeam(_viewModel.Team);
                _drawView.Invalidate();
            });
        }
コード例 #26
0
ファイル: StateSequencer.cs プロジェクト: kitatas/Kakomi
        public StateSequencer(IGameStateUseCase gameStateUseCase, ReadyView readyView, DrawView drawView,
                              AttackView attackView, DamageView damageView, ClearView clearView, FailView failView)
        {
            _states = new List <BaseState>
            {
                readyView,
                drawView,
                attackView,
                damageView,
                clearView,
                failView,
            };

            _disposable  = new CompositeDisposable();
            _tokenSource = new CancellationTokenSource();

            foreach (var state in _states)
            {
                state.InitAsync(_tokenSource.Token).Forget();
            }

            _gameStateUseCase = gameStateUseCase;
            _gameStateUseCase.GameState()
            .Subscribe(gameState =>
            {
                Reset(gameState);
                TickAsync(gameState, _tokenSource.Token).Forget();
            })
            .AddTo(_disposable);
        }