Пример #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (textBox1.Text.Trim() == "")
            {
                textBox1.Focus();
                return;
            }
            if (textBox2.Text.Trim() == "")
            {
                textBox2.Focus();
                return;
            }
            if (textBox3.Text.Trim() == "")
            {
                textBox3.Focus();
                return;
            }

            IBMi.SetConfig("system", textBox1.Text);
            IBMi.SetConfig("username", textBox2.Text);
            IBMi.SetConfig("password", textBox3.Text);
            IBMi.SetConfig("clrcdlen", numericUpDown1.Value.ToString());

            this.Close();
        }
Пример #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (textBox1.Text.Trim() == "")
            {
                textBox1.Focus();
                return;
            }
            if (textBox2.Text.Trim() == "")
            {
                textBox2.Focus();
                return;
            }
            if (textBox3.Text.Trim() == "")
            {
                textBox3.Focus();
                return;
            }

            IBMi.SetConfig("system", textBox1.Text);
            IBMi.SetConfig("username", textBox2.Text);
            IBMi.SetConfig("password", textBox3.Text);
            IBMi.SetConfig("relicdir", textBox4.Text);
            IBMi.SetConfig("reliclib", textBox5.Text);

            this.Close();
        }
Пример #3
0
        private void button2_Click(object sender, EventArgs e)
        {
            label2.Text = "";
            label2.Update();

            //Add a default library
            if (listBox1.Items.Count == 0)
            {
                listBox1.Items.Add("SYSTOOLS");
            }

            string s = "";

            foreach (string item in listBox1.Items)
            {
                if (IBMiUtilities.IsValidQSYSObjectName(item.Trim()))
                {
                    s += item.Trim() + ',';
                }
                else
                {
                    label2.Text = "Invalid library: " + item.Trim();
                    label2.Update();
                    return;
                }
            }

            if (!IBMiUtilities.IsValidQSYSObjectName(textBox2.Text.Trim()))
            {
                label2.Text = "Invalid current library.";
                label2.Update();
                return;
            }

            string origLibl = IBMi.GetConfig("datalibl");
            string origCur  = IBMi.GetConfig("curlib");

            IBMi.SetConfig("datalibl", s.Remove(s.Length - 1, 1)); //Remove last comma
            IBMi.SetConfig("curlib", textBox2.Text.Trim());        //Remove last comma

            Boolean hasFailed = IBMi.RunCommands(new string[0]);

            if (hasFailed)
            {
                IBMi.SetConfig("datalibl", origLibl);
                IBMi.SetConfig("curlib", origCur);

                MessageBox.Show("Library list contains invalid libraries.", "Library list", MessageBoxButtons.OK, MessageBoxIcon.Error);
                if (Main.CommandWindow != null)
                {
                    Main.CommandWindow.loadNewOutput();
                }
            }
            else
            {
                this.Close();
            }
        }
Пример #4
0
        private void treeView1_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Delete)
            {
                if (treeView1.SelectedNode != null)
                {
                    var confirmResult = MessageBox.Show("Are you sure to delete this binding?",
                                                        "Delete binding",
                                                        MessageBoxButtons.YesNo);

                    if (confirmResult == DialogResult.Yes)
                    {
                        bindings.Remove(treeView1.SelectedNode.Text);
                        IBMi.SetConfig("binds", string.Join("|", bindings.ToArray()));
                        IBMi.RemConfig(treeView1.SelectedNode.Text);
                        treeView1.Nodes.Remove(treeView1.SelectedNode);
                    }
                }
            }
        }
Пример #5
0
        public void wrkWithBind()
        {
            TreeNode curNode;

            editingCanceled = true;
            new wrkBind().ShowDialog();
            if (editingCanceled == false)
            {
                IBMi.SetConfig(editingBind, string.Join("|", editingBindCmds));

                if (bindings.Contains(editingBind))
                {
                    //Handled in wrkwithBind
                }
                else
                {
                    curNode     = treeView1.Nodes.Add(editingBind);
                    curNode.Tag = string.Join("|", editingBindCmds);

                    bindings.Add(editingBind);
                    IBMi.SetConfig("binds", string.Join("|", bindings.ToArray()));
                }
            }
        }
Пример #6
0
        private void button2_Click(object sender, EventArgs e)
        {
            label2.Text = "";
            label2.Update();

            string s = "";

            foreach (string item in textBox1.Text.Trim().Split(','))
            {
                if (IBMiUtilities.IsValidQSYSObjectName(item.Trim()))
                {
                    s += item.Trim() + ',';
                }
                else
                {
                    label2.Text = "Invalid Library List Syntax. Valid syntax is < LIB,LIB,LIB >";
                    label2.Update();
                    return;
                }
            }

            if (IBMiUtilities.IsValidQSYSObjectName(textBox2.Text.Trim()))
            {
                IBMi.SetConfig("curlib", textBox2.Text.Trim()); //Remove last comma
            }
            else
            {
                label2.Text = "Invalid Current Library Syntax. Valid syntax is < LIB >";
                label2.Update();
                return;
            }

            IBMi.SetConfig("datalibl", s.Remove(s.Length - 1, 1)); //Remove last comma

            this.Close();
        }