/// <summary> /// Initializes a new instance of the <see cref="MonitorMySqlServerInstancesDialog"/> class. /// </summary> /// <param name="machinesList">List of <see cref="MySqlService"/> objects monitored by the Notifier.</param> /// <param name="instancesList">List of names of MySQL instance monitored by the Notifier.</param> public MonitorMySqlServerInstancesDialog(MachinesList machinesList, MySqlInstancesList instancesList) { InitializeComponent(); _lastServicesNameFilter = FilterTextBox.Text; _lastShowMonitoredServices = ShowMonitoredInstancesCheckBox.Checked; MachinesList = machinesList; MySqlInstancesList = instancesList ?? new MySqlInstancesList(); InstancesListChanged = false; ResetChangeCursorDelegate(true); }
/// <summary> /// Initializes a new instance of the <see cref="ManageItemsDialog"/> class. /// </summary> /// <param name="instancesList">List of <see cref="MySqlInstance"/> objects.</param> /// <param name="machineslist">List of <see cref="Machine"/> objects.</param> public ManageItemsDialog(MySqlInstancesList instancesList, MachinesList machineslist) { _selectedItem = null; _instancesHaveChanges = false; _servicesHaveChanges = false; InitializeComponent(); InstancesList = instancesList; InstancesListChanged = false; MachinesList = machineslist; RefreshServicesAndInstancesListViews(); SetDialogControlsAvailability(); }
/// <summary> /// Reloads the list of MySQL Server instances from the ones contained in the MySQL Workbench connections file. /// </summary> /// <param name="forceRefresh">Flag indicating if the refresh must be done although filters haven't changed.</param> private void RefreshMySqlInstancesList(bool forceRefresh) { if (_lastServicesNameFilter != null && _lastServicesNameFilter != FilterTextBox.Text) { _lastServicesNameFilter = FilterTextBox.Text; } _lastShowMonitoredServices = ShowMonitoredInstancesCheckBox.Checked; if (forceRefresh) { MySqlInstancesList.LoadMySqlWorkbenchConnections(); } RefreshMySqlInstancesList(_lastServicesNameFilter, _lastShowMonitoredServices); }
/// <summary> /// Checks if a Workbench connection is being monitored already. /// </summary> /// <param name="connection">A Workbench connection to check for.</param> /// <returns><c>true</c> if the connection is already being monitored, <c>false</c> otherwise.</returns> private bool IsWorkbenchConnectionAlreadyMonitored(MySqlWorkbenchConnection connection) { foreach (var machine in MachinesList.Machines) { foreach (var mySqlService in machine.Services) { if (mySqlService.WorkbenchConnections == null) { continue; } if (mySqlService.WorkbenchConnections.Exists(wbConn => wbConn.Id == connection.Id)) { return(true); } } } return(MySqlInstancesList.Any(mySqlInstance => mySqlInstance.RelatedConnections.Exists(wbConn => wbConn.Id == connection.Id))); }
/// <summary> /// Checks if a Workbench connection is being monitored already. /// </summary> /// <param name="connection">A Workbench connection to check for.</param> /// <returns><c>true</c> if the connection is already being monitored, <c>false</c> otherwise.</returns> private bool IsWorkbenchConnectionAlreadyMonitored(MySqlWorkbenchConnection connection) { return(MachinesList.IsWorkbenchConnectionAlreadyMonitored(connection) || MySqlInstancesList.IsWorkbenchConnectionAlreadyMonitored(connection)); }