Skip to content

Commit

Permalink
Hide from designer TabPage properties that are not meaningful at desi…
Browse files Browse the repository at this point in the history
…gn time. Minor tidy up.

Signed-off-by: Konstantina Chremmou <[email protected]>
  • Loading branch information
kc284 committed Oct 25, 2023
1 parent 9b2204d commit 7b41c3a
Show file tree
Hide file tree
Showing 10 changed files with 43 additions and 25 deletions.
4 changes: 4 additions & 0 deletions XenAdmin/Controls/AD/LoggedInLabel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
* SUCH DAMAGE.
*/

using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;
using XenAPI;
Expand All @@ -39,6 +40,9 @@ namespace XenAdmin.Controls
public partial class LoggedInLabel : UserControl
{
private IXenConnection connection;

[Browsable(false)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public IXenConnection Connection
{
get
Expand Down
1 change: 0 additions & 1 deletion XenAdmin/MainWindow.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions XenAdmin/TabPages/DockerDetailsPage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
using XenAdmin.Model;
using System.Xml;
using System.Collections;
using System.ComponentModel;

namespace XenAdmin.TabPages
{
Expand All @@ -49,6 +50,8 @@ public partial class DockerDetailsPage : BaseTabPage
private Host host;
private string cachedResult;

[Browsable(false)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public DockerContainer DockerContainer
{
get
Expand Down
3 changes: 3 additions & 0 deletions XenAdmin/TabPages/DockerProcessPage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Xml;
using System.Windows.Forms;
using XenAdmin.Actions;
Expand Down Expand Up @@ -61,6 +62,8 @@ public DockerProcessPage()

public override string HelpID => "TabPageDockerProcess";

[Browsable(false)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public DockerContainer DockerContainer
{
get
Expand Down
2 changes: 2 additions & 0 deletions XenAdmin/TabPages/NICPage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ public NICPage()

private readonly CollectionChangeEventHandler PIF_CollectionChangedWithInvoke;

[Browsable(false)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public Host Host
{
get
Expand Down
6 changes: 5 additions & 1 deletion XenAdmin/TabPages/NetworkPage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Windows.Forms;

using XenAPI;
Expand All @@ -44,9 +45,12 @@ public partial class NetworkPage : BaseTabPage
private static readonly log4net.ILog log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);

// We don't rebuild the controls while the tab is not visible, but instead queue it up later for when the page is displayed.
private bool refreshNeeded = false;
private bool refreshNeeded;

private IXenObject _xenObject;

[Browsable(false)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public IXenObject XenObject
{
get
Expand Down
2 changes: 2 additions & 0 deletions XenAdmin/TabPages/PvsPage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ public PvsPage()

public override string HelpID => "TabPagePvs";

[Browsable(false)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public IXenConnection Connection
{
get
Expand Down
2 changes: 2 additions & 0 deletions XenAdmin/TabPages/SnapshotsPage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,8 @@ void DataGridView_Sorted(object sender, EventArgs e)
}
}

[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
[Browsable(false)]
public VM VM
{
set
Expand Down
28 changes: 15 additions & 13 deletions XenAdmin/TabPages/UpsellTabPage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,38 +28,36 @@
* SUCH DAMAGE.
*/

using System.ComponentModel;
using XenAdmin.Core;


namespace XenAdmin.TabPages
{
public partial class UpsellTabPage : BaseTabPage
{
protected UpsellTabPage(string title, string blurb)
protected UpsellTabPage()
{
InitializeComponent();
base.Text = title;

BlurbText = blurb;
LearnMoreUrl = InvisibleMessages.UPSELL_LEARNMOREURL_TRIAL;
}

public string BlurbText
protected string BlurbText
{
set => upsellPage1.BlurbText = value;
}

public string LearnMoreUrl
protected string Title
{
set => upsellPage1.LearnMoreUrl = value;
set => Text = value;
}
}

public class ADUpsellPage : UpsellTabPage
{
public ADUpsellPage()
: base(Messages.ACTIVE_DIRECTORY_TAB_TITLE, string.Format(Messages.UPSELL_BLURB_AD, BrandManager.ProductBrand))
{
Title = Messages.ACTIVE_DIRECTORY_TAB_TITLE;
BlurbText = string.Format(Messages.UPSELL_BLURB_AD, BrandManager.ProductBrand);
}

public override string HelpID => "TabPageADUpsell";
Expand All @@ -68,17 +66,21 @@ public ADUpsellPage()
public class HAUpsellPage : UpsellTabPage
{
public HAUpsellPage()
: base(Messages.HIGH_AVAILABILITY, Messages.UPSELL_BLURB_HA)
{ }
{
Title = Messages.HIGH_AVAILABILITY;
BlurbText = Messages.UPSELL_BLURB_HA;
}

public override string HelpID => "TabPageHAUpsell";
}

public class WLBUpsellPage : UpsellTabPage
{
public WLBUpsellPage()
: base(Messages.WORKLOAD_BALANCING, Messages.UPSELL_BLURB_WLB)
{ }
{
Title = Messages.WORKLOAD_BALANCING;
BlurbText = Messages.UPSELL_BLURB_WLB;
}

public override string HelpID => "TabPageWLBUpsell";
}
Expand Down
17 changes: 7 additions & 10 deletions XenAdmin/TabPages/UsbPage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ namespace XenAdmin.TabPages
public partial class UsbPage : BaseTabPage
{
private Host _host;
private HostUsbRow selectedRow;
private bool InBuildList;

public UsbPage()
{
Expand All @@ -56,6 +58,8 @@ public UsbPage()

public override string HelpID => "TabPageUSB";

[Browsable(false)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public IXenObject XenObject
{
get
Expand All @@ -80,7 +84,6 @@ public IXenObject XenObject
}
}

public bool InBuildList = false;
private void BuildList()
{
Program.AssertOnEventThread();
Expand Down Expand Up @@ -121,24 +124,19 @@ private void BuildList()
}
}

protected override void OnVisibleChanged(EventArgs e)
{
base.OnVisibleChanged(e);
}

public override void PageHidden()
{
UnregisterHandlers();

base.PageHidden();
}

void Host_PropertyChanged(object sender, PropertyChangedEventArgs e)
private void Host_PropertyChanged(object sender, PropertyChangedEventArgs e)
{
RefreshAllItems();
}

void UsbCollectionChanged(object sender, EventArgs e)
private void UsbCollectionChanged(object sender, EventArgs e)
{
BuildList();
}
Expand All @@ -153,7 +151,7 @@ private void RefreshAllItems()
}
}

internal void UnregisterHandlers()
private void UnregisterHandlers()
{
if (_host != null)
{
Expand All @@ -169,7 +167,6 @@ internal void UnregisterHandlers()
}
}

private HostUsbRow selectedRow = null;
private void dataGridViewUsbList_SelectionChanged(object sender, EventArgs e)
{
selectedRow = null;
Expand Down

0 comments on commit 7b41c3a

Please sign in to comment.