public bool CancelVote() { IsTurnSkipped = false; BaseActivity voteActivity; switch (Game.CurrentState) { case GameState.Day: voteActivity = VoteFor; break; case GameState.Evening: voteActivity = EveningVoteActivity; break; default: return(false); } if (voteActivity != null) { voteActivity.Cancel(); ActivityList.Remove(voteActivity); return(true); } return(false); }
/// <summary> /// Method that removes the selected activity from the ActivityList, called by the equivalent command. /// </summary> private void RemoveActivity() { if (ActivityList.Count > 0 && ActivityList.Contains(SelectedActivity)) { ActivityList.Remove(SelectedActivity); } }
private async void AddJob() { ShowNewJobScreen = false; var jobData = new CreateFmJobData { Title = newJobTitle, Description = newJobDescription, ProcessId = SelectedProcess.Id }; var addJobActivity = new Activity { Name = $"Adding job {newJobTitle}", ProgressText = "Creating tar file" }; ActivityList.Add(addJobActivity); IProgress <string> progress = new Progress <string>(s => { Dispatcher.CurrentDispatcher.Invoke(() => { addJobActivity.ProgressText = s; }); }); var tarFilePath = await Task.Run(() => FileHelper.CreateTarGz("InputData", InputDirectory, progress)); var uploadedFiles = await api.UploadFiles(new[] { tarFilePath }, SelectedProcess.Id, NewJobTitle, progress); progress.Report($"Creating job \"{NewJobTitle}\""); jobData.RelativeS3Path = uploadedFiles[0].RemotePath.Split(new[] { '/' }, 3)[2]; await api.CreateJob(jobData); progress.Report($"Job \"{NewJobTitle}\" is created"); ActivityList.Remove(addJobActivity); //UpdateJobs(); }
public IList <Activity> DeleteSelected() { IList <Activity> result = new List <Activity>(); foreach (Activity activity in ActivityList) { if (activity.IsSelected) { result.Add(activity); } else { if (activity is LineActivity) { LineActivity line = activity as LineActivity; if (line.Source.IsSelected || line.Target.IsSelected) { result.Add(activity); } } } } foreach (Activity activity in result) { ActivityList.Remove(activity); } return(result); }
/// <summary> /// Method that edit the selected activity from the ActivityList, called by the equivalent command. /// </summary> private async void EditActivity() { if (SelectedActivity != null && ActivityList.Contains(SelectedActivity)) { int Index = ActivityList.IndexOf(SelectedActivity); _inserted = false; await AddActivity(Index); if (_inserted) { ActivityList.Remove(SelectedActivity); } } }
public void CancelActivity(InGamePlayerInfo onlyAgainstTarget = null) { if (onlyAgainstTarget != null && HasActivityAgainst(onlyAgainstTarget)) { if (TryUseAntiMask()) { return; } } Role?.ClearActivity(true, onlyAgainstTarget); if (onlyAgainstTarget != null) { var itemsToRemove = new List <BaseActivity>(); foreach (var item in ActivityList) { item.Cancel(onlyAgainstTarget); if (item.IsCanceled) { itemsToRemove.Add(item); } } foreach (var item in itemsToRemove) { ActivityList.Remove(item); } } else { IsTurnSkipped = false; var itemsToRemove = new List <BaseActivity>(); foreach (var item in ActivityList) { // Дневное и вечернее голосование отменяется через CancelVote if (Game.CurrentState == GameState.Day && item == VoteFor || Game.CurrentState == GameState.Evening && item == EveningVoteActivity) { continue; } item.Cancel(); itemsToRemove.Add(item); } foreach (var item in itemsToRemove) { ActivityList.Remove(item); } } }
private async void DoRemoveActivity() { if (SelectedActivity == null) { MessageBox.Show("Please select a row first"); return; } var confirmMessage = $"Are you sure you want to remove this activity from committee activities?"; if (!ImHereMessageBox.ShowYesNo("Remove Activity", confirmMessage)) { return; } var success = true; var errorMsg = ""; try { AppModel.CommitteeActivities.Remove(SelectedActivity); ActivityList.Remove(SelectedActivity); await AppModel.SaveChangesAsync(); } catch (Exception e) { success = false; errorMsg = e.Message; } if (success) { return; } ImHereMessageBox.ShowError("Error deleting row!", errorMsg); }
public void RemoveActivity(Activity activity) { ActivityList.Remove(activity); }
public void Remove(object activity) { ActivityList.Remove((ExerciceVM)activity); }