public EPuzzleWindow(EPuzzleData ePuzzleData)
 {
     InputDevice = InputDevice.Mouse;
     EPuzzleData = ePuzzleData;
     WindowState.常にカーソルを表示 = (bool)ePuzzleData.Settings.GetValue("常にカーソルを表示");
     ChumonResult = new ChumonResult(ePuzzleData.CurrentUserInfo);
 }
        public ChumonResultState(EPuzzleWindow window, EigoTestMondai mondai, ChumonResult chumonResult, MondaiResult mondaiResult)
            : base(window)
        {
            _mondai = mondai;
            _chumonResult = chumonResult;

            DrawingObjectRoot.BackColor = EPuzzleColors.Color109;

            //			var imageFile = ResultImageManager.Instance.GetFile(_mondai.Parent.GetGradeString(mondaiResult.所要時間));
            //			var imageFile = ResultImageManager.Instance.GetImage(_mondai.Parent.GetGradeString(mondaiResult.所要時間));
            var image = window.EPuzzleData.CurrentUserInfo.ResultImageManager.GetImage(_mondai.Parent.GetGradeString(mondaiResult.所要時間, window.EPuzzleData.CurrentUserInfo));
            if (null != image)
            {
            //				var imageItem = new ImageItem(imageFile, true);
                var imageItem = new ImageItem(image.Shrink((int)DrawingObjectRoot.Width, (int)DrawingObjectRoot.Height));
                imageItem.Left = 0f;
                imageItem.Top = 0f;
                imageItem.Position = DrawingObjectPosition.Absolute;
                Items.Add(imageItem);

            #if DEBUG
                { // 使用したファイルの記録
                    var imagePath = (string)image.Tag;
                    Clipboard.SetText(imagePath);

                    var path = Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), "usedImages.txt");
                    File.AppendAllText(path, imagePath + Environment.NewLine);
                }
            #endif // DEBUG

            //				ResultImageManager.Instance.UpdateAccessTime(fileName);
            //				ResultImageManager.Instance.SaveFileIfItPassed(TimeSpan.FromMinutes(10d));
            }

            var w1 = 180f;
            var h1 = EPuzzleFonts.ChumonResultState_Default.Height;
            var backColor = EPuzzleColors.Color107;

            var kirokuBox = new KirokuBox2()
            {
                BorderLine = false,
                Position = DrawingObjectPosition.Absolute,
                Width = 200,
                UserInfo = Window.EPuzzleData.CurrentUserInfo,
                Chumon = (Chumon)_mondai.Parent,
                Color = EPuzzleColors.ChumonResultState_KirokuBox2_Color,
                BackColor = EPuzzleColors.ChumonResultState_KirokuBox2_BackColor,
                BackColorA = EPuzzleColors.ChumonResultState_KirokuBox2_BackColorA,
                BackColorB = EPuzzleColors.ChumonResultState_KirokuBox2_BackColorB,
                LineColor = EPuzzleColors.ChumonResultState_KirokuBox2_LineColor,
                NodeColor = EPuzzleColors.ChumonResultState_KirokuBox2_NodeColor,
            };
            Items.Add(kirokuBox);

            var box = new DrawingObjectContainer()
            {
                Position = DrawingObjectPosition.Absolute,
                Color = EPuzzleColors.Color108,
                BackColor = backColor,
                Width = w1,
                PaddingLeft = 10f, PaddingRight = 10f,
                PaddingTop = 10f, PaddingBottom = 10f,
                BorderLine = false,
            };
            Items.Add(box);

            {
                var item = new EigoTestLabelItem()
                {
                    Color = EPuzzleColors.Color108,
                    Text = mondai.Parent.LongName,
                    Font = EPuzzleFonts.ChumonResultState_Default,
                    Width = w1,
                    Height = h1,
                    StringFormat = new StringFormat() { Alignment = StringAlignment.Near, LineAlignment = StringAlignment.Center, },
                };
                box.Items.Add(item);
            }
            {
                var item = new EigoTestLabelItem()
                {
                    Color = EPuzzleColors.Color108,
                    Text = string.Format("グレード: {0}({1:0.00})", mondai.Parent.GetGradeString(mondaiResult.所要時間, window.EPuzzleData.CurrentUserInfo), mondai.Parent.GetGrade(mondaiResult.所要時間, window.EPuzzleData.CurrentUserInfo)),
                    Font = EPuzzleFonts.ChumonResultState_Default,
                    Width = w1,
                    Height = h1,
                    StringFormat = new StringFormat() { Alignment = StringAlignment.Near, LineAlignment = StringAlignment.Center, },
                };
                box.Items.Add(item);
            }
            {
                var duration = mondai.Parent.復習までの猶予期間を取得(window.EPuzzleData.CurrentUserInfo);
                if (null != duration)
                {
                    var item = new EigoTestLabelItem()
                    {
                        Color = EPuzzleColors.Color108,
                        Text = string.Format("復習猶予期間: {0:0.0}日", ((TimeSpan)duration).TotalDays),
                        Font = EPuzzleFonts.ChumonResultState_Default,
                        Width = w1,
                        Height = h1,
                        StringFormat = new StringFormat() { Alignment = StringAlignment.Near, LineAlignment = StringAlignment.Center, },
                    };
                    box.Items.Add(item);
                }
            }
            {
                var item = new EigoTestLabelItem()
                {
                    Color = EPuzzleColors.Color108,
                    Text = string.Format("基準時間: {0}", EigoTestMondai.符号無時間文字列(_mondai.Parent.GetTimeLimit(window.EPuzzleData.CurrentUserInfo))),
                    Font = EPuzzleFonts.ChumonResultState_Default,
                    Width = w1,
                    Height = h1,
                    StringFormat = new StringFormat() { Alignment = StringAlignment.Near, LineAlignment = StringAlignment.Center, },
                };
                box.Items.Add(item);
            }
            {
                var item = new EigoTestLabelItem()
                {
                    Color = EPuzzleColors.Color108,
                    Text = string.Format("所要時間: {0}", EigoTestMondai.符号無時間文字列(mondaiResult.所要時間)),
                    Font = EPuzzleFonts.ChumonResultState_Default,
                    Width = w1,
                    Height = h1,
                    StringFormat = new StringFormat() { Alignment = StringAlignment.Near, LineAlignment = StringAlignment.Center, },
                };
                box.Items.Add(item);
            }
            {
                var item = new EigoTestLabelItem()
                {
                    Color = EPuzzleColors.Color108,
                    Text = string.Format("基準との差: {0}", EigoTestMondai.符号付時間文字列(mondaiResult.所要時間 - _mondai.Parent.GetTimeLimit(window.EPuzzleData.CurrentUserInfo))),
                    Font = EPuzzleFonts.ChumonResultState_Default,
                    Width = w1,
                    Height = h1,
                    StringFormat = new StringFormat() { Alignment = StringAlignment.Near, LineAlignment = StringAlignment.Center, },
                };
                box.Items.Add(item);
            }
            /*			{
                var item = new EigoTestLabelItem()
                {
                    Color = EPuzzleColors.Color108,
                    Text = string.Format("Perfect: {0}", string.Join("", chumonResult.ShomonResults.Select(x => x.IsPerfect ? "■" : "□").ToArray())),
                    Font = EPuzzleFonts.ChumonResultState_Default,
                    Width = w1,
                    Height = h1,
                    StringFormat = new StringFormat() { Alignment = StringAlignment.Near, LineAlignment = StringAlignment.Center, },
                };
                box.Items.Add(item);
            }*/
            {
                var height = 25f;
                var stars = chumonResult.ShomonResults.Select(x =>
                {
                    var star = new Pentagram(2)
                    {
                        Color = EPuzzleColors.PerfectStarOnChumonResultState,
                        Width = height,
                        Height = height,
                        Tag = x.IsPerfect,
                        PaddingLeft = 3f,
                        PaddingBottom = 3f,
                    };
                    return star;
                }).ToArray();
            /*				for (int i = 0; i < stars.Length; i++)
                {
                    stars[i].Left = stars[0].OuterWidth * i;
                    stars[i].Top = DrawingObjectRoot.Height - stars[0].OuterHeight;
                }
                */
                for (int i = 0; i < stars.Length; i++)
                {
                    stars[i].Left = stars[0].OuterWidth * i;
                    stars[i].Top = 0f;
                }

                if (stars.Any())
                {
                    var starbox = new DrawingObjectContainer()
                    {
                        Position = DrawingObjectPosition.Absolute,
                        Left = 0f,
                        Top = DrawingObjectRoot.Height - stars.First().OuterHeight,
                        Width = stars.Last().OuterRight - stars.First().OuterLeft,
                        Height = stars.First().OuterHeight,
            //						BackColor = EPuzzleColors.Color107,
                    };
                    starbox.Items.AddRange(stars);
                    Items.Add(starbox);
                }
            //				Items.AddRange(stars);
            }

            /*			{
                var bestMondaiResult = window.EPuzzleData.CurrentUserInfo.MondaiResults.GetBest(mondai.Parent.Id);
                if (null != bestMondaiResult)
                {
                    var item = new EigoTestLabelItem()
                    {
                        Color = EPuzzleColors.Color108,
                        Text = string.Format("最速記録: {0}", EigoTestMondai.符号無時間文字列(bestMondaiResult.所要時間)),
                        Font = EPuzzleFonts.ChumonResultState_Default,
                        Width = w1,
                        Height = h1,
                        StringFormat = new StringFormat() { Alignment = StringAlignment.Near, LineAlignment = StringAlignment.Center, },
                    };
                    box.Items.Add(item);
                }
            }
            {
                var bestMondaiResult = window.EPuzzleData.CurrentUserInfo.MondaiResults.GetBest(mondai.Parent.Id);
                if (null != bestMondaiResult)
                {
                    var item = new EigoTestLabelItem()
                    {
                        Color = EPuzzleColors.Color108,
                        Text = string.Format("最速との差: {0}", EigoTestMondai.符号付時間文字列(mondaiResult.所要時間 - bestMondaiResult.所要時間)),
                        Font = EPuzzleFonts.ChumonResultState_Default,
                        Width = w1,
                        Height = h1,
                        StringFormat = new StringFormat() { Alignment = StringAlignment.Near, LineAlignment = StringAlignment.Center, },
                    };
                    box.Items.Add(item);
                }
            }*/

            /*			var retryButton = new EigoTestButtonItem()
            {
                Position = DrawingObjectPosition.Absolute,
                Color = EPuzzleColors.Color108,
                Text = "再挑戦",
                Name = "retryButton",
                Font = EPuzzleFonts.ChumonResultState_Default,
                Width = 80,
                Height = h1,
            };
            Items.Add(retryButton);*/

            /*
            // 右がbox
            box.Left = DrawingObjectRoot.Width - ( box.OuterWidth + kirokuBox.OuterWidth );
            box.Top = DrawingObjectRoot.Height - box.OuterHeight;

            kirokuBox.Height = box.OuterHeight;
            kirokuBox.Left = DrawingObjectRoot.Width - kirokuBox.OuterWidth;
            kirokuBox.Top = box.Top;
            */

            box.Left = DrawingObjectRoot.Width - box.OuterWidth;
            box.Top = DrawingObjectRoot.Height - box.OuterHeight;

            kirokuBox.Height = box.OuterHeight;
            kirokuBox.Left = box.OuterLeft - kirokuBox.OuterWidth;
            kirokuBox.Top = box.Top;

            Action0 += (sender, e) =>
            {
                MouseUpInternal(new MouseEventInfo(new PointF(0f, 0f), MouseButtons.Left));
            };
        }
 public EPuzzleWindow()
 {
     InputDevice = InputDevice.Mouse;
     ChumonResult = new ChumonResult(null);
 }