Esempio n. 1
0
        private void btnPQ_Click(object sender, EventArgs e)
        {
            int intStart = 1564;
            int intEnd   = 1564;



            int countInside = intStart;

            for (int j = 0; countInside <= intEnd; j++)
            {
                for (int i = 0; i < 2; i++)
                {
                    ThermalLabel _currentThermalLabel = null;
                    _currentThermalLabel = this.GenerateBasicThermalLabel222(countInside);

                    //Neodynamic.SDK.Printing.PrinterSettings _printerSettings = new Neodynamic.SDK.Printing.PrinterSettings();
                    Neodynamic.SDK.Printing.PrinterSettings _printerSettings = new Neodynamic.SDK.Printing.PrinterSettings();
                    _printerSettings.Communication.CommunicationType = CommunicationType.USB;
                    _printerSettings.PrinterName         = _Printer;
                    _printerSettings.Dpi                 = 203;
                    _printerSettings.ProgrammingLanguage = (ProgrammingLanguage)Enum.Parse(typeof(ProgrammingLanguage), "ZPL");
                    PrintOrientation _printOrientation = PrintOrientation.Portrait;

                    using (PrintJob pj = new PrintJob(_printerSettings))
                    {
                        pj.PrintOrientation = _printOrientation;
                        pj.ThermalLabel     = _currentThermalLabel;
                        pj.Print();
                    }
                }
                countInside++;
            }
        }
Esempio n. 2
0
        // Printed Dropdown Menu
        private void tsdbPrinter_DropDownItemClicked(object sender, ToolStripItemClickedEventArgs e)
        {
            ToolStripDropDownButton dd = (ToolStripDropDownButton)sender;
            string pick = e.ClickedItem.Name;

            psettings = new Neodynamic.SDK.Printing.PrinterSettings();
            switch (pick)
            {
            case "printSettingsToolStripMenuItem":
            {
                Weaselware.InventoryFerret.PrintJobDialog dialog = new Weaselware.InventoryFerret.PrintJobDialog();
                //dialog.PrinterSettings = Properties.Settings.Default.PrinterSetting;
                if (dialog.ShowDialog() == DialogResult.OK)
                {
                    psettings.PrinterName         = dialog.PrinterSettings.PrinterName;
                    psettings.ProgrammingLanguage = dialog.PrinterSettings.ProgrammingLanguage;
                    psettings.Dpi = dialog.PrinterSettings.Dpi;
                    psettings.Communication.CommunicationType  = dialog.PrinterSettings.Communication.CommunicationType;
                    Properties.Settings.Default.PrinterSetting = psettings;
                    Properties.Settings.Default.Save();
                }

                break;
            }

            case  "printSelectedLabelToolStripMenuItem":
            {
                break;
            }

            default:
                break;
            }
        }
