public override void Refresh()
        {
            try
            {
                grdModule.BeginUpdate();

                grdModuleView.Columns.Clear();
                grdModuleView.Columns.Add(new GridColumn()
                {
                    Caption = "Device", Visible = true, FieldName = "Name"
                });
                grdModuleView.Columns.Add(new GridColumn()
                {
                    Caption = "Connections", Visible = true, FieldName = "ConnectionsCount", Width = 45
                });

                grdModuleView.Columns["ConnectionsCount"].AppearanceHeader.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center;
                grdModuleView.Columns["ConnectionsCount"].AppearanceCell.TextOptions.HAlignment   = DevExpress.Utils.HorzAlignment.Center;

                grdModule.DataSource = FeedbackDecoder.FindAll();

                grdModule.EndUpdate();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            base.Refresh();
        }
        public void DeleteModule()
        {
            if (grdModuleView.SelectedRowsCount <= 0)
            {
                MessageBox.Show("You must select the control device you want to delete.",
                                Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            if (!(grdModuleView.GetRow(grdModuleView.GetSelectedRows()[0]) is FeedbackDecoder device))
            {
                return;
            }

            if (MessageBox.Show("Are you sure you want to delete the module " + device.Name + " and all its related data and configurations?",
                                Application.ProductName, MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == System.Windows.Forms.DialogResult.No)
            {
                return;
            }

            try
            {
                FeedbackDecoder.Delete(device.ID);

                // Delete decoder also from project
                OTCContext.Project.FeedbackDecoders.Remove(device);

                this.Refresh();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }