private void Page_Loaded(object sender, RoutedEventArgs e)
        {
            //flip1.Slides.Add(new TextBlock { Text = "hello" });
            //flip1.Slides.Add(new TextBlock { Text = "nihao" });
            //flip1.ReadyControl();
            //flip1.CurrentSlideNumber = 0;

            string type = NavigationManager.GetQueryString("type");

            if (type == "city")
            {
                var answers = DocumentManager.CurrentDocument.City.Questionnaire;
                QuestionnaireManager.Questions.Where(x => x.Name.StartsWith("C")).ToList().ForEach(x => flip1.Slides.Add(new QuestionControl(x.Name, answers)));
                flip1.ReadyControl();
                flip1.CurrentSlideNumber = 0;
            }
            else if (type == "project")
            {
                int id      = Convert.ToInt32(NavigationManager.GetQueryString("id"));
                var answers = DocumentManager.CurrentDocument.Projects[id].Questionnaire;
                QuestionnaireManager.Questions.Where(x => x.Name.StartsWith("P")).ToList().ForEach(x => flip1.Slides.Add(new QuestionControl(x.Name, answers, true)));
                flip1.ReadyControl();
                flip1.CurrentSlideNumber = 0;
            }
        }
        private void Page_Loaded(object sender, RoutedEventArgs e)
        {
            var btn1 = new ImageButton {
                IsToggleButton = true, Width = 171, Height = 78, Margin = new Thickness(2), NormalImage = new BitmapImage(new Uri(@MainWindow.ImagePath + "p2-11-2.png", UriKind.Relative)), HoverImage = new BitmapImage(new Uri(@MainWindow.ImagePath + "p2-11-3.png", UriKind.Relative)), DownImage = new BitmapImage(new Uri(@MainWindow.ImagePath + "p2-11-1.png", UriKind.Relative))
            };
            var btn2 = new ImageButton {
                IsToggleButton = true, Width = 171, Height = 78, Margin = new Thickness(2), NormalImage = new BitmapImage(new Uri(@MainWindow.ImagePath + "p2-12-2.png", UriKind.Relative)), HoverImage = new BitmapImage(new Uri(@MainWindow.ImagePath + "p2-12-3.png", UriKind.Relative)), DownImage = new BitmapImage(new Uri(@MainWindow.ImagePath + "p2-12-1.png", UriKind.Relative))
            };
            var btn3 = new ImageButton {
                IsToggleButton = true, Width = 171, Height = 78, Margin = new Thickness(2), NormalImage = new BitmapImage(new Uri(@MainWindow.ImagePath + "p2-13-2.png", UriKind.Relative)), HoverImage = new BitmapImage(new Uri(@MainWindow.ImagePath + "p2-13-3.png", UriKind.Relative)), DownImage = new BitmapImage(new Uri(@MainWindow.ImagePath + "p2-13-1.png", UriKind.Relative))
            };
            var btn4 = new ImageButton {
                IsToggleButton = true, Width = 171, Height = 78, Margin = new Thickness(2), NormalImage = new BitmapImage(new Uri(@MainWindow.ImagePath + "p2-14-2.png", UriKind.Relative)), HoverImage = new BitmapImage(new Uri(@MainWindow.ImagePath + "p2-14-3.png", UriKind.Relative)), DownImage = new BitmapImage(new Uri(@MainWindow.ImagePath + "p2-14-1.png", UriKind.Relative))
            };
            var btn5 = new ImageButton {
                Width = 171, Height = 78, Margin = new Thickness(2), NormalImage = new BitmapImage(new Uri(@MainWindow.ImagePath + "p2-15-2.png", UriKind.Relative)), HoverImage = new BitmapImage(new Uri(@MainWindow.ImagePath + "p2-15-3.png", UriKind.Relative)), DownImage = new BitmapImage(new Uri(@MainWindow.ImagePath + "p2-15-1.png", UriKind.Relative))
            };

            var btns = new ImageButton[] { btn1, btn2, btn3, btn4, btn5 };

            tileStackControl1.Tiles = btns;
            foreach (var btn in btns)
            {
                var btn000 = btn;
                btn000.Click += (s, arg) =>
                {
                    CurrentPart = btns.ToList().IndexOf(btn000);
                    btns.ToList().ForEach(x => x.ToggleOff());
                    btn000.ToggleOn();
                };
            }

            var idString = NavigationManager.GetQueryString("part");

            if (idString == "0")
            {
                CurrentPart = 0;
                btn1.ToggleOn();
            }
            else if (idString == "1")
            {
                CurrentPart = 1;
                btn2.ToggleOn();
            }
            else if (idString == "2")
            {
                CurrentPart = 2;
                btn3.ToggleOn();
            }
            else if (idString == "3")
            {
                CurrentPart = 3;
                btn4.ToggleOn();
            }
        }
        private void Page_Loaded(object sender, RoutedEventArgs e)
        {
            var slideString = NavigationManager.GetQueryString("slide");

            if (slideString != string.Empty)
            {
                _slidePos = Convert.ToInt32(slideString);
            }

            _basket = new ProjectGroup(DocumentManager.CurrentDocument.Projects.Where(x => x.PIP == 0));
            Update().ForEach(x => Pager.Slides.Add(x));
            Pager.ReadyControl(_slidePos);
        }
