private void setConfirmAction(ConfirmAction action) { switch (action) { case ConfirmAction.LogIn: this.confirmButtonText.Text = "LOG IN"; this.forgotPasswordButton.Visibility = Visibility.Visible; this.googleLoginButton.Visibility = Visibility.Visible; this.countryLabel.Visibility = Visibility.Collapsed; this.countrySelect.Visibility = Visibility.Collapsed; this.tosCheckbox.Visibility = Visibility.Collapsed; this.signupLoginToggle.Content = "Sign up for free"; break; case ConfirmAction.SignUp: this.confirmButtonText.Text = "SIGN UP"; this.forgotPasswordButton.Visibility = Visibility.Collapsed; this.googleLoginButton.Visibility = Visibility.Collapsed; this.countryLabel.Visibility = Visibility.Visible; this.countrySelect.Visibility = Visibility.Visible; this.tosCheckbox.Visibility = Visibility.Visible; this.signupLoginToggle.Content = "Log in"; Task.Factory.StartNew(() => { getCountries(); }); break; default: throw new ArgumentException(string.Format("Invalid action '{0}' in login form.", action)); } this.confirmAction = action; }
public void ProcessAction(ActionBase action) { switch (action.GetActionType()) { case ActionType.BetAction: BetStage.ProcessBetAction((BetAction)action); if (BetStage.BetResult != null) { Log.Information(BetStage.BetResult.ToString()); ConfirmAction?.Invoke(); var playType = BetStage.BetResult.Bet.PlayType; PlayStage = new PlayStage(Rules, PlayerGroupInfo, ConfirmAction, PlayerHandDictionary, InitialPlayer, playType); ExpectedActionType = ActionType.PlayAction; } return; case ActionType.PlayAction: PlayStage.ProcessPlayAction((PlayAction)action); if (PlayStage.PlayResult != null) { Log.Information(PlayStage.PlayResult.ToString()); ConfirmAction?.Invoke(); RoundResult = GetRoundResult(); ExpectedActionType = ActionType.Invalid; } return; default: var msg = $"Invalid ActionType {action?.GetActionType()}!"; Log.Error(msg); throw new Exception(msg); } }
private void deleteBtn_Click(object sender, EventArgs e) { ConfirmAction confirm = new ConfirmAction(); DialogResult dr = confirm.ShowDialog(); if (dr == DialogResult.OK) { dao.Delete(idInput.Text, table); MessageBox.Show("Elemento eliminado!"); //Close edit form this.Close(); } }
public override BaseActionType[] GetFolderActions(Folder folder, BaseActionType[] proposedActions, EntityActionType[] types) { BaseActionType action = null; OPCServerFolderBehaviorData ext = folder.GetExtensionData <OPCServerFolderBehaviorData>(); if (!OPCEngine.IsListening(ext.Url, ext.AgentId)) { action = new ConfirmAction("Start Listening", null, "Start Listening", "Are You Sure?", new SimpleDelegate(() => { OPCServerFolderBehaviorData folderExt = folder.GetExtensionData <OPCServerFolderBehaviorData>(); var allEvents = Folder.GetEntitiesInFolder <OPCEvent>(folder.FolderID); OpcEventGroup[] eventGroups = allEvents.Where(x => !x.Disabled).Select(x => new OpcEventGroup { Paths = x.EventValues?.Select(y => y.PathToValue).ToArray() ?? new string[0], EventId = x.Id, Deadband = x.Deadband, UpdateRate = x.UpdateRate }).ToArray(); OPCEngine.StartListening(folderExt.Url, folderExt.AgentId, eventGroups); OPCEngine.GetInitialData(folderExt.Url, folderExt.AgentId, true); })); } else { action = new ConfirmAction("Stop Listening", null, "Stop Listening", "Are You Sure?", new SimpleDelegate(() => { OPCServerFolderBehaviorData folderExt = folder.GetExtensionData <OPCServerFolderBehaviorData>(); OPCEngine.StopListening(folderExt.Url, folderExt.AgentId); })); } return(new BaseActionType[] { new AddEntityAction(typeof(OPCEvent), "Add Event", null, "Add OPC Event"), new SimpleAction("Rebuild Tag Cache", null, new SimpleDelegate(() => { RebuildTagCache(folder); })) { DisplayType = ActionDisplayType.Secondary }, action }.Concat(proposedActions.Where(a => a is NavigateToFolderAction || a.Name == "Delete Folder")).ToArray()); }
//------------------------------------------------------------Delete or Edit Action private void employeeDV_CellMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e) { if (e.RowIndex < 0) { return; } var dto = (EmployeeDTO)employeeDV.Rows[e.RowIndex].DataBoundItem; if (dto == null) { return; } ChooseAction3 chooseAction = new ChooseAction3(); DialogResult dr = chooseAction.ShowDialog(); if (dr == DialogResult.OK) //Wants to edit { FillEmployeeForm(dto); createUserBtn.Text = EDIT_EMPLOYEE_PARAM; } else if (dr == DialogResult.Cancel) //Wants to delete { ConfirmAction confirmation = new ConfirmAction(); //Confirmar que quiere eliminar DialogResult result = confirmation.ShowDialog(); //Si, Elimino el record if (result == DialogResult.OK) { dao.DELETE(dto.EmployeeId); MessageBox.Show("Elemento eliminado!"); FillDataView(); } else { MessageBox.Show("Problemas borrando..."); } }//Obtener usuario del empleado... else if (dr == DialogResult.Abort) // Wants to get employee user credentials { MessageBox.Show(dao.GetEmployeeUserCredentials(dto.EmployeeId, dto.IdentificationCard)); } }
public void ProcessPlayAction(PlayAction playAction) { CurrentStickRound.ProcessPlayAction(playAction); if (CurrentStickRound.StickResult != null) { Log.Information(CurrentStickRound.StickResult.ToString()); ConfirmAction?.Invoke(); PlayResult = GetPlayResult(); if (PlayResult == null) { var currentPlayer = CurrentStickRound.StickResult.Winner; var stickRound = new StickRound(PlayerGroupInfo, PlayerHandDictionary, currentPlayer, PlayType); StickRoundList.Add(stickRound); } } return; }
//-------------------------------------------------------------------------------------Edit or Delete //-------------------------------------------------------------------------------------Choose action over record private void CustomerDV_CellMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e) { if (e.RowIndex < 0) { return; } var dto = (CustomerDTO)CustomerDV.Rows[e.RowIndex].DataBoundItem; if (dto == null) { return; } ChooseAction2 chooseAction = new ChooseAction2(); DialogResult dr = chooseAction.ShowDialog(); if (dr == DialogResult.OK) //Wants to edit { FillCustomerForm(dto); validateCustomerBtn.Text = editCustomerParam; } else if (dr == DialogResult.Cancel) //Wants to delete { ConfirmAction confirmation = new ConfirmAction(); //Confirmar que quiere eliminar DialogResult result = confirmation.ShowDialog(); //Si, Elimino el record if (result == DialogResult.OK) { dao.DELETE(dto.Id); MessageBox.Show("Elemento eliminado!"); ReopenForm(); } else { MessageBox.Show("Problemas borrando..."); } } }
//---------------------------------------------------------------------------------Search action //------------------------------------------------------------------------------Edit or Delete Car events private void carDV_CellMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e) { if (e.RowIndex < 0) { return; } var dto = (CarDTO)carDV.Rows[e.RowIndex].DataBoundItem; if (dto == null) { return; } //new GeneralCrud(dto.CarTypeId, dto.CarTypeDescription, dto.CarTypeStatus, "type"); ChooseAction2 confirmAction = new ChooseAction2(); DialogResult dr = confirmAction.ShowDialog(); if (dr == DialogResult.OK) { //Prepare the form to edit record carId = dto.Id; EditMode(dto); } else if (dr == DialogResult.Cancel) { ConfirmAction confirm = new ConfirmAction(); DialogResult result = confirm.ShowDialog(); if (result == DialogResult.OK) { ///Delete the record carDao.DELETE(dto.Id); MessageBox.Show("Elemento borrado!"); ResetCarForm(); } } }
private void setConfirmAction(ConfirmAction action) { switch (action) { case ConfirmAction.LogIn: this.confirmButton.Content = "Log in"; this.forgotPasswordButton.Visibility = Visibility.Visible; this.googleLoginButton.Visibility = Visibility.Visible; this.signupLoginToggle.Content = "Sign up for free"; break; case ConfirmAction.SignUp: this.confirmButton.Content = "Sign up"; this.forgotPasswordButton.Visibility = Visibility.Hidden; this.googleLoginButton.Visibility = Visibility.Hidden; this.signupLoginToggle.Content = "Log in"; break; default: throw new ArgumentException(string.Format("Invalid action '{0}' in login form.", action)); } this.confirmAction = action; }
public void ProcessAction(ActionBase action) { Log.Information(action.ToString()); CurrentGameRound.ProcessAction(action); if (CurrentGameRound.RoundResult != null) { Log.Information(CurrentGameRound.RoundResult.ToString()); ConfirmAction?.Invoke(); GameResult = GetGameResult(); if (GameResult == null) { CurrentPlayer = PlayerGroupInfo.GetNextPlayer(CurrentPlayer.PlayerId); var deck = CardPile.CreateDeckPile(); var gameRound = new GameRound(Rules, PlayerGroupInfo, ConfirmAction, CurrentPlayer, deck); GameRoundList.Add(gameRound); } else { Log.Information(GameResult.ToString()); } } }
private void setConfirmAction(ConfirmAction action) { switch (action) { case ConfirmAction.LogIn: this.confirmButtonText.Text = "LOG IN"; this.forgotPasswordButton.Visibility = Visibility.Visible; this.googleLoginButton.Visibility = Visibility.Visible; this.signupLoginToggle.Content = "Sign up for free"; break; case ConfirmAction.SignUp: this.confirmButtonText.Text = "SIGN UP"; this.forgotPasswordButton.Visibility = Visibility.Hidden; this.googleLoginButton.Visibility = Visibility.Hidden; this.signupLoginToggle.Content = "Log in"; break; default: throw new ArgumentException(string.Format("Invalid action '{0}' in login form.", action)); } this.confirmAction = action; }
private void setConfirmAction(ConfirmAction action) { switch (action) { case ConfirmAction.LogIn: confirmButton.Text = "Log in"; passwordForgotTextField.Show(); googleLoginTextField.Show(); loginSignupToggle.Text = "Sign up for free"; break; case ConfirmAction.SignUp: confirmButton.Text = "Sign up"; passwordForgotTextField.Hide(); googleLoginTextField.Hide(); loginSignupToggle.Text = "Log in"; break; default: throw new ArgumentException(string.Format("Invalid action '{0}' in login form.", action)); } confirmAction = action; centerControl(loginSignupToggle); }
public void Show(string message, ConfirmAction action) { Text.text = message; current_action = action; Active = true; }
private void inspectionsDV_CellMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e) { //Abrir form de renta. //Si se renta el vehiculo, desaparece de las inspecciones... //Refresh data table //Dialog rent(ABORT), edit(OK) or delete(CANCEL) inspection if (e.RowIndex < 0) { return; } var dto = (InspectionDTO)inspectionsDV.Rows[e.RowIndex].DataBoundItem; if (dto == null) { return; } //new GeneralCrud(dto.CarTypeId, dto.CarTypeDescription, dto.CarTypeStatus, "type"); // ChooseAction3 confirmAction = new ChooseAction3("Rentar", "Editar", "Eliminar"); DialogResult dr = confirmAction.ShowDialog(); if (dr == DialogResult.OK) //Edit record { //Prepare the form to edit record FillForm(dto); } else if (dr == DialogResult.Abort) //Display Rent form... { RentForm rentForm = new RentForm(dto); DialogResult rentResult = rentForm.ShowDialog(); if (rentResult == DialogResult.OK || dr == DialogResult.Cancel) { //Here do refresh to the table... rentForm.Close(); inspectionsDV.DataSource = dao.GETALL(); } } else if (dr == DialogResult.Cancel) //Delete record { ConfirmAction confirm = new ConfirmAction(); DialogResult result = confirm.ShowDialog(); if (result == DialogResult.OK) { ///Delete the record dao.DELETE(dto.Id); MessageBox.Show("Elemento borrado!"); RefreshForm(); } } }
private void Confirm_Click(object Sender, RoutedEventArgs E) { ConfirmAction?.Invoke(); }