mirror of
https://github.com/xcp-ng/xenadmin.git
synced 2024-11-23 12:30:50 +01:00
CP-36392: Use value
in empty setters
Mostly to remove warning from SonarQube, so exception is only thrown in DEBUG mode Address code surrounding previously emptied setters Avoids throwing exceptions when not needed Move default `VerticalTabs` fields outside of constructor Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com>
This commit is contained in:
parent
2c5373323c
commit
101d6f0a00
@ -33,6 +33,7 @@ using System;
|
||||
using System.Windows.Forms;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.Reflection;
|
||||
using XenAdmin.Core;
|
||||
|
||||
|
||||
@ -46,24 +47,13 @@ namespace XenAdmin.Controls
|
||||
string SubText { get; }
|
||||
Image Image { get; }
|
||||
}
|
||||
|
||||
public VerticalTabs()
|
||||
{
|
||||
base.ItemHeight = 40;
|
||||
IntegralHeight = false;
|
||||
DrawMode = DrawMode.OwnerDrawFixed;
|
||||
}
|
||||
|
||||
public override int ItemHeight
|
||||
{
|
||||
get
|
||||
{
|
||||
return base.ItemHeight;
|
||||
}
|
||||
set
|
||||
{
|
||||
}
|
||||
}
|
||||
public override int ItemHeight => 40;
|
||||
public override DrawMode DrawMode => DrawMode.OwnerDrawFixed;
|
||||
|
||||
public Func<Rectangle, Rectangle> AdjustItemTextBounds;
|
||||
|
||||
|
@ -222,8 +222,7 @@ namespace XenAdmin.Wizards
|
||||
xenTabPageLvmoHbaSummary.SuccessfullyCreatedSRs.Clear();
|
||||
xenTabPageLvmoHbaSummary.FailedToCreateSRs.Clear();
|
||||
|
||||
bool closeWizard;
|
||||
RunFinalAction(out closeWizard);
|
||||
RunFinalAction(out var closeWizard);
|
||||
return closeWizard;
|
||||
}
|
||||
|
||||
|
@ -105,7 +105,13 @@ namespace XenAdmin.Wizards.NewSRWizard_Pages
|
||||
{
|
||||
var frontend = (SrWizardType)radioButton.Tag;
|
||||
frontend.ResetSrName(Connection);
|
||||
|
||||
// these SR types have a blocked setter
|
||||
if (!(frontend is SrWizardType_Cslg || frontend is SrWizardType_CifsIso || frontend is SrWizardType_NfsIso || frontend is SrWizardType_Cifs))
|
||||
{
|
||||
frontend.AllowToCreateNewSr = SrToReattach == null && !DisasterRecoveryTask;
|
||||
}
|
||||
|
||||
frontend.DisasterRecoveryTask = DisasterRecoveryTask;
|
||||
frontend.SrToReattach = SrToReattach;
|
||||
}
|
||||
|
@ -31,6 +31,7 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
using XenAdmin.Actions;
|
||||
using XenAdmin.Core;
|
||||
using XenAdmin.Network;
|
||||
@ -157,7 +158,10 @@ namespace XenAdmin.Wizards.NewSRWizard_Pages
|
||||
public abstract bool ShowIntroducePrompt { get; }
|
||||
public abstract bool ShowReattachWarning { get; }
|
||||
public abstract bool AllowToCreateNewSr { get; set; }
|
||||
public virtual bool IsGfs2 { get { return false; } set { } }
|
||||
public virtual bool IsGfs2 {
|
||||
get => false;
|
||||
set => throw new NotSupportedException($"Invalid set call for '{MethodBase.GetCurrentMethod()?.Name}', value: '{value}'");
|
||||
}
|
||||
|
||||
public string SrName
|
||||
{
|
||||
@ -256,7 +260,11 @@ namespace XenAdmin.Wizards.NewSRWizard_Pages
|
||||
public override string ContentType { get { return SR.Content_Type_ISO; } }
|
||||
public override bool ShowIntroducePrompt { get { return false; } }
|
||||
public override bool ShowReattachWarning { get { return false; } }
|
||||
public override bool AllowToCreateNewSr { get { return true; } set { } }
|
||||
public override bool AllowToCreateNewSr
|
||||
{
|
||||
get => true;
|
||||
set => throw new NotSupportedException($"Invalid set call for '{MethodBase.GetCurrentMethod()?.Name}', value: '{value}'");
|
||||
}
|
||||
|
||||
public override void ResetSrName(IXenConnection connection)
|
||||
{
|
||||
@ -340,7 +348,11 @@ namespace XenAdmin.Wizards.NewSRWizard_Pages
|
||||
public override string ContentType { get { return SR.Content_Type_ISO; } }
|
||||
public override bool ShowIntroducePrompt { get { return false; } }
|
||||
public override bool ShowReattachWarning { get { return false; } }
|
||||
public override bool AllowToCreateNewSr { get { return true; } set { } }
|
||||
public override bool AllowToCreateNewSr
|
||||
{
|
||||
get => true;
|
||||
set => throw new NotSupportedException($"Invalid set call for '{MethodBase.GetCurrentMethod()?.Name}', value: '{value}'");
|
||||
}
|
||||
|
||||
public override void ResetSrName(IXenConnection connection)
|
||||
{
|
||||
@ -362,7 +374,10 @@ namespace XenAdmin.Wizards.NewSRWizard_Pages
|
||||
public override string ContentType { get { return ""; } }
|
||||
public override bool ShowIntroducePrompt { get { return false; } }
|
||||
public override bool ShowReattachWarning { get { return false; } }
|
||||
public override bool AllowToCreateNewSr { get { return true; } set { } }
|
||||
public override bool AllowToCreateNewSr {
|
||||
get => true;
|
||||
set => throw new NotSupportedException($"Invalid set call for '{MethodBase.GetCurrentMethod()?.Name}', value: '{value}'");
|
||||
}
|
||||
|
||||
public override void ResetSrName(IXenConnection connection)
|
||||
{
|
||||
@ -379,7 +394,11 @@ namespace XenAdmin.Wizards.NewSRWizard_Pages
|
||||
public override string ContentType { get { return ""; } }
|
||||
public override bool ShowIntroducePrompt { get { return true; } }
|
||||
public override bool ShowReattachWarning { get { return true; } }
|
||||
public override bool AllowToCreateNewSr { get { return true; } set { } }
|
||||
public override bool AllowToCreateNewSr
|
||||
{
|
||||
get => true;
|
||||
set => throw new NotSupportedException($"Invalid set call for '{MethodBase.GetCurrentMethod()?.Name}', value: '{value}'");
|
||||
}
|
||||
|
||||
public SrWizardType_NetApp ToNetApp()
|
||||
{
|
||||
|
@ -32,6 +32,7 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Net;
|
||||
using System.Reflection;
|
||||
using System.Xml;
|
||||
|
||||
namespace XenCenterLib
|
||||
@ -40,7 +41,7 @@ namespace XenCenterLib
|
||||
{
|
||||
public override ICredentials Credentials
|
||||
{
|
||||
set { }
|
||||
set => throw new NotSupportedException($"Invalid set call for '{MethodBase.GetCurrentMethod()?.Name}', value: '{value}'");
|
||||
}
|
||||
|
||||
public override object GetEntity(Uri absoluteUri, string role, Type ofObjectToReturn)
|
||||
|
Loading…
Reference in New Issue
Block a user