Beispiel #1
0
        private void createUpdateTouchButton_Load(object sender, EventArgs e)
        {
            int selectedItem;
            int ruleID = 0;

            createUpdateTouchButton.Hide();
            ruleAndActionTextBox.Text = Strings.Trim(ruleAndActionTextBox.Text);
            if (!createUpdateTouchButton.Caption.Equals("Create " + nameOfAction))
            {
                selectedItem = rulesListView.FocusedItem.Index;
                ruleID       = Conversions.ToInteger(rulesListView.Items[selectedItem].SubItems[1].Text);
            }

            if (!string.IsNullOrEmpty(ruleAndActionTextBox.Text))
            {
                db.saveRule(ruleID, tableName, ruleAndActionTextBox.Text);
                MdlScripts.populateMessageRules(rulesListView, tableName);
                titleLabel.Text      = "Success!";
                titleLabel.BackColor = Color.Green;
                Size     = (Size) new Point(533, 510);
                Location = new Point((int)Math.Round((My.MyProject.Computer.Screen.Bounds.Size.Width - Width) / 2d), (int)Math.Round((My.MyProject.Computer.Screen.Bounds.Size.Height - Height) / 2d));
                closeTouchButton.Location = new Point(470, 12);
                My.MyProject.Forms.FrmCreatePreScript.rulesListView.Items.Add(ruleAndActionTextBox.Text);
                ruleAndActionTextBox.Text = "";
            }
            else
            {
                titleLabel.Text      = "Please write down the title";
                titleLabel.BackColor = Color.Red;
            }
        }