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()); }
public UserSelect() { try { InitializeComponent(); GuiController.IsMainActionsAllowed = false; CloseTabButton.Barcode = CloseTabButton.RegisterControl((c) => this.NavigateToMainPage()); GuiController.ControlCallback SessionCallback = delegate(string code) { string workerName = GuiController.GetAssociatedControl(code).GetCustomData <string>(); if (SessionManager.CreateNewSession(workerName)) { GuiController.CreateMessage("Смена открыта под пользователем " + workerName, false); } else { GuiController.CreateMessage("Не удалось открыть смену. Проверьте конфигурационный файл", true); } this.NavigateToMainPage(); }; List <LinearButton> buttons = new List <LinearButton>(); int index = 0; foreach (string user in AppHelper.Configuration.Users) { LinearButton button = new LinearButton(); button.ButtonText = user; button.ButtonBackColor = Color.DimGray; button.Image = Properties.Resources.sad_64; button.Barcode = button.RegisterControl(SessionCallback); button.Anchor = AnchorStyles.Left | AnchorStyles.Top; button.Height = ContentHeight; button.Width = ContentWidth; button.TabIndex = index; button.Margin = new Padding(ContentMargins, ContentMargins, 0, 0); button.SetCustomData(user); buttons.Add(button); index++; } ContentLayoutPanel.Controls.AddRange(buttons.ToArray()); } catch (Exception ex) { GuiController.IsMainActionsAllowed = true; MessageBox.Show(ex.ToString(), "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public ShowCartridgeInfo() { try { InitializeComponent(); GuiController.IsMainActionsAllowed = false; CloseTabButton.Barcode = CloseTabButton.RegisterControl((c) => this.NavigateToMainPage()); Disposed += (s, e) => AppHelper.ComListener.BarcodeReaded -= CartridgeCodeReaded; AppHelper.ComListener.BarcodeReaded += CartridgeCodeReaded; } catch (Exception ex) { GuiController.IsMainActionsAllowed = true; MessageBox.Show(ex.ToString(), "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public AddNewCartridge() { GuiController.IsMainActionsAllowed = false; InitializeComponent(); Disposed += (s, e) => AppHelper.ComListener.BarcodeReaded -= CartridgeCodeReaded; AppHelper.ComListener.BarcodeReaded += CartridgeCodeReaded; DateBox.Text = DateTime.Now.ToString("dd.MM.yyyy"); WorkerBox.Text = SessionManager.WorkerName; CloseTabButton.Barcode = CloseTabButton.RegisterControl((c) => this.NavigateToMainPage()); SaveButton.Barcode = SaveButton.RegisterControl((c) => this.NavigateToMainPage()); GuiController.ControlCallback SessionCallback = delegate(string code) { ICodeButton sender = GuiController.GetAssociatedControl(code); sender.Checked = !sender.Checked; }; string[] types = DatabaseHelper.GetCartridgeTypes().ToArray(); List <LinearButton> buttons = new List <LinearButton>(); int index = 0; foreach (string type in types) { LinearButton button = new LinearButton(); button.ButtonText = type; button.Barcode = button.RegisterControl(SessionCallback); button.Anchor = AnchorStyles.Left | AnchorStyles.Top; button.CompactMode = true; button.TabIndex = index; button.Margin = new Padding(0, 0, 0, ContentMargins); button.SetCustomData(type); buttons.Add(button); index++; } TypeLayoutPanel.Controls.AddRange(buttons.ToArray()); string[] models = DatabaseHelper.GetCartridgeModels().ToArray(); buttons = new List <LinearButton>(); index = 0; foreach (string model in models) { LinearButton button = new LinearButton(); button.ButtonText = model; button.Barcode = button.RegisterControl(SessionCallback); button.Anchor = AnchorStyles.Left | AnchorStyles.Top; button.CompactMode = true; button.TabIndex = index; button.Margin = new Padding(0, 0, ContentMargins, ContentMargins); button.SetCustomData(model); buttons.Add(button); index++; } ModelsLayoutPanel.Controls.AddRange(buttons.ToArray()); LocationsBox.LoadContentPage += delegate(AlphabetBox sender, char[] words) { string[] locations = DatabaseHelper.GetCartridgeLocations().ToArray(); locations = locations.Where(x => words.Contains(char.ToLowerInvariant(x.First()))).ToArray(); buttons = new List <LinearButton>(); index = 0; foreach (string location in locations) { LinearButton button = new LinearButton(); button.ButtonText = location; button.Barcode = button.RegisterControl(SessionCallback); button.Anchor = AnchorStyles.Left | AnchorStyles.Top; button.CompactMode = true; button.TabIndex = index; button.Margin = new Padding(0, 0, ContentMargins, ContentMargins); button.SetCustomData(location); buttons.Add(button); index++; } LinearButton backButton = new LinearButton(); backButton.ButtonText = "Вернуться назад"; backButton.Image = Properties.Resources.back_64; backButton.Barcode = backButton.RegisterControl((c) => sender.LoadMainPage()); backButton.ButtonBackColor = Color.LightSkyBlue; backButton.Anchor = AnchorStyles.Left | AnchorStyles.Top; backButton.CompactMode = true; backButton.FontSize = 9.25F; backButton.TabIndex = index; backButton.Margin = new Padding(0, 0, ContentMargins, ContentMargins); buttons.Add(backButton); sender.ContentControls.AddRange(buttons.ToArray()); }; }