2023-01-24 15:29:31 +01:00
|
|
|
|
/* Copyright (c) Cloud Software Group, Inc.
|
2013-06-24 13:41:48 +02:00
|
|
|
|
*
|
|
|
|
|
* Redistribution and use in source and binary forms,
|
|
|
|
|
* with or without modification, are permitted provided
|
|
|
|
|
* that the following conditions are met:
|
|
|
|
|
*
|
|
|
|
|
* * Redistributions of source code must retain the above
|
|
|
|
|
* copyright notice, this list of conditions and the
|
|
|
|
|
* following disclaimer.
|
|
|
|
|
* * Redistributions in binary form must reproduce the above
|
|
|
|
|
* copyright notice, this list of conditions and the
|
|
|
|
|
* following disclaimer in the documentation and/or other
|
|
|
|
|
* materials provided with the distribution.
|
|
|
|
|
*
|
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
|
|
|
|
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
|
|
|
|
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
|
|
|
|
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
|
|
|
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
|
|
|
|
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
|
|
|
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
|
|
|
|
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
|
|
|
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
|
|
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
|
|
|
|
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
|
|
|
|
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
|
|
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
|
|
|
* SUCH DAMAGE.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
using System;
|
|
|
|
|
using System.Drawing;
|
|
|
|
|
using System.Windows.Forms;
|
|
|
|
|
using XenAdmin.Core;
|
|
|
|
|
using XenAdmin.Dialogs.OptionsPages;
|
|
|
|
|
using XenAdmin.Plugins;
|
|
|
|
|
|
|
|
|
|
namespace XenAdmin.Dialogs
|
|
|
|
|
{
|
|
|
|
|
public partial class OptionsDialog : VerticallyTabbedDialog
|
|
|
|
|
{
|
|
|
|
|
internal OptionsDialog(PluginManager pluginManager)
|
|
|
|
|
{
|
|
|
|
|
InitializeComponent();
|
2020-10-22 03:07:02 +02:00
|
|
|
|
pluginOptionsPage1.SetPluginManager(pluginManager, false);//do not request rebuild; it will be done on load
|
2013-06-24 13:41:48 +02:00
|
|
|
|
verticalTabs.SelectedItem = securityOptionsPage1;
|
|
|
|
|
|
|
|
|
|
if (!Application.RenderWithVisualStyles)
|
|
|
|
|
ContentPanel.BackColor = SystemColors.Control;
|
|
|
|
|
// call save serverlist on OK
|
|
|
|
|
saveAndRestoreOptionsPage1.SaveAllAfter = true;
|
|
|
|
|
}
|
|
|
|
|
|
2020-10-22 03:07:02 +02:00
|
|
|
|
protected override void OnLoad(EventArgs e)
|
2020-06-20 12:58:29 +02:00
|
|
|
|
{
|
2020-10-22 03:07:02 +02:00
|
|
|
|
base.OnLoad(e);
|
|
|
|
|
|
|
|
|
|
foreach (IOptionsPage page in verticalTabs.Items)
|
|
|
|
|
page.Build();
|
2020-06-20 12:58:29 +02:00
|
|
|
|
}
|
|
|
|
|
|
2013-06-24 13:41:48 +02:00
|
|
|
|
private void okButton_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
2020-10-22 03:07:02 +02:00
|
|
|
|
foreach (IOptionsPage page in verticalTabs.Items)
|
|
|
|
|
{
|
2023-05-11 13:04:44 +02:00
|
|
|
|
if (!page.IsValidToSave(out Control control, out string invalidReason))
|
2020-10-22 03:07:02 +02:00
|
|
|
|
{
|
|
|
|
|
SelectPage(page);
|
2023-05-11 13:04:44 +02:00
|
|
|
|
page.ShowValidationMessages(control, invalidReason);
|
2020-10-22 03:07:02 +02:00
|
|
|
|
DialogResult = DialogResult.None;
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2013-06-24 13:41:48 +02:00
|
|
|
|
foreach (IOptionsPage page in verticalTabs.Items)
|
|
|
|
|
page.Save();
|
|
|
|
|
|
|
|
|
|
Settings.TrySaveSettings();
|
2020-06-19 18:31:01 +02:00
|
|
|
|
Settings.Log();
|
2013-06-24 13:41:48 +02:00
|
|
|
|
Close();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void cancelButton_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
Close();
|
|
|
|
|
}
|
2013-12-22 18:17:04 +01:00
|
|
|
|
|
|
|
|
|
public void SelectConnectionOptionsPage()
|
|
|
|
|
{
|
|
|
|
|
SelectPage(connectionOptionsPage1);
|
|
|
|
|
}
|
2021-08-23 11:34:46 +02:00
|
|
|
|
|
2021-11-29 16:20:33 +01:00
|
|
|
|
public void SelectExternalToolsPage()
|
|
|
|
|
{
|
|
|
|
|
SelectPage(externalToolsOptionsPage1);
|
|
|
|
|
}
|
|
|
|
|
|
2021-08-23 11:34:46 +02:00
|
|
|
|
private void OptionsDialog_Move(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
HideValidationToolTips();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void verticalTabs_SelectedIndexChanged(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
HideValidationToolTips();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void HideValidationToolTips()
|
|
|
|
|
{
|
|
|
|
|
foreach (IOptionsPage page in verticalTabs.Items)
|
|
|
|
|
{
|
|
|
|
|
page.HideValidationMessages();
|
|
|
|
|
}
|
|
|
|
|
}
|
2013-06-24 13:41:48 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|