Esempio n. 3
0
        private void btnPrint_Click(object sender, EventArgs e)
        {
            ThermalLabel _currentThermalLabel = null;

            _currentThermalLabel = this.GenerateBasicThermalLabel();

            //Neodynamic.SDK.Printing.PrinterSettings _printerSettings = new Neodynamic.SDK.Printing.PrinterSettings();
            Neodynamic.SDK.Printing.PrinterSettings _printerSettings = new Neodynamic.SDK.Printing.PrinterSettings();
            _printerSettings.Communication.CommunicationType = CommunicationType.USB;
            _printerSettings.PrinterName         = _Printer;
            _printerSettings.Dpi                 = 203;
            _printerSettings.ProgrammingLanguage = (ProgrammingLanguage)Enum.Parse(typeof(ProgrammingLanguage), "ZPL");
            PrintOrientation _printOrientation = PrintOrientation.Portrait;

            int    x = 0;
            bool   isPrinterValid = false;
            string printerName    = _Printer;
            string query          = string.Format("SELECT * from Win32_Printer "
                                                  + "WHERE Name LIKE '%{0}'",
                                                  printerName);

            ManagementObjectSearcher   searcher = new ManagementObjectSearcher(query);
            ManagementObjectCollection coll     = searcher.Get();

            foreach (ManagementObject printer in coll)
            {
                foreach (PropertyData property in printer.Properties)
                {
                    //Console.WriteLine(string.Format("{0}: {1}",
                    //                                property.Name,
                    //                                property.Value));
                    if (x == 85)
                    {
                        isPrinterValid = (bool)property.Value;
                    }
                    x++;
                }
            }

            if (isPrinterValid)
            {
                MessageBox.Show("Impresora no conectada o apagada. Asegúrese de que la impresora esté conectada y que esté encendida. \nPuede imprimir la etiqueta en otro momento en el menú ACTUALIZAR.", "Conecte y encieda la impresora", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            else
            {
                for (int i = 0; i < 2; i++)
                {
                    using (PrintJob pj = new PrintJob(_printerSettings))
                    {
                        pj.PrintOrientation = _printOrientation;
                        pj.ThermalLabel     = _currentThermalLabel;
                        pj.Print();
                    }
                }
                this.Close();
            }
        }
Esempio n. 4
0
 public MainFrm()
 {
     InitializeComponent();
     this.dgLineItems.AutoGenerateColumns = false;
     this.dgJobItems.AutoGenerateColumns  = false;
     this.dgJobItems.SelectionMode        = DataGridViewSelectionMode.FullRowSelect;
     this.dgJobItems.Columns[1].DefaultCellStyle.BackColor     = System.Drawing.Color.BlanchedAlmond;
     this.dgJobItems.AlternatingRowsDefaultCellStyle.BackColor = System.Drawing.Color.LightGray;
     lvSuppliersOrders.MultiSelect            = false;
     this.dgSupplierItems.AutoGenerateColumns = false;
     psettings = Properties.Settings.Default.PrinterSetting;
     ThermalLabel.LicenseOwner          = "Richard Young-Standard Edition-Developer License";
     ThermalLabel.LicenseKey            = "MC4J7E7UM8BDLXA72PEWSJ84NR5FXRVBKPANLSYTCCGKKNMW9N6A";
     this.tabMain.SelectedIndexChanged += tabMain_SelectedIndexChanged;
 }
Esempio n. 5
0
        private void btnPrint_Click(object sender, EventArgs e)
        {
            if (_aObject.IdAssets == 0)
            {
                MessageBox.Show("Busque primero un Activo Fijo.", "Campo Faltante", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                ThermalLabel _currentThermalLabel = null;
                _currentThermalLabel = this.GenerateBasicThermalLabel();

                Neodynamic.SDK.Printing.PrinterSettings _printerSettings = new Neodynamic.SDK.Printing.PrinterSettings();
                _printerSettings.Communication.CommunicationType = CommunicationType.USB;
                _printerSettings.PrinterName         = _Printer;
                _printerSettings.Dpi                 = 203;
                _printerSettings.ProgrammingLanguage = (ProgrammingLanguage)Enum.Parse(typeof(ProgrammingLanguage), "ZPL");
                PrintOrientation _printOrientation = PrintOrientation.Portrait;

                int    x = 0;
                bool   isPrinterValid = false;
                string printerName    = _Printer;
                string query          = string.Format("SELECT * from Win32_Printer "
                                                      + "WHERE Name LIKE '%{0}'",
                                                      printerName);

                ManagementObjectSearcher   searcher = new ManagementObjectSearcher(query);
                ManagementObjectCollection coll     = searcher.Get();

                foreach (ManagementObject printer in coll)
                {
                    foreach (PropertyData property in printer.Properties)
                    {
                        //Console.WriteLine(string.Format("{0}: {1}",
                        //                                property.Name,
                        //                                property.Value));
                        if (x == 85)
                        {
                            isPrinterValid = (bool)property.Value;
                        }
                        x++;
                    }
                }

                if (isPrinterValid)
                {
                    MessageBox.Show("Impresora no conectada o apagada. Asegúrese de que la impresora esté conectada y que esté encendida para poder imprimir.", "Conecte y encieda la impresora", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
                else
                {
                    try
                    {
                        using (PrintJob pj = new PrintJob(_printerSettings))
                        {
                            pj.PrintOrientation = _printOrientation;
                            pj.ThermalLabel     = _currentThermalLabel;
                            pj.Print();
                        }
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show("Error: " + ex);
                    }
                }
            }
        }