Пример #1
0
        /// <summary>
        /// Get events count from the specified server/list
        /// </summary>
        public IEnumerable <EventEventIdPair> GetEventsList(String server, Int32 list)
        {
            ADCListHelper lc = GetListHelper(server, list);
            IEnumerable <EventEventIdPair> resList = lc.GetList();

            return(resList);
        }
Пример #2
0
        public Int32 GetLookAhead(String server, Int32 list)
        {
            Int32         result;
            ADCListHelper lc = GetListHelper(server, list);

            result = lc.GetLookAhead();
            return(result);
        }
Пример #3
0
        public IEnumerable <ListStateValue> GetListState(String server, Int32 list)
        {
            IEnumerable <ListStateValue> result;
            ADCListHelper lc = GetListHelper(server, list);

            result = lc.GetListState();
            return(result);
        }
Пример #4
0
        public String GetExtListName(String server, Int32 list)
        {
            String        result;
            ADCListHelper lc = GetListHelper(server, list);

            result = lc.GetExtListName();

            return(result);
        }
Пример #5
0
        public EventEventIdPair InsertEvent(String server, Int32 list, EventEventIdPair ev, InsertPlaceType place, Guid position)
        {
            ADCListHelper           lc = GetListHelper(server, list);
            List <EventEventIdPair> el = new List <EventEventIdPair> {
                ev
            };
            var res = lc.InsertEvents(position, el, place);

            return(res.FirstOrDefault());
        }
Пример #6
0
        protected override void Execute()
        {
            try
            {
                while (!this._bStop)
                {
                    _statusUpdateHandle.WaitOne();

                    while (!_serversToInitialize.IsEmpty)
                    {
                        String serverName;
                        if (_serversToInitialize.TryTake(out serverName))
                        {
                            var           server    = _servers.FirstOrDefault(adapter => adapter.ServerName == serverName);
                            ServerAdapter tmpServer = server;
                            if (tmpServer != null && !this._lists.Keys.Any(listServer => listServer == tmpServer.ServerName))
                            {
                                Logger.ServiceLogger.Informational(String.Format("Initialization for server {0} started.", server.ServerName));
                                List <String>        listNames = server.GetListNames();
                                List <ADCListHelper> tmpList   = new List <ADCListHelper>();
                                for (Int32 i = 0; i < server.NumberOfLists; i++)
                                {
                                    ADCListHelper newListHelper = new ADCListHelper(server, i + 1, true);
                                    try
                                    {
                                        newListHelper.ListName = listNames.ElementAt(i);
                                    }
                                    catch (ArgumentNullException)
                                    {
                                    }
                                    catch (ArgumentOutOfRangeException)
                                    {
                                    }
                                    newListHelper.OnListChange    += this.OnListChange;
                                    newListHelper.OnDisplayChange += this.OnListChange;
                                    newListHelper.OnSystemChange  += this.OnListChange;
                                    newListHelper.OnEventsAdded   += this.OnEventsAdded;
                                    newListHelper.OnEventsUpdated += this.OnEventsUpdated;
                                    newListHelper.OnEventsDeleted += this.OnEventsDeleted;
                                    newListHelper.OnEventsMoved   += this.OnEventsMoved;
                                    tmpList.Add(newListHelper);
                                }
                                while (!this._lists.TryAdd(server.ServerName, tmpList))
                                {
                                }
                                this.OnServerInitialized(tmpServer);
                                Logger.ServiceLogger.Informational(String.Format("Initialization for server {0} has been completed successfully.", server.ServerName));
                            }
                        }
                    }

                    while (!_serversToRemove.IsEmpty)
                    {
                        String serverName;
                        if (_serversToRemove.TryTake(out serverName))
                        {
                            RemoveAllListHelpersForServer(serverName);
                        }
                    }

                    var    serversToUpdate = new List <String>();
                    String srv;
                    while (_updates.TryDequeue(out srv))
                    {
                        if (!serversToUpdate.Contains(srv))
                        {
                            serversToUpdate.Add(srv);
                        }
                    }

                    foreach (var serverName in serversToUpdate)
                    {
                        if (_servers.Any(server => server.ServerName == serverName &&
                                         server.ServerStatus == ServerStatus.Connected))
                        {
                            // Execute NetworkBackground for each listHelper
                            try
                            {
                                if (this._lists.Keys.Any(key => key == serverName))
                                {
                                    List <ADCListHelper> listHelpers = this._lists[serverName];
                                    if (listHelpers != null)
                                    {
                                        listHelpers.ForEach(lc => lc.NetworkBackground());
                                    }
                                    this.IsReady = true;
                                }

                                LowPriorityTasks(_lowPriorityCounter);
                            }
                            catch (ObjectDisposedException)
                            {
                            }
                        }
                        _lowPriorityCounter++;
                    }
                    _statusUpdateHandle.Reset();
                }
            }
            catch (ThreadInterruptedException)
            {
            }
        }
Пример #7
0
        public TypeOfList GetListType(String server, Int32 list)
        {
            ADCListHelper lc = GetListHelper(server, list);

            return(lc.GetListType());
        }
Пример #8
0
        /// <summary>
        /// Get events count from the specified server/list
        /// </summary>
        public Int32 GetEventsCount(String server, Int32 list)
        {
            ADCListHelper lc = GetListHelper(server, list);

            return(lc.GetEventsCount());
        }