Example #1
0
 public Annotation(User user, string comment, Press press)
 {
     this.User = user;
     this.Comment = comment;
     this.Press = press;
 }
        public void ButtonPress(User u)
        {
            try
            {
                if (gameStarted && roundInProgress)
                {
                    Color c = GetColorFromUser(u);
                    u.Color = c;

                    TimeSpan end = DateTime.UtcNow - startTime;
                    TimeSpan start = end - Properties.Settings.Default.PressClipLength;
                    if (start < TimeSpan.Zero)
                    {
                        start = TimeSpan.Zero;
                    }

                    if (end < TimeSpan.Zero)
                    {
                        end = TimeSpan.Zero;
                    }

                    Press p = new Press(start, end, u);
                    presses.Add(p);
                }
            }
            catch (Exception e)
            {
                throw new FaultException(new FaultReason(e.Message + "\r\n" + e.StackTrace));
            }
        }
        private bool GetPressScatterViewItemPosition(Press p, out Point point)
        {
            foreach (ScatterViewItem i in Scatter.Items)
            {
                object content = i.Content;
                if (content.GetType() == typeof(PressPlayer))
                {
                    PressPlayer pp = (PressPlayer)content;
                    if (pp.Press.Id == p.Id)
                    {
                        point = i.Center;
                        return true;
                    }
                }
            }

            point = new Point();
            return false;
        }
 public AnnotationMadeEventArgs(Press press, string comment, User user)
 {
     this.Press = press;
     this.Comment = comment;
     this.User = user;
 }