コード例 #1
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");
            }
        }
コード例 #2
0
ファイル: DemoForm.cs プロジェクト: combit/NETDataProviders
        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();
        }