Reduced accessibility of controls to private. Minor refactoring. Typo. Removed

unnecessary event handler. Removed event that was fired but never subscribed to.

Signed-off-by: Konstantina Chremmou <konstantina.chremmou@citrix.com>
This commit is contained in:
Konstantina Chremmou 2018-12-21 17:11:54 +00:00 committed by Mihaela Stoica
parent cd2c2f6ea7
commit 1789abb901
5 changed files with 40 additions and 80 deletions

View File

@ -178,7 +178,6 @@ namespace XenAdmin.Controls.Wlb
this.MinimumSize = new System.Drawing.Size(671, 278);
this.Name = "WlbReportSubscriptionView";
this.Load += new System.EventHandler(this.ReportSubscriptionView_Load);
this.Resize += new System.EventHandler(this.WlbReportSubscriptionView_Resize);
this.tableLayoutPanelSubscriptionDetails.ResumeLayout(false);
this.panelTopControls.ResumeLayout(false);
this.panelTopControls.PerformLayout();
@ -194,8 +193,8 @@ namespace XenAdmin.Controls.Wlb
#endregion
internal System.Windows.Forms.Button btnDelete;
internal System.Windows.Forms.Button btnChange;
private System.Windows.Forms.Button btnDelete;
private System.Windows.Forms.Button btnChange;
private System.Windows.Forms.Label labelSubscription;
private System.Windows.Forms.Button btnClose;
private System.Windows.Forms.TableLayoutPanel tableLayoutPanelSubscriptionDetails;

View File

@ -30,16 +30,8 @@
*/
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;
using System.Drawing.Drawing2D;
using XenAdmin.Actions;
using XenAdmin.Actions.Wlb;
using XenAdmin.Controls;
using XenAdmin.Core;
using XenAdmin.Wlb;
using XenAdmin.Dialogs;
@ -276,11 +268,6 @@ namespace XenAdmin.Controls.Wlb
}
#endregion
private void WlbReportSubscriptionView_Resize(object sender, EventArgs e)
{
}
}
}

View File

@ -286,17 +286,17 @@ namespace XenAdmin.Controls.Wlb
#endregion
public System.Windows.Forms.Label labelHostCombo;
public System.Windows.Forms.ComboBox hostComboBox;
public System.Windows.Forms.Button btnRunReport;
public System.Windows.Forms.Button btnLaterReport;
private System.Windows.Forms.Label labelHostCombo;
private System.Windows.Forms.ComboBox hostComboBox;
private System.Windows.Forms.Button btnRunReport;
private System.Windows.Forms.Button btnLaterReport;
private System.Windows.Forms.Label labelEndDate;
private System.Windows.Forms.DateTimePicker EndDatePicker;
private System.Windows.Forms.Label labelStartDate;
private System.Windows.Forms.DateTimePicker StartDatePicker;
private Microsoft.Reporting.WinForms.ReportViewer reportViewer1;
public System.Windows.Forms.Button btnSubscribe;
public System.Windows.Forms.Button btnClose;
private System.Windows.Forms.Button btnSubscribe;
private System.Windows.Forms.Button btnClose;
private System.Windows.Forms.ComboBox comboBoxView;
private System.Windows.Forms.Label labelShow;
private System.Windows.Forms.Panel panelHosts;
@ -309,8 +309,8 @@ namespace XenAdmin.Controls.Wlb
private System.Windows.Forms.ToolTip toolTip1;
private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel2;
private System.Windows.Forms.Panel panelUsers;
public XenAdmin.Controls.LongStringComboBox userComboBox;
public System.Windows.Forms.Label labelUsers;
private XenAdmin.Controls.LongStringComboBox userComboBox;
private System.Windows.Forms.Label labelUsers;
private System.Windows.Forms.Panel panelObjects;
private System.Windows.Forms.Label labelObjects;
private System.Windows.Forms.ComboBox objectComboBox;

View File

