public void ShowSettings(int tabindex, IWin32Window owner = null)
{
int pi = Conf.PreviewItems;
var settings = new Settings { MainClass = this, InitialTab = tabindex };
if (settings.ShowDialog(owner ?? this) == DialogResult.OK)
{
if (pi != Conf.PreviewItems)
NeedsMediaRefresh = Helper.Now;
_pnlCameras.BackColor = Conf.MainColor.ToColor();
notifyIcon1.Text = Conf.TrayIconText;
if (!string.IsNullOrEmpty(Conf.Joystick.id))
{
if (_jst == null)
{
_jst = new JoystickDevice();
}
_jst.ReleaseJoystick();
if (_tmrJoystick != null)
{
_tmrJoystick.Stop();
_tmrJoystick = null;
}
bool jsactive = false;
string[] sticks = _jst.FindJoysticks();
foreach (string js in sticks)
{
string[] nameid = js.Split('|');
if (nameid[1] == Conf.Joystick.id)
{
Guid g = Guid.Parse(nameid[1]);
jsactive = _jst.AcquireJoystick(g);
}
}
if (!jsactive)
{
_jst.ReleaseJoystick();
_jst = null;
}
else
{
_tmrJoystick = new Timer(100);
_tmrJoystick.Elapsed += TmrJoystickElapsed;
_tmrJoystick.Start();
}
}
else
{
if (_tmrJoystick != null)
{
_tmrJoystick.Stop();
_tmrJoystick = null;
}
if (_jst != null)
{
_jst.ReleaseJoystick();
_jst = null;
}
}
}
if (settings.ReloadResources)
{
RenderResources();
LoadCommands();
}
AddressIPv4 = ""; //forces reload
AddressIPv6 = "";
settings.Dispose();
SaveConfig();
Refresh();
}