コード例 #1
0
        private void buttonFile_Click(object sender, EventArgs e)
        {
            OpenFileDialog openFileDialog1 = new OpenFileDialog();

            //openFileDialog1.InitialDirectory = "c:\\";
            openFileDialog1.Filter      = "Json files (*.json)|*.json|All files (*.*)|*.*";
            openFileDialog1.FilterIndex = 2;
            //openFileDialog1.RestoreDirectory = true;

            if (openFileDialog1.ShowDialog() == DialogResult.OK)
            {
                textFilename.Text = openFileDialog1.FileName;
                try
                {
                    _schema = File.ReadAllText(openFileDialog1.FileName, Encoding.UTF8);
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Error: Could not read file from disk. Original error: " + ex.Message);
                }

                OpenEdgeServiceCatalogReader reader = new OpenEdgeServiceCatalogReader();
                TextServiceName.Text = reader.ReadSchema(_schema);

                OpenEdgeDataProvider dp = new OpenEdgeDataProvider();
                ServiceAdapter       s  = new ServiceAdapter(_schema);
                dp.ServiceName    = TextServiceName.Text;
                dp.ServiceAdapter = s;
                dp.Initialize();

                ReadOnlyCollection <ITable> tables;
                tables = dp.Tables;

                TableCombo.Items.Clear();
                TableCombo.Items.Add("<none>");
                foreach (ITable t in tables)
                {
                    TableCombo.Items.Add(t.TableName);
                }
                TableCombo.SelectedIndex = 0;
            }
        }
コード例 #2
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");
            }
        }
コード例 #3
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();
        }
コード例 #4
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();
        }