Пример #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="BaseApplication"/> class.
        /// </summary>
        /// <param name="settings">The settings.</param>
        /// <exception cref="System.InvalidOperationException">You can only have one instance of Application at any given time.</exception>
        protected BaseApplication(BaseApplicationSettings settings)
        {
            if (settings == null)
            {
                throw new ArgumentNullException("settings");
            }

            lock (OneApplicationCheckLock)
            {
                if (Current != null)
                {
                    throw new InvalidOperationException("You can only have one instance of Application at any given time.");
                }

                Current = this;
            }

            AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;

            LogsDirectoryPath = PathUtility.WorkingDirectory + "/" + LogsDirectory;
            EnsureLogsDirectory();

            InitializeLog4Net();

            CacheDirectoryPath = PathUtility.WorkingDirectory + "/" + CacheDirectory;
            EnsureCacheDirectory();

            ThreadId = Thread.CurrentThread.ManagedThreadId;

            SyncProperties = SyncPropertyAttribute.GetProperties <BaseApplication>();
        }
Пример #2
0
        /// <summary>
        /// Initializes this instance.
        /// </summary>
        /// <param name="settings">The settings.</param>
        protected override void Initialize(BaseApplicationSettings settings)
        {
            base.Initialize(settings);

            InitializeSelf(null);
        }