private void editServerButton_Click(object sender, EventArgs e)
        {
            if (serverList.SelectedItem == null)
            {
                return;
            }

            var itemIndex                  = serverList.SelectedIndex;
            var statisticsServer           = _statisticsServers.ElementAt(itemIndex);
            var statisticsServerEditDialog = new StatisticsServerEditDialog
            {
                DatabaseName = statisticsServer.DatabaseName,
                WebUrl       = statisticsServer.WebUrl,
                Username     = statisticsServer.Username
            };

            if (statisticsServerEditDialog.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            try
            {
                _statisticsServers[itemIndex] = new StatisticsServer(statisticsServerEditDialog.WebUrl,
                                                                     statisticsServerEditDialog.DatabaseName, statisticsServerEditDialog.Username);
                File.WriteAllText(Program.StatisticServersFilePath, Serializer.Serialize(_statisticsServers));
            }
            catch (Exception ex)
            {
                Popup.ShowPopup(this, SystemIcons.Error, "Error while saving the server data.",
                                ex, PopupButtons.Ok);
                return;
            }

            InitializeServers(); // Re-initialize the servers again
        }
        private void editServerButton_Click(object sender, EventArgs e)
        {
            if (serverList.SelectedItem == null)
                return;

            var itemIndex = serverList.SelectedIndex;
            var statisticsServer = _statisticsServers.ElementAt(itemIndex);
            var statisticsServerEditDialog = new StatisticsServerEditDialog
            {
                DatabaseName = statisticsServer.DatabaseName,
                WebUrl = statisticsServer.WebUrl,
                Username = statisticsServer.Username
            };

            if (statisticsServerEditDialog.ShowDialog() != DialogResult.OK)
                return;

            try
            {
                _statisticsServers[itemIndex] = new StatisticsServer(statisticsServerEditDialog.WebUrl,
                    statisticsServerEditDialog.DatabaseName, statisticsServerEditDialog.Username);
                File.WriteAllText(Program.StatisticServersFilePath, Serializer.Serialize(_statisticsServers));
            }
            catch (Exception ex)
            {
                Popup.ShowPopup(this, SystemIcons.Error, "Error while saving the server data.",
                    ex, PopupButtons.Ok);
                return;
            }

            InitializeServers(); // Re-initialize the servers again
        }