Exemplo n.º 1
0
 private void saveSong(string fileName)
 {
     SongManager.SaveSong(this.currentSong, fileName);
     this.songFileName = fileName;
     setFocusToEditor();
 }
Exemplo n.º 2
0
        private void cmdOk_Click(object sender, EventArgs e)
        {
            string selectedLanguage = cboIdioma.SelectedItem as string;

            bool continueWithOk  = true;
            bool languageChanged = selectedLanguage != LocalizationManager.GetCurrentCultureName();

            if (languageChanged)
            {
                System.Windows.Forms.DialogResult result = MessageBox.Show(
                    Properties.Resources.RestartMessage,
                    Properties.Resources.Warning,
                    MessageBoxButtons.YesNoCancel,
                    MessageBoxIcon.Warning);

                switch (result)
                {
                case System.Windows.Forms.DialogResult.Yes:
                    if (string.IsNullOrEmpty(ApplicationState.Instance.FileName))
                    {
                        this.sfd.Filter = WYZTracker.Properties.Resources.WYZFilter;
                        if (this.sfd.ShowDialog() == DialogResult.OK)
                        {
                            SongManager.SaveSong(ApplicationState.Instance.CurrentSong, this.sfd.FileName);
                        }
                    }
                    else
                    {
                        SongManager.SaveSong(ApplicationState.Instance.CurrentSong, ApplicationState.Instance.FileName);
                    }
                    break;

                case System.Windows.Forms.DialogResult.Cancel:
                    continueWithOk = false;
                    break;
                }
            }

            if (continueWithOk)
            {
                Properties.Settings.Default.CheckFileAssociation = chkCheckFileAssociation.Checked;
                Properties.Settings.Default.ShowSplash           = chkSplash.Checked;
                Properties.Settings.Default.UseCustomFont        = chkDigitalFont.Checked;
                Properties.Settings.Default.Language             = selectedLanguage;

                Properties.Settings.Default.ColumnWidth    = (int)numColWidth.Value;
                Properties.Settings.Default.FontSize       = (int)numFontSize.Value;
                Properties.Settings.Default.KeyboardLayout = cboKeyboardLayout.SelectedItem as string;

                //Properties.Settings.Default.SoundBufSize = (int)numBufSize.Value;

                Properties.Settings.Default.Save();

                LocalizationManager.LocalizeApplication(Properties.Settings.Default.Language);
                VirtualPiano.InitPianoKeys();
                //Player.BufferLengthInMs = Properties.Settings.Default.SoundBufSize;

                if (languageChanged)
                {
                    Program.Restart(ApplicationState.Instance.FileName);
                }
            }
            this.DialogResult = System.Windows.Forms.DialogResult.OK;
            this.Close();
        }