Пример #1
0
 private void btnAddAction_Click(object sender, EventArgs e)
 {
     using (ActionForm af = new ActionForm())
     {
         af.plug = plug;
         af.wmp  = wmp;
         af.tts  = tts;
         af.trvTrigger.ImageList = imgs;
         af.trvTrigger.Nodes.Add((TreeNode)trv.Nodes[0].Clone());
         CloseTree(af.trvTrigger.Nodes[0]);
         af.trvFolder.ImageList = imgs;
         af.trvFolder.Nodes.Add((TreeNode)trv.Nodes[0].Clone());
         RemoveTriggerNodesFromTree(af.trvFolder.Nodes[0]);
         CloseTree(af.trvFolder.Nodes[0]);
         af.SettingsFromAction(null);
         if (panel5.Visible == true)
         {
             af.SetReadOnly();
         }
         af.Text       = I18n.Translate("internal/TriggerForm/addnewaction", "Add new action");
         af.btnOk.Text = I18n.Translate("internal/TriggerForm/add", "Add");
         if (af.ShowDialog() == DialogResult.OK)
         {
             Action a = new Action();
             af.SettingsToAction(a);
             a._Enabled = true;
             Actions.Add(a);
             a.OrderNumber       = Actions.Count;
             dgvActions.RowCount = Actions.Count;
             dgvActions.ClearSelection();
             dgvActions.Rows[dgvActions.RowCount - 1].Selected = true;
         }
     }
 }
Пример #2
0
        private void btnEditAction_Click(object sender, EventArgs e)
        {
            Context ctx = new Context();

            ctx.plug = plug;
            ctx.trig = fakectx.trig;
            using (ActionForm af = new ActionForm())
            {
                Action a = Actions[dgvActions.SelectedRows[0].Index];
                af.plug = plug;
                af.wmp  = wmp;
                af.trvTrigger.ImageList = imgs;
                af.trvTrigger.Nodes.Add((TreeNode)trv.Nodes[0].Clone());
                CloseTree(af.trvTrigger.Nodes[0]);
                af.trvFolder.ImageList = imgs;
                af.trvFolder.Nodes.Add((TreeNode)trv.Nodes[0].Clone());
                RemoveTriggerNodesFromTree(af.trvFolder.Nodes[0]);
                CloseTree(af.trvFolder.Nodes[0]);
                af.SettingsFromAction(a);
                if (panel5.Visible == true)
                {
                    af.SetReadOnly();
                }
                af.tts        = tts;
                af.Text       = I18n.Translate("internal/TriggerForm/editaction", "Edit action '{0}'", a.GetDescription(ctx));
                af.btnOk.Text = I18n.Translate("internal/TriggerForm/savechanges", "Save changes");
                if (af.ShowDialog() == DialogResult.OK)
                {
                    af.SettingsToAction(a);
                    dgvActions.Refresh();
                }
            }
        }
Пример #3
0
        private void loginButton_Click(object sender, EventArgs e)
        {
            string username = usernameTextBox.Text.Trim();
            string password = passwordTextBox.Text.Trim();

            //checking username
            if (username == "")
            {
                MessageBox.Show("Vui lòng nhập tên đăng nhập", "Thông Báo");
                usernameTextBox.Focus();
                return;
            }
            //checking password
            if (password == "")
            {
                MessageBox.Show("Vui lòng nhập Mật khẩu", "Thông Báo");
                passwordTextBox.Focus();
                return;
            }

            AccountModel accountModel = new AccountModel();

            if (!accountModel.CheckUserExists(username, password))
            {
                MessageBox.Show("Sai thông tin tài khoản", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            //checking username and password empty

            ActionForm actionForm = new ActionForm();

            actionForm.ShowDialog();
        }
Пример #4
0
 private void passwordTextBox_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.KeyCode == Keys.Enter)
     {
         ActionForm actionForm = new ActionForm();
         actionForm.ShowDialog();
         this.Close();
     }
 }
Пример #5
0
 /// <summary>
 /// This method executes the insert operation after the insertion position has been set
 /// </summary>
 public void Do()
 {
     //If the operation is not precanceled and the mouse is within the workspace (when the temporary layer is visible)
     if ((!this.opPrecanceled) && (this.tempLayer.Visible))
     {
         //It is checked if the position is valid for insertion
         if (this.ValidateLocation())
         {
             //It checks if the action needs Inicilización
             if (this.graphElement.NeedInit)
             {
                 ActionForm actionForm = ActionFactory.GetActionForm(this.graphElement.Element);
                 if (DialogResult.OK != actionForm.ShowDialog())
                 {
                     this.Cancel();
                     return;
                 }
             }
             //The GraphElement is added to the diagram layer, and to the logical diagram
             this.diagramLayer.AddElement(this.graphElement);
             this.diagram.AddElement(this.graphElement.Element);
             //The temporary layer is cleaned and hidden
             this.tempLayer.ClearAndHide();
             //The diagram layer is updated
             this.diagramLayer.UpdateSurface();
             //It is indicated that the diagram has changed
             if (this.DiagramChanged != null)
             {
                 this.DiagramChanged(this, new EventArgs());
             }
             //The operation is terminated
             if (this.OperationFinished != null)
             {
                 this.OperationFinished(this, new OperationEventArgs(Operation.Insert));
             }
         }
         else
         {
             //If the position is invalid, it is precanceled to show notice to the user
             this.PreCancel();
             if (GraphSettings.Default.InsertWarning == true)
             {
                 bool showAgain = true;
                 MowayMessageBox.Show(InsertElementMessages.DRAG_OBJECT, InsertElementMessages.INSERT_ELEMENT, MessageBoxButtons.OK, MessageBoxIcon.Error, ref showAgain);
                 GraphSettings.Default.InsertWarning = showAgain;
                 GraphSettings.Default.Save();
             }
             this.Cancel();
         }
     }
     else
     {
         this.Cancel();
     }
 }