private void SettingsForm_Load(object sender, EventArgs e) { cbPriorityClass.DataSource = Enum.GetNames(typeof(ProcessPriorityClass)); cbArMode.DataSource = Enum.GetNames(typeof(MFVideoAspectRatioMode)); PlaySettings ps = new PlaySettings(); GetAudioDevices(cbAudioDevice, ps.AudioPlaybackDevice); AddLines(txtBlockedFilters, ps.BlockedFilters); AddLines(txtPreferedFilters, ps.PreferredDecoders); AddLines(txtReplacePaths, ps.ReplacePaths); txtMaxHeight.Text = ps.MaxInitialHeight.ToString(); txtMaxWidth.Text = ps.MaxInitialWidth.ToString(); txtMouseSensitivity.Text = ps.MouseSensitivity.ToString(); txtSkipBack1.Text = ps.SkipBack1.ToString(); txtSkipBack2.Text = ps.SkipBack2.ToString(); txtSkipForward1.Text = ps.SkipForward1.ToString(); txtSkipForward2.Text = ps.SkipForward2.ToString(); txtFSControlTimeout.Text = ps.FSControlTimeout.ToString(); chkPublishGraph.Checked = ps.PublishGraph; chkWriteLog.Checked = ps.WriteLog; txtFileHistory.Text = ps.FileHistory.ToString(); txtOverscanHeight.Text = ps.OverscanHeight.ToString(); txtOverscanWidth.Text = ps.OverscanWidth.ToString(); chkSingleInstance.Checked = ps.SingleInstance; txtSageWebserver.Text = ps.SageWebserver; txtUsername.Text = ps.SWUsername; txtPassword.Text = ps.SWPassword; chkAutoBrowse.Checked = ps.BrowseOnLoad; txtSageMac.Text = ps.WOLMac; txtBrowseAttempts.Text = ps.BrowseAttempts.ToString(); txtZoom.Text = ps.Zoom.ToString(); txtZoomIncrement.Text = ps.ZoomIncrement.ToString(); txtCustomPresenter.Text = ps.CustomPresenter; chkCustomPresenter.Checked = ps.CustomPresenterEnabled; txtCustomAudio.Text = ps.CustomAudioRender; chkCustomAudio.Checked = ps.UseCustomAudioRenderer; chkOpenMediaBrower.Checked = ps.OpenMediaBrowser; chkUseDtbXml.Checked = ps.UseDtbXml; chkMultichannelWMA.Checked = ps.MultiChannelWMA; chkUseBookmarks.Checked = ps.UseBookmarks; if (ps.PriorityClass > 0) cbPriorityClass.SelectedItem = Enum.GetName(typeof(ProcessPriorityClass), ps.PriorityClass); else cbPriorityClass.SelectedItem = Enum.GetName(typeof(ProcessPriorityClass), ProcessPriorityClass.Normal); cbArMode.SelectedItem = Enum.GetName(typeof(MFVideoAspectRatioMode), ps.VideoAspectRatioMode); if (!string.IsNullOrEmpty(ps.BookmarkDir)) txtBookmarkDir.Text = ps.BookmarkDir; else txtBookmarkDir.Text = MainForm.BaseBookmarkPath; txtDtbXmlPath.Text = ps.DtbXmlPath; }
private void btnOK_Click(object sender, EventArgs e) { try { PlaySettings ps = new PlaySettings(); ps.MaxInitialHeight = Convert.ToInt32(txtMaxHeight.Text); ps.MaxInitialWidth = Convert.ToInt32(txtMaxWidth.Text); ps.MouseSensitivity = Convert.ToInt32(txtMouseSensitivity.Text); ps.SkipBack1 = Convert.ToInt32(txtSkipBack1.Text); ps.SkipBack2 = Convert.ToInt32(txtSkipBack2.Text); ps.SkipForward1 = Convert.ToInt32(txtSkipForward1.Text); ps.SkipForward2 = Convert.ToInt32(txtSkipForward2.Text); ps.FSControlTimeout = Convert.ToInt32(txtFSControlTimeout.Text); ps.FileHistory = Convert.ToInt32(txtFileHistory.Text); ps.OverscanHeight = Convert.ToInt32(txtOverscanHeight.Text); ps.OverscanWidth = Convert.ToInt32(txtOverscanWidth.Text); ps.BrowseAttempts = Convert.ToInt32(txtBrowseAttempts.Text); ps.Zoom = Convert.ToSingle(txtZoom.Text); ps.ZoomIncrement = Convert.ToSingle(txtZoomIncrement.Text); ps.SageWebserver = txtSageWebserver.Text; ps.SWUsername = txtUsername.Text; ps.SWPassword = txtPassword.Text; ps.WOLMac = txtSageMac.Text; if (!string.IsNullOrEmpty(txtBookmarkDir.Text) && System.IO.Directory.Exists(txtBookmarkDir.Text)) ps.BookmarkDir = txtBookmarkDir.Text; ps.PublishGraph = chkPublishGraph.Checked; ps.WriteLog = chkWriteLog.Checked; ps.SingleInstance = chkSingleInstance.Checked; ps.BrowseOnLoad = chkAutoBrowse.Checked; ps.BlockedFilters = ConvertLines(txtBlockedFilters); ps.PreferredDecoders = ConvertLines(txtPreferedFilters); ps.ReplacePaths = ConvertLines(txtReplacePaths); ps.OpenMediaBrowser = chkOpenMediaBrower.Checked; ps.UseDtbXml = chkUseDtbXml.Checked; ps.PriorityClass = (int)Enum.Parse(typeof(ProcessPriorityClass), cbPriorityClass.Text); ps.DtbXmlPath = txtDtbXmlPath.Text; ps.MultiChannelWMA = chkMultichannelWMA.Checked; ps.CustomPresenterEnabled = chkCustomPresenter.Checked; ps.CustomPresenter = txtCustomPresenter.Text; ps.CustomAudioRender = txtCustomAudio.Text; ps.UseCustomAudioRenderer = chkCustomAudio.Checked; ps.VideoAspectRatioMode = (int)Enum.Parse(typeof(MFVideoAspectRatioMode), cbArMode.Text); ps.UseBookmarks = chkUseBookmarks.Checked; ps.AudioPlaybackDevice = (cbAudioDevice.SelectedItem as AudioDevice).Value; ps.Save(); this.DialogResult = DialogResult.OK; this.Close(); } catch (Exception ex) { MessageBox.Show("Error saving: {0}", ex.Message); } }
private void menuItemSettings_Click(object sender, EventArgs e) { SettingsForm sf = new SettingsForm(); if (sf.ShowDialog() == DialogResult.OK) ps = new PlaySettings(); }