Example #1
0
            private void _searchRefresh(object sender, EventArgs e)
            {
                if (_objectsSubscription != null)
                {
                    _objectsSubscription.Dispose();
                    _objectsSubscription = null;
                }

                if (!string.IsNullOrEmpty(_search.Text))
                {
                    var db = BACnetSession.Current.GetProcess <NetworkDatabase>();
                    _objects             = new DescriptorObserverCollection <ObjectInfo, GlobalObjectId>(Eto.Forms.Application.Instance);
                    _objectsSubscription = db.Subscribe(new DescriptorQuery(nameRegex: _search.Text), _objects);
                    _grid.DataStore      = _objects;
                }

                _searchTimer.Stop();
            }
Example #2
0
            private void _searchRefresh(object sender, EventArgs e)
            {
                if (_objectsSubscription != null)
                {
                    _objectsSubscription.Dispose();
                    _objectsSubscription = null;
                }

                if (!string.IsNullOrEmpty(_search.Text))
                {
                    var db = BACnetSession.Current.GetProcess<NetworkDatabase>();
                    _objects = new DescriptorObserverCollection<ObjectInfo, GlobalObjectId>(Eto.Forms.Application.Instance);
                    _objectsSubscription = db.Subscribe(new DescriptorQuery(nameRegex: _search.Text), _objects);
                    _grid.DataStore = _objects;
                }

                _searchTimer.Stop();
            }
Example #3
0
            /// <summary>
            /// Constructs a new device info tab panel
            /// </summary>
            /// <param name="device">The device to show information for</param>
            public Panel(ObjectInfo device)
            {
                this._device = device;

                // subscribe to the device's objects
                var db = BACnetSession.Current.GetProcess<NetworkDatabase>();
                this._objects = new DescriptorObserverCollection<ObjectInfo, GlobalObjectId>(Application.Instance);
                this._objectsSubscription = db.Subscribe(new DescriptorQuery(deviceInstance: _device.DeviceInstance), this._objects);

                _grid = new GridView<ObjectInfo>();
                _grid.DataStore = _objects;

                // helps drastically with layout performance,
                // specifically on WPF
                _grid.RowHeight = 19;

                _grid.AllowMultipleSelection = false;

                _grid.Columns.Add(new GridColumn()
                {
                    HeaderText = Constants.ObjectTypeHeaderText,
                    Editable = false,
                    Width = 100,
                    DataCell = new TextBoxCell()
                    {
                        Binding = new LambdaBinding<ObjectInfo, string>(
                            oi => ((ObjectType)oi.ObjectIdentifier.Type).ToString())
                    }
                });

                _grid.Columns.Add(new GridColumn()
                {
                    HeaderText = Constants.ObjectInstanceHeaderText,
                    Editable = false,
                    Width = 75,
                    DataCell = new TextBoxCell()
                    {
                        Binding = new LambdaBinding<ObjectInfo, string>(
                            oi => oi.ObjectIdentifier.Instance.ToString())
                    }
                });

                _grid.Columns.Add(new GridColumn()
                {
                    HeaderText = Constants.ObjectNameHeaderText,
                    Editable = false,
                    DataCell = new TextBoxCell()
                    {
                        Binding = new LambdaBinding<ObjectInfo, string>(
                            oi => oi.Name)
                    }
                });

                _grid.SelectedItemsChanged += delegate(object s, EventArgs e)
                {
                    var item = _grid.SelectedItem as ObjectInfo;
                    if (item != null)
                    {
                        var stack = MainForm.Current.Stack;
                        stack.PopUntil<DevicePanel>();
                        stack.Push(new ObjectPanel(item));
                    }
                };

                this.Content = _grid;
            }
Example #4
0
            /// <summary>
            /// Constructs a new device info tab panel
            /// </summary>
            /// <param name="device">The device to show information for</param>
            public Panel(ObjectInfo device)
            {
                this._device = device;

                // subscribe to the device's objects
                var db = BACnetSession.Current.GetProcess <NetworkDatabase>();

                this._objects             = new DescriptorObserverCollection <ObjectInfo, GlobalObjectId>(Application.Instance);
                this._objectsSubscription = db.Subscribe(new DescriptorQuery(deviceInstance: _device.DeviceInstance), this._objects);

                _grid           = new GridView <ObjectInfo>();
                _grid.DataStore = _objects;

                // helps drastically with layout performance,
                // specifically on WPF
                _grid.RowHeight = 19;

                _grid.AllowMultipleSelection = false;

                _grid.Columns.Add(new GridColumn()
                {
                    HeaderText = Constants.ObjectTypeHeaderText,
                    Editable   = false,
                    Width      = 100,
                    DataCell   = new TextBoxCell()
                    {
                        Binding = new LambdaBinding <ObjectInfo, string>(
                            oi => ((ObjectType)oi.ObjectIdentifier.Type).ToString())
                    }
                });

                _grid.Columns.Add(new GridColumn()
                {
                    HeaderText = Constants.ObjectInstanceHeaderText,
                    Editable   = false,
                    Width      = 75,
                    DataCell   = new TextBoxCell()
                    {
                        Binding = new LambdaBinding <ObjectInfo, string>(
                            oi => oi.ObjectIdentifier.Instance.ToString())
                    }
                });

                _grid.Columns.Add(new GridColumn()
                {
                    HeaderText = Constants.ObjectNameHeaderText,
                    Editable   = false,
                    DataCell   = new TextBoxCell()
                    {
                        Binding = new LambdaBinding <ObjectInfo, string>(
                            oi => oi.Name)
                    }
                });

                _grid.SelectedItemsChanged += delegate(object s, EventArgs e)
                {
                    var item = _grid.SelectedItem as ObjectInfo;
                    if (item != null)
                    {
                        var stack = MainForm.Current.Stack;
                        stack.PopUntil <DevicePanel>();
                        stack.Push(new ObjectPanel(item));
                    }
                };

                this.Content = _grid;
            }