Exemplo n.º 1
0
        private void Controller_Load(object sender, EventArgs e)
        {
            if (this.DesignMode || System.Diagnostics.Process.GetCurrentProcess().ProcessName.ToLowerInvariant().StartsWith("devenv"))
            {
                return;
            }

            if (!String.IsNullOrEmpty(Settings.Default.LastProjectFile))
            {
                OpenFile(Settings.Default.LastProjectFile);
            }

            m_HasLocalPlayer      = FindLocalPlayer() != null;
            connectButton.Enabled = m_HasLocalPlayer;
            openButton.Enabled    = Controllers.Control.Instance.IsConnected;
            UpdateProjectTitle();

            m_ServerSearch              = new Controllers.ServerSearch(Settings.Default.ServerSearchPort);
            m_ServerSearch.ServerFound += new EventHandler <Controllers.ServerEventArgs>(m_ServerSearch_ServerFound);
            m_ServerSearch.StartSearch();

            if (Settings.Default.CheckForNewVersion || Settings.Default.StartLocalPlayer || Settings.Default.ShowOverlayPanel)
            {
                m_FirstTimer          = new Timer();
                m_FirstTimer.Interval = 2000;
                m_FirstTimer.Tick    += new EventHandler(m_FirstTimer_Tick);
                m_FirstTimer.Start();
            }
        }
Exemplo n.º 2
0
        private void ShowSettings()
        {
            MusicSettings musicSettings = new MusicSettings();

            musicSettings.MusicOnAllSpeakers = m_IsMusicOnAllSpeakers;
            musicSettings.MusicFadeOption    = m_MusicFadingOption;
            musicSettings.MusicFadeTime      = m_MusicFadingTime;
            SettingsDialog dialog = new SettingsDialog(musicSettings);
            DialogResult   result = dialog.ShowDialog(this);

            if (result == DialogResult.OK)
            {
                if (m_ServerSearch.IsSearching)
                {
                    m_ServerSearch.StopSearch();
                    m_ServerSearch.Dispose();
                    m_ServerSearch              = new Controllers.ServerSearch(Settings.Default.ServerSearchPort);
                    m_ServerSearch.ServerFound += new EventHandler <Controllers.ServerEventArgs>(m_ServerSearch_ServerFound);
                    m_ServerSearch.StartSearch();
                }
                else
                {
                    m_ServerSearch.Dispose();
                    m_ServerSearch              = new Controllers.ServerSearch(Settings.Default.ServerSearchPort);
                    m_ServerSearch.ServerFound += new EventHandler <Controllers.ServerEventArgs>(m_ServerSearch_ServerFound);
                }
                m_HasLocalPlayer      = FindLocalPlayer() != null;
                connectButton.Enabled = m_HasLocalPlayer || Controllers.Control.Instance.IsConnected;
                openButton.Enabled    = Controllers.Control.Instance.IsConnected;
                musicSettings         = dialog.MusicSettings;
                Controllers.Control.Instance.SetMusicOnAllSpeakers(musicSettings.MusicOnAllSpeakers);
                Controllers.Control.Instance.SetMusicFading(musicSettings.MusicFadeOption, musicSettings.MusicFadeTime);

                if (!Controllers.Control.Instance.IsConnected && m_HasLocalPlayer && Settings.Default.StartLocalPlayer)
                {
                    m_FirstTimer          = new Timer();
                    m_FirstTimer.Interval = 2000;
                    m_FirstTimer.Tick    += new EventHandler(m_FirstTimer_Tick2);
                    m_FirstTimer.Start();
                }
            }
        }