Exemplo n.º 1
0
 private void Index()
 {
     if (HasCollectionChanged)
     {
         ICollectionIndexer indexer = CreateIndexer();
         indexer.IndexingFinished += delegate { _UpdateIndex(indexer); };
         indexer.Index();
     }
 }
Exemplo n.º 2
0
            protected override void UpdateIndex(ICollectionIndexer indexer)
            {
                lock (shutdown_mutex) {
                    indexer_running    = true;
                    shutdown_requested = false;
                }

                bool shutdown_while_indexing = false;

                if (parent.export_fields != null && parent.export_fields.Count > 0)
                {
                    indexer.SetExportFields(parent.export_fields.ToArray());
                }

                parent.OnBeginUpdateIndex();

                for (int i = 0, models = indexer.GetModelCounts(); i < models; i++)
                {
                    for (int j = 0, items = indexer.GetModelResultsCount(i); j < items; j++)
                    {
                        if (Shutdown)
                        {
                            shutdown_while_indexing = true;
                            break;
                        }

                        parent.IndexResult(indexer.GetResult(i, j));
                    }

                    if (shutdown_while_indexing)
                    {
                        break;
                    }
                }

                lock (shutdown_mutex) {
                    indexer_running    = false;
                    shutdown_requested = false;
                }

                if (shutdown_while_indexing)
                {
                    parent.OnShutdownWhileIndexing();
                }

                parent.OnEndUpdateIndex();
            }
Exemplo n.º 3
0
        private void _UpdateIndex(ICollectionIndexer indexer)
        {
            ThreadPool.QueueUserWorkItem(delegate {
                Debug("Running indexer");

                try {
                    UpdateIndex(indexer);
                } catch (Exception e) {
                    Console.Error.WriteLine(e);
                }

                Debug("Indexer finished");

                indexer.Dispose();

                if (!ApplicationAvailable || !listening)
                {
                    DisconnectFromIndexerService();
                }
            });
        }
Exemplo n.º 4
0
            protected override void UpdateIndex(ICollectionIndexer indexer)
            {
                lock (shutdown_mutex) {
                    indexer_running = true;
                    shutdown_requested = false;
                }

                bool shutdown_while_indexing = false;

                if (parent.export_fields != null && parent.export_fields.Count > 0) {
                    indexer.SetExportFields (parent.export_fields.ToArray ());
                }

                parent.OnBeginUpdateIndex ();

                for (int i = 0, models = indexer.GetModelCounts (); i < models; i++) {
                    for (int j = 0, items = indexer.GetModelResultsCount (i); j < items; j++) {
                        if (Shutdown) {
                            shutdown_while_indexing = true;
                            break;
                        }

                        parent.IndexResult (indexer.GetResult (i, j));
                    }

                    if (shutdown_while_indexing) {
                        break;
                    }
                }

                lock (shutdown_mutex) {
                    indexer_running = false;
                    shutdown_requested = false;
                }

                if (shutdown_while_indexing) {
                    parent.OnShutdownWhileIndexing ();
                }

                parent.OnEndUpdateIndex ();
            }
Exemplo n.º 5
0
 protected abstract void UpdateIndex(ICollectionIndexer indexer);
Exemplo n.º 6
0
        private void _UpdateIndex(ICollectionIndexer indexer)
        {
            ThreadPool.QueueUserWorkItem (delegate {
                Debug ("Running indexer");

                try {
                    UpdateIndex (indexer);
                } catch (Exception e) {
                    Console.Error.WriteLine (e);
                }

                Debug ("Indexer finished");

                indexer.Dispose ();

                if (!ApplicationAvailable || !listening) {
                    DisconnectFromIndexerService ();
                }
            });
        }
Exemplo n.º 7
0
 protected abstract void UpdateIndex(ICollectionIndexer indexer);
Exemplo n.º 8
0
 /// <summary>
 /// Простой конструктор.
 /// </summary>
 public CollectionReference(ICollectionIndexer array, IValue index)
 {
     _index = index;
     _array = array;
 }