Пример #1
0
        public CodingWidget()
        {
            this.Build();

            LoadIcons();

            notebook.ShowBorder         = false;
            notebook.Group              = this.Handle;
            notebook.SwitchPage        += HandleSwitchPage;
            Notebook.WindowCreationHook = CreateNewWindow;
            activeWindows = new List <Window> ();

            notebook.Page = 0;

            teamtagger = new LMTeamTaggerView(new WidgetWrapper(teamsdrawingarea));

            teamsdrawingarea.HeightRequest     = 200;
            teamsdrawingarea.WidthRequest      = 300;
            timeline.HeightRequest             = 200;
            playspositionviewer1.HeightRequest = 200;

            App.Current.EventsBroker.Subscribe <CapturerTickEvent> (HandleCapturerTick);
            App.Current.EventsBroker.Subscribe <TimeNodeStoppedEvent> (HandleTimeNodeStoppedEvent);

            Helpers.Misc.SetFocus(this, false);

            buttonswidget.CodingDashboardMode = true;

            dashboardhpaned.SizeAllocated += HandleSizeAllocated;
            TagPositions = true;
        }
Пример #2
0
        public override void EditPlayer(Text text)
        {
            playerText = text;
            if (playerDialog == null)
            {
                Gtk.Dialog d = new Gtk.Dialog(Catalog.GetString("Select player"),
                                              this, DialogFlags.Modal | DialogFlags.DestroyWithParent,
                                              Stock.Cancel, ResponseType.Cancel);
                d.WidthRequest  = 600;
                d.HeightRequest = 400;

                DrawingArea      da     = new DrawingArea();
                LMTeamTaggerView tagger = new LMTeamTaggerView(new WidgetWrapper(da));
                tagger.ViewModel           = ViewModel.TeamTagger;
                ViewModel.PropertyChanged += (sender, e) => {
                    if (e.PropertyName == "Tagged")
                    {
                        var    playerVM = (LMPlayerVM)sender;
                        Player p        = playerVM.Model;
                        playerVM.Tagged  = false;
                        playerText.Value = p.ToString();
                        d.Respond(ResponseType.Ok);
                    }
                };
                d.VBox.PackStart(da, true, true, 0);
                d.ShowAll();
                playerDialog = d;
            }
            if (playerDialog.Run() != (int)ResponseType.Ok)
            {
                text.Value = null;
            }
            playerDialog.Hide();
        }
Пример #3
0
        void LoadTeams(LMProject project)
        {
            List <Team> teams;
            bool        hasLocalTeam = false;
            bool        hasAwayTeam  = false;

            drawingarea.HeightRequest = 200;
            teamtagger = new LMTeamTaggerView(new WidgetWrapper(drawingarea));
            teamtagger.ShowMenuEvent += HandleShowMenuEvent;
            teams = App.Current.TeamTemplatesProvider.Templates;

            // Fill the combobox with project values or the templates ones
            if (project != null)
            {
                if (project.LocalTeamTemplate != null)
                {
                    hasLocalTeam = true;
                }
                if (project.VisitorTeamTemplate != null)
                {
                    hasAwayTeam = true;
                }
            }

            // Update the combobox
            if (hasAwayTeam)
            {
                awayteamscombobox.Load(new List <LMTeam> {
                    project.VisitorTeamTemplate
                });
            }
            else
            {
                awayteamscombobox.Load(teams.OfType <LMTeam> ().ToList());
                awayteamscombobox.Changed += (sender, e) => {
                    LoadTemplate(awayteamscombobox.ActiveTeam.Clone(), TeamType.VISITOR, false);
                };
            }

            if (hasLocalTeam)
            {
                hometeamscombobox.Load(new List <LMTeam> {
                    project.LocalTeamTemplate
                });
            }
            else
            {
                hometeamscombobox.Load(teams.OfType <LMTeam> ().ToList());
                hometeamscombobox.Changed += (sender, e) => {
                    LoadTemplate(hometeamscombobox.ActiveTeam.Clone(), TeamType.LOCAL, false);
                };
            }

            hometeamscombobox.Active = 0;
            awayteamscombobox.Active = teams.Count == 1 ? 0 : 1;
        }
