Пример #1
0
        public MainWindow()
        {
            InitializeComponent();

            _tray = new TrayManager(tbiTaskbarIcon)
            {
                State = TrayIconState.Disabled
            };

            _poe = new PoeMonitor();
            _poe.StateChanged += _poe_StateChanged;

            _client = new ClientMonitor {
                ClientPath = Config.Instance.ClientFilePath
            };

            _client.Append += _client_Append;

            _media = new MediaPlayer();

            // Controls
            _bindingFilterCheckers();

            miNitificationChecker.IsChecked = Config.Instance.IsNotificationsEnabled;
        }
 public void SubscribeConfig(ClientConfigModel model)
 {
     if (model.ClientID < 1 && string.IsNullOrEmpty(model.ConfigCode) == false)
     {
         ConfigModel config = DBFactory.GetModel <IDBConfigDal>("IDBConfigDal").GetConfig(new ConfigModel()
         {
             ID = model.ConfigID, Code = model.ConfigCode, ParentID = model.ConfigParentID
         });;
         if (config == null || config.ID < 1)
         {
             return;
         }
         model.ConfigID       = config.ID;
         model.ConfigParentID = config.ParentID;
     }
     if (model.ClientID < 1)
     {
         return;
     }
     if (model.ClientState < 1)
     {
         ClientMonitor.CancelClient(model.ClientID);
         return;
     }
     if (model.ConfigID > 0)
     {
         ClientMonitor.RegisterClient(model.ClientID, model.ConfigID);
     }
     else
     {
         ClientMonitor.RegisterClient(model.ClientID);
     }
 }
Пример #3
0
 public void RegisterClientOption(ClientOptionModel client)
 {
     if (client.ID > 0 && string.IsNullOrEmpty(client.PushType) == false)
     {
         ClientMonitor.RegisterClient(client.ID);
     }
 }
Пример #4
0
 public int AddClient(ClientModel model)
 {
     model.ID = DBFactory.GetModel <IDBClientDal>("IDBClientDal").AddClient(model);
     if (model.ID > 0 && model.DataStatus > 0)
     {
         ClientMonitor.RegisterClient(model.ID);
     }
     return(model.ID);
 }
Пример #5
0
        public bool DeleteClient(ClientModel model)
        {
            if (model.ID <= 0)
            {
                return(false);
            }
            bool result = DBFactory.GetModel <IDBClientDal>("IDBClientDal").DeleteClient(model);

            if (result == true)
            {
                ClientMonitor.CancelClient(model.ID);
            }
            return(result);
        }
Пример #6
0
        public bool EditConfig(ConfigModel config)
        {
            DBFactory.GetModel <IDBConfigDal>("IDBConfigDal").EditConfig(config);
            ConfigEntity  entity = ConvertData.ConfigModelToEntity(config);
            ICacheService cache  = CacheFactory.GetInstace();

            if (cache != null)
            {
                string key = CacheFactory.MadePrefix(config.Code, config.ParentID);
                cache.SetConfig(key, entity);
            }
            ClientMonitor.SetConfig(entity);
            return(true);
        }
Пример #7
0
        public void ClientTimerCallback(object e)
        {
            try
            {
                ConfigSettings.SetRules();

                ArchiveLog(ConfigSettings.SystemRules.ClientMonitorPath, 10.0);

                using (StreamWriter writer = new StreamWriter($"{ConfigSettings.SystemRules.ClientMonitorPath}\\log.log", true))
                {
                    writer.AutoFlush = true;

                    try
                    {
                        writer.WriteLine();
                        writer.WriteLine($"BEGIN Client MONITOR @ {DateTime.Now}   ========================");

                        ClientMonitor.Run(writer);

                        writer.WriteLine();
                        writer.WriteLine($"END Client MONITOR @ {DateTime.Now}   ========================");
                    }
                    catch (Exception ex)
                    {
                        BaseMonitor.Error(writer, ex, "ClientTimerCallback");
                    }
                }
            }
            catch (Exception ex)
            {
                BaseMonitor.Error(Writer, ex, "ClientTimerCallback");
            }

            // Reset Timer
            ConfigureTimers(Timers.ClientMonitorTimer);
        }
 public virtual void CreateClientMonitor(ClientMonitor entity)
 {
     Create(entity);
 }
 public virtual void DeleteClientMonitor(ClientMonitor entity)
 {
     entityDao.DeleteClientMonitor(entity);
 }
 public virtual void UpdateClientMonitor(ClientMonitor entity)
 {
     entityDao.UpdateClientMonitor(entity);
 }
 public virtual void CreateClientMonitor(ClientMonitor entity)
 {
     entityDao.CreateClientMonitor(entity);
 }
 public virtual void DeleteClientMonitor(ClientMonitor entity)
 {
     Delete(entity);
 }
 public virtual void UpdateClientMonitor(ClientMonitor entity)
 {
     Update(entity);
 }
 public virtual void CreateClientMonitor(ClientMonitor entity)
 {
     Create(entity);
 }
 public virtual void DeleteClientMonitor(ClientMonitor entity)
 {
     Delete(entity);
 }
 public virtual void UpdateClientMonitor(ClientMonitor entity)
 {
     Update(entity);
 }
Пример #17
0
 public virtual void CreateClientMonitor(ClientMonitor entity)
 {
     entityDao.CreateClientMonitor(entity);
 }
Пример #18
0
 public virtual void DeleteClientMonitor(ClientMonitor entity)
 {
     entityDao.DeleteClientMonitor(entity);
 }
Пример #19
0
 public virtual void UpdateClientMonitor(ClientMonitor entity)
 {
     entityDao.UpdateClientMonitor(entity);
 }