Inheritance: System.Windows.Controls.UserControl
        private void MoveToContentPanel(BaseUnifiedSettingsPanel newPanel)
        {
            _currentContent.SaveData();

            _previousContent.Add(_currentContent);
            _currentContent = newPanel;
            UpdateContentInUI();
        }
        public UnifiedSettingsCtrl()
        {
            InitializeComponent();
            _previousContent = new List <BaseUnifiedSettingsPanel>();
            _allPanels       = new List <BaseUnifiedSettingsPanel>();

            BaseUnifiedSettingsPanel.EnableAdvancedSettings = false;
            BaseUnifiedSettingsPanel.EnabledDebugSettings   = false;
            BaseUnifiedSettingsPanel.EnableSuperSettings    = false;

            _mainPanel = new UnifiedSettingsMainCtrl();
            _mainPanel.ShowSettingsUpdate += HandleShowSettingsUpdate;
            InitializePanelAndEvents(_mainPanel);

            _generalPanel = new UnifiedSettingsGeneralCtrl();
            InitializePanelAndEvents(_generalPanel);

            _audioVideoPanel = new UnifiedSettingsAudioVideoCtrl();
            InitializePanelAndEvents(_audioVideoPanel);

            _themePanel = new UnifiedSettingsThemeCtrl();
            InitializePanelAndEvents(_themePanel);

            _textPanel = new UnifiedSettingsTextCtrl();
            InitializePanelAndEvents(_textPanel);

            _summaryPanel = new UnifiedSettingsSummaryCtrl();
            _summaryPanel.ShowSettingsUpdate += HandleShowSettingsUpdate;
            InitializePanelAndEvents(_summaryPanel);

            _audioSettingsPanel = new UnifiedSettingsAudioCtrl();
            InitializePanelAndEvents(_audioSettingsPanel);

            _videoSettingsPanel = new UnifiedSettingsVideoCtrl();
            InitializePanelAndEvents(_videoSettingsPanel);

            _callSettingsPanel = new UnifiedSettingsCallCtrl();
            InitializePanelAndEvents(_callSettingsPanel);

            _networkSettingsPanel = new UnifiedSettingsNetworkCtrl();
            InitializePanelAndEvents(_networkSettingsPanel);

            _advancedSettingsPanel = new UnifiedSettingsAdvancedCtrl();
            InitializePanelAndEvents(_advancedSettingsPanel);

            _viewTechnicalSupportPanel = new TechnicalSupportSheetCtrl();
            InitializePanelAndEvents(_viewTechnicalSupportPanel);

            _currentContent = _mainPanel;
#if DEBUG
            HandleShowSettingsUpdate(UnifiedSettings_LevelToShow.Normal, true);
#else
            HandleShowSettingsUpdate(UnifiedSettings_LevelToShow.Normal, true);
#endif
            UpdateContentInUI();
        }
        public SettingsWindow(CallViewCtrl callControl, UnifiedSettings_AccountChange accountChangeRequestedMethod)
        {
            //************************************************************************************************************************************
            // Initilize of setting screen More==>Settings. Called only once when application runs first time.
            //************************************************************************************************************************************
            InitializeComponent();

            AccountChangeRequested += accountChangeRequestedMethod;

            _allPanels = new List <BaseUnifiedSettingsPanel>();

            BaseUnifiedSettingsPanel.EnableAdvancedSettings = false;
            BaseUnifiedSettingsPanel.EnabledDebugSettings   = false;
            BaseUnifiedSettingsPanel.EnableSuperSettings    = false;

            AccountSettings.ShowSettingsUpdate += HandleShowSettingsUpdate;
            AccountSettings.updateVideomail    += OnUpdateVideomail;
            AccountSettings.ShiftFocus         += focusCloseButton;
            InitializePanelAndEvents(AccountSettings);

            InitializePanelAndEvents(GeneralSettings);

            InitializePanelAndEvents(AudioVideoSettings);

            InitializePanelAndEvents(ThemeSettings);

            InitializePanelAndEvents(TextSettings);

            SummarySettings.ShowSettingsUpdate += HandleShowSettingsUpdate;
            InitializePanelAndEvents(SummarySettings);

//            InitializePanelAndEvents(AudioSettings);

//            InitializePanelAndEvents(VideoSettings);

//            InitializePanelAndEvents(CallSettings);

//            InitializePanelAndEvents(NetworkSettings);

            InitializePanelAndEvents(AdvancedSettings);

//            InitializePanelAndEvents(_viewTechnicalSupportPanel);

            _currentContent = GeneralSettings;
#if DEBUG
            HandleShowSettingsUpdate(UnifiedSettings_LevelToShow.Normal, true);
#else
            HandleShowSettingsUpdate(UnifiedSettings_LevelToShow.Normal, true);
#endif
            SetCallControl(callControl);

            this.Loaded += SettingsWindow_Loaded;

            AudioVideoSettings.UpdateAdvancedMenuHandler += UpdateAdvancedMenuBitrate;
        }
        private void InitializePanelAndEvents(BaseUnifiedSettingsPanel panel)
        {
            if (panel == null)
            {
                return;
            }

            if (!_allPanels.Contains(panel))
            {
                _allPanels.Add(panel);
            }

            panel.ContentChanging        += HandleContentChanging;
            panel.AccountChangeRequested += HandleAccountChangeRequested;
        }
        public SettingsWindow(CallViewCtrl callControl, UnifiedSettings_AccountChange accountChangeRequestedMethod)
        {
            InitializeComponent();

            AccountChangeRequested += accountChangeRequestedMethod;

            _allPanels = new List<BaseUnifiedSettingsPanel>();

            BaseUnifiedSettingsPanel.EnableAdvancedSettings = false;
            BaseUnifiedSettingsPanel.EnabledDebugSettings = false;
            BaseUnifiedSettingsPanel.EnableSuperSettings = false;

            AccountSettings.ShowSettingsUpdate += HandleShowSettingsUpdate;
            InitializePanelAndEvents(AccountSettings);

            InitializePanelAndEvents(GeneralSettings);

            InitializePanelAndEvents(AudioVideoSettings);

            InitializePanelAndEvents(ThemeSettings);

            InitializePanelAndEvents(TextSettings);

            SummarySettings.ShowSettingsUpdate += HandleShowSettingsUpdate;
            InitializePanelAndEvents(SummarySettings);

            //            InitializePanelAndEvents(AudioSettings);

            //            InitializePanelAndEvents(VideoSettings);

            //            InitializePanelAndEvents(CallSettings);

            //            InitializePanelAndEvents(NetworkSettings);

            InitializePanelAndEvents(AdvancedSettings);

            //            InitializePanelAndEvents(_viewTechnicalSupportPanel);

            _currentContent = GeneralSettings;
            #if DEBUG
            HandleShowSettingsUpdate(UnifiedSettings_LevelToShow.Normal, true);
            #else
            HandleShowSettingsUpdate(UnifiedSettings_LevelToShow.Normal, true);
            #endif
            SetCallControl(callControl);

            this.Loaded += SettingsWindow_Loaded;
        }
        private void HandleContentChanging(UnifiedSettingsContentType newContentType)
        {
            switch (newContentType)
            {
            case UnifiedSettingsContentType.MainContent:     // clear previous, set to main
                _currentContent.SaveData();
                _previousContent.Clear();
                _currentContent = _mainPanel;
                UpdateContentInUI();
                break;

            case UnifiedSettingsContentType.GeneralContent: MoveToContentPanel(_generalPanel);
                break;

            case UnifiedSettingsContentType.AudioVideoContent: MoveToContentPanel(_audioVideoPanel);
                break;

            case UnifiedSettingsContentType.ThemeContent: MoveToContentPanel(_themePanel);
                break;

            case UnifiedSettingsContentType.TextContent: MoveToContentPanel(_textPanel);
                break;

            case UnifiedSettingsContentType.SummaryContent: MoveToContentPanel(_summaryPanel);
                break;

            case UnifiedSettingsContentType.AudioSettingsContent: MoveToContentPanel(_audioSettingsPanel);
                break;

            case UnifiedSettingsContentType.VideoSettingsContent: MoveToContentPanel(_videoSettingsPanel);
                break;

            case UnifiedSettingsContentType.CallSettingsContent: MoveToContentPanel(_callSettingsPanel);
                break;

            case UnifiedSettingsContentType.NetworkSettingsContent: MoveToContentPanel(_networkSettingsPanel);
                break;

            case UnifiedSettingsContentType.AdvancedSettingsContent: MoveToContentPanel(_advancedSettingsPanel);
                break;

            case UnifiedSettingsContentType.ViewTSS: MoveToContentPanel(_viewTechnicalSupportPanel);
                break;

            default: break;
            }
        }
        private void TabControl_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            _currentContent.SaveData();
            if (GeneralTab.IsSelected)
            {
                _currentContent = GeneralSettings;
            }
            else if (AudioVideoTab.IsSelected)
            {
                _currentContent = AudioVideoSettings;
            }
            else if (TextTab.IsSelected)
            {
                _currentContent = TextSettings;
            }
            else if (ThemeTab.IsSelected)
            {
                _currentContent = ThemeSettings;
            }
            else if (SummaryTab.IsSelected)
            {
                _currentContent = SummarySettings;
            }
            else if (AccountTab.IsSelected)
            {
                _currentContent = AccountSettings;
            }
            else if (MediaTab.IsSelected)
            {
//                _currentContent = MediaSettings;
            }
            else if (TestingTab.IsSelected)
            {
//                _currentContent = TestingSettings;
            }
            else if (AdvancedTab.IsSelected)
            {
                _currentContent = AdvancedSettings;
            }
        }
        private void OnBack(object sender, RoutedEventArgs e)
        {
            Console.WriteLine("Back Clicked");
            if (_currentContent == _mainPanel)
            {
                // ignore
                return;
            }
            if (_previousContent.Count > 0)
            {
                // beacuse this comes from the main control not from within the content,
                //   make sure that the current data is saved before changing content
                _currentContent.SaveData();

                // set the new content in this panel
                _currentContent = _previousContent[_previousContent.Count - 1];
                // pop the panel that is now the current panel off the previous stack
                _previousContent.Remove(_currentContent);

                UpdateContentInUI();
            }
        }
        private void UpdateContentInUI()
        {
            // in case current content is not set, revert to main panel to 'restart'
            if (_currentContent == null)
            {
                Console.WriteLine("UnifiedSettings: Navigation error - _currentContent is null");
                _currentContent = _mainPanel;
                _previousContent.Clear();
                this.ContentPanel.Content = _mainPanel;
            }
            _currentContent.Initialize();
            this.ContentPanel.Content = _currentContent;
            this.TitleLabel.Content   = _currentContent.Title;
            this.MaxWidth             = 300;

            if (_currentContent == _mainPanel)
            {
                BackLabel.Content = "";
            }
            else
            {
                BackLabel.Content = "< Back";
            }
        }
 //        protected override void OnClosing(System.ComponentModel.CancelEventArgs e)
 //        {
 //            //base.OnClosing(e);
 //            e.Cancel = true;
 //            SetHidden();
 //        }
 private void TabControl_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     if (_currentContent != null)
         _currentContent.SaveData();
     if (GeneralTab.IsSelected)
     {
         _currentContent = GeneralSettings;
     }
     else if (AudioVideoTab.IsSelected)
     {
         _currentContent = AudioVideoSettings;
     }
     else if (TextTab.IsSelected)
     {
         _currentContent = TextSettings;
     }
     else if (ThemeTab.IsSelected)
     {
         _currentContent = ThemeSettings;
     }
     else if (SummaryTab.IsSelected)
     {
         _currentContent = SummarySettings;
     }
     else if (AccountTab.IsSelected)
     {
         _currentContent = AccountSettings;
     }
     else if (MediaTab.IsSelected)
     {
     //                _currentContent = MediaSettings;
     }
     else if (TestingTab.IsSelected)
     {
     //                _currentContent = TestingSettings;
     }
     else if (AdvancedTab.IsSelected)
     {
         _currentContent = AdvancedSettings;
     }
 }
        private void InitializePanelAndEvents(BaseUnifiedSettingsPanel panel)
        {
            if (panel == null)
                return;

            if (!_allPanels.Contains(panel))
            {
                _allPanels.Add(panel);
            }
            //            panel.ContentChanging += HandleContentChanging;
            panel.AddAccountChangedMethod(HandleAccountChangeRequested);
            //            panel.AccountChangeRequested += HandleAccountChangeRequested;
        }