Пример #4
0
        public TeamTemplateEditor()
        {
            this.Build();

            applyimage.Image = App.Current.ResourcesLocator.LoadIcon("vas-apply", StyleConf.ButtonDialogIconSize);

            teamtagger = new LMTeamTaggerView(new WidgetWrapper(drawingarea));
            shieldvbox.WidthRequest = SHIELD_SIZE;
            shieldimage.SetSize(SHIELD_SIZE);
            playerimage.SetSize(PLAYER_SIZE);
            colorbutton1.Color     = Misc.ToGdkColor(Color.Red1);
            colorbutton1.ColorSet += HandleColorSet;
            colorbutton2.Color     = Misc.ToGdkColor(Color.Green1);
            colorbutton2.ColorSet += HandleColorSet;

            ConnectSignals();

            ClearPlayer();
        }
Пример #5
0
        public PlayEditor()
        {
            this.Build();
            field = new TimelineEventLocationTaggerView(new WidgetWrapper(fieldDrawingarea))
            {
                FieldPosition = FieldPositionType.Field
            };
            hfield = new TimelineEventLocationTaggerView(new WidgetWrapper(hfieldDrawingarea))
            {
                FieldPosition = FieldPositionType.HalfField
            };
            goal = new TimelineEventLocationTaggerView(new WidgetWrapper(goalDrawingarea))
            {
                FieldPosition = FieldPositionType.Goal
            };

            teamtagger         = new LMTeamTaggerView(new WidgetWrapper(drawingarea3));
            nameentry.Changed += HandleChanged;
        }
 public SubstitutionsEditor()
 {
     this.Build();
     tagger              = new LMTeamTaggerView(new WidgetWrapper(drawingarea));
     incanvas            = new SelectionCanvas(new WidgetWrapper(drawingarea2));
     outcanvas           = new SelectionCanvas(new WidgetWrapper(drawingarea3));
     inpo                = new LMPlayerView();
     outpo               = new LMPlayerView();
     inpo.ClickedEvent  += HandleClickedEvent;
     outpo.ClickedEvent += HandleClickedEvent;
     inpo.Size           = PLAYER_SIZE;
     outpo.Size          = PLAYER_SIZE;
     inpo.Center         = new Point(PLAYER_SIZE / 2, PLAYER_SIZE / 2);
     outpo.Center        = new Point(PLAYER_SIZE / 2, PLAYER_SIZE / 2);
     incanvas.AddObject(inpo);
     outcanvas.AddObject(outpo);
     drawingarea2.WidthRequest = drawingarea2.HeightRequest = PLAYER_SIZE;
     drawingarea3.WidthRequest = drawingarea3.HeightRequest = PLAYER_SIZE;
 }
        bool ValidateTaggerView(LMTeamTaggerView view)
        {
            LMTeamTaggerVM vm = view.ViewModel;

            if (vm.AwayTeam != null)
            {
                return(false);
            }
            if (vm.Background.Width != App.Current.HHalfFieldBackground.Width)
            {
                return(false);
            }
            if (vm.Background.Height != App.Current.HHalfFieldBackground.Height)
            {
                return(false);
            }

            return(true);
        }
Пример #8
0
        /// <summary>
        /// Generates the team preview.
        /// </summary>
        /// <returns>The team preview.</returns>
        /// <param name="team">Team.</param>
        protected override Image CreatePreview(Team team)
        {
            // load viewmodel and create the view to extract the image
            LMTeamTaggerVM taggerVM = new LMTeamTaggerVM {
                HomeTeam = new LMTeamVM {
                    Model = team as LMTeam
                }
            };

            taggerVM.AwayTeam   = null;
            taggerVM.Background = App.Current.HHalfFieldBackground;

            LMTeamTaggerView taggerView = new LMTeamTaggerView {
                BackgroundColor = App.Current.Style.ColorBackgroundPreview
            };
            double width  = App.Current.HHalfFieldBackground.Width + Sizes.BenchSize;
            double height = App.Current.HHalfFieldBackground.Height;

            CreateInternalPreview(taggerView, taggerVM, width, height);

            return(App.Current.DrawingToolkit.Copy(taggerView, new Area(new Point(0, 0), width, height)));
        }