Exemplo n.º 1
0
        /// <summary>
        /// Show, enqueue events into Datas.
        /// </summary>
        /// <param name="name">String that should contain Name.</param>
        /// <param name="description">String that should contain Description.</param>
        /// <param name="from">Start of interval when event happen.</param>
        /// <param name="to">End of interval when event happen.</param>
        /// <param name="notificationDate">Date when notification should happen.</param>
        public void SearchShowEvents(string name, string description, DateTime from, DateTime to, DateTime notificationDate)
        {
            SearchParams searchParams;
            lock (searchStateChangeLock)
            {
                searchParams = new SearchParams(name, description, from, to, notificationDate);
                searchSearchingParams = searchParams;
                temporaryStopRequested = true;
            }
            Working = true;

            form.ClearSearchListBox();

            lock (listboxSearchData)
                listboxSearchData.Clear();
            lock (searchBoldedDates)
                searchBoldedDates.Clear();

            Thread t = new Thread(searchFindEventsParallel);
            t.IsBackground = true; 
            t.Name = " - Search Worker";
            t.Start(searchParams);

            form.EnableSearchTimer();
        }
Exemplo n.º 2
0
 /// <summary>
 /// Determine if work should stop.
 /// </summary>
 /// <param name="sParams">Starting parameters.</param>
 /// <returns>True if it should stop, False otherwise.</returns>
 private bool invokeStopSearchQueing(SearchParams sParams)
 {
     lock (searchStateChangeLock)
     {
         if (searchSearchingParams != sParams)
             return true;
         if (stopRequested)
             return true;
         if (temporaryStopRequested)
             return true;
         return false;
     }
 }
Exemplo n.º 3
0
 /// <summary>
 /// Chnage searching parameter to new one.
 /// </summary>
 /// <param name="searchSearchingParams">New searching parameters.</param>
 public void ChangePreviewSearchingData(SearchParams searchSearchingParams)
 {
     lock (searchStateChangeLock)
     {
         this.searchSearchingParams = searchSearchingParams;
     }
 }
Exemplo n.º 4
0
        /// <summary>
        /// Insert new Events and Bolded Dates into queues.
        /// </summary>
        /// <param name="events">Source of events, that should be inserted.</param>
        /// <param name="sParams">Local paramater with which this was started.</param>
        private void insertEventsAndBoldedDates(IEnumerable<TimeEvent> events, SearchParams sParams)
        {
            foreach (var item in events)
            {
                if (invokeStopSearchQueing(sParams))
                    return;
                lock (listboxSearchData)
                {
                    while (listboxSearchData.Count > 500)
                    {
                        Monitor.Wait(listboxSearchData, 250);
                        if (invokeStopSearchQueing(sParams))
                            return;
                    }
                    listboxSearchData.Enqueue(item);
                }

                lock (searchBoldedDates)
                {
                    if (invokeStopSearchQueing(sParams))
                        return;
                    SupportMethods.EnqueInterval(searchBoldedDates, item.StartDate, item.EndDate);
                }
            }

            
        }