Пример #1
0
        public ServiceCartridge()
        {
            InitializeComponent();

            CloseTabButton.Barcode = CloseTabButton.RegisterControl((c) => this.NavigateToMainPage());

            DateBox.Text   = DateTime.Now.ToString("dd.MM.yyyy");
            WorkerBox.Text = SessionManager.WorkerName;

            GuiController.ControlCallback SessionCallback = delegate(string code) {
                ICodeButton sender = GuiController.GetAssociatedControl(code);
                sender.Checked = !sender.Checked;
            };

            string[]        actions = DatabaseHelper.GetCartridgeActionTypes().ToArray(); // !!!!!
            List <QRButton> buttons = new List <QRButton>();
            int             index   = 0;

            foreach (string action in actions)
            {
                QRButton button = new QRButton();
                button.ButtonText      = action;
                button.Barcode         = button.RegisterControl(SessionCallback);
                button.Anchor          = AnchorStyles.Left | AnchorStyles.Top;
                button.ButtonForeColor = Color.White;
                button.ButtonFont      = new Font(FontFactory.GetFontFamilyByName("Century Gothic"), 12.25F, FontStyle.Bold);
                button.TabIndex        = index;
                button.Margin          = new Padding(0, 0, ContentMargins, ContentMargins);
                //button.SetCustomData(type);

                buttons.Add(button);
                index++;
            }
            ContentLayoutPanel.Controls.AddRange(buttons.ToArray());
        }