public MovableDrawView() : base("", false) { drawView = new DrawView(); Remove(textview); Attach(drawView, 1, 1, 1, 2); }
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); }
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; } }
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; }; }
protected override void OnDraw(Canvas canvas) { base.OnDraw(canvas); DrawView?.Invoke(this, new DrawViewEventArgs() { Canvas = canvas }); }
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(); }
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(); }
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(); }
//绑定主视图和绘画视图,初始化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)); }
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 }; }
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(); }
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 }); } }
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(); }
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(); } }
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(); }
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; }; }
void ReleaseDesignerOutlets() { if (ContentView != null) { ContentView.Dispose(); ContentView = null; } if (DrawView != null) { DrawView.Dispose(); DrawView = null; } if (ImageView != null) { ImageView.Dispose(); ImageView = null; } }
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(); }
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; } }
public App() { _reader = new FileReader(); _view = new DrawView(); }
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(); }
public void Draw(DrawView drawView) { drawView.DrawActorInventory(); }
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; } }
public void Draw(DrawView drawView) { drawView.DrawMap(); }
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(); }); }
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); }