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 XenAPI;
|
|
|
|
using XenAdmin.Commands;
|
2021-03-16 02:50:45 +01:00
|
|
|
using XenAdmin.Core;
|
2013-06-24 13:41:48 +02:00
|
|
|
|
|
|
|
namespace XenAdmin.Dialogs
|
|
|
|
{
|
|
|
|
public partial class SelectHostDialog : XenDialogBase
|
|
|
|
{
|
2018-12-21 17:36:18 +01:00
|
|
|
public string HelpString = "License"; // don't i18n
|
2013-06-24 13:41:48 +02:00
|
|
|
|
|
|
|
public SelectHostDialog()
|
|
|
|
{
|
|
|
|
InitializeComponent();
|
2021-03-16 02:50:45 +01:00
|
|
|
label1.Text = string.Format(label1.Text, BrandManager.ProductBrand);
|
2013-06-24 13:41:48 +02:00
|
|
|
poolHostPicker1.AllowPoolSelect = false;
|
|
|
|
poolHostPicker1.SupressErrors = true;
|
2018-12-21 17:36:18 +01:00
|
|
|
poolHostPicker1.SelectedItemChanged += selectionChanged;
|
2013-06-24 13:41:48 +02:00
|
|
|
poolHostPicker1.buildList();
|
|
|
|
}
|
|
|
|
|
2018-12-21 17:36:18 +01:00
|
|
|
public string TopBlurb
|
2013-06-24 13:41:48 +02:00
|
|
|
{
|
2018-12-21 17:36:18 +01:00
|
|
|
set { label1.Text = value; }
|
2013-06-24 13:41:48 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// set image, must be 32x32
|
|
|
|
/// </summary>
|
2018-12-21 17:36:18 +01:00
|
|
|
public Image TopPicture
|
2013-06-24 13:41:48 +02:00
|
|
|
{
|
2018-12-21 17:36:18 +01:00
|
|
|
set { pictureBox1.Image = value; }
|
|
|
|
}
|
|
|
|
|
|
|
|
public string OkButtonText
|
|
|
|
{
|
|
|
|
set { okbutton.Text = value; }
|
2013-06-24 13:41:48 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
private void button3_Click(object sender, EventArgs e)
|
|
|
|
{
|
2021-08-31 12:31:16 +02:00
|
|
|
new AddHostCommand(Program.MainWindow, this).Run();
|
2013-06-24 13:41:48 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
public Host TheHost
|
|
|
|
{
|
|
|
|
get
|
|
|
|
{
|
|
|
|
return poolHostPicker1.ChosenHost;
|
|
|
|
}
|
|
|
|
set
|
|
|
|
{
|
|
|
|
poolHostPicker1.SelectHost(value);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
private void selectionChanged(object sender, XenAdmin.Controls.SelectedItemEventArgs e)
|
|
|
|
{
|
|
|
|
okbutton.Enabled = e.SomethingSelected;
|
|
|
|
}
|
|
|
|
|
|
|
|
private void okbutton_Click(object sender, EventArgs e)
|
|
|
|
{
|
|
|
|
DialogResult = DialogResult.OK;
|
|
|
|
Close();
|
|
|
|
}
|
|
|
|
|
|
|
|
private void cancelbutton_Click(object sender, EventArgs e)
|
|
|
|
{
|
|
|
|
DialogResult = DialogResult.Cancel;
|
|
|
|
Close();
|
|
|
|
}
|
|
|
|
|
|
|
|
internal override string HelpName
|
|
|
|
{
|
|
|
|
get
|
|
|
|
{
|
|
|
|
return Name + HelpString;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|