/// <summary>
        ///     按原图比例展示图像
        /// </summary>
        //--------------------------------------------------------------------------
        //修改历史:
        //日期      修改人     修改
        //2010-8-27 zhanggang  创建代码
        //--------------------------------------------------------------------------
        public void OriginalView()
        {
            BitmapSource img = (BitmapSource)(ViewedPhoto.Source);

            ViewedPhoto.Width  = curCoef * img.Width;
            ViewedPhoto.Height = curCoef * img.Height;
            ViewScroll.UpdateLayout();
        }
        public void draw(View Vw, ViewWindow Window, Review review)
        {
            Window.title = "Bases";
            InstanceData GameInstance = StateFundingGlobal.fetch.GameInstance;

            if (GameInstance == null)
            {
                Log.Error("StateFundingHubBasesView.draw, Inst is null");
                return;
            }

            string Description = "Below is a list of existing Bases. Vessels that are Bases should be labeled as " +
                                 "such, be landed on a body other than the home planet, and be able to generate power. Bases increase State Confidence " +
                                 "as well as Public Opinion. Bases are scored by the following criteria: Total Fuel (SC), Total Ore (SC), Crew (PO), Crew Capacity " +
                                 "(SC), Docking Port Count (SC), Docked Vessels (PO), if it has a science lab (SC/PO), and if it has a drill (SC/PO).";

            ViewLabel DescriptionLabel = new ViewLabel(Description);

            DescriptionLabel.setRelativeTo(Window);
            DescriptionLabel.setLeft(140);
            DescriptionLabel.setTop(20);
            DescriptionLabel.setColor(Color.white);
            DescriptionLabel.setHeight(100);
            DescriptionLabel.setWidth(Window.getWidth() - 140);

            Vw.addComponent(DescriptionLabel);

            ViewLabel TotalBases = new ViewLabel("Total Bases: " + review.variables.Bases.Length);

            TotalBases.setRelativeTo(Window);
            TotalBases.setLeft(140);
            TotalBases.setTop(130);
            TotalBases.setColor(Color.white);
            TotalBases.setHeight(30);
            TotalBases.setWidth(Window.getWidth() - 140);

            Vw.addComponent(TotalBases);

            ViewScroll BasesScroll = new ViewScroll();

            BasesScroll.setRelativeTo(Window);
            BasesScroll.setWidth(Window.getWidth() - 140);
            BasesScroll.setHeight(Window.getHeight() - 160);
            BasesScroll.setLeft(140);
            BasesScroll.setTop(150);

            Vw.addComponent(BasesScroll);

            BaseReport[] Bases = review.variables.Bases;

            for (int i = 0; i < Bases.Length; i++)
            {
                drawItem(Bases[i], BasesScroll, i);
            }
        }
        /// <summary>
        ///     鼠标在图片上移动的拖动操作
        ///     <param name="sender">调用对象</param>
        ///     <param name="e">参数信息</param>
        /// </summary>
        //--------------------------------------------------------------------------
        //修改历史:
        //日期      修改人     修改
        //2010-8-3  qizhenguo  创建代码
        //--------------------------------------------------------------------------
        private void ViewedPhoto_MouseMove(object sender, MouseEventArgs e)
        {
            // 如果正在拖动图片,则通过变换滚动条位置,移动图片
            if (draging)
            {
                Point  newPoint      = e.GetPosition(this);
                double newHoriOffset = ViewScroll.HorizontalOffset - newPoint.X + beginPoint.X;
                double newVertOffset = ViewScroll.VerticalOffset - newPoint.Y + beginPoint.Y;

                ViewScroll.ScrollToHorizontalOffset(newHoriOffset);
                ViewScroll.ScrollToVerticalOffset(newVertOffset);

                beginPoint = newPoint;
            }
        }
        /// <summary>
        ///     顺时针旋转图片
        ///     <param name="sender">调用对象</param>
        ///     <param name="e">参数信息</param>
        /// </summary>
        //--------------------------------------------------------------------------
        //修改历史:
        //日期      修改人     修改
        //2010-8-3  zhanggang  创建代码
        //--------------------------------------------------------------------------
        private void Rotate_Click(object sender, RoutedEventArgs e)
        {
            logger.Debug("旋转图片处理开始。");

            //1:判断命令来源
            Button button = e.Source as Button;
            string cmd    = button.Content.ToString();

            //2:根据按钮进行放大系数修改
            switch (cmd)
            {
            case "旋转(顺)":
                rotateDegree += 90;
                break;

            case "旋转(逆)":
                rotateDegree -= 90;
                break;

            default:
                break;
            }

            //3:旋转图像
            using (FileStream mse = new FileStream(SelectedImageName, FileMode.Open, FileAccess.Read))
            {
                BitmapImage bitImage = new BitmapImage();
                bitImage.BeginInit();
                bitImage.StreamSource = mse;
                bitImage.CacheOption  = BitmapCacheOption.OnLoad;
                bitImage.Rotation     = InnerUtility.GetRotation(rotateDegree);
                bitImage.EndInit();
                bitImage.Freeze();

                ViewedPhoto.Source = bitImage;
                ViewedPhoto.Width  = bitImage.Width * curCoef;
                ViewedPhoto.Height = bitImage.Height * curCoef;

                ViewScroll.UpdateLayout();
            }

            logger.Debug("旋转图片处理结束。");
        }
        /// <summary>
        ///
        ///     <param name="sender">调用对象</param>
        ///     <param name="e">参数信息</param>
        /// </summary>
        //--------------------------------------------------------------------------
        //修改历史:
        //日期      修改人     修改
        //2010-8-5  zhanggang  创建代码
        //--------------------------------------------------------------------------
        private void Zoom_Click(object sender, RoutedEventArgs e)
        {
            logger.Debug("更新图像大小处理开始。");

            orginalViewButtonPressed = false;

            //1:判断命令来源
            Button button = e.Source as Button;
            string cmd    = button.Content.ToString();

            //2:根据按钮进行放大系数修改
            switch (cmd)
            {
            case "放大":
                curCoef *= 1.5;
                SingleImageSizeChanged();
                break;

            case "缩小":
                curCoef *= (double)2.0 / 3;
                SingleImageSizeChanged();
                break;

            case "原图":
                curCoef = 1.0;
                orginalViewButtonPressed = true;
                OriginalView();
                break;

            default:
                break;
            }

            ViewScroll.UpdateLayout();
            SetScrollViewerVisible(ViewScroll, ScrollBarVisibility.Auto);

            logger.Debug("更新图像大小处理结束。");
        }
        public void draw(View Vw, ViewWindow Window, Review review)
        {
            Window.title = "Kerbals";

            InstanceData GameInstance = StateFundingGlobal.fetch.GameInstance;

            if (GameInstance == null)
            {
                Log.Error("StateFundingHubKerbalsView.draw, Inst is null");
                return;
            }

            string Description = "You Love Kerbals, I Love Kerbals, Kerbals Love Kerbals. Just one of those facts of life. " +
                                 "So it goes without saying, having Kerbals actively on missions increases Public Opinion. " +
                                 "The more Kerbals you have in flight the more Public Opinion you will garner, but be careful, " +
                                 "a stranded Kerbal is as bad as a dead Kerbal and will hurt public opinion until they are " +
                                 "rescued. A qualified \"Stranded Kerbal\" is one that is in a vessel without fuel/energy, a science lab, " +
                                 "or a mining rig. They are floating without reason to be there. A kerbal will not be considered stranded unless it's " +
                                 "been on the current mission for at least 2 years.";

            ViewLabel DescriptionLabel = new ViewLabel(Description);

            DescriptionLabel.setRelativeTo(Window);
            DescriptionLabel.setLeft(140);
            DescriptionLabel.setTop(20);
            DescriptionLabel.setColor(Color.white);
            DescriptionLabel.setHeight(100);
            DescriptionLabel.setWidth(Window.getWidth() - 140);

            Vw.addComponent(DescriptionLabel);

            ViewLabel ActiveKerbals = new ViewLabel("Active Kerbals: " + review.variables.activeKerbals + ". Stranded Kerbals: " + review.variables.strandedKerbals + ".");

            ActiveKerbals.setRelativeTo(Window);
            ActiveKerbals.setLeft(140);
            ActiveKerbals.setTop(130);
            ActiveKerbals.setColor(Color.white);
            ActiveKerbals.setHeight(30);
            ActiveKerbals.setWidth(Window.getWidth() - 140);

            Vw.addComponent(ActiveKerbals);

            ViewScroll KerbalsScroll = new ViewScroll();

            KerbalsScroll.setRelativeTo(Window);
            KerbalsScroll.setWidth(Window.getWidth() - 140);
            KerbalsScroll.setHeight(Window.getHeight() - 160);
            KerbalsScroll.setLeft(140);
            KerbalsScroll.setTop(150);

            Vw.addComponent(KerbalsScroll);

            ProtoCrewMember[] Kerbals = KerbalHelper.GetKerbals();

            int labelHeight = 20;

            for (int i = 0; i < Kerbals.Length; i++)
            {
                ProtoCrewMember Kerb = Kerbals[i];

                string state = "Active";
                Color  color = Color.green;
                if (KerbalHelper.IsStranded(Kerb))
                {
                    state = "Stranded";
                    color = Color.white;
                }
                else if (KerbalHelper.QualifiedStranded(Kerb))
                {
                    state = "Active [Will be Stranded In " + KerbalHelper.TimeToStranded(Kerb) + " Days!]";
                    color = Color.yellow;
                }

                string label = Kerb.name + " (" + state + ")";

                ViewLabel KerbalLabel = new ViewLabel(label);
                KerbalLabel.setRelativeTo(KerbalsScroll);
                KerbalLabel.setTop(labelHeight + (labelHeight + 5) * i);
                KerbalLabel.setLeft(0);
                KerbalLabel.setHeight(labelHeight);
                KerbalLabel.setWidth(KerbalsScroll.getWidth() - 20);
                KerbalLabel.setColor(color);
                KerbalsScroll.Components.Add(KerbalLabel);
            }
        }
        public static void drawItem(BaseReport Base, ViewScroll parent, int offset)
        {
            int boxHeight = 110;

            ViewBox Box = new ViewBox();

            Box.setRelativeTo(parent);
            Box.setWidth(parent.getWidth() - 20);
            Box.setHeight(boxHeight);
            Box.setLeft(0);
            Box.setTop((boxHeight + 10) * offset);
            Box.setColor(Color.white);
            parent.Components.Add(Box);

            string    label     = "[" + Base.name + " is Landed At " + Base.entity + "]";
            ViewLabel BaseLabel = new ViewLabel(label);

            BaseLabel.setRelativeTo(Box);
            BaseLabel.setTop(5);
            BaseLabel.setLeft(5);
            BaseLabel.setHeight(15);
            BaseLabel.setPercentWidth(100);
            BaseLabel.setColor(Color.green);
            parent.Components.Add(BaseLabel);

            ViewLabel FuelLabel = new ViewLabel("Fuel: " + Base.fuel);

            FuelLabel.setRelativeTo(Box);
            FuelLabel.setTop(25);
            FuelLabel.setLeft(5);
            FuelLabel.setHeight(15);
            FuelLabel.setWidth(150);
            FuelLabel.setColor(Color.white);
            parent.Components.Add(FuelLabel);

            ViewLabel OreLabel = new ViewLabel("Ore: " + Base.ore);

            OreLabel.setRelativeTo(Box);
            OreLabel.setTop(45);
            OreLabel.setLeft(5);
            OreLabel.setHeight(20);
            OreLabel.setWidth(150);
            OreLabel.setColor(Color.white);
            parent.Components.Add(OreLabel);

            ViewLabel CrewLabel = new ViewLabel("Crew: " + Base.crew);

            CrewLabel.setRelativeTo(Box);
            CrewLabel.setTop(65);
            CrewLabel.setLeft(5);
            CrewLabel.setHeight(20);
            CrewLabel.setWidth(150);
            CrewLabel.setColor(Color.white);
            parent.Components.Add(CrewLabel);

            ViewLabel CrewCapacityLabel = new ViewLabel("Crew Capacity: " + Base.crewCapacity);

            CrewCapacityLabel.setRelativeTo(Box);
            CrewCapacityLabel.setTop(85);
            CrewCapacityLabel.setLeft(5);
            CrewCapacityLabel.setHeight(20);
            CrewCapacityLabel.setWidth(150);
            CrewCapacityLabel.setColor(Color.white);
            parent.Components.Add(CrewCapacityLabel);

            ViewLabel DockingPortsLabel = new ViewLabel("Docking Ports: " + Base.dockingPorts);

            DockingPortsLabel.setRelativeTo(Box);
            DockingPortsLabel.setTop(25);
            DockingPortsLabel.setLeft(155);
            DockingPortsLabel.setHeight(15);
            DockingPortsLabel.setWidth(150);
            DockingPortsLabel.setColor(Color.white);
            parent.Components.Add(DockingPortsLabel);

            ViewLabel DockedVesselsLabel = new ViewLabel("Docked Vessels: " + Base.dockedVessels);

            DockedVesselsLabel.setRelativeTo(Box);
            DockedVesselsLabel.setTop(45);
            DockedVesselsLabel.setLeft(155);
            DockedVesselsLabel.setHeight(15);
            DockedVesselsLabel.setWidth(150);
            DockedVesselsLabel.setColor(Color.white);
            parent.Components.Add(DockedVesselsLabel);

            ViewLabel ScienceLabLabel = new ViewLabel("Science Lab: " + Base.scienceLab);

            ScienceLabLabel.setRelativeTo(Box);
            ScienceLabLabel.setTop(65);
            ScienceLabLabel.setLeft(155);
            ScienceLabLabel.setHeight(15);
            ScienceLabLabel.setWidth(150);
            ScienceLabLabel.setColor(Color.white);
            parent.Components.Add(ScienceLabLabel);

            ViewLabel HasDrillLabel = new ViewLabel("Has Drill: " + Base.drill);

            HasDrillLabel.setRelativeTo(Box);
            HasDrillLabel.setTop(85);
            HasDrillLabel.setLeft(155);
            HasDrillLabel.setHeight(15);
            HasDrillLabel.setWidth(150);
            HasDrillLabel.setColor(Color.white);
            parent.Components.Add(HasDrillLabel);

            ViewLabel SCLabel = new ViewLabel("PO: " + Base.po);

            SCLabel.setRelativeTo(Box);
            SCLabel.setTop(25);
            SCLabel.setLeft(310);
            SCLabel.setHeight(15);
            SCLabel.setWidth(150);
            SCLabel.setColor(Color.white);
            parent.Components.Add(SCLabel);

            ViewLabel POLabel = new ViewLabel("SC: " + Base.sc);

            POLabel.setRelativeTo(Box);
            POLabel.setTop(45);
            POLabel.setLeft(310);
            POLabel.setHeight(15);
            POLabel.setWidth(150);
            POLabel.setColor(Color.white);
            parent.Components.Add(POLabel);
        }