public LicenserModel(LocaleManager localeManager)
		{
			this._lM               = localeManager;
			this._settings         = null;
			this._logger           = null;
			this._settingsFileName = null;
		}
		/// <summary>
		/// Constructor with mainform
		/// </summary>
		/// <param name="mainForm">Mainform </param>
		public MsSqlAuditorModel()
		{
			this._vaultProcessors  = new Dictionary<ConnectionGroupInfo, IStorageManager>();
			this._settings         = null;
			this._layoutSettings   = null;
			this._localeManager    = null;
			this._templateSettings = null;
			this._filesProvider    = new FilesProvider(this);

			LoadSettings();

			this._visualizeProcessor = new VisualizeProcessor(this);
			this._cryptoService      = new CachingCryptoService(Settings.EncryptionKey);

			DeleteTempCurrentDbFile();
		}
		public SettingsForm()
		{
			InitializeComponent();

			this._lM = new LocaleManager(() => (Settings ?? Settings.UserOnes).UiLanguage, Path.Combine(Application.StartupPath, "AuditorLicenser.i18n.xml"))
			{
				FormIfOmited = this
			};

			List<string> availableLocales = Settings.SystemOnes.AvailableUiLanguages;

			uiLangCombo.Items.Clear();
			uiLangCombo.Items.AddRange(availableLocales.Cast<object>().ToArray());

			this._lM.LocalizeForm(this);
			this._lM.LocalizeDeep(this, Controls);
		}
Example #4
0
        private void LocalizableFormShown(object sender, EventArgs e)
        {
            if (!DesignMode)
            {
                if (Program.Model != null)
                {
                    Program.Model.SettingsChanged += ModelSettingsChanged;

                    LocaleManager localeManager = Program.Model.LocaleManager;

                    Type baseForm = this.GetType().BaseType;

                    if (baseForm != null && baseForm.IsSubclassOf(typeof(LocalizableForm)))
                    {
                        // localize base form
                        localeManager.LocalizeForm(this, formAlias: baseForm.Name);
                    }

                    localeManager.LocalizeForm(this);
                }
            }

            Icon = Properties.Resources.appIcon;
        }
Example #5
0
        public frmMain()
        {
            InitializeComponent();

            //this.PrepareView();

            _lM = new LocaleManager(() => Settings.UserOnes.UiLanguage, Path.Combine(Application.StartupPath, "AuditorLicenser.i18n.xml"))
            {
                FormIfOmited = this
            };

            _model = new LicenserModel(_lM);

            Text += " - " + Application.ProductVersion;

            _model.SetLogger(this);

            ApplyLocalization();

            Settings.UserOnesChanged += (s, e) => ApplyLocalization();

            fileAppPath.IsCorrectFile = name =>
            {
                var isValid = File.Exists(name) && Path.GetExtension(name) == ".exe";
                if (isValid)
                {
                    _model.Settings.AppPath = fileAppPath.Text;
                    MSSQLAuditorVersion.Text = _lM.GetText("AppVersion") + _model.MSSQLAuditorVersion;
                }
                return isValid;
            };

            txtLoadConfFileName.IsCorrectFile = delegate(string name)
            {
                try
                {
                    LicSettingsLoader.LoadFromXml(name);
                }
                catch { return false; }
                return true;
            };

            txtLangFileName.IsCorrectFile = delegate(string name)
            {
                try { new LocaleManager(null, name); }
                catch { return false; }
                return true;
            };

            txtSysSettingsFileName.IsCorrectFile = delegate(string name)
            {
                try { SettingsLoader.LoadFromXml(null, name); }
                catch { return false; }
                return true;
            };

            txtUserSettingsFileName.IsCorrectFile = delegate(string name)
            {
                try { SettingsLoader.LoadFromXml(name, null); }
                catch { return false; }
                return true;
            };
        }
		public static string GetCloseConnectionCommandText(LocaleManager localeManager)
		{
			return localeManager.GetLocalizedText("frmMain", "mnuCloseConnection");
		}
		/// <summary>
		/// Flush locale cache
		/// </summary>
		public void FlushLocaleCache()
		{
			this._localeManager = null;
		}