예제 #1
0
        void Init()
        {
            _mainBox = new VBox();

            _headerBox = new HBox
            {
                Margin = new WidgetSpacing(6, 6, 6, 6)
            };

            _appNameLabel = new Label
            {
                Font = Font.SystemFont.WithSize(24)
            };

            _titleLabel = new Label("Dashboard")
            {
                Font = Font.SystemFont.WithSize(24)
            };

            _rangeBox = new HBox
            {
                HorizontalPlacement = WidgetPlacement.Center
            };

            _lastDayToggle = new ToggleButton("Today");

            _lastWeekToggle = new ToggleButton("Last Week")
            {
                Active = true
            };

            _lastMonthToggle = new ToggleButton("Last Month");

            _appsCombo = new ComboBox
            {
                VerticalPlacement = WidgetPlacement.Center,
                WidthRequest      = 250
            };

            _separator = new HSeparator();

            _contentBox = new VBox();

            _contentSpinner = new MDSpinner
            {
                Animate = true,
                Visible = false
            };

            _contentScroll = new ScrollView
            {
                BorderVisible = false
            };

            _contentScrollBox = new VBox();

            _firstBox = new HBox();

            _devicesFrameBox = new RoundedFrameBox
            {
                BackgroundColor = Styles.BaseBackgroundColor,
                Margin          = new WidgetSpacing(6, 6, 6, 6)
            };

            _devicesBox = new VBox
            {
                HeightRequest = 300
            };

            _devicesTitleLabel = new Label("Devices")
            {
                Font   = Font.SystemFont.WithSize(14),
                Margin = new WidgetSpacing(6, 6, 6, 6)
            };

            _devicesPlotView = new PlotView
            {
                BorderWidth   = 0,
                HeightRequest = 200,
                WidthRequest  = 200,
                Visible       = true
            };

            _devicesPlotView.ModifyBg(Gtk.StateType.Normal, Styles.BaseBackgroundColor.ToGdkColor());

            _countriesFrameBox = new RoundedFrameBox
            {
                BackgroundColor = Styles.BaseBackgroundColor,
                Margin          = new WidgetSpacing(6, 6, 6, 6)
            };

            _countriesBox = new VBox
            {
                HeightRequest = 300
            };

            _countriesTitleLabel = new Label("Countries")
            {
                Font   = Font.SystemFont.WithSize(14),
                Margin = new WidgetSpacing(6, 6, 6, 6)
            };

            _countriesPlotView = new PlotView
            {
                BorderWidth   = 0,
                HeightRequest = 200,
                WidthRequest  = 200,
                Visible       = true
            };

            _countriesPlotView.ModifyBg(Gtk.StateType.Normal, Styles.BaseBackgroundColor.ToGdkColor());

            _languagesFrameBox = new RoundedFrameBox
            {
                BackgroundColor = Styles.BaseBackgroundColor,
                Margin          = new WidgetSpacing(6, 6, 6, 6)
            };

            _languagesBox = new VBox
            {
                HeightRequest = 300
            };

            _languagesTitleLabel = new Label("Languages")
            {
                Font   = Font.SystemFont.WithSize(14),
                Margin = new WidgetSpacing(6, 6, 6, 6)
            };

            _languagesPlotView = new PlotView
            {
                BorderWidth   = 0,
                HeightRequest = 200,
                WidthRequest  = 200,
                Visible       = true
            };

            _languagesPlotView.ModifyBg(Gtk.StateType.Normal, Styles.BaseBackgroundColor.ToGdkColor());

            _secondBox = new HBox();

            _usersFrameBox = new RoundedFrameBox
            {
                BackgroundColor = Styles.BaseBackgroundColor,
                Margin          = new WidgetSpacing(6, 6, 6, 6)
            };

            _usersBox = new VBox
            {
                HeightRequest = 600
            };

            _usersTitleLabel = new Label("Active Users")
            {
                Font   = Font.SystemFont.WithSize(14),
                Margin = new WidgetSpacing(6, 6, 6, 6)
            };

            _usersPlotView = new PlotView
            {
                Visible = true
            };

            _usersPlotView.ModifyBg(Gtk.StateType.Normal, Styles.BaseBackgroundColor.ToGdkColor());

            _thirdBox = new HBox();

            _durationsFrameBox = new RoundedFrameBox
            {
                BackgroundColor = Styles.BaseBackgroundColor,
                Margin          = new WidgetSpacing(6, 6, 6, 6)
            };

            _durationsBox = new VBox();

            _durationsTitleLabel = new Label("Session Durations")
            {
                Font   = Font.SystemFont.WithSize(14),
                Margin = new WidgetSpacing(6, 6, 6, 6)
            };

            _durationsView = new ListView
            {
                SelectionMode = SelectionMode.None,
                HeightRequest = 200,
                Margin        = new WidgetSpacing(6, 6, 6, 6)
            };

            _descriptionField = new DataField <string>();
            _countField       = new DataField <int>();

            _durationsStore = new ListStore(_descriptionField, _countField);

            _durationsView.Columns.Add(new ListViewColumn("", new TextCellView(_descriptionField)
            {
                Editable = false
            }));
            _durationsView.Columns.Add(new ListViewColumn("Count", new TextCellView(_countField)
            {
                Editable = false
            }));

            _durationsView.DataSource = _durationsStore;

            _statisticsFrameBox = new RoundedFrameBox
            {
                BackgroundColor = Styles.BaseBackgroundColor,
                Margin          = new WidgetSpacing(6, 6, 6, 6)
            };

            _statisticsBox = new VBox();

            _statisticsTitleLabel = new Label("Session Statistics")
            {
                Font   = Font.SystemFont.WithSize(14),
                Margin = new WidgetSpacing(6, 6, 6, 6)
            };

            _statisticsView = new ListView
            {
                SelectionMode = SelectionMode.None,
                HeightRequest = 100,
                Margin        = new WidgetSpacing(6, 6, 6, 6)
            };

            _statisticsDescriptionField = new DataField <string>();
            _statisticsCountField       = new DataField <double>();
            _statisticsChangeField      = new DataField <string>();

            _statisticsStore = new ListStore(_statisticsDescriptionField, _statisticsCountField, _statisticsChangeField);

            _statisticsView.Columns.Add(new ListViewColumn("", new TextCellView(_statisticsDescriptionField)
            {
                Editable = false
            }));
            _statisticsView.Columns.Add(new ListViewColumn("Count", new TextCellView(_statisticsCountField)
            {
                Editable = false
            }));
            _statisticsView.Columns.Add(new ListViewColumn("Change", new TextCellView(_statisticsChangeField)
            {
                Editable = false
            }));

            _statisticsView.DataSource = _statisticsStore;
        }