2015-12-27 22:05:45 -05:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.ComponentModel;
|
|
|
|
|
using System.Data;
|
|
|
|
|
using System.Drawing;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using System.Windows.Forms;
|
|
|
|
|
using Mesen.GUI.Config;
|
2016-05-22 14:43:07 -04:00
|
|
|
|
using Mesen.GUI.GoogleDriveIntegration;
|
2015-12-27 22:05:45 -05:00
|
|
|
|
|
|
|
|
|
namespace Mesen.GUI.Forms.Config
|
|
|
|
|
{
|
|
|
|
|
public partial class frmPreferences : BaseConfigForm
|
|
|
|
|
{
|
|
|
|
|
public frmPreferences()
|
|
|
|
|
{
|
|
|
|
|
InitializeComponent();
|
|
|
|
|
|
|
|
|
|
Entity = ConfigManager.Config.PreferenceInfo;
|
|
|
|
|
|
2016-02-19 13:05:04 -05:00
|
|
|
|
AddBinding("DisplayLanguage", cboDisplayLanguage);
|
|
|
|
|
|
2016-02-08 23:23:31 -05:00
|
|
|
|
AddBinding("AutomaticallyCheckForUpdates", chkAutomaticallyCheckForUpdates);
|
2015-12-27 22:05:45 -05:00
|
|
|
|
AddBinding("SingleInstance", chkSingleInstance);
|
|
|
|
|
AddBinding("AutoLoadIpsPatches", chkAutoLoadIps);
|
|
|
|
|
AddBinding("AssociateNesFiles", chkNesFormat);
|
2016-01-31 14:03:12 -05:00
|
|
|
|
AddBinding("AssociateFdsFiles", chkFdsFormat);
|
|
|
|
|
AddBinding("AssociateMmoFiles", chkMmoFormat);
|
|
|
|
|
AddBinding("AssociateMstFiles", chkMstFormat);
|
2016-06-25 20:46:54 -04:00
|
|
|
|
AddBinding("AssociateNsfFiles", chkNsfFormat);
|
|
|
|
|
AddBinding("AssociateNsfeFiles", chkNsfeFormat);
|
2016-08-14 20:12:50 -04:00
|
|
|
|
AddBinding("AssociateUnfFiles", chkUnfFormat);
|
2016-06-25 20:46:54 -04:00
|
|
|
|
|
|
|
|
|
AddBinding("NsfAutoDetectSilence", chkNsfAutoDetectSilence);
|
|
|
|
|
AddBinding("NsfMoveToNextTrackAfterTime", chkNsfMoveToNextTrackAfterTime);
|
|
|
|
|
AddBinding("NsfMoveToNextTrackTime", nudNsfMoveToNextTrackTime);
|
|
|
|
|
AddBinding("NsfAutoDetectSilenceDelay", nudNsfAutoDetectSilenceDelay);
|
|
|
|
|
AddBinding("NsfDisableApuIrqs", chkNsfDisableApuIrqs);
|
2016-01-06 23:10:29 -05:00
|
|
|
|
|
2016-01-28 20:47:16 -05:00
|
|
|
|
AddBinding("FdsAutoLoadDisk", chkFdsAutoLoadDisk);
|
|
|
|
|
AddBinding("FdsFastForwardOnLoad", chkFdsFastForwardOnLoad);
|
2016-01-31 13:53:17 -05:00
|
|
|
|
|
|
|
|
|
AddBinding("PauseWhenInBackground", chkPauseWhenInBackground);
|
|
|
|
|
AddBinding("AllowBackgroundInput", chkAllowBackgroundInput);
|
2016-01-31 14:28:31 -05:00
|
|
|
|
|
|
|
|
|
AddBinding("PauseOnMovieEnd", chkPauseOnMovieEnd);
|
2016-05-22 14:43:07 -04:00
|
|
|
|
|
2016-06-15 21:59:34 -04:00
|
|
|
|
AddBinding("DisableGameDatabase", chkDisableGameDatabase);
|
|
|
|
|
|
2016-08-31 20:54:38 -04:00
|
|
|
|
AddBinding("AutoSave", chkAutoSave);
|
|
|
|
|
AddBinding("AutoSaveDelay", nudAutoSave);
|
|
|
|
|
AddBinding("AutoSaveNotify", chkAutoSaveNotify);
|
|
|
|
|
|
2016-05-22 14:43:07 -04:00
|
|
|
|
UpdateCloudDisplay();
|
2015-12-27 22:05:45 -05:00
|
|
|
|
}
|
|
|
|
|
|
2016-09-02 19:36:37 -04:00
|
|
|
|
protected override void UpdateConfig()
|
|
|
|
|
{
|
|
|
|
|
base.UpdateConfig();
|
|
|
|
|
ctrlEmulatorShortcuts.UpdateConfig();
|
|
|
|
|
}
|
|
|
|
|
|
2015-12-27 22:05:45 -05:00
|
|
|
|
protected override void OnFormClosed(FormClosedEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
base.OnFormClosed(e);
|
|
|
|
|
PreferenceInfo.ApplyConfig();
|
|
|
|
|
}
|
2016-01-31 13:53:17 -05:00
|
|
|
|
|
|
|
|
|
private void chkPauseWhenInBackground_CheckedChanged(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
chkAllowBackgroundInput.Enabled = !chkPauseWhenInBackground.Checked;
|
|
|
|
|
if(!chkAllowBackgroundInput.Enabled) {
|
|
|
|
|
chkAllowBackgroundInput.Checked = false;
|
|
|
|
|
}
|
|
|
|
|
}
|
2016-02-06 18:35:38 -05:00
|
|
|
|
|
|
|
|
|
private void btnOpenMesenFolder_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
System.Diagnostics.Process.Start(ConfigManager.HomeFolder);
|
|
|
|
|
}
|
2016-05-22 14:43:07 -04:00
|
|
|
|
|
|
|
|
|
private void UpdateCloudDisplay()
|
|
|
|
|
{
|
|
|
|
|
if(!this.IsDisposed) {
|
|
|
|
|
if(this.InvokeRequired) {
|
|
|
|
|
this.BeginInvoke((MethodInvoker)(() => this.UpdateCloudDisplay()));
|
|
|
|
|
} else {
|
|
|
|
|
this.tlpCloudSaveDesc.Visible = !ConfigManager.Config.PreferenceInfo.CloudSaveIntegration;
|
|
|
|
|
this.tlpCloudSaveEnabled.Visible = ConfigManager.Config.PreferenceInfo.CloudSaveIntegration;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void TryEnableSync(bool retry = true)
|
|
|
|
|
{
|
|
|
|
|
if(CloudSyncHelper.EnableSync()) {
|
|
|
|
|
if(!CloudSyncHelper.Sync()) {
|
|
|
|
|
if(retry) {
|
|
|
|
|
TryEnableSync(false);
|
|
|
|
|
} else {
|
|
|
|
|
MesenMsgBox.Show("GoogleDriveIntegrationError", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
UpdateCloudDisplay();
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
MesenMsgBox.Show("GoogleDriveIntegrationError", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void btnEnableIntegration_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
Task.Run(() => TryEnableSync());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void btnDisableIntegration_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
Task.Run(() => {
|
|
|
|
|
CloudSyncHelper.DisableSync();
|
|
|
|
|
UpdateCloudDisplay();
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void tmrSyncDateTime_Tick(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
btnDisableIntegration.Enabled = !CloudSyncHelper.Syncing;
|
|
|
|
|
btnResync.Enabled = btnDisableIntegration.Enabled;
|
|
|
|
|
|
|
|
|
|
if(ConfigManager.Config.PreferenceInfo.CloudLastSync != DateTime.MinValue) {
|
|
|
|
|
lblLastSyncDateTime.Text = ConfigManager.Config.PreferenceInfo.CloudLastSync.ToLongDateString() + " " + ConfigManager.Config.PreferenceInfo.CloudLastSync.ToLongTimeString();
|
|
|
|
|
} else {
|
|
|
|
|
lblLastSyncDateTime.Text = "";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void btnResync_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
Task.Run(() => CloudSyncHelper.Sync());
|
|
|
|
|
}
|
2016-08-31 20:54:38 -04:00
|
|
|
|
|
|
|
|
|
private void chkAutoSave_CheckedChanged(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
nudAutoSave.Enabled = chkAutoSave.Checked;
|
|
|
|
|
chkAutoSaveNotify.Enabled = chkAutoSave.Checked;
|
|
|
|
|
}
|
2015-12-27 22:05:45 -05:00
|
|
|
|
}
|
|
|
|
|
}
|