public string Design(string labelDefinition, IEnumerable <Object> data, string parentEntity, string printerName)
        {
            using (var listLabel = new ListLabel())
            {
                listLabel.LicensingInfo = ListLabelLicenseString;
                listLabel.Core.LlSetOption(LlOption.Metric, 1);
                listLabel.Core.LlSetOption(LlOption.Wizard_FileNew, 0);
                listLabel.Core.LlSetOption(LlOption.RibbonDefaultEnabledState, 1);
                listLabel.Core.LlSetOption(LlOption.NoFileVersionUpgradeWarning, 1);

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


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

                // Launch the designer
                listLabel.Design(LlProject.List);

                return(String.Empty);
            }
        }
Esempio n. 2
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 DesignListAndLabel(List <FlipDataSource> data, string labelFilePath, string labelFile, string printerName, int startPosition = 0)
        {
            using (ListLabel ll = new ListLabel())
            {
                FlipPrintDataToLaserFlips(data);
                SetUpListAndLabel(ll, data, startPosition);

                if (!string.IsNullOrEmpty(labelFile))
                {
                    ll.Design("", LlProject.Label, GetFullLabelFilePath(labelFilePath, labelFile), false);
                }
                else
                {
                    ll.Design(LlProject.Label);
                }
            }
        }
Esempio 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");
            }
        }
Esempio n. 5
0
 private void btnDesign_Click(object sender, EventArgs e)
 {
     InitDataSource();
     try
     {
         _lL.DesignerWorkspace.Caption = "RedmineReports";
         _lL.Design(LlProject.List);
     }
     catch (ListLabelException)
     {
     }
     catch (NullReferenceException ex)
     {
         MessageBox.Show(ex.Message);
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message + ex.StackTrace);
     }
 }
Esempio n. 6
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();
        }
Esempio n. 7
0
        private void button1_Click(object sender, EventArgs e)
        {
            ListLabel            LL = new ListLabel();
            OpenEdgeDataProvider dp = new OpenEdgeDataProvider();
            ServiceAdapter       s  = new ServiceAdapter(_schema);

            try
            {
                dp.ServiceName    = TextServiceName.Text;
                dp.ServiceAdapter = s;
                dp.Initialize();

                if (TableCombo.Text != "<none>")
                {
                    LL.DataMember = TableCombo.Text;
                    if (AutoMasterModeNone.Checked)
                    {
                        LL.AutoMasterMode = LlAutoMasterMode.None;
                    }
                    if (AutomasterModeAsVariables.Checked)
                    {
                        LL.AutoMasterMode = LlAutoMasterMode.AsVariables;
                    }
                    if (AutoMasterModeAsFields.Checked)
                    {
                        LL.AutoMasterMode = LlAutoMasterMode.AsFields;
                    }
                }

                LL.DataSource = dp;
                LL.Design();
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error: " + ex.Message);
            }
            LL.Dispose();
        }
Esempio n. 8
0
        public static string Design(string labelDefinition, IEnumerable <object> data, string parentEntity)
        {
            using (var listLabel = new ListLabel())
            {
                listLabel.LicensingInfo = ListLabelLicenseString;
                listLabel.Core.LlSetOption(LlOption.Metric, 1);
                listLabel.Core.LlSetOption(LlOption.Wizard_FileNew, 0);
                listLabel.Core.LlSetOption(LlOption.RibbonDefaultEnabledState, 1);
                listLabel.Core.LlSetOption(LlOption.NoFileVersionUpgradeWarning, 1);

                // 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);
                }

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

                // Now convert the resulting report stream into a string
                var streamReader           = new StreamReader(memoryStream);
                var updatedLabelDefinition = streamReader.ReadToEnd();

                return(updatedLabelDefinition);
            }
        }