private void EmptyCompletion()
 {
     _completionListStore = new ListStore(typeof(Guid), typeof(string), typeof(string), typeof(string));
     _completionListStore.AppendValues("", "Загрузка...", "");
     Completion.Model = _completionListStore;
     Completion.Complete();
 }
        private void StreetLoaded()
        {
            var streets = _streetsDataLoader.GetStreets();

            _completionListStore = new ListStore(typeof(Guid), typeof(string), typeof(string), typeof(string), typeof(string));

            foreach (var s in streets)
            {
                _completionListStore.AppendValues(
                    s.FiasGuid,
                    s.Name,
                    s.TypeName,
                    s.TypeShortName,
                    s.StreetDistrict
                    );
            }

            Application.Invoke((sender, e) =>
            {
                if (Completion != null)
                {
                    Completion.Model = _completionListStore;
                    if (HasFocus)
                    {
                        Completion.Complete();
                    }
                }
            });
        }
        private void HousesLoaded()
        {
            Application.Invoke((sender, e) =>
            {
                var houses           = HousesDataLoader.GetHouses();
                _completionListStore = new ListStore(typeof(HouseDTO));

                foreach (var house in houses)
                {
                    _completionListStore.AppendValues(house);
                }

                if (Completion != null)
                {
                    Completion.Model = _completionListStore;

                    if (HasFocus)
                    {
                        Completion.Complete();
                    }

                    CompletionLoaded?.Invoke(null, EventArgs.Empty);
                }
            });
        }
Example #4
0
        private void CitiesLoaded()
        {
            Application.Invoke((senderObject, eventArgs) =>
            {
                var cities           = _citiesDataLoader.GetCities();
                _completionListStore = new ListStore(typeof(Guid), typeof(string), typeof(string), typeof(string));

                foreach (var city in cities)
                {
                    _completionListStore.AppendValues(
                        city.FiasGuid,
                        city.TypeName,
                        city.TypeShortName,
                        city.Name
                        );
                }

                if (Completion != null)
                {
                    Completion.Model = _completionListStore;
                    if (HasFocus)
                    {
                        Completion.Complete();
                    }
                }
            });
        }
Example #5
0
        public void TestCompleteAndWaitMethodWithTwoThreads()
        {
            var myEvent      = new ManualResetEvent(false);
            var synchronizer = new Completion();
            var producer     = new Thread(() =>
            {
                myEvent.Set();
                synchronizer.WaitForCompletion(Timeout.Infinite);
            });

            producer.Start();
            myEvent.WaitOne();
            synchronizer.Complete();
            producer.Join();
        }
Example #6
0
        private void HousesLoaded()
        {
            Application.Invoke((sender, e) => {
                OsmHouse[] houses   = HousesDataLoader.GetHouses();
                completionListStore = new ListStore(typeof(string), typeof(long), typeof(OsmHouse));

                foreach (var h in houses)
                {
                    completionListStore.AppendValues(h.ComplexNumber, h.Id, h);
                }

                if (Completion != null)
                {
                    Completion.Model = completionListStore;
                    if (HasFocus)
                    {
                        Completion?.Complete();
                    }
                    CompletionLoaded?.Invoke(null, EventArgs.Empty);
                }
            });
        }
Example #7
0
        private void StreetLoaded()
        {
            var streets = streetsDataLoader.GetStreets();

            completionListStore = new ListStore(typeof(string), typeof(string));
            foreach (var s in streets)
            {
                completionListStore.AppendValues(
                    s.Name,
                    s.Districts
                    );
            }
            Application.Invoke((sender, e) => {
                if (Completion != null)
                {
                    Completion.Model = completionListStore;
                    if (HasFocus)
                    {
                        Completion.Complete();
                    }
                }
            });
        }
Example #8
0
 private void CitiesLoaded()
 {
     Application.Invoke((senderObject, eventArgs) => {
         OsmCity[] cities    = citiesDataLoader.GetCities();
         completionListStore = new ListStore(typeof(string), typeof(string), typeof(LocalityType), typeof(long));
         foreach (var c in cities)
         {
             completionListStore.AppendValues(
                 c.Name,
                 c.SuburbDistrict,
                 c.LocalityType,
                 c.OsmId
                 );
         }
         if (Completion != null)
         {
             Completion.Model = completionListStore;
             if (HasFocus)
             {
                 Completion?.Complete();
             }
         }
     });
 }
Example #9
0
 private void AskSequential(IPerfReceiver receiver, Completion<TimeSpan> completion, Stopwatch sw, int messageCount)
 {
     if(messageCount == 0) {
         sw.Stop();
         completion.Complete(sw.Elapsed);
     }
     receiver.Ask("foo").ContinueWith(t => AskSequential(receiver, completion, sw, messageCount - 1));
 }