Пример #1
0
                public StatsPanel(string number, string text)
                {
                        this.Orientation = System.Windows.Controls.Orientation.Horizontal;
                        this.HorizontalAlignment = System.Windows.HorizontalAlignment.Center;
                        _number = new NumberBlock();
                        _number.Text = number;

                        _text = new StatsBlock();
                        _text.Text = text;
                        _text.VerticalAlignment = System.Windows.VerticalAlignment.Bottom;

                        this.Children.Add(_number);
                        this.Children.Add(_text);
                }//ctor
                }//ctor()

                private void SetUpProjectsPanel()
                {
                        _projectsPanel = new StackPanel();
                        _projectsPanel.Orientation = Orientation.Horizontal;
                        _projectsPanel.HorizontalAlignment = System.Windows.HorizontalAlignment.Center;
                        _projectsList = new Selector(Paths.PROJECTS_SAVE).SelectProjects();
                        _projects = new StatsBlock();

                        _projectsNB = _projectsList.Count;
                        _projectsNumber = new NumberBlock();
                        _projectsNumber.Text = _projectsNB.ToString();
                        _projects.Text = " projects.";
                        _projects.VerticalAlignment = System.Windows.VerticalAlignment.Bottom;

                        _projectsPanel.Children.Add(_projectsNumber);
                        _projectsPanel.Children.Add(_projects);
                }//SetUpProjectsPanel()
                private void SetUpDPanel()
                {
                        _projectsDPanel = new StackPanel();
                        _projectsDPanel.Orientation = Orientation.Horizontal;
                        _projectsDPanel.HorizontalAlignment = System.Windows.HorizontalAlignment.Center;
                        _projectsDNumber = new NumberBlock();
                        _projectsDNumber.Text = _projectsDNB.ToString();

                        _projectsD = new StatsBlock();

                        if(_projectsDNumber.Text == "1")
                             _projectsD.Text = " project finished.";
                        else
                            _projectsD.Text = " projects finished.";
                                            
                        _projectsD.VerticalAlignment = System.Windows.VerticalAlignment.Bottom;

                        _projectsDPanel.Children.Add(_projectsDNumber);
                        _projectsDPanel.Children.Add(_projectsD);
                }
                private void SetUpProjectsIPPanel()
                {
                        _projectsIPPanel = new StackPanel();
                        _projectsIPPanel.Orientation = Orientation.Horizontal;
                        _projectsIPPanel.HorizontalAlignment = System.Windows.HorizontalAlignment.Center;
                        _projectsIPNumber = new NumberBlock();
                        _projectsIPNB = GetProjectsIP();
                        _projectsIPNumber.Text = _projectsIPNB.ToString();
                        _projectsIP = new StatsBlock();
                        _projectsIP.Text = " projects in progress.";
                        _projectsIP.VerticalAlignment = System.Windows.VerticalAlignment.Bottom;

                        _projectsIPPanel.Children.Add(_projectsIPNumber);
                        _projectsIPPanel.Children.Add(_projectsIP);
                }
                private void SetUpPercentagePanel()
                {
                        _percentagePanel = new StackPanel();
                        _percentagePanel.Orientation = Orientation.Horizontal;
                        _percentagePanel.HorizontalAlignment = System.Windows.HorizontalAlignment.Center;

                        _percentageNB = new NumberBlock();
                        _percentageNB.Text = Convert.ToInt64(_projectsDNB / _projectsNB * 100).ToString();


                        _percentageText = new StatsBlock();
                        _percentageText.Text = "% of finished projects (YAY ! ).";
                        _percentageText.VerticalAlignment = System.Windows.VerticalAlignment.Bottom;

                        _percentagePanel.Children.Add(_percentageNB);
                        _percentagePanel.Children.Add(_percentageText);
                }