/// <summary> /// Shows only the quuestions and answers for the current study being viewed /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnShowThisStudy_Click(object sender, EventArgs e) { Study study = new Study(Convert.ToInt32(Request.QueryString["study_id"])); Participant participant = new Participant(Convert.ToInt32(Request.QueryString["participant_id"])); pnlQualifiers.Controls.Clear(); showStudyInfo(study, participant); }
public WhisperWindow(Conversation conversation, Participant participant, SeriousBusinessCat seriousBusiness, string info) { this.conversation = conversation; this.participant = participant; this.seriousBusiness = seriousBusiness; InitializeComponent(); this.DataContext = this; InitCommands(); this.Activated += (s,e) => { FlashWindow.Stop(this); }; lbWhispers.ItemsSource = _whispers; string bob = "neighbor cat"; if (participant != null) { bob = participant.Contact.GetContactInformation(ContactInformationType.DisplayName).ToString(); } textBlock.Text = bob; if (!string.IsNullOrEmpty(info)) { textBlock.ToolTip = info; } this.Title = $"Whispering with {bob}"; FocusManager.SetFocusedElement(this, tbMessage); }
// Methods public void Register( Participant participant ) { if( participants[ participant.Name ] == null ) participants[ participant.Name ] = participant; participant.Chatroom = this; }
internal Invitation(InvType invType, string invId, Participant inviter, int variant) { mInvitationType = invType; mInvitationId = invId; mInviter = inviter; mVariant = variant; }
/// <summary> /// Shows questions/answers for all existing studies /// </summary> private void showAllInfo(Participant participant) { List<Study> studies = DAL.GetStudies(); foreach (Study study in studies) { showStudyInfo(study, participant); } }
// Set up gameboard and players public override void gameSetup() { //Set up gameboard and view base.gameSetup(); //Online Multiplayer Setup myHand = new List<int>(); MultiplayerController.Instance.gp = this; myself = MultiplayerController.Instance.getMyself(); participants = MultiplayerController.Instance.getParticipants(); if (myself == participants [0]) { playerType = slot.Red; playerColor = Color.red; opponentType = slot.Blue; opponentColor = Color.blue; opponent = participants[1]; TakeTurn(); } else{ playerType = slot.Blue; playerColor = Color.blue; opponentType = slot.Red; opponentColor = Color.red; opponent = participants[0]; base.clearHandArea(); } }
public ParticipantInfo(Participant p) { InitializeComponent(); Title = String.Format("Participant Info — {0} {1}", p.FirstName, p.LastName); P = p; ReadResults(); string info = String.Format("Name:\t\t{0}\n\n" + "Gender:\t\t{1}\n\n" + "Team:\t\t{2}\n\n" + "Age division:\t{3}", p.FirstName + " " + p.LastName, Global.GendersFull[p.Gender], p.Team, p.AgeDivision); if (Results.Count > 0) { dataGridParticipantResults.Visibility = Visibility.Visible; dataGridParticipantResults.ItemsSource = Results; } else { info += String.Format("\n\n{0} has no results recorded.", p.FirstName); } labelParticipantInfo.Content = info; }
/// <summary> /// Event handler when a participant is finished creating/editing an account. /// If there are no errors, the session variable will be set to the user and they /// will be redirected to the participant form. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnParSubmit_Click(object sender, EventArgs e) { if (isFormValid(SuperUser.UserType.Participant)) { DatabaseQuery query; string queryString = ""; if (Request.QueryString["edit"] == "true") { int parID = ((Participant)Session["user"]).UserID; DAL.UpdateParticipant(tbParUserName.Text, tbParFirstName.Text, tbParLastName.Text, tbParEmail.Text, tbParPassword.Text, parID); } else { try { DAL.InsertParticipant(tbParUserName.Text, tbParFirstName.Text, tbParLastName.Text, tbParEmail.Text, tbParPassword.Text); } catch (Exception exception) { lblParStatus.Text = exception.Message; lblParStatus.Visible = true; return; } } lblParStatus.Text = ""; queryString = "select Par_ID from Participant where User_Name = '" + tbParUserName.Text + "'"; query = new DatabaseQuery(queryString, DatabaseQuery.Type.Select); int userID = Convert.ToInt32(query.Results[0][0]); Session["user"] = new Participant(userID, tbParUserName.Text, tbParFirstName.Text, tbParLastName.Text, tbParEmail.Text, new List<Answer>()); Response.Redirect("ParticipantForm.aspx"); } }
public static int GetParticipantPoints(Participant p, Dictionary<string, List<Result>> results) { if (!results.ContainsKey(p.Id)) return 0; return results[p.Id].Sum(r => Global.GetPoints(r.Place)); }
protected void Page_Load(object sender, EventArgs e) { Participant participant = new Participant(); if(Session["TTID"] != null) { participant = Participant.GetParticipantDetails(int.Parse(Session["TTID"].ToString())); Session["TTID"] = null; } else { participant = Participant.GetParticipantDetails(Session["EmailID"].ToString()); Session["EmailID"] = null; } if (participant != null) { lblName.Text = participant.Name; lblBranch.Text = participant.Branch.ToString(); lblCollege.Text = Participant.GetCollegeName(participant.CollegeID); lblTTID.Text = "TT" + participant.TTID.ToString(); lblYear.Text = participant.Year.ToString(); lblContact.Text = participant.ContactNo; } else { Response.Redirect("ICard.aspx"); } }
public AgeChampion(Participant p, int place, int points) { Name = p.FirstName + " " + p.LastName; Team = p.Team; Place = place; Points = points; }
public static TestParticipant BuildTestParticipantFromDataBase(string idCase, string idDoctor, byte idPersonRole) { Participant p = new Participant(); p.IdRole = idPersonRole; TestParticipant part = new TestParticipant(p); part.doctor = TestDoctor.BuildTestDoctorFromDataBase(idDoctor); return part; }
private void AddNewPartyMember(Attack newAttack, String partyMemberName) { var result = MessageBox.Show("Is this character an NPC?", "NPC?", MessageBoxButtons.YesNo, MessageBoxIcon.Question); var npc = (result != DialogResult.No); var newPerson = new Participant(partyMemberName, npc, newAttack); group.Add(newPerson); }
public void a_AddValid() { var response = client.AddParticipant(entity); WasSuccessfulTest(response); Assert.True(response.Data.id > 0); Assert.True(response.Data.data_saved.id == response.Data.id); entity = response.Data.data_saved; }
/// <summary> /// Connects with HealthVault to get a unique code for the participant /// </summary> /// <param name="participant">New participant that needs a HV authentication code</param> /// <returns>Authentication code from HealthVault</returns> public string GetParticipantCode(Participant participant) { OfflineWebApplicationConnection conn = HVConnectionManager.CreateConnection(); string participantCode = PatientConnection.Create(conn, participant.FirstName, participant.SecurityQuestion, participant.SecurityAnswer, null, participant.ID.ToString()); return participantCode; }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { BindLstPatients(); frmSelectedPatient.Visible = false; } selectedParticipant = GetSelectedParticpant(); }
public TestParticipant(Participant d, string idLpu = "") { if (d != null) { if (d.Doctor != null) doctor = new TestDoctor(d.Doctor, idLpu); participant = d; } }
public override void Register(Participant participant) { if (!participants.ContainsValue(participant)) { participants[participant.Name] = participant; } participant.Chatroom = this; }
protected void Button1_Click(object sender, EventArgs e) { if (!IsValid) return; Participant part = new Participant(); part.Name = TextBox1.Text; ScrumPokerSession.GameParticipant = part; Response.Redirect("~/GameList.aspx"); }
public static string GetMailTo(Participant participant) { string returnVar = "mailto:" + participant.Email; if (!string.IsNullOrEmpty(participant.AlternateEmail)) { returnVar += "?cc=" + participant.AlternateEmail; } return returnVar; }
/// <summary> /// Returns the appropriate enrollment redirect URL for the provided participant /// </summary> /// <param name="participant">Participant containing the HvParticipantCode needed to form the URL</param> /// <returns>The enrollment URL to send to the participant</returns> public string BuildTargetEnrollmentUrl(Participant participant) { if (String.IsNullOrEmpty(participant.HVParticipantCode)) throw new Exception("Invalid participant to enroll: bad participant code"); // See http://msdn.microsoft.com/en-us/library/ff803620.aspx return String.Format( "{0}/redirect.aspx?target=CONNECT&targetqs=packageid%3d{1}", HVConnectionManager.ShellUrl, participant.HVParticipantCode ); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { Study study = new Study(Convert.ToInt32(Request.QueryString["study_id"])); Participant participant = new Participant(Convert.ToInt32(Request.QueryString["participant_id"])); lblUserName2.Text = participant.UserName; lblFullName2.Text = participant.FirstName + " " + participant.LastName; lblEmail2.Text = participant.Email; showStudyInfo(study, participant); } }
protected void Page_Load(object sender, EventArgs e) { selectedParticipant = (Participant)Session["selected_participant"]; if (selectedParticipant == null) { lblPatientHeader.Text = "No selected patient"; return; } HVDataAccessor accessor = new HVDataAccessor(selectedParticipant); lblPatientHeader.Text = selectedParticipant.FullName; lblPatientBasicInfo.Text = accessor.BuildBasicInfoString(); }
public WhisperWindow FindWhisperWindow(Conversation conversation, Participant participant) { foreach (var window in _whisperWindows) { if (window.conversation == conversation && window.participant == participant) { return window; } } return null; }
public void ChangeTarget() { foreach (Participant p in participants) { if (p.State == Participant.HudState.P_NORMAL) { if (currentTarget != null) { currentTarget.State = Participant.HudState.P_NORMAL; } currentTarget = p; p.State = Participant.HudState.P_TRACKED; return; } } }
public void CreateProductEnvironment() { //foreach (string participant in new List<string> {"Kekker Ino", "Lol Rofl", "Oane Ite", "Test"}) { foreach (string participant in Gegevens.CurrentGroup ().Deelnemers) { if (participant != Gegevens.GetPerson ().Id) { Participant person = new Participant (participant); person.debt = 0.00; enabledParticipants.Add (person); } } try // just to be sure { foreach (Tuple<string, double, bool> product in Gegevens.GetBonnetje()) { productList.Add (new ListItem(product.Item1, product.Item2, product.Item3, enabledParticipants, Enumerable.Repeat(true, enabledParticipants.Count).ToList())); } } catch { Toast.MakeText(this, "No products have been found", ToastLength.Long).Show(); Finish(); } /*double d = 4.20; //heheheh for (int i = 0; i < 5; i++) { productList.Add(new ListItem("testproduct", d, i % 2 == 1, enabledParticipants, Enumerable.Repeat(true, enabledParticipants.Count).ToList())); }*/ productAdapter = new ListItemAdapter (ListItem.ProcessedListItem, productList); _processedListRecyclerView.SetAdapter (productAdapter); productAdapter.ItemClick += (sender, args) => { if (args.ButtonPressed == -3) { //EDIT/BACK } else if (args.ButtonPressed == -2) { //DROPDOWN } else if (args.ButtonPressed == -1) { //HANDLE DELETION productList.RemoveAt(args.Position); productAdapter.NotifyItemRemoved(args.Position); productAdapter.NotifyItemRangeChanged(args.Position, productList.Count); } else if (args.ButtonPressed >= 0) { //HANDLE PARTICIPATION productList[args.Position].Deelnames[args.ButtonPressed] = !productList[args.Position].Deelnames[args.ButtonPressed]; productAdapter.NotifyItemChanged(args.Position); } }; }
public ITaskParticipant CreateParticipant() { if (_stoppingToken.IsCancellationRequested) throw new OperationCanceledException("The supervisor is stopping, no additional participants can be created"); var participant = new Participant(); lock (_participants) { _participants.Add(participant); } return participant; }
public WhisperWindow FindOrCreateWhisperWindow(Conversation conversation, Participant participant, string info) { WhisperWindow window = FindWhisperWindow(conversation, participant); if (window == null) { window = new WhisperWindow(conversation, participant, seriousBusiness, info); _whisperWindows.Add(window); window.Closed += (s, e) => { _whisperWindows.Remove(window); }; window.Show(); } return window; }
public void Initialize() { var username = Properties.Settings.Default.username; var apiKey = Properties.Settings.Default.apiKey; this.tournamentName = "TommeAPITest" + Utilities.RandomName(); Debug.WriteLine(string.Format("Initializing with name {0}", this.tournamentName)); this.target = new ChallongeV1(username, apiKey); this.tournamentUnderTest = this.target.TournamentCreate(this.tournamentName, TournamentType.SingleElimination, this.tournamentName); this.particiant1Name = "TommeAPITest" + Utilities.RandomName(); this.particiant2Name = "TommeAPITest" + Utilities.RandomName(); this.particiant1 = this.target.ParticipantCreate(this.tournamentUnderTest, new ParticipantCreateParameters { Name = this.particiant1Name }); this.particiant2 = this.target.ParticipantCreate(this.tournamentUnderTest, new ParticipantCreateParameters { Name = this.particiant2Name }); }
/// <summary> /// Enrolls a new participant with HealthVault; that is, gets a participant code /// and sends the enrolment email. /// </summary> /// <param name="participant">New participant to enroll</param> public void EnrollNewParticipant(Participant participant) { participant.HasAuthorized = false; participant.IsEligible = false; participant.TrialGroup = ""; // get app-specific participant ID from database participant.ID = ParticipantDAO.InsertParticipant(participant); // enroll with healthvault participant.HVParticipantCode = HvEnroller.GetParticipantCode(participant); SendEnrollmentEmail(participant); // update data store for participant ParticipantDAO.UpdateParticipant(participant); }
public override bool Execute(Participant participant) { participant.Heal(_healAmmount); return(false); }
private void BuildSiteDirData() { this.session = new Mock <ISession>(); this.permissionService = new Mock <IPermissionService>(); this.session.Setup(x => x.PermissionService).Returns(this.permissionService.Object); this.assembler = new Assembler(this.uri); this.session.Setup(x => x.Assembler).Returns(this.assembler); this.siteDir = new SiteDirectory(Guid.NewGuid(), this.assembler.Cache, this.uri); this.modelsetup1 = new EngineeringModelSetup(Guid.NewGuid(), this.assembler.Cache, this.uri); this.modelsetup2 = new EngineeringModelSetup(Guid.NewGuid(), this.assembler.Cache, this.uri); this.iterationSetup1 = new IterationSetup(Guid.NewGuid(), this.assembler.Cache, this.uri); this.iterationSetup2 = new IterationSetup(Guid.NewGuid(), this.assembler.Cache, this.uri); this.person = new Person(Guid.NewGuid(), this.assembler.Cache, this.uri); this.participant1 = new Participant(Guid.NewGuid(), this.assembler.Cache, this.uri); this.participant2 = new Participant(Guid.NewGuid(), this.assembler.Cache, this.uri); this.domain1 = new DomainOfExpertise(Guid.NewGuid(), this.assembler.Cache, this.uri); this.domain2 = new DomainOfExpertise(Guid.NewGuid(), this.assembler.Cache, this.uri); this.domain3 = new DomainOfExpertise(Guid.NewGuid(), this.assembler.Cache, this.uri); this.srdl1 = new SiteReferenceDataLibrary(Guid.NewGuid(), this.assembler.Cache, this.uri); this.srdl2 = new SiteReferenceDataLibrary(Guid.NewGuid(), this.assembler.Cache, this.uri); this.mrdl1 = new ModelReferenceDataLibrary(Guid.NewGuid(), this.assembler.Cache, this.uri); this.mrdl2 = new ModelReferenceDataLibrary(Guid.NewGuid(), this.assembler.Cache, this.uri); this.category = new Category(Guid.NewGuid(), this.assembler.Cache, this.uri); this.booleanPt = new BooleanParameterType(Guid.NewGuid(), this.assembler.Cache, this.uri); this.srdl2.RequiredRdl = this.srdl1; this.mrdl1.RequiredRdl = this.srdl2; this.mrdl2.RequiredRdl = this.srdl1; this.participant1.Person = this.person; this.participant2.Person = this.person; this.modelsetup1.ActiveDomain.Add(this.domain1); this.modelsetup1.ActiveDomain.Add(this.domain2); this.modelsetup1.ActiveDomain.Add(this.domain3); this.modelsetup2.ActiveDomain.Add(this.domain1); this.modelsetup2.ActiveDomain.Add(this.domain2); this.srdl1.ParameterType.Add(this.booleanPt); this.srdl2.DefinedCategory.Add(this.category); this.siteDir.Model.Add(this.modelsetup1); this.siteDir.Model.Add(this.modelsetup2); this.siteDir.Person.Add(this.person); this.siteDir.Domain.Add(this.domain1); this.siteDir.Domain.Add(this.domain2); this.siteDir.Domain.Add(this.domain3); this.siteDir.SiteReferenceDataLibrary.Add(this.srdl1); this.siteDir.SiteReferenceDataLibrary.Add(this.srdl2); this.modelsetup1.IterationSetup.Add(this.iterationSetup1); this.modelsetup2.IterationSetup.Add(this.iterationSetup2); this.modelsetup1.Participant.Add(this.participant1); this.modelsetup2.Participant.Add(this.participant2); this.modelsetup1.RequiredRdl.Add(this.mrdl1); this.modelsetup2.RequiredRdl.Add(this.mrdl2); this.session.Setup(x => x.ActivePerson).Returns(this.person); this.session.Setup(x => x.ActivePersonParticipants) .Returns(new List <Participant> { this.participant1, this.participant2 }); }
// called from UI thread private void UpdateRoom() { List <AndroidJavaObject> toDispose = new List <AndroidJavaObject>(); Logger.d("UpdateRoom: Updating our cached data about the room."); string roomId = mRoom.Call <string>("getRoomId"); Logger.d("UpdateRoom: room id: " + roomId); Logger.d("UpdateRoom: querying for my player ID."); string playerId = mClient.GHManager.CallGmsApi <string>("games.Games", "Players", "getCurrentPlayerId"); Logger.d("UpdateRoom: my player ID is: " + playerId); Logger.d("UpdateRoom: querying for my participant ID in the room."); string myPartId = mRoom.Call <string>("getParticipantId", playerId); Logger.d("UpdateRoom: my participant ID is: " + myPartId); AndroidJavaObject participantIds = mRoom.Call <AndroidJavaObject>("getParticipantIds"); toDispose.Add(participantIds); int participantCount = participantIds.Call <int>("size"); Logger.d("UpdateRoom: # participants: " + participantCount); List <Participant> connectedParticipants = new List <Participant>(); List <Participant> allParticipants = new List <Participant>(); mSelf = null; for (int i = 0; i < participantCount; i++) { Logger.d("UpdateRoom: querying participant #" + i); string thisId = participantIds.Call <string>("get", i); Logger.d("UpdateRoom: participant #" + i + " has id: " + thisId); AndroidJavaObject thisPart = mRoom.Call <AndroidJavaObject>("getParticipant", thisId); toDispose.Add(thisPart); Participant p = JavaUtil.ConvertParticipant(thisPart); allParticipants.Add(p); if (p.ParticipantId.Equals(myPartId)) { Logger.d("Participant is SELF."); mSelf = p; } if (p.IsConnectedToRoom) { connectedParticipants.Add(p); } } if (mSelf == null) { Logger.e("List of room participants did not include self, " + " participant id: " + myPartId + ", player id: " + playerId); // stopgap: mSelf = new Participant("?", myPartId, Participant.ParticipantStatus.Unknown, new Player("?", playerId), false); } connectedParticipants.Sort(); allParticipants.Sort(); string[] newlyConnected; string[] newlyDisconnected; // lock the list because it's read by the game thread lock (mParticipantListsLock) { newlyConnected = SubtractParticipants(connectedParticipants, mConnectedParticipants); newlyDisconnected = SubtractParticipants(mConnectedParticipants, connectedParticipants); // IMPORTANT: we treat mConnectedParticipants as an immutable list; we give // away references to it to the callers of our API, so anyone out there might // be holding a reference to it and reading it from any thread. // This is why, instead of modifying it in place, we assign a NEW list to it. mConnectedParticipants = connectedParticipants; mAllParticipants = allParticipants; Logger.d("UpdateRoom: participant list now has " + mConnectedParticipants.Count + " participants."); } // cleanup Logger.d("UpdateRoom: cleanup."); foreach (AndroidJavaObject obj in toDispose) { obj.Dispose(); } Logger.d("UpdateRoom: newly connected participants: " + newlyConnected.Length); Logger.d("UpdateRoom: newly disconnected participants: " + newlyDisconnected.Length); // only deliver peers connected/disconnected events if have delivered OnRoomConnected if (mDeliveredRoomConnected) { if (newlyConnected.Length > 0 && mRtmpListener != null) { Logger.d("UpdateRoom: calling OnPeersConnected callback"); mRtmpListener.OnPeersConnected(newlyConnected); } if (newlyDisconnected.Length > 0 && mRtmpListener != null) { Logger.d("UpdateRoom: calling OnPeersDisconnected callback"); mRtmpListener.OnPeersDisconnected(newlyDisconnected); } } // did the developer request to leave the room? if (mLeaveRoomRequested) { Clear("deferred leave-room request"); } // is it time to report progress during room setup? if (!mDeliveredRoomConnected) { DeliverRoomSetupProgressUpdate(); } }
//Update Participant public bool Update(Participant participant) { return(_participantRepository.Update(participant)); }
public ConversationChunkPaddingTop(DateTime sentTime, Participant author, string text) : base(sentTime, author, text) { }
private void btnModify_Click(object sender, RoutedEventArgs e) { Participant participant = _participants[0]; participant.FirstName = "Mario"; }
public void OnParticipantLeft(Participant player) { //El jugador player dejo la sala }
internal bool FindRemovedRecipient(Participant participant, out CoreRecipient recipient) { return(this.removedRecipients.TryGetValue(participant, out recipient)); }
public async Task DeleteAsync(Participant entity) { await m_entityDataContext.DeleteAsync(entity.Id, "Participant"); }
public async Task CreateAsync(Participant participant) { var cmd = $"INSERT INTO Participant VALUES ('{participant.Id}','{participant.Name}',{participant.Age});"; await m_entityDataContext.CreateAsync(cmd); }
public async Task TranscribeConversationsAsync(IEnumerable <string> voiceSignatureStringUsers) { uint samplesPerSecond = 16000; byte bitsPerSample = 16; byte channels = 8; // 7 + 1 channels var config = SpeechConfig.FromSubscription(this.SubscriptionKey, this.Region); config.SetProperty("ConversationTranscriptionInRoomAndOnline", "true"); var stopRecognition = new TaskCompletionSource <int>(); using (var audioInput = AudioInputStream.CreatePushStream(AudioStreamFormat.GetWaveFormatPCM(samplesPerSecond, bitsPerSample, channels))) { var meetingID = Guid.NewGuid().ToString(); using (var conversation = await Conversation.CreateConversationAsync(config, meetingID)) { // create a conversation transcriber using audio stream input using (this.conversationTranscriber = new ConversationTranscriber(AudioConfig.FromStreamInput(audioInput))) { conversationTranscriber.Transcribing += (s, e) => { this.SetText($"TRANSCRIBING: Text={e.Result.Text} SpeakerId={e.Result.UserId}"); }; conversationTranscriber.Transcribed += (s, e) => { if (e.Result.Reason == ResultReason.RecognizedSpeech) { this.SetText($"TRANSCRIBED: Text={e.Result.Text} SpeakerId={e.Result.UserId}"); } else if (e.Result.Reason == ResultReason.NoMatch) { this.SetText($"NOMATCH: Speech could not be recognized."); } }; conversationTranscriber.Canceled += (s, e) => { this.SetText($"CANCELED: Reason={e.Reason}"); if (e.Reason == CancellationReason.Error) { this.SetText($"CANCELED: ErrorCode={e.ErrorCode}"); this.SetText($"CANCELED: ErrorDetails={e.ErrorDetails}"); this.SetText($"CANCELED: Did you update the subscription info?"); stopRecognition.TrySetResult(0); } }; conversationTranscriber.SessionStarted += (s, e) => { this.SetText($"\nSession started event. SessionId={e.SessionId}"); }; conversationTranscriber.SessionStopped += (s, e) => { this.SetText($"\nSession stopped event. SessionId={e.SessionId}"); this.SetText("\nStop recognition."); stopRecognition.TrySetResult(0); }; // Add participants to the conversation. int i = 1; foreach (var voiceSignatureStringUser in voiceSignatureStringUsers) { var speaker = Participant.From($"User{i++}", "en-US", voiceSignatureStringUser); await conversation.AddParticipantAsync(speaker); } // Join to the conversation and start transcribing await conversationTranscriber.JoinConversationAsync(conversation); await conversationTranscriber.StartTranscribingAsync().ConfigureAwait(false); using (var p = Pipeline.Create()) { var store = PsiStore.Create(p, "Transcribe", @"D:\Temp"); var capture = new AudioCapture(p, WaveFormat.CreatePcm((int)samplesPerSecond, bitsPerSample, channels)).Write("Audio", store); capture.Do(audio => audioInput.Write(audio.Data)); p.RunAsync(); // waits for completion, then stop transcription await stopRecognition.Task; } await conversationTranscriber.StopTranscribingAsync().ConfigureAwait(false); } } } }
public static ParticipantDto ToDto(this Participant participant) { return(new ParticipantDto { }); }
public static void ReplyWithImageSchedule(Message message, ITelegramBotClient client, Participant participant) { var chatId = message.Chat.Id; var messageId = message.MessageId; InputOnlineFile inputOnlineFile; using (FileStream fs = FormSchedule.FormScheduleImage(participant)) { String caption = $"Ваш статус: {participant.Status}\nДоступно {maxHoursToBook(participant.Status)} часов бронирования в день."; inputOnlineFile = new InputOnlineFile(fs, "schedule.png"); Message mes = client.SendPhotoAsync(chatId: chatId, photo: inputOnlineFile, caption: caption, replyToMessageId: messageId, replyMarkup: reply).Result; } }
public async Task <IActionResult> AddPlayerToTournamentAsync(string tournamentId, Participant <Player> addPlayer) { var user = await Session.GetCurrentUser(); if (user == null) { return(Unauthorized()); } var tournament = (await TournamentInfo.GetAllTournamentsAsync()).FirstOrDefault(t => t.Id == tournamentId || t.Slug == tournamentId || t.ToornamentId == tournamentId); Toornament.Participant player = new Toornament.Participant { Identifier = addPlayer.Item.Id, Name = addPlayer.Item.Name }; if (!string.IsNullOrEmpty(tournament?.ToornamentId)) { player = await Toornament.Organizer.AddParticipantAsync(tournament.ToornamentId, player); } var participant = new Participant <Player> { Item = addPlayer.Item, Information = addPlayer.Information, ToornamentId = player.Id }; return(Ok(await TournamentInfo.AddPlayerToTournamentAsync(tournamentId, participant))); }
public async Task <IActionResult> AddTeamToTournamentAsync(string tournamentId, Participant <Team> addTeam) { if (await Session.GetCurrentUser() == null) { return(Unauthorized()); } var tournament = (await TournamentInfo.GetAllTournamentsAsync()).FirstOrDefault(t => t.Id == tournamentId || t.Slug == tournamentId || t.ToornamentId == tournamentId); if (tournament.Teams.Any(i => i.Id == addTeam.Item.Id)) { return(Ok()); } Toornament.Participant team = new Toornament.Participant { Identifier = addTeam.Item.Id, Name = addTeam.Item.Name }; if (!string.IsNullOrEmpty(tournament?.ToornamentId)) { try { team = await Toornament.Organizer.AddParticipantAsync(tournament.ToornamentId, team); } catch { var parts = await Toornament.Organizer.GetParticipantsAsync(tournament.ToornamentId); team = parts.FirstOrDefault(p => p.Identifier == addTeam.Item.Id); } } var participant = new Participant <Team> { Item = addTeam.Item, Information = addTeam.Information, ToornamentId = team?.Id }; return(Ok(await TournamentInfo.AddTeamToTournamentAsync(tournamentId, participant))); }
internal BlobRecipient(Participant participant) { this.propertyBag = new MemoryPropertyBag(); this.propertyBag[InternalSchema.RecipientBaseParticipant] = participant; this.propertyBag.SetAllPropertiesLoaded(); }
public virtual void Invite(Context context, Group group, Participant participant) { throw new StateException($"Operation not supported in {GetType()}: Invite"); }
//вызывается при отклонении опонентом приглашения поиграть public void OnParticipantLeft(Participant participant) { ManagerUI.ShowMsg("Your invitation has been declined"); MultiplayerGameExit(); }
private void btnAdd_Click(object sender, RoutedEventArgs e) { Participant participant = new Participant("Vuns", "Mette", "Quickie-Mart"); _participants.Add(participant); }
private IEnumerable <UserObject> ExtractAttendees(IAttendeeCollection attendeeCollection, Participant organizerParticipant, bool dlParticipantsOnly) { Dictionary <ADObjectId, UserObject> dictionary = new Dictionary <ADObjectId, UserObject>(attendeeCollection.Count); HashSet <ADObjectId> hashSet = new HashSet <ADObjectId>(); Dictionary <ProxyAddress, UserObject> dictionary2 = new Dictionary <ProxyAddress, UserObject>(); int expandedDLCount = 0; foreach (Attendee attendee in attendeeCollection) { if (CalendarValidator.IsValidParticipant(attendee.Participant)) { ProxyAddress attendeeProxyAddress = ProxyAddress.Parse(attendee.Participant.RoutingType, attendee.Participant.EmailAddress); ADRecipient attendeeRecipient = null; ADOperationResult adoperationResult = ADNotificationAdapter.TryRunADOperation(delegate() { attendeeRecipient = this.recipientSession.FindByProxyAddress(attendeeProxyAddress); }); if (!adoperationResult.Succeeded || attendeeRecipient == null) { this.ExtractUnaccessibleAttendee(organizerParticipant, dictionary2, attendee, attendeeProxyAddress); } else if (hashSet.Contains(attendeeRecipient.Id)) { AttendeeExtractor.RevisitAttendee(dictionary, attendee, attendeeRecipient); } else if (attendeeRecipient is ADGroup) { AttendeeExtractor.DLExpansionHandler dlexpansionHandler = new AttendeeExtractor.DLExpansionHandler(organizerParticipant, dictionary, hashSet, expandedDLCount, attendee, attendeeRecipient, this.recipientSession, this.expansionManager); expandedDLCount = dlexpansionHandler.ExpandDL(); } else if (!dlParticipantsOnly) { hashSet.Add(attendeeRecipient.Id); AttendeeExtractor.DLExpansionHandler.AddOrganizerFilteredAttendee <ADObjectId>(dictionary, attendeeRecipient.Id, new UserObject(attendee, attendeeRecipient, this.recipientSession), organizerParticipant, this.recipientSession); } } } return(dictionary.Values.Concat(dictionary2.Values)); }
public static void AddOrganizerFilteredAttendee <KeyType>(Dictionary <KeyType, UserObject> attendeeTable, KeyType key, UserObject user, Participant organizer, IRecipientSession session) { if (!Participant.HasSameEmail(user.Participant, organizer, session)) { attendeeTable.Add(key, user); } }
private bool OnParticipantConnectAuthorize(Session session, JoinRequestMessage message, out Guid participantId, out Guid avatarId) { try { string idString = message.ParticipantIdentifier; idString = idString.Insert(8, "-"); idString = idString.Insert(13, "-"); idString = idString.Insert(18, "-"); idString = idString.Insert(23, "-"); participantId = new Guid(idString); avatarId = message.AvatarId; } catch (Exception) { LogUtil.Warn("Participant login id was not guid (without dashes): " + message.ParticipantIdentifier); participantId = Guid.Empty; avatarId = Guid.Empty; return(false); } foreach (CloudBubble bubble in service.Bubbles) { if (message.BubbleId == bubble.BubbleId && bubble.GetParticipant(participantId) != null) { LogUtil.Warn("Participant already connected " + participantId + "."); return(false); } } foreach (DaemonParticipant daemonParticipant in bubbleDaemons.Values) { if (message.ParticipantIdentifier.Equals(daemonParticipant.DaemonIdentifier) && message.ParticipantSecret.Equals(daemonParticipant.DaemonSecret)) { LogUtil.Info("Login secret match for daemon participant " + participantId + "."); return(true); } } Participant participant = ParticipantLogic.GetParticipant(participantId); if (participant.LoginSecret == null) { LogUtil.Warn("No login secret defined for participant " + participantId + " in database."); return(false); } if (DateTime.Now > participant.LoginSecretExpires) { LogUtil.Warn("Login secret expired for participant " + participantId + " in database."); return(false); } if (participant.LoginSecret.Equals(message.ParticipantSecret)) { LogUtil.Info("Login secret match for participant " + participantId + "."); ParticipantLogic.ClearLoginSecret(participant); return(true); } else { LogUtil.Warn("Login secret mismatch for participant " + participantId + "."); return(false); } }
//Add Participant public bool Add(Participant participant) { return(_participantRepository.Add(participant)); }
public SampleMainWindowViewModel() { var someChatter = new ObservableCollection <ChatMessage> { new ChatMessage { Author = "Batman", Message = "What do you think about the Batmobile?", Time = DateTime.Now, IsOriginNative = true }, new ChatMessage { Author = "Batman", Message = "Coolest superhero ride?", Time = DateTime.Now, IsOriginNative = true }, new ChatMessage { Author = "Superman", Message = "Only if you don't have superpowers :P", Time = DateTime.Now }, new ChatMessage { Author = "Batman", Message = "I'm rich. That's my superpower.", Time = DateTime.Now, IsOriginNative = true }, new ChatMessage { Author = "Superman", Message = ":D Lorem Ipsum something blah blah blah blah blah blah blah blah. Lorem Ipsum something blah blah blah blah.", Time = DateTime.Now }, new ChatMessage { Author = "Batman", Message = "I have no feelings", Time = DateTime.Now, IsOriginNative = true }, new ChatMessage { Author = "Batman", Message = "How's Martha?", Time = DateTime.Now, IsOriginNative = true } }; Participants.Add(new Participant { Name = "Superman", Chatter = someChatter, IsTyping = true, IsLoggedIn = true }); Participants.Add(new Participant { Name = "Wonder Woman", Chatter = someChatter, IsLoggedIn = false }); Participants.Add(new Participant { Name = "Aquaman", Chatter = someChatter, HasSentNewMessage = true }); Participants.Add(new Participant { Name = "Captain Canada", Chatter = someChatter, HasSentNewMessage = true }); Participants.Add(new Participant { Name = "Iron Man", Chatter = someChatter, IsTyping = true }); SelectedParticipant = Participants.First(); }
private static bool IsMobileNumberInput(Participant parsedParticipant, AnrManager.Options options) { return(parsedParticipant.ValidationStatus == ParticipantValidationStatus.NoError && AnrManager.AreNameAndAddressTheSameNumber(options, parsedParticipant.RoutingType, parsedParticipant.DisplayName, parsedParticipant.EmailAddress)); }
// Token: 0x06001E9D RID: 7837 RVA: 0x000B0698 File Offset: 0x000AE898 internal override void RenderContents(TextWriter writer, UserContext userContext, RecipientWellType type, RecipientWellNode.RenderFlags flags, RenderRecipientWellNode wellNode) { if (writer == null) { throw new ArgumentNullException("writer"); } if (userContext == null) { throw new ArgumentNullException("userContext"); } if (!this.HasRecipients(type)) { return; } IEnumerator <Participant> recipientsCollection = this.GetRecipientsCollection(type); RecipientWellNode.RenderFlags renderFlags = flags & ~RecipientWellNode.RenderFlags.RenderCommas; bool flag = true; bool flag2 = userContext.IsInstantMessageEnabled(); Result <ADRawEntry>[] array = null; int num = 0; while (recipientsCollection.MoveNext()) { Participant participant = recipientsCollection.Current; string smtpAddress = null; string alias = null; string text = null; int num2 = 0; ADObjectId adObjectId = null; string mobilePhoneNumber = null; if (participant.RoutingType == "EX" && !string.IsNullOrEmpty(participant.EmailAddress)) { bool flag3 = (flags & RecipientWellNode.RenderFlags.ReadOnly) != RecipientWellNode.RenderFlags.None; if (flag3) { alias = Utilities.GetParticipantProperty <string>(participant, ParticipantSchema.Alias, null); } bool participantProperty = Utilities.GetParticipantProperty <bool>(participant, ParticipantSchema.IsDistributionList, false); if (participantProperty) { num2 |= 1; } bool participantProperty2 = Utilities.GetParticipantProperty <bool>(participant, ParticipantSchema.IsRoom, false); if (participantProperty2) { num2 |= 2; } smtpAddress = Utilities.GetParticipantProperty <string>(participant, ParticipantSchema.SmtpAddress, null); if (flag2 && !participantProperty && !participantProperty2) { text = Utilities.GetParticipantProperty <string>(participant, ParticipantSchema.SipUri, null); if (text == null || text.Trim().Length == 0) { if (array == null) { array = AdRecipientBatchQuery.FindAdResultsByLegacyExchangeDNs(this.GetRecipientsCollection(type), userContext); } ADRawEntry data = array[num].Data; if (data != null) { adObjectId = (ADObjectId)data[ADObjectSchema.Id]; text = InstantMessageUtilities.GetSipUri((ProxyAddressCollection)data[ADRecipientSchema.EmailAddresses]); if (text != null && text.Trim().Length == 0) { text = null; } } } } if (userContext.IsSmsEnabled) { if (array == null) { array = AdRecipientBatchQuery.FindAdResultsByLegacyExchangeDNs(this.GetRecipientsCollection(type), userContext); } ADRawEntry data2 = array[num].Data; if (data2 != null) { mobilePhoneNumber = (string)data2[ADOrgPersonSchema.MobilePhone]; } } num++; } else if (participant.RoutingType == "SMTP") { smtpAddress = participant.EmailAddress; if (flag2) { text = participant.EmailAddress; } } else if (string.CompareOrdinal(participant.RoutingType, "MAPIPDL") == 0) { num2 |= 1; } StoreObjectId storeObjectId = null; EmailAddressIndex emailAddressIndex = EmailAddressIndex.None; StoreParticipantOrigin storeParticipantOrigin = participant.Origin as StoreParticipantOrigin; if (storeParticipantOrigin != null && storeParticipantOrigin.OriginItemId != null) { storeObjectId = storeParticipantOrigin.OriginItemId; emailAddressIndex = storeParticipantOrigin.EmailAddressIndex; } if (wellNode(writer, userContext, participant.DisplayName, smtpAddress, participant.EmailAddress, participant.RoutingType, alias, RecipientAddress.ToAddressOrigin(participant), num2, storeObjectId, emailAddressIndex, adObjectId, renderFlags, text, mobilePhoneNumber) && flag) { flag = false; if ((flags & RecipientWellNode.RenderFlags.RenderCommas) != RecipientWellNode.RenderFlags.None) { renderFlags |= RecipientWellNode.RenderFlags.RenderCommas; } } } }
private static void AddContacts(UserContext userContext, AnrManager.Options options, PropertyDefinition[] properties, object[][] results, List <RecipientAddress> addresses) { if (results != null && results.GetLength(0) > 0) { int i = 0; while (i < results.GetLength(0)) { object[] results2 = results[i]; Participant participant = null; string displayName = null; string text = Utilities.NormalizePhoneNumber(AnrManager.FindFromResultsMapping(ContactSchema.MobilePhone, properties, results2) as string); VersionedId versionedId = AnrManager.FindFromResultsMapping(ItemSchema.Id, properties, results2) as VersionedId; if (!options.ResolveAgainstAllContacts && !options.IsDefaultRoutingType("MOBILE")) { participant = (AnrManager.FindFromResultsMapping(ContactBaseSchema.AnrViewParticipant, properties, results2) as Participant); displayName = participant.DisplayName; goto IL_1AB; } Participant participant2 = AnrManager.FindFromResultsMapping(DistributionListSchema.AsParticipant, properties, results2) as Participant; if (participant2 != null) { participant = participant2; displayName = participant.DisplayName; goto IL_1AB; } if (options.IsDefaultRoutingType("MOBILE")) { if (!string.IsNullOrEmpty(text)) { displayName = (AnrManager.FindFromResultsMapping(StoreObjectSchema.DisplayName, properties, results2) as string); participant = new Participant(displayName, text, "MOBILE", new StoreParticipantOrigin(versionedId), new KeyValuePair <PropertyDefinition, object> [0]); } else if (options.OnlyAllowDefaultRoutingType) { goto IL_339; } } if (!(participant == null)) { goto IL_1AB; } Participant participant3 = AnrManager.FindFromResultsMapping(ContactSchema.Email1, properties, results2) as Participant; Participant participant4 = AnrManager.FindFromResultsMapping(ContactSchema.Email2, properties, results2) as Participant; Participant participant5 = AnrManager.FindFromResultsMapping(ContactSchema.Email3, properties, results2) as Participant; if (participant3 != null && !string.IsNullOrEmpty(participant3.EmailAddress)) { participant = participant3; displayName = participant.DisplayName; goto IL_1AB; } if (participant4 != null && !string.IsNullOrEmpty(participant4.EmailAddress)) { participant = participant4; displayName = participant.DisplayName; goto IL_1AB; } if (participant5 != null && !string.IsNullOrEmpty(participant5.EmailAddress)) { participant = participant5; displayName = participant.DisplayName; goto IL_1AB; } goto IL_1AB; IL_339: i++; continue; IL_1AB: RecipientAddress recipientAddress = new RecipientAddress(); recipientAddress.MobilePhoneNumber = text; recipientAddress.DisplayName = displayName; recipientAddress.AddressOrigin = AddressOrigin.Store; if (participant != null) { if (Utilities.IsMapiPDL(participant.RoutingType) && Utilities.IsFlagSet((int)options.RecipientBlockType, 2)) { goto IL_339; } recipientAddress.RoutingType = participant.RoutingType; recipientAddress.EmailAddressIndex = ((StoreParticipantOrigin)participant.Origin).EmailAddressIndex; if (!string.IsNullOrEmpty(participant.EmailAddress)) { recipientAddress.RoutingAddress = participant.EmailAddress; if (string.CompareOrdinal(recipientAddress.RoutingType, "EX") == 0) { string text2 = participant.TryGetProperty(ParticipantSchema.SmtpAddress) as string; if (string.IsNullOrEmpty(text2)) { IRecipientSession recipientSession = Utilities.CreateADRecipientSession(Culture.GetUserCulture().LCID, true, ConsistencyMode.IgnoreInvalid, true, userContext); ADRecipient adrecipient = null; try { adrecipient = recipientSession.FindByLegacyExchangeDN(recipientAddress.RoutingAddress); } catch (NonUniqueRecipientException ex) { ExTraceGlobals.CoreTracer.TraceDebug <string>(0L, "AnrManager.GetNamesByAnrFromContacts: NonUniqueRecipientException was thrown by FindByLegacyExchangeDN: {0}", ex.Message); } if (adrecipient == null || adrecipient.HiddenFromAddressListsEnabled) { goto IL_339; } recipientAddress.SmtpAddress = adrecipient.PrimarySmtpAddress.ToString(); } else { recipientAddress.SmtpAddress = text2; } } else if (string.CompareOrdinal(recipientAddress.RoutingType, "SMTP") == 0) { recipientAddress.SmtpAddress = recipientAddress.RoutingAddress; } } } if (Utilities.IsMapiPDL(recipientAddress.RoutingType)) { recipientAddress.IsDistributionList = true; } if (versionedId != null) { recipientAddress.StoreObjectId = versionedId.ObjectId; } addresses.Add(recipientAddress); goto IL_339; } } }
private static bool TryParseParticipant(string input, AnrManager.Options options, out Participant participant) { if (string.IsNullOrEmpty(input)) { participant = null; return(false); } return(Participant.TryParse(input, out participant) && participant.ValidationStatus == ParticipantValidationStatus.NoError && participant.RoutingType != null); }
public static void ReplyWithTimeInput(Message message, ITelegramBotClient client, Participant participant, int selectedDateNum) { var chatId = message.Chat.Id; var messageId = message.MessageId; // Берём начало недели. DateTime now = DateTime.Today; int daynum = dayOfWeekInt(now); DateTime selectedDay = now.AddDays(-daynum + selectedDateNum); DateTime weekStart = now.AddDays(-daynum); DateTime weekEnd = weekStart.AddDays(+7); //Нужно получить доступное время для бронирования double freetime = maxHoursToBook(participant.Status); using (MobileContext db = new MobileContext()) { //var bookingsWeek = db.Bookings.Where(c => (c.Participant == participant) && (c.TimeStart > weekStart) && (c.TimeEnd < weekEnd)); //TODO: Вывыести списком все брони (хотя не факт что надо, расписание картинкой его успешно заменяет) //var allBookingsInSelectedDay = db.Bookings.Where(c => (c.TimeEnd.Year == selectedDay.Year) && (c.TimeEnd.Month == selectedDay.Month) && (c.TimeEnd.Day == selectedDay.Day)).ToList(); var bookings = db.Bookings.Where(c => (c.Participant == participant) && (c.TimeEnd.Year == selectedDay.Year) && (c.TimeEnd.Month == selectedDay.Month) && (c.TimeEnd.Day == selectedDay.Day)).ToList(); foreach (var booking in bookings) { freetime -= (booking.TimeEnd.Subtract(booking.TimeStart).TotalHours); } participant.SelectedDate = selectedDay; db.Participants.Update(participant); db.SaveChanges(); } Message mes = client.SendTextMessageAsync(chatId, $"Доступно часов для бронирования: {freetime}.\nВведите время начала и завершения брони. Например \"12:20 14:20\"", replyToMessageId: messageId).Result; }
public NewFinisher(Participant ParticipantFinished) { this.ParticipantFinished = ParticipantFinished; }