Ejemplo n.º 1
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);
        }
Ejemplo n.º 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);
		}