public MainForm()
        {
            InitializeComponent();
            // ReSharper disable once VirtualMemberCallInConstructor
            Text = $@"{AssemblyInfoHelper.GetTitle()} v{AssemblyInfoHelper.GetVersion()}";

            this.Subscribe <CantConnectToTheBarcodeReaderEvent>(e => {
                Invoke(new Action(() =>
                {
                    MessageBox.Show("Skaner Kodów Kreskowych nie został podłączony.\nSkanowanie kodów nie będzie możliwe.", "Uwaga", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }));
            });

            this.Subscribe <CantConnectToTheThermalPrinterEvent>(e => {
                Invoke(new Action(() =>
                {
                    MessageBox.Show("Drukarka termiczna nie została podłączona.\nDrukowanie faktur nie będzie możliwe.", "Uwaga", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }));
            });

            this.Subscribe <BarcodeWasScannedEvent>(e => {
                Invoke(new Action(() =>
                {
                    var activeChild = ActiveMdiChild;

                    if (activeChild != null)
                    {
                        try
                        {
                            var transactionForm = (TransactionForm)activeChild;
                            if (transactionForm.AddProductByBarcode(e.Barcode))
                            {
                                return;
                            }

                            this.Publish(new BarcodeErrorEncounteredEvent());

                            MessageBox.Show("Produktu o kodzie " + e.Barcode + " nie ma w bazie produktów!", "Błędny Kod", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        }
                        catch (Exception)
                        {
                            MessageBox.Show("Aby zeskanować kod kreskowy, aktywuj okno z tranzakcją", "Informacja", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        }
                    }
                    else
                    {
                        MessageBox.Show("Aby zeskanować kod kreskowy, aktywuj okno z tranzakcją", "Informacja", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                }));
            });
        }
Пример #2
0
        public AboutBox()
        {
            InitializeComponent();

            this.Text = String.Format("Informacje o {0} v{1}", AssemblyInfoHelper.GetTitle(), AssemblyInfoHelper.GetVersion());
            this.labelProductName.Text   = AssemblyInfoHelper.GetProduct();
            this.labelVersion.Text       = String.Format("Wersja {0}", AssemblyInfoHelper.GetVersion());
            this.labelCopyright.Text     = AssemblyInfoHelper.GetCopyright();
            this.labelCompanyName.Text   = AssemblyInfoHelper.GetCompany();
            this.textBoxDescription.Text = AssemblyInfoHelper.GetDescription();


            _gearImage = Image.FromFile(@"Images\gear.png");
        }