Example #1
0
        public RectangleF GetBoundingBox()
        {
            List<PointF> allPoints = new List<PointF> ();
            foreach (DrawingInfo eachDrawingInfo in this.DrawingItems.Values) {

                if (eachDrawingInfo.DrawingType == DrawingLayerType.Drawing) {

                    allPoints.AddRange (eachDrawingInfo.PathPoints);

                } else if (eachDrawingInfo.DrawingType == DrawingLayerType.Image ||
                    eachDrawingInfo.DrawingType == DrawingLayerType.Comix ||
                    eachDrawingInfo.DrawingType == DrawingLayerType.Stamp ||
                    eachDrawingInfo.DrawingType == DrawingLayerType.Callout) {

                    RectangleF imgFrame = eachDrawingInfo.RotationAngle == 0 ? eachDrawingInfo.ImageFrame : eachDrawingInfo.RotatedImageBox;
                    allPoints.Add (imgFrame.Location);
                    allPoints.Add (new PointF (imgFrame.Right, imgFrame.Y));
                    allPoints.Add (new PointF (imgFrame.Right, imgFrame.Bottom));
                    allPoints.Add (new PointF (imgFrame.X, imgFrame.Bottom));

                }//end if else

            }//end foreach

            if (allPoints.Count == 0) {
                return RectangleF.Empty;
            } else {

                PointF minXPoint =
                    allPoints
                        .MinItem<PointF, float> (s => s.X);
                PointF maxXPoint =
                    allPoints
                        .MaxItem<PointF, float> (s => s.X);
                PointF minYPoint =
                    allPoints
                        .MinItem<PointF, float> (s => s.Y);
                PointF maxYPoint =
                    allPoints
                        .MaxItem<PointF, float> (s => s.Y);

                return new RectangleF (minXPoint.X,
                                      minYPoint.Y,
                                      maxXPoint.X - minXPoint.X,
                                      maxYPoint.Y - minYPoint.Y);

            }//end if else
        }
        public UserDB GetSenderOfOldestMessage()
        {
            List<MessageInfo> messageInfoList = new List<MessageInfo> ();
            messageInfoList =
                this.Messages.Values.Where (s => s.Message.FromAccountID != AndroidData.CurrentUser.AccountID).ToList ();

            if (messageInfoList.Count > 0)
                return messageInfoList.MinItem<MessageInfo, DateTime> (s => s.Message.MessageSent).MessageUser;
            else
                return null;
        }