Beispiel #1
0
        /// <summary>
        /// Get available connection list
        /// </summary>
        public List <ConnectionGroupInfo> GetAvailableConnections()
        {
            var filenames   = this._filesProvider.GetConnectionsFilenames();
            var connections = new List <ConnectionGroupInfo>();

            foreach (var filename in filenames)
            {
                connections.AddRange(ConnectionsLoader.LoadFromXml(filename));
            }

            return(connections);
        }
Beispiel #2
0
        private void mnuAddLicense_Click(object sender, EventArgs e)
        {
            List <ConnectionGroupInfo> licenses;

            using (var dlg = new OpenFileDialog {
                Filter = @"XML|*.xml"
            })
            {
                if (dlg.ShowDialog() != DialogResult.OK)
                {
                    return;
                }

                try
                {
                    licenses = ConnectionsLoader.LoadFromXml(dlg.FileName).ToList();
                }
                catch (Exception ex)
                {
                    licenses = new List <ConnectionGroupInfo>();
                    log.Error(ex);
                }
            }

            if (licenses.Count == 0)
            {
                MessageBox.Show(
                    this._model.LocaleManager.GetLocalizedText(this.Name, @"msgNoLicenseFound"),
                    LicensesLocalizedText(),
                    MessageBoxButtons.OK,
                    MessageBoxIcon.Warning
                    );

                return;
            }

            ConnectionsLoader.SaveToXml(this._model.FilesProvider.ComposeNewFileNameForAddedConnection(), licenses);

            var form = new frmLicenseErrors
            {
                StartPosition = FormStartPosition.CenterParent,
                Text          = this._model.LocaleManager.GetLocalizedText(this.Name, @"msgLicenseSuccessfulyAdded")
            };

            form.IgnoreLocalizationProperties.Add("Text");
            form.SetLicenseProblems(licenses.SelectMany(cnn => cnn.Connections.Select(l => l.ValidateLicense(true))).ToList());
            form.ShowDialog();

            //MessageBox.Show(this._model.LocaleManager.GetLocalizedText(this.Name, @"msgLicenseSuccessfulyAdded"), LicensesLocalizedText(),
            //    MessageBoxButtons.OK, MessageBoxIcon.Information);
        }