Beispiel #1
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Create and load all the views.
        /// </summary>
        /// ------------------------------------------------------------------------------------
        private void SetupViews()
        {
            CleanOutViews();

            foreach (ToolStripButton btn in tsMain.Items)
            {
                btn.Checked = false;
            }

            SpongeProject project = CurrentProject;

            _backgroundStatisticsGather = new BackgroundStatisticsMananager(project.SessionsFolder);
            _backgroundStatisticsGather.Start();

            var statisticsModel = new StatisticsViewModel(project, _backgroundStatisticsGather);

            _overviewView    = new OverviewVw(project, statisticsModel);
            _sessionsView    = new SessionsVw(CurrentProject, CurrentProject.GetPeopleNames);
            _peopleView      = new PeopleVw(CurrentProject);
            _sendReceiveView = new SendReceiveVw();
            _setupView       = new SetupVw();

            var views = new Control[] { _overviewView, _sessionsView,
                                        _peopleView, _sendReceiveView, _setupView };

            Controls.AddRange(views);
            _viewManger = new ViewButtonManager(tsMain, views);
        }
Beispiel #2
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Remove and dispose of existing view controls.
        /// </summary>
        /// ------------------------------------------------------------------------------------
        private void CleanOutViews()
        {
            if (_overviewView != null)
            {
                Controls.Remove(_overviewView);
                Controls.Remove(_sessionsView);
                Controls.Remove(_peopleView);
                Controls.Remove(_sendReceiveView);
                Controls.Remove(_setupView);

                _overviewView.Dispose();
                _sessionsView.Dispose();
                _peopleView.Dispose();
                _sendReceiveView.Dispose();
                _setupView.Dispose();
            }

            if (_viewManger != null)
            {
                _viewManger.Dispose();
            }

            if (_backgroundStatisticsGather != null)
            {
                _backgroundStatisticsGather.Dispose();
                _backgroundStatisticsGather = null;
            }
        }