Exemple #4
0
        private void Page_Loaded(object sender, RoutedEventArgs e)
        {
            var slideString = NavigationManager.GetQueryString("slide");

            if (slideString != string.Empty)
            {
                _slidePos = Convert.ToInt32(slideString);
            }

            GetPages().ForEach(x => Pager.Slides.Add(x));
            Pager.NavBar.PointDescripions = Enumerable.Range(0, Pager.Slides.Count).Select(x => Caption.Financial(x)).ToList();
            Pager.ReadyControl(_slidePos);
        }
        private void Page_Loaded(object sender, RoutedEventArgs e)
        {
            var idString = NavigationManager.GetQueryString("id");

            if (idString != string.Empty)
            {
                _projId = Convert.ToInt32(idString);
            }
            var slideString = NavigationManager.GetQueryString("slide");

            if (slideString != string.Empty)
            {
                _slidePos = Convert.ToInt32(slideString);
            }
            ReadyProject(_projId, _slidePos);
        }
        private void Page_Loaded(object sender, RoutedEventArgs e)
        {
            id = Convert.ToInt32(NavigationManager.GetQueryString("id"));

            Button btnToQ1 = new Button {
                Content = "演示模式", Width = 200, HorizontalAlignment = HorizontalAlignment.Left, Margin = new Thickness(0, 0, 0, 20)
            };

            btnToQ1.Click += (s, arg) => NavigationManager.Navigate("QuestionPage.xaml", "type=project&id=" + id.ToString());
            layoutRoot.Children.Insert(0, btnToQ1);

            string[] qs1 = { "PQ01", "PQ02", "PQ03", "PQ04", "PQ05", "PQ06" };
            setQuestionnaire(qs1, layoutRoot1);

            string[] qs2 = { "PQ07", "PQ08", "PQ09", "PQ10", "PQ11", "PQ12", "PQ13", "PQ14" };
            setQuestionnaire(qs2, layoutRoot2);

            string[] qs3 = { "PQ15", "PQ16", "PQ17", "PQ18", "PQ19", "PQ20" };
            setQuestionnaire(qs3, layoutRoot3);

            string[] qs4 = { "PQ21", "PQ22", "PQ23", "PQ24", "PQ25", "PQ26", "PQ27", "PQ28", "PQ29" };
            setQuestionnaire(qs4, layoutRoot4);

            string[] qs5 = { "PQ30", "PQ31", "PQ32", "PQ33", "PQ34", "PQ35", "PQ36", "PQ37", "PQ38", "PQ39" };
            setQuestionnaire(qs5, layoutRoot5);

            StackPanel layout2 = new StackPanel();

            layout2.Orientation = Orientation.Horizontal;
            layout2.Margin      = new Thickness(0, 20, 0, 0);
            TextBlock tbPoint = new TextBlock();

            tbPoint.FontSize = 18;
            tbPoint.Text     = "统计得分: ";
            layout2.Children.Add(tbPoint);
            layout2.Children.Add(tbTotal);
            layoutRoot.Children.Add(layout2);

            UpdatePoints();
        }
        public void PrintContent()
        {
            var list = GetPrintContent();

            list.ForEach(x => x.HorizontalAlignment = System.Windows.HorizontalAlignment.Center);
            var part = NavigationManager.GetQueryString("part");

            if (part == "summary")
            {
                PrintManager.Page = PrintPage.A3_Landscape;
            }
            else
            {
                PrintManager.Page = PrintPage.A3_Portrait;
            }
            var flow               = PrintManager.GetDocumentFrom(list);
            var fixedDoc           = PrintManager.FlowToFixed(flow);
            PrintPreviewWindow ppw = new PrintPreviewWindow {
                Owner = MainWindow.Current
            };

            ppw.SetDocument(fixedDoc);
            ppw.ShowDialog();
        }
        private void Page_Loaded(object sender, RoutedEventArgs e)
        {
            var btn1 = new ImageButton {
                IsToggleButton = true, Width = 171, Height = 78, Margin = new Thickness(2), NormalImage = new BitmapImage(new Uri(@MainWindow.ImagePath + "p2-11-2.png", UriKind.Relative)), HoverImage = new BitmapImage(new Uri(@MainWindow.ImagePath + "p2-11-3.png", UriKind.Relative)), DownImage = new BitmapImage(new Uri(@MainWindow.ImagePath + "p2-11-1.png", UriKind.Relative))
            };
            var btn2 = new ImageButton {
                IsToggleButton = true, Width = 171, Height = 78, Margin = new Thickness(2), NormalImage = new BitmapImage(new Uri(@MainWindow.ImagePath + "p2-12-2.png", UriKind.Relative)), HoverImage = new BitmapImage(new Uri(@MainWindow.ImagePath + "p2-12-3.png", UriKind.Relative)), DownImage = new BitmapImage(new Uri(@MainWindow.ImagePath + "p2-12-1.png", UriKind.Relative))
            };
            var btn3 = new ImageButton {
                IsToggleButton = true, Width = 171, Height = 78, Margin = new Thickness(2), NormalImage = new BitmapImage(new Uri(@MainWindow.ImagePath + "p2-13-2.png", UriKind.Relative)), HoverImage = new BitmapImage(new Uri(@MainWindow.ImagePath + "p2-13-3.png", UriKind.Relative)), DownImage = new BitmapImage(new Uri(@MainWindow.ImagePath + "p2-13-1.png", UriKind.Relative))
            };
            var btn4 = new ImageButton {
                IsToggleButton = true, Width = 171, Height = 78, Margin = new Thickness(2), NormalImage = new BitmapImage(new Uri(@MainWindow.ImagePath + "p2-14-2.png", UriKind.Relative)), HoverImage = new BitmapImage(new Uri(@MainWindow.ImagePath + "p2-14-3.png", UriKind.Relative)), DownImage = new BitmapImage(new Uri(@MainWindow.ImagePath + "p2-14-1.png", UriKind.Relative))
            };
            var btn5 = new ImageButton {
                Width = 171, Height = 78, Margin = new Thickness(2), NormalImage = new BitmapImage(new Uri(@MainWindow.ImagePath + "p2-15-2.png", UriKind.Relative)), HoverImage = new BitmapImage(new Uri(@MainWindow.ImagePath + "p2-15-3.png", UriKind.Relative)), DownImage = new BitmapImage(new Uri(@MainWindow.ImagePath + "p2-15-1.png", UriKind.Relative))
            };

            btn1.Click += (s, arg) => NavigationManager.Navigate("TileSecondaryPage.xaml", "part=0");;
            btn2.Click += (s, arg) => NavigationManager.Navigate("TileSecondaryPage.xaml", "part=1");
            btn3.Click += (s, arg) => NavigationManager.Navigate("TileSecondaryPage.xaml", "part=2");
            btn4.Click += (s, arg) => NavigationManager.Navigate("TileSecondaryPage.xaml", "part=3");
            btn5.Click += (s, arg) => NavigationManager.Navigate("TileMainPage.xaml");
            var btns = new ImageButton[] { btn1, btn2, btn3, btn4, btn5 };

            tileStackControl1.Tiles = btns;
            foreach (var btn in btns)
            {
                var btn000 = btn;
                btn000.Click += (s, arg) =>
                {
                    CurrentPart = btns.ToList().IndexOf(btn000);
                    btns.ToList().ForEach(x => x.ToggleOff());
                    btn000.ToggleOn();
                };
            }

            var partString = NavigationManager.GetQueryString("part");

            if (partString == "city" || partString == "city_q")
            {
                CurrentPart = 0;
                btn1.ToggleOn();
            }
            else if (partString == "financial")
            {
                CurrentPart = 1;
                btn2.ToggleOn();
            }
            else if (partString == "project")
            {
                CurrentPart = 2;
                btn3.ToggleOn();
            }
            else if (partString == "pip" || partString == "summary")
            {
                CurrentPart = 3;
                btn4.ToggleOn();
            }
            this.ReadyContent();
        }
        public List <FrameworkElement> GetPrintContent()
        {
            List <FrameworkElement> list = new List <FrameworkElement>();

            var part        = NavigationManager.GetQueryString("part");
            int slide       = 0;
            var slideString = NavigationManager.GetQueryString("slide");

            if (slideString != string.Empty)
            {
                slide = Convert.ToInt32(slideString);
            }
            int id       = 0;
            var idString = NavigationManager.GetQueryString("id");

            if (idString != string.Empty)
            {
                id = Convert.ToInt32(idString);
            }

            if (part == "city")
            {
                RichCityPage richPage = new RichCityPage();
                richPage.GetPages().ForEach(x => list.Add(x));
                list.RemoveAt(list.Count - 1); // 去掉最后一个
            }
            else if (part == "financial")
            {
                RichFinancialPage richPage = new RichFinancialPage();
                richPage.GetPages().ForEach(x => list.Add(x));
                list.RemoveAt(list.Count - 1); // 去掉最后一个
            }
            else if (part == "project")
            {
                RichProjectPage richPage = new RichProjectPage();
                richPage.SetProj(id);
                richPage.GetPages().ForEach(x => list.Add(x));
                list.RemoveAt(list.Count - 1); // 去掉最后一个
            }
            else if (part == "pip")
            {
                PipPage richPage = new PipPage();
                richPage.Update().ForEach(x =>
                {
                    var fes = x.Children.Cast <FrameworkElement>().ToList();
                    fes.ForEach(y =>
                    {
                        x.Children.Remove(y);
                        list.Add(y);
                    });
                });
            }
            else if (part == "summary")
            {
                SummaryPage richpage = new SummaryPage();
                richpage.Update();
                var content = richpage.LayoutRoot;
                content.Children.RemoveAt(0);
                content.Children.RemoveAt(content.Children.Count - 2);
                richpage.grid1.Children.Remove(content);
                list.Add(content);
            }
            return(list);
        }
        public void ReadyContent()
        {
            var part        = NavigationManager.GetQueryString("part");
            int slide       = 0;
            var slideString = NavigationManager.GetQueryString("slide");

            if (slideString != string.Empty)
            {
                slide = Convert.ToInt32(slideString);
            }
            int id       = 0;
            var idString = NavigationManager.GetQueryString("id");

            if (idString != string.Empty)
            {
                id = Convert.ToInt32(idString);
            }

            if (part == "city")
            {
                RichCityPage richPage = new RichCityPage();
                this.Pager.Slides.Clear();
                richPage.GetPages().ForEach(x => this.Pager.Slides.Add(x));
                Pager.Slides.RemoveAt(Pager.Slides.Count - 1); // 去掉最后一个
                // 问卷
                QuestionPage page = new QuestionPage();
                Pager.Slides.Add(page.GetContent("city", 0));
                Pager.NavBar.PointDescripions = Enumerable.Range(0, Pager.Slides.Count).Select(x => Caption.City(x)).ToList();
                this.Pager.ReadyControl(slide);
            }
            else if (part == "financial")
            {
                RichFinancialPage richPage = new RichFinancialPage();
                this.Pager.Slides.Clear();
                richPage.GetPages().ForEach(x => this.Pager.Slides.Add(x));
                Pager.Slides.RemoveAt(Pager.Slides.Count - 1); // 去掉最后一个
                Pager.NavBar.PointDescripions = Enumerable.Range(0, Pager.Slides.Count).Select(x => Caption.Financial(x)).ToList();
                this.Pager.ReadyControl(slide);
            }
            else if (part == "project")
            {
                RichProjectPage richPage = new RichProjectPage();
                richPage.SetProj(id);
                this.Pager.Slides.Clear();
                richPage.GetPages().ForEach(x => this.Pager.Slides.Add(x));
                Pager.Slides.RemoveAt(Pager.Slides.Count - 1); // 去掉最后一个
                Pager.NavBar.PointDescripions = Enumerable.Range(0, Pager.Slides.Count).Select(x => Caption.Project(x)).ToList();
                this.Pager.ReadyControl(slide);
            }
            else if (part == "pip")
            {
                PipPage richPage = new PipPage();
                this.Pager.Slides.Clear();
                richPage.Update().ForEach(x => this.Pager.Slides.Add(x));
                Pager.NavBar.PointDescripions = Enumerable.Range(0, Pager.Slides.Count).Select(x => Caption.Pip(x)).ToList();
                this.Pager.ReadyControl(slide);
            }
            //else if (part == "city_q")
            //{
            //    QuestionPage page = new QuestionPage();
            //    this.Pager.Slides.Clear();
            //    this.Pager.Slides.Add(page.GetContent("city", 0));
            //    this.Pager.ReadyControl(0);
            //}
            //else if (part == "project_q")
            //{
            //    QuestionPage page = new QuestionPage();
            //    this.Pager.Slides.Clear();
            //    this.Pager.Slides.Add(page.GetContent("project", id));
            //    this.Pager.ReadyControl(0);
            //}
            else if (part == "summary")
            {
                SummaryPage page = new SummaryPage();
                page.Update();
                var content = page.LayoutRoot;
                content.Children.RemoveAt(0);
                content.Children.RemoveAt(content.Children.Count - 2);
                page.grid1.Children.Remove(content);
                this.Pager.Slides.Clear();
                this.Pager.Slides.Add(content);
                this.Pager.ReadyControl(0);
            }
            else if (part == "about")
            {
                AboutPage ap = new AboutPage();
                this.Pager.Slides.Clear();
                this.Pager.Slides.Add(ap);
                this.Pager.ReadyControl(0);
            }
        }
 private void Page_Loaded(object sender, RoutedEventArgs e)
 {
     id = Convert.ToInt32(NavigationManager.GetQueryString("id"));
     Initialize();
 }