Beispiel #1
0
 public CategoryObject(AnalysisEventButton category)
     : base(category)
 {
     Button = category;
     rects = new Dictionary <Rectangle, object> ();
     buttonsRects = new Dictionary <Rectangle, object> ();
     SelectedTags = new List<Tag> ();
     cancelRect = new Rectangle (new Point (0, 0), 0, 0);
     editRect = new Rectangle (new Point (0, 0), 0, 0);
     applyRect = new Rectangle (new Point (0, 0), 0, 0);
     if (iconImage == null) {
         iconImage = new Image (Path.Combine (Config.ImagesDir,
             StyleConf.ButtonEventIcon));
     }
     if (recImage == null) {
         recImage = new Image (Path.Combine (Config.IconsDir,
             StyleConf.RecordButton));
     }
     if (editImage == null) {
         editImage = new Image (Path.Combine (Config.IconsDir,
             StyleConf.EditButton));
     }
     if (cancelImage == null) {
         cancelImage = new Image (Path.Combine (Config.IconsDir,
             StyleConf.CancelButton));
     }
     if (applyImage == null) {
         applyImage = new Image (Path.Combine (Config.IconsDir,
             StyleConf.ApplyButton));
     }
     MinWidth = 100;
     MinHeight = HeaderHeight * 2;
     subcatAnchors = new Dictionary<Tag, LinkAnchorObject> ();
     foreach (Tag tag in category.AnalysisEventType.Tags) {
         AddSubcatAnchor (tag, new Point (0, 0), 100, HeaderHeight);
     }
 }
        public void DashboardKeyListener(KeyPressedEvent e)
        {
            KeyAction action;
            DashboardButton button;

            if (openedProject == null) {
                return;
            }

            try {
                action = App.Current.Config.Hotkeys.ActionsHotkeys.GetKeyByValue (e.Key);
            } catch {
                return;
            }

            if (action == KeyAction.LocalPlayer || action == KeyAction.VisitorPlayer) {
                if (inPlayerTagging) {
                    TagPlayer ();
                }
                if (pendingButton != null) {
                    analysisWindow.ClickButton (pendingButton);
                }
                inPlayerTagging = true;
                taggedTeam = action == KeyAction.LocalPlayer ? TeamType.LOCAL : TeamType.VISITOR;
                playerNumber = "";
                analysisWindow.TagTeam (taggedTeam);
                timer.Change (TIMEOUT_MS, 0);
            } else if (action == KeyAction.None) {
                if (pendingButton != null) {
                    Tag tag = pendingButton.AnalysisEventType.Tags.FirstOrDefault (t => t.HotKey == e.Key);
                    if (tag != null) {
                        analysisWindow.ClickButton (pendingButton, tag);
                        timer.Change (TIMEOUT_MS, 0);
                    }
                } else if (dashboardHotkeys.TryGetValue (e.Key, out button)) {
                    if (inPlayerTagging) {
                        TagPlayer ();
                    }
                    if (button is AnalysisEventButton) {
                        AnalysisEventButton evButton = button as AnalysisEventButton;
                        /* Finish tagging for the pending button */
                        if (pendingButton != null) {
                            analysisWindow.ClickButton (pendingButton);
                        }
                        if (evButton.AnalysisEventType.Tags.Count == 0) {
                            analysisWindow.ClickButton (button);
                        } else {
                            pendingButton = evButton;
                            timer.Change (TIMEOUT_MS, 0);
                        }
                    } else {
                        analysisWindow.ClickButton (button);
                    }
                } else if (inPlayerTagging) {
                    int number;
                    string name = App.Current.Keyboard.NameFromKeyval ((uint)e.Key.Key);
                    if (name.StartsWith ("KP_")) {
                        name = name.Replace ("KP_", "");
                    }
                    if (int.TryParse (name, out number)) {
                        playerNumber += number.ToString ();
                        timer.Change (TIMEOUT_MS, 0);
                    }
                    return;
                }
            }
        }
 void HandleTimeout(object state)
 {
     App.Current.DrawingToolkit.Invoke (delegate {
         if (pendingButton != null) {
             analysisWindow.ClickButton (pendingButton);
             pendingButton = null;
         } else if (inPlayerTagging) {
             TagPlayer ();
         }
     });
 }
 public void TestSerialization()
 {
     DashboardButton db = new DashboardButton ();
     Utils.CheckSerialization (db);
     db = new TimedDashboardButton ();
     Utils.CheckSerialization (db);
     db = new TagButton ();
     Utils.CheckSerialization (db);
     db = new TimerButton ();
     Utils.CheckSerialization (db);
     db = new EventButton ();
     Utils.CheckSerialization (db);
     db = new AnalysisEventButton ();
     Utils.CheckSerialization (db);
     db = new PenaltyCardButton ();
     Utils.CheckSerialization (db);
     db = new PenaltyCardButton ();
     Utils.CheckSerialization (db);
     db = new ScoreButton ();
     Utils.CheckSerialization (db);
 }
 public void TestAnalysisEventButton()
 {
     AnalysisEventButton ab = new AnalysisEventButton ();
     ab.EventType = new AnalysisEventType ();
     Assert.AreEqual (ab.EventType, ab.AnalysisEventType);
 }
Beispiel #6
0
 void CategoryClicked(AnalysisEventButton category)
 {
     if (Button.TagMode == TagMode.Predefined) {
         emitEvent = true;
         Active = true;
     } else if (Button.TagMode == TagMode.Free) {
         if (!Recording) {
             StartRecording ();
         } else {
             emitEvent = true;
         }
     }
 }