Exemple #1
0
        void EntryUpdated(EntryEvent<CarKey, Car> _event)
        {
            if (this.InvokeRequired)
            {
                this.Invoke(
                    new MethodInvoker(
                    delegate() { EntryUpdated(_event); }));
            }
            else
            {
                Console.WriteLine("UPDATE RECEIVED");
                long modelId = _event.GetKey().ModelId;

                BindingList<RowData> list = bindingSource.DataSource as BindingList<RowData>;

                for (int i = 0; i < list.Count; i++)
                {
                    if (modelId == list[i].ModelId)
                    {
                        CarKey key = _event.GetKey();
                        Car car = _event.GetValue();

                        var row = list[i];
                        row.Update(key, car);
                        list[i] = row;
                    }
                }

            }
        }
Exemple #2
0
        void EntryAdded(EntryEvent<CarKey, Car> _event)
        {
            if (this.InvokeRequired)
            {
                this.Invoke(
                    new MethodInvoker(
                    delegate() { EntryAdded(_event); }));
            }
            else
            {
                BindingList<RowData> list = bindingSource.DataSource as BindingList<RowData>;

                CarKey key = _event.GetKey();
                Car car = _event.GetValue();

                list.Add(new RowData(key, car));
            }
        }