示例#1
0
        /// <summary>
        /// Конструктор, ограничивающий создание объекта из других классов
        /// </summary>
        private AppData()
        {
            appDataLock = new object();

            inited        = false;
            cultureName   = Localization.Culture.Name;
            viewStampCntr = 0;

            scadaDataDictUpdater = null;
            scadaWebDictUpdater  = null;
            webSettingsUpdater   = null;
            viewSettingsUpdater  = null;
            viewSettingsBaseAge  = DateTime.MinValue;

            WebSettings  = new WebSettings();
            ViewSettings = new ViewSettings();
            PluginSpecs  = new List <PluginSpec>();
            UiObjSpecs   = new Dictionary <string, UiObjSpec>();
            AppDirs      = new AppDirs();
            Log          = new Log(Log.Formats.Full);
            Storage      = new Storage(AppDirs.StorageDir);
            RememberMe   = new RememberMe(Storage, Log);
            Stats        = new Stats(Storage, Log);
            UserMonitor  = new UserMonitor(Log);

            CreateDataObjects();
        }
示例#2
0
 /// <summary>
 /// Проверить, что пользователь вошёл систему
 /// </summary>
 public void CheckLoggedOn()
 {
     if (!UserMonitor.UserIsLoggedOn(WebOperationContext.Current))
     {
         throw new ScadaException(WebPhrases.NotLoggedOn);
     }
 }
示例#3
0
 /// <summary>
 /// Проверить, что пользователь вошёл систему, и получить его права
 /// </summary>
 /// <remarks>Метод используется, если сессия не доступна</remarks>
 public bool CheckLoggedOn(out UserRights userRights, bool throwOnFail = true)
 {
     if (UserMonitor.UserIsLoggedOn(WebOperationContext.Current, out userRights))
     {
         return(true);
     }
     else if (throwOnFail)
     {
         throw new ScadaException(WebPhrases.NotLoggedOn);
     }
     else
     {
         return(false);
     }
 }
示例#4
0
        /// <summary>
        /// Конструктор, ограничивающий создание объекта из других классов
        /// </summary>
        private AppData()
        {
            appDataLock = new object();

            inited        = false;
            commSettings  = new CommSettings();
            viewStampCntr = 0;

            WebSettings  = new WebSettings();
            ViewSettings = new ViewSettings();
            PluginSpecs  = new List <PluginSpec>();
            ViewSpecs    = new Dictionary <string, ViewSpec>();
            AppDirs      = new AppDirs();
            Log          = new Log(Log.Formats.Full);
            Storage      = new Storage(AppDirs.StorageDir);
            RememberMe   = new RememberMe(Storage, Log);
            UserMonitor  = new UserMonitor(Log);

            InitUpdaters();
            CreateDataObjects();
        }
示例#5
0
 /// <summary>
 /// Проверить, что пользователь вошёл систему, и получить его права
 /// </summary>
 /// <remarks>Метод используется, если сессия не доступна</remarks>
 public bool CheckLoggedOn(out UserRights userRights, bool throwOnFail = true)
 {
     return(UserMonitor.CheckLoggedOn(out userRights, throwOnFail));
 }