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(); }
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(); }); }