Exemplo n.º 1
0
        private void Button_Click(object sender, EventArgs e)
        {
            Button btn = (Button)sender;
            int    type;

            if (btn.Name == "MainWHButton")
            {
                type = 0;
            }
            else
            {
                type = 1;
            }
            try
            {
                if (this.Text == "Печать")
                {
                    LL.Print(type, LlProject.Label, System.Windows.Forms.Application.StartupPath + "\\Шаблоны\\Пропуск.lbl", false, LlPrintMode.Export, LlBoxType.EmptyWait, this.Handle, "Печать...", true, "");
                }
                else
                {
                    LL.Design(type, this.Handle, "Открытие шаблона", LlProject.Label | LlProject.FileAlsoNew, System.Windows.Forms.Application.StartupPath + "\\Шаблоны\\Пропуск.lbl", false);
                }
            }
            catch (LL_User_Aborted_Exception) { }
            catch (Exception exp)
            {
                MessageBox.Show(exp.ToString(), "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            Close();
        }
        public void PrintListAndLabel(List <FlipDataSource> data,
                                      string labelFilePath,
                                      string labelFile,
                                      string printerName,
                                      int startPosition = 0
                                      )
        {
            using (ListLabel ll = new ListLabel())
            {
                FlipPrintDataToLaserFlips(data);
                SetUpListAndLabel(ll, data, startPosition);

                ll.Print(printerName, LlProject.Label, GetFullLabelFilePath(labelFilePath, labelFile));
            }
        }
        public bool Print(string labelDefinition, IEnumerable <Object> data, string parentEntity, string printerName)
        {
            try
            {
                using (var listLabel = new ListLabel())
                {
                    listLabel.LicensingInfo = ListLabelLicenseString;

                    // Set up the dataset
                    listLabel.DataSource = new ObjectDataProvider(data)
                    {
                        FlattenStructure = true,
                    };
                    listLabel.DataMember     = parentEntity;
                    listLabel.AutoMasterMode = LlAutoMasterMode.AsVariables;

                    // Configure the designer to read the report design from a memoryStream
                    var memoryStream = new MemoryStream();
                    if (labelDefinition != null)
                    {
                        var stringBytes = Encoding.Unicode.GetBytes(labelDefinition);
                        memoryStream.Write(stringBytes, 0, stringBytes.Length);
                    }

                    // If we have a default printer then set it here
                    if (printerName != null)
                    {
                        listLabel.Core.LlSetOptionString(71, printerName);
                    }

                    // Launch the designer
                    listLabel.Print(LlProject.List, memoryStream);

                    return(true);
                }
            }
            catch (LL_User_Aborted_Exception)
            {
                // Ignore user abort
            }

            return(false);
        }
Exemplo n.º 4
0
        private void LLAction(string action)
        {
            if (ensureService())
            {
                ListLabel            LL       = new ListLabel();
                OpenEdgeDataProvider Provider = new OpenEdgeDataProvider();

                Provider.ServiceAdapter = OpenEdgeServiceAdapter;
                Provider.ServiceName    = Config.ServiceName;
                Provider.Initialize();
                LL.DataSource = Provider;

                try
                {
                    if (action == "Design")
                    {
                        if (Config.DesignerPreviewMaxRows > 0)
                        {
                            Provider.MaxRows = Config.DesignerPreviewMaxRows;
                        }
                        LL.Design();
                    }
                    else
                    {
                        LL.Print();
                    }
                }
                catch (ListLabelException ex)
                {
                    MessageBox.Show(ex.Message);
                }
                finally
                {
                    Provider.Dispose();
                    LL.Dispose();
                }
            }
            else
            {
                MessageBox.Show("No connection available");
            }
        }
Exemplo n.º 5
0
        private void LLAction(string action)
        {
            var param = new RestConnectionParameter();

            param.RestURL  = Properties.Settings.Default.RestURL;
            param.Userid   = Properties.Settings.Default.Userid;
            param.Password = Properties.Settings.Default.Password;

            var ll = new ListLabel();
            var dp = new OpenEdgeDataProvider();

            dp.ServiceAdapter = new RestServiceAdapter(param);
            dp.ServiceName    = Properties.Settings.Default.ServiceName;
            dp.Initialize();
            ll.DataSource = dp;
            try
            {
                if (action == "DESIGN")
                {
                    if (Properties.Settings.Default.DesignerPreviewMaxRows > 0)
                    {
                        dp.MaxRows = Properties.Settings.Default.DesignerPreviewMaxRows;
                    }
                    ll.Design();
                }
                else if (action == "PRINT")
                {
                    ll.Print();
                }
                else
                {
                }
            }
            catch (ListLabelException e)
            {
                MessageBox.Show(e.Message);
            }
            ll.Dispose();

            dp.Dispose();
        }