@ -31,15 +31,11 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Globalization;
using System.Text;
using System.Threading;
using System.Windows.Forms;
using System.Windows;
using System.Xml;
using XenAPI;
using XenAdmin.Core;
using XenAdmin.Wlb;
@ -47,12 +43,10 @@ using XenAdmin.Dialogs;
using XenAdmin.Dialogs.Wlb;
using XenAdmin.Actions;
using XenAdmin.Actions.Wlb;
using XenAdmin.Help;
using System.Collections;
// Report viewer control dependencies
using Microsoft.Reporting.WinForms;
using Microsoft.ReportingServices;
using System.IO;
@ -66,14 +60,12 @@ namespace XenAdmin.Controls.Wlb
public event CustomRefreshEventHandler OnChangeOK;
public event DrillthroughEventHandler ReportDrilledThrough;
public event BackEventHandler ReportBack;
public event EventHandler Close;
public event EventHandler PoolConnectionLost;
private static readonly log4net.ILog log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
private bool _bDisplayedError;
private bool _resetReportViewer;
private int _currentOffsetMinutes;
private int _startLine;
private int _endLine;
@ -90,14 +82,13 @@ namespace XenAdmin.Controls.Wlb
private string _startTime = String.Empty;
private string _endTime = String.Empty;
private bool _isAuditReport;
private bool _isCreedenceOrLater;
private WlbReportInfo _reportInfo;
private LocalReport _localReport;
private IEnumerable<Host> _hosts;
private Pool _pool;
private List<string> _selectedCustomFilters;
private static string DELIMETER = ",";
private static string DELIMITER = ",";
// for report subscription
private Dictionary<string, string> _reportParameters;
@ -107,6 +98,16 @@ namespace XenAdmin.Controls.Wlb
#region Properties
public bool ButtonSubscribeVisible
{
set { btnSubscribe.Visible = value; }
}
public bool ButtonLaterReportVisible
{
set { btnLaterReport.Visible = value; }
}
public WlbReportInfo ViewerReportInfo
{
get { return _reportInfo; }
@ -119,18 +120,9 @@ namespace XenAdmin.Controls.Wlb
set { _localReport = value; }
}
public Pool Pool
{
get { return _pool; }
set { _pool = value; }
}
public Pool Pool { get; set; }
public bool ResetReportViewer
{
get { return _resetReportViewer; }
set { _resetReportViewer = value; }
}
public bool ResetReportViewer { get; set; }
public IEnumerable<Host> Hosts
{
@ -142,11 +134,7 @@ namespace XenAdmin.Controls.Wlb
}
}
public bool IsCreedenceOrLater
{
get { return _isCreedenceOrLater; }
set { _isCreedenceOrLater = value; }
}
public bool IsCreedenceOrLater { get; set; }
#endregion
@ -463,7 +451,7 @@ namespace XenAdmin.Controls.Wlb
try
{
// Make sure the pool is okay
if (!_pool.Connection.IsConnected)
if (!Pool.Connection.IsConnected)
{
PoolConnectionLost(this, EventArgs.Empty);
}
@ -841,12 +829,12 @@ namespace XenAdmin.Controls.Wlb
break;
case "PoolID":
paramValue = currentParams["PoolID"].Values.Count == 0 ? _pool.uuid : currentParams["PoolID"].Values[0];
paramValue = currentParams["PoolID"].Values.Count == 0 ? Pool.uuid : currentParams["PoolID"].Values[0];
addParam = true;
break;
case "PoolName":
paramValue = currentParams["PoolName"].Values.Count == 0 ? Helpers.GetName(_pool) : currentParams["PoolName"].Values[0];
paramValue = currentParams["PoolName"].Values.Count == 0 ? Helpers.GetName(Pool) : currentParams["PoolName"].Values[0];
addParam = true;
break;
@ -862,7 +850,7 @@ namespace XenAdmin.Controls.Wlb
case "Filter":
paramValue = currentParams["Filter"].Values.Count == 0 ?
(_selectedCustomFilters != null && _selectedCustomFilters.Count > 0 ? String.Join(DELIMETER, _selectedCustomFilters.ToArray()) : comboBoxView.SelectedIndex.ToString()) :
(_selectedCustomFilters != null && _selectedCustomFilters.Count > 0 ? String.Join(DELIMITER, _selectedCustomFilters.ToArray()) : comboBoxView.SelectedIndex.ToString()) :
currentParams["Filter"].Values[0];
addParam = true;
break;
@ -1038,7 +1026,7 @@ namespace XenAdmin.Controls.Wlb
reportDataSource1.Value = reportDS.Tables[0];
_localReport.DataSources.Add(reportDataSource1);
if(_isAuditReport && _isCreedenceOrLater)
if(_isAuditReport && IsCreedenceOrLater)
{
int cnt = reportDS.Tables[0].Rows.Count;
@ -1264,19 +1252,6 @@ namespace XenAdmin.Controls.Wlb
}
/// <summary>
///
/// </summary>
/// <param name="currentBackEventArgs"></param>
private void OnReportBack(BackEventArgs currentBackEventArgs)
{
if (ReportBack != null)
{
ReportBack(this, currentBackEventArgs);
}
}
/// <summary>
/// Event handler for the "Run Report"/"Next Section" button
/// </summary>
@ -1284,7 +1259,7 @@ namespace XenAdmin.Controls.Wlb
/// <param name="e"></param>
internal void btnRunReport_Click(object sender, EventArgs e)
{
if(_isAuditReport && _isCreedenceOrLater)
if(_isAuditReport && IsCreedenceOrLater)
{
// If the button displays "Run Report",
// that means the 1st report section is requested.
@ -1317,7 +1292,7 @@ namespace XenAdmin.Controls.Wlb
/// <param name="e"></param>
internal void btnLaterReport_Click(object sender, EventArgs e)
{
if(_isAuditReport && _isCreedenceOrLater)
if(_isAuditReport && IsCreedenceOrLater)
{
// The previous report section is requested.
@ -1338,7 +1313,7 @@ namespace XenAdmin.Controls.Wlb
private void btnSubscribe_Click(object sender, EventArgs e)
{
// Make sure the pool is okay
if (!_pool.Connection.IsConnected)
if (!Pool.Connection.IsConnected)
{
PoolConnectionLost(this, EventArgs.Empty);
}
@ -1349,7 +1324,7 @@ namespace XenAdmin.Controls.Wlb
this._reportParameters.Remove("reportName");
}
this._reportParameters.Add("reportName", this._reportInfo.ReportFile.Split('.')[0]);
WlbReportSubscriptionDialog rpSubDialog = new WlbReportSubscriptionDialog(this._reportInfo.ReportName, this._reportParameters, _pool);
WlbReportSubscriptionDialog rpSubDialog = new WlbReportSubscriptionDialog(this._reportInfo.ReportName, this._reportParameters, Pool);
if (rpSubDialog.ShowDialog() == DialogResult.OK)
{
OnChangeOK(this, e);
@ -1374,7 +1349,7 @@ namespace XenAdmin.Controls.Wlb
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void reportViewer1_Drillthrough(object sender, DrillthroughEventArgs e)
private void reportViewer1_Drillthrough(object sender, DrillthroughEventArgs e)
{
_localReport = (LocalReport)e.Report;
@ -1401,7 +1376,6 @@ namespace XenAdmin.Controls.Wlb
private void reportViewer1_Back(object sender, BackEventArgs e)
{
_localReport = (LocalReport)e.ParentReport;
OnReportBack(e);
}
@ -1427,7 +1401,7 @@ namespace XenAdmin.Controls.Wlb
{
if (this.comboBoxView.SelectedIndex == 1)
{
Dialogs.Wlb.WlbReportCustomFilter customFilterDialog = new Dialogs.Wlb.WlbReportCustomFilter(_pool.Connection);
WlbReportCustomFilter customFilterDialog = new WlbReportCustomFilter(Pool.Connection);
customFilterDialog.InitializeFilterTypeIndex();
if (customFilterDialog.ShowDialog() == DialogResult.OK)
{

View File

@ -148,9 +148,9 @@ namespace XenAdmin
// retrieve subscription
SetSubscriptionCollection();
this.wlbReportView1.btnSubscribe.Visible = false;
this.wlbReportView1.btnLaterReport.Visible = false;
this.wlbReportView1.IsCreedenceOrLater = _isCreedenceOrLater;
wlbReportView1.ButtonSubscribeVisible = false;
wlbReportView1.ButtonLaterReportVisible = false;
wlbReportView1.IsCreedenceOrLater = _isCreedenceOrLater;
PopulateTreeView();
}
catch (XenAdmin.CancelledException xc)
@ -407,7 +407,7 @@ namespace XenAdmin
_isCreedenceOrLater = poolConfiguration.IsCreedenceOrLater;
this.splitContainerLeftPane.Panel2Collapsed = true;
this.wlbReportView1.btnSubscribe.Visible=false;
this.wlbReportView1.ButtonSubscribeVisible = false;
}
else
{