//void BuddyListChanged(object sender, BuddyListEventArgs args) //{ // switch (args.EventType) // { // case EventType.Add: // if (InvokeRequired) // Invoke(new Action(() => AddBuddy(args.Buddy))); // break; // case EventType.Update: // if (InvokeRequired) // Invoke(new Action(() => UpdateBuddy(args.Buddy))); // break; // case EventType.Remove: // if (InvokeRequired) // Invoke(new Action(() => RemoveBuddy(args.Buddy))); // break; // } //} //private void RemoveBuddy(Buddy buddy) //{ // if (BuddyList.Buddies.Contains(buddy)) // BuddyList.Buddies.Remove(buddy); //} //private void UpdateBuddy(Buddy buddy) //{ // var buddyItem = buddyListBox.Controls.OfType<BuddyListboxItem>(). // Where(i => i.Buddy.Equals(buddy)). // SingleOrDefault(); // if (buddyItem != null) // { // buddyItem.UpdateBuddyInformation(); // if (InvokeRequired) // Invoke(new Action(buddyListBox.Invalidate)); // else // buddyListBox.Invalidate(); // } //} private void OpenChatForm(Buddy buddy, Message msg = null) { if (!ChatForm.Singleton.OpenBuddies.Contains(buddy)) ChatForm.Singleton.AddChat(buddy, msg); ChatForm.Singleton.Show(); }
public ConversationItem(Buddy from, string message = null) { Buddy = from; InitializeComponent(); if (message != null) AddMessage(message); }
// GET: Buddies/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Buddy buddy = this.db.Buddies.Find(id); if (buddy == null) { return(this.HttpNotFound()); } return(this.View(buddy)); }
public async Task <HttpResponseMessage> GetById(int id) { try { Buddy buddy = await BuddyService.GetById(id); return(Request.CreateResponse(HttpStatusCode.OK, buddy)); } catch (Exception exception) { ErrorResponse errorResponse = new ErrorResponse(exception.Message); return(Request.CreateResponse(HttpStatusCode.BadRequest, errorResponse)); } }
public Buddy RemoveBuddyById(int id) { Buddy buddyById = GetBuddyById(id); if (buddyById != null) { lock (buddiesByName) { buddiesByName.Remove(buddyById.Name); return(buddyById); } } return(buddyById); }
public Buddy RemoveBuddyByName(string name) { Buddy buddyByName = GetBuddyByName(name); if (buddyByName != null) { lock (buddiesByName) { buddiesByName.Remove(name); return(buddyByName); } } return(buddyByName); }
// GET: Buddies/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Buddy buddy = db.Buddies.Find(id); if (buddy == null) { return(HttpNotFound()); } return(View(buddy)); }
internal string getUpdates() { FriendListPacket FriendList = new FriendListPacket(); FriendListArrayPacket[] Buddylist = new FriendListArrayPacket[Buddies.Count]; int count = 0; foreach (Buddy Buddy in Buddies.Values) { Buddylist[count++] = Buddy.BuddyPacket(); } FriendList.F = Buddylist; return(JsonConvert.SerializeObject(FriendList)); }
private void OnItemDoubleClicked(object sender, RoutedEventArgs e) { CommunityMember member = this.MemberListBox.ItemContainerGenerator.ItemFromContainer((DependencyObject)sender) as CommunityMember; if ((member != null) && Util_Buddy.IsOnlineStatus()) { Buddy buddy = member.Buddy; if ((buddy != null) && Util_Buddy.IsFriend(buddy.Uin)) { Util_Buddy.OpenContactSessionWindow(buddy); e.Handled = true; } } }
public long Insert(Buddy buddy) { return(QueryFactory.Query(TableName).InsertGetId <long>(new { shared_id = buddy.SharedId, character_id = buddy.CharacterId, friend_character_id = buddy.Friend.CharacterId, buddy.Message, is_friend_request = buddy.IsFriendRequest, is_pending = buddy.IsPending, buddy.Blocked, block_reason = buddy.BlockReason, buddy.Timestamp })); }
public void Update(Buddy buddy) { QueryFactory.Query(TableName).Where("id", buddy.Id).Update(new { shared_id = buddy.SharedId, character_id = buddy.CharacterId, friend_character_id = buddy.Friend.CharacterId, buddy.Message, is_friend_request = buddy.IsFriendRequest, is_pending = buddy.IsPending, buddy.Blocked, block_reason = buddy.BlockReason, buddy.Timestamp }); }
public void BuddyETA_IsCorrect() { var buddy = new Buddy { BeaconId = 1, UserId = 1, BuddyStatus = BuddyStatus.OnTheWay, ETAdrinks = 2 }; var datetimeNow = new DateTime(2017, 07, 12, 10, 30, 0); var expected = new DateTime(2017, 07, 12, 11, 30, 0); var actual = datetimeNow.AddMinutes(buddy.ETAdrinks * 30); Assert.AreEqual(expected, actual); }
// GET: Buddies/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Buddy buddy = db.Buddies.Find(id); if (buddy == null) { return(HttpNotFound()); } ViewBag.userId = new SelectList(db.UserInfos, "userId", "firstName", buddy.userId); return(View(buddy)); }
/// <summary> /// 定义Buddy属性变更执行操作 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Buddy_BuddyPropertyChanged(object sender, PropertyChangedEventArgs e) { if ((("PresenceInfo" == e.PropertyName) && ((this._filterType & FilterType.FilterByOnline) == FilterType.FilterByOnline)) && ((this._filterType & FilterType.FilterByUin) != FilterType.FilterByUin)) { Buddy buddy = sender as Buddy; if (buddy.PresenceInfo.IsOnline) { buddy.VisibilityInContactPanel = Visibility.Visible; } else { buddy.VisibilityInContactPanel = Visibility.Collapsed; } } }
public static async Task <int> Create(Buddy Buddy) { int id = -1; //get connection string from web.config string connectionString = System.Web.Configuration.WebConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString; SqlConnection sqlConnection = new SqlConnection(connectionString); try { if (sqlConnection.State == ConnectionState.Closed) { await sqlConnection.OpenAsync(); } SqlCommand sqlCommand = sqlConnection.CreateCommand(); sqlCommand.CommandText = "[dbo].[Buddy_Create]"; sqlCommand.CommandType = CommandType.StoredProcedure; sqlCommand.Parameters.AddWithValue("@firstName", Buddy.FirstName); sqlCommand.Parameters.AddWithValue("@lastName", Buddy.LastName); sqlCommand.Parameters.AddWithValue("@phoneNumber", Buddy.PhoneNumber); sqlCommand.Parameters.AddWithValue("@age", Buddy.Age); sqlCommand.Parameters.AddWithValue("@isActive", Buddy.IsActive); sqlCommand.Parameters.AddWithValue("@branch", Buddy.Branch); sqlCommand.Parameters.AddWithValue("@rank", Buddy.Rank); sqlCommand.Parameters.AddWithValue("@yearsServed", Buddy.YearsServed); sqlCommand.Parameters.AddWithValue("@location", Buddy.Location); sqlCommand.Parameters.AddWithValue("@currentOccupation", Buddy.CurrentOccupation); sqlCommand.Parameters.AddWithValue("@tagline", Buddy.TagLine); sqlCommand.Parameters.AddWithValue("@bio", Buddy.Bio); object returnedObject = await sqlCommand.ExecuteScalarAsync(); int.TryParse(returnedObject.ToString(), out id); } catch (Exception exception) { Debug.WriteLine(exception.Message); } finally { if (sqlConnection.State == ConnectionState.Open) { sqlConnection.Close(); } } return(id); }
private void AddImage(Buddy buddy, ImgurResponse imgurResponse) { if (imgurResponse == null) { return; } BuddyTab tab = GetTabPage(buddy); if (tab == null) { return; } tab.AddImage(imgurResponse.UploadLinks.DirectLink); }
void CheckPlayerDead() { if (!PlayerAlive) { camFollow.parent = cow.transform; camFollow.localPosition = Vector3.zero; foreach (GameObject b in spawner.ActiveBuddies) { Buddy buddy = b.GetComponent <Buddy>(); if (buddy.learning) { buddy.SwitchToAILearn(); } } } }
/// <summary> /// Retrieves a sound from the Buddy sound library, and returns a Stream. Your application should perisist this stream locally in a location such as IsolatedStorage. /// </summary> /// <param name="soundName">The name of the sound file. See the Buddy Developer Portal "Sounds" page to find sounds and get their names.</param> /// <param name="quality">The quality level of the file to retrieve.</param> public Task<Stream> GetSoundAsync(string soundName, Buddy.Sounds.SoundQuality quality) { var tcs = new System.Threading.Tasks.TaskCompletionSource<Stream>(); this.GetSoundInternal(soundName, quality, (bcr) => { if (bcr.Error != BuddyServiceClient.BuddyError.None) { tcs.TrySetException(new BuddyServiceException(bcr.Error)); } else { tcs.TrySetResult(bcr.Result); } }); return tcs.Task; }
private static void HandleEditBlockReason(GameSession session, PacketReader packet) { long buddyId = packet.ReadLong(); string otherPlayerName = packet.ReadUnicodeString(); string newBlockReason = packet.ReadUnicodeString(); Buddy buddy = GameServer.BuddyManager.GetBuddyByPlayerAndId(session.Player, buddyId); if (buddy == null || otherPlayerName != buddy.Friend.Name) { return; } buddy.Message = newBlockReason; session.Send(BuddyPacket.EditBlockReason(buddy)); }
void CollectionViewSource_Filter(object sender, FilterEventArgs e) { Buddy buddy = (Buddy)e.Item; if (!showOfflineContacts && buddy.Status == UserStatus.Offline) { e.Accepted = false; } else if (filter == String.Empty) { e.Accepted = true; } else { e.Accepted = buddy.DisplayName.ToUpperInvariant().Contains(filter.ToUpperInvariant()); } }
public bool PostBuddy([FromBody] Buddy buddy) { if (!Validator.Validate(buddy)) { return(false); } try { return(DataController.SaveBuddy(buddy)); } catch (Exception e) { var entry = new LogEntry(e); DataController.SaveLogEntry(entry); return(false); } }
public Buddy GetBuddy(int id) { var buddy = new Buddy(); using (var context = new BeaconContext()) { try { buddy = context.Buddies.Find(id); } catch { throw; } return(buddy); } }
public MainPage() { _speechPlayer = new MediaPlayer(); InitializeComponent(); _buddy = new Buddy(_speechPlayer); AppConfiguration.LuisApiSubscriptionKey = "3e2934014f074071b2e976fa07a6b3b8"; AppConfiguration.LuisApiEndPoint = "https://westus.api.cognitive.microsoft.com/"; AppConfiguration.LuisApiApplicationId = "34cba600-73d1-45de-b30d-a80156854438"; AppConfiguration.FaceApiSubscriptionKey = "d5c5af33cd604b78bc6f85de2600549b"; AppConfiguration.FaceApiEndPoint = "https://westcentralus.api.cognitive.microsoft.com"; AppConfiguration.VisionApiSubscriptionKey = "c629cf862be745d49e5f1e1ba5273d4b"; AppConfiguration.VisionApiEndPoint = "https://westcentralus.api.cognitive.microsoft.com"; AppConfiguration.ProjectAnswerSearchSubscriptionKey = "6c8eb7b5c0964e61930c5fa4ed693900"; AppConfiguration.ProjectAnswerSearchEndpoint = "https://api.labs.cognitive.microsoft.com/answersearch/v7.0/search"; }
public bool ProcessEnterKey() { Buddy selectedItem = this.RecentContactsBox.SelectedItem as Buddy; if (selectedItem != null) { Util_Buddy.OpenContactSessionWindow(selectedItem); return(true); } InstanceAnswerPro.Core.Community.Community community = this.RecentContactsBox.SelectedItem as InstanceAnswerPro.Core.Community.Community; if (community != null) { Util_Buddy.OpenCommunitySessionWindow(community); return(true); } return(false); }
static void Main(string[] args) { Buddy friend1 = new Buddy("Kate", "liliana"); Buddy friend2 = new Buddy("Ecki", "Bieze"); Buddy friend3 = new Buddy("Sarah", "Magic"); List <Buddy> Buddies = new List <Buddy>(); Buddies.Add(friend1); Buddies.Add(friend2); Buddies.Add(friend3); friend1.eat(); friend1.eat("pizza"); friend1.eat(Buddies); friend1.eat("pizza", Buddies); }
private async Task <NotificationResult> HandleSend() { EditText messageBody = (EditText)SendDialog.FindViewById(Resource.Id.messageBody); if (null != SelectedUser && null != messageBody) { var result = await Buddy.PostAsync <NotificationResult>("/notificaitons", new { message = messageBody.Text } ); if (result.IsSuccess) { return(result.Value); } } return(null); }
private void ContactSessionWindow_Unloaded(object sender, RoutedEventArgs e) { base.Unloaded -= new RoutedEventHandler(this.ContactSessionWindow_Unloaded); //this.InputBox.SaveSettings(typeof(Util_UserSettings_ContactSessionWindow).Name); ContactSessionWindows.Remove(this); CoreMessenger.Instance.MessageCenter.RemoveMessageProcessor(this); Buddy buddy = null; if (this.CurrentIMSession != null) { buddy = this.CurrentIMSession.Buddy; } foreach (SessionTabItem item in this.sessionTabItems) { item.Close(); } this.sessionTabItems.Clear(); }
private async void Button_Click(object sender, RoutedEventArgs e) { var username = UsernameInput.Text.Trim(); var password = PasswordInput.Password.Trim(); StatusMsg.Text = String.Empty; var result = await Buddy.LoginUserAsync(username, password); if (result.IsSuccess) { MessageBox.Show(String.Format("Logged in as {0}", result.Value.Username)); NavigationService.Navigate(new Uri("/ChatScreen.xaml", UriKind.Relative)); } else { StatusMsg.Text = result.Error.Message; } }
async void HandleCurrentUserChanged(object sender, CurrentUserChangedEventArgs e) { var user = e.NewUser ?? await Buddy.GetCurrentUserAsync(); PlatformAccess.Current.InvokeOnUiThread(() => { if (user != null) { lblUserCheckins.Text = String.Format("{0}'s Checkins:", user.FirstName ?? user.Username); lblUserCheckins.Hidden = false; } else { lblUserCheckins.Hidden = true; } _dataSource.Clear(); checkinTable.ReloadData(); }); }
public async override void ViewDidAppear(bool animated) { Buddy.CurrentUserChanged += HandleCurrentUserChanged; base.ViewDidAppear(animated); var user = await Buddy.GetCurrentUserAsync(); HandleCurrentUserChanged(null, new CurrentUserChangedEventArgs(user, null)); if (_timedMetric) { await _timedMetric.FinishAsync(); _timedMetric = null; } await UpdateData(); }
public void CharacterWorldInteraction(Packet inPacket) { Character character; switch ((CharacterWorldInteractionAction)inPacket.ReadByte()) { case CharacterWorldInteractionAction.UpdateBuddyChannel: character = ChannelData.Characters[inPacket.ReadInt()]; Buddy buddy = character.BuddyList[inPacket.ReadString()]; if (buddy != null) { buddy.Channel = inPacket.ReadByte(); character.BuddyList.UpdateBuddyChannel(buddy); } break; case CharacterWorldInteractionAction.SendBuddyRequest: character = ChannelData.Characters[inPacket.ReadInt()]; int addBuddyID = inPacket.ReadInt(); string addBuddyName = inPacket.ReadString(); short addBuddyLevel = inPacket.ReadShort(), addBuddyJob = inPacket.ReadShort(); using (Packet outPacket = new Packet(MapleServerOperationCode.BuddyList)) { outPacket.WriteByte(9); outPacket.WriteInt(addBuddyID); outPacket.WriteString(addBuddyName); outPacket.WriteShort(addBuddyLevel); outPacket.WriteShort(); outPacket.WriteShort(addBuddyJob); outPacket.WriteShort(); outPacket.WriteInt(addBuddyID); outPacket.WriteStringFixed(addBuddyName, 13); outPacket.WriteByte(1); outPacket.WriteInt(0); outPacket.WriteStringFixed("Default Group", 17); outPacket.WriteByte(); character.Client.Send(outPacket); } break; } }
public void MergeFrom(PlayerFriendDisplay other) { if (other == null) { return; } if (other.buddy_ != null) { if (buddy_ == null) { buddy_ = new global::POGOProtos.Data.PokemonDisplay(); } Buddy.MergeFrom(other.Buddy); } if (other.BuddyDisplayPokemonId != 0) { BuddyDisplayPokemonId = other.BuddyDisplayPokemonId; } if (other.BuddyPokemonNickname.Length != 0) { BuddyPokemonNickname = other.BuddyPokemonNickname; } if (other.lastPokemonCaught_ != null) { if (lastPokemonCaught_ == null) { lastPokemonCaught_ = new global::POGOProtos.Data.PokemonDisplay(); } LastPokemonCaught.MergeFrom(other.LastPokemonCaught); } if (other.LastPokemonCaughtDisplayId != 0) { LastPokemonCaughtDisplayId = other.LastPokemonCaughtDisplayId; } if (other.LastPokemonCaughtTimestamp != 0L) { LastPokemonCaughtTimestamp = other.LastPokemonCaughtTimestamp; } if (other.BuddyCandyAwarded != 0) { BuddyCandyAwarded = other.BuddyCandyAwarded; } _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); }
private string RemoteAddress = Properties.Settings.Default.server_ip; // Define Network Propertys (ServerIP and commandport) #endregion Fields #region Constructors public SynChat() { InitializeComponent(); // Clear all indices in chat marker array for(int i=0; i < 10; i++) { freechats[i] = true; chatbuddies[i] = ""; } // Marrie the delegates with their events (needed for invokes) OnReceiveBuddy += new Buddy(ReceiveBuddy); EnableItems += new Enable(Enable_Items); OnReceive += new Receive(OpenChat); OnStatusChange += new BuddyStatus(StatusChange); OnStatusReceived += new RequestedStatusReceived(RequestedStatusReceive); OnStatusSend += new StatusSend(SendStatus); Client = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); // Create the Socket try { // Try to connect and send the port request command Client.Connect(IPAddress.Parse(RemoteAddress), port); } catch (SocketException) { // If that fails -> Show a error and close the Application MessageBox.Show("Konnte keine Verbindung zum Server herstellen!"); debugFile.Write("Server unavaliable\r\n"); this.Close(); } // Create the Thread for the Listener and put it in the background Thread lis = new Thread(new ThreadStart(Listener)); lis.IsBackground = true; lis.Start(); // Remove menu entry for clearing chatlogs if chatlogs are disabled if (Properties.Settings.Default.client_log_conversations) { alleMitschnitteLöschenToolStripMenuItem.Visible = true; } }
internal string getUpdates() { int updateAmount = 0; StringBuilder Updates = new StringBuilder(); try { foreach (virtualBuddy Buddy in Buddies.Values) { if (Buddy.Updated) { updateAmount++; Updates.Append("H" + Buddy.ToString(false)); } } return("H" + Encoding.encodeVL64(updateAmount) + Updates.ToString()); } catch { return("HH"); } }
//void BuddyListChanged(object sender, BuddyListEventArgs args) //{ // var tab = GetTabPage(args.Buddy); // if (tab != null) // if (InvokeRequired) // Invoke(new Action(() => UpdateBuddyStatus(args.Buddy, tab))); //} //private void UpdateBuddyStatus(Buddy buddy, BuddyTab tab = null) //{ // if (tab == null) // tab = GetTabPage(buddy); // string status = String.IsNullOrEmpty(buddy.Status) ? buddy.MainPresenceTypeString: buddy.Status; // tab.Text = String.Format("{0} ({1})", tab.Buddy.Name, status); //} public void AddChat(Buddy buddy, Message msg = null) { var buddyTab = GetTabPage(buddy); if (buddyTab == null) { buddyTab = msg == null ? new BuddyTab(buddy.Jid) : new BuddyTab(msg.From); tabControl.TabPages.Add(buddyTab); buddyTab = GetTabPage(buddy); } tabControl.SelectTab(buddyTab); if (msg != null) { buddyTab.Resource = msg.From.Resource; buddyTab.AddMessage(msg); } UpdateTitleText(); }
public ContactSessionWindow(SessionTabItem sessionTabItem) { RoutedEventHandler handler = null; this.sessionTabItems = new ObservableCollection<SessionTabItem>(); this._buddyWhenWindowCreated = sessionTabItem.Buddy; base.Unloaded += new RoutedEventHandler(this.ContactSessionWindow_Unloaded); this.InitializeComponent(); ContactSessionWindows.Add(this); CoreMessenger.Instance.MessageCenter.AddMessageProcessor(this); this.AddSession(sessionTabItem); if (handler == null) { handler = delegate { //if (this.sessionsControl.ShouldLoseFocus) //{ // this.SetFocusOnInputBoxWithDelay(); //} //this.sessionsControl.ShouldLoseFocus = false; }; } // this.sessionsControl.AddHandler(UIElement.GotFocusEvent, handler); }
private static void UpdateInfoFromTorrentSearcher(object sender, Buddy.TorrentSearcher.InfoReadyEventArgs args) { Buddy.TorrentSearcher searcher = (Buddy.TorrentSearcher)sender; System.Text.RegularExpressions.MatchCollection results = searcher.results; if (results != null) { foreach (System.Text.RegularExpressions.Match line in results) { System.Text.RegularExpressions.GroupCollection group = line.Groups; if(line != null) { Console.WriteLine(group[0].Value); } } } else { Console.WriteLine("Webpage failed to load"); } Console.Read(); }
/// <summary> /// Update virtual album picture comment or app.tag. /// </summary> /// <param name="picture">The picture to be updated, either PicturePublic or Picture works.</param> /// <param name="newComment">The new comment to set for the picture.</param> /// <param name="newAppTag">An optional new application tag for the picture.</param> /// <returns>A Task<Boolean>that can be used to monitor progress on this call.</returns> public static System.Threading.Tasks.Task<Boolean> UpdatePictureAsync(this Buddy.VirtualAlbum virtualAlbum, Buddy.PicturePublic picture, string newComment, string newAppTag = "") { var tcs = new System.Threading.Tasks.TaskCompletionSource<Boolean>(); virtualAlbum.UpdatePictureInternal(picture, newComment, newAppTag, (bcr) => { if (bcr.Error != BuddyServiceClient.BuddyError.None) { tcs.TrySetException(new BuddyServiceException(bcr.Error)); } else { tcs.TrySetResult(bcr.Result); } }); return tcs.Task; }
/// <summary> /// Accept a friend request from a user. /// </summary> /// <param name="user">The user to accept as friend. Can't be null and must be on the friend requests list.</param> /// <param name="appTag">Tag this friend accept with a string.</param> /// <returns>A Task<Boolean>that can be used to monitor progress on this call.</returns> public static System.Threading.Tasks.Task<Boolean> AcceptAsync(this Buddy.FriendRequests friendRequests, Buddy.User user, string appTag = "") { var tcs = new System.Threading.Tasks.TaskCompletionSource<Boolean>(); friendRequests.AcceptInternal(user, appTag, (bcr) => { if (bcr.Error != BuddyServiceClient.BuddyError.None) { tcs.TrySetException(new BuddyServiceException(bcr.Error)); } else { tcs.TrySetResult(bcr.Result); } }); return tcs.Task; }
public static void SendMessage(Buddy buddy, Message message) { buddy.UpdateThreadExpiration(); ThreadPool.QueueUserWorkItem(delegate { XmppClient.Send(message); }); }
public BuddyTab(Jid jid) { from = jid; originalBuddy = BuddyList.Instance.Get(from); InitializeComponents(); }
public static void SendMessage(Buddy buddy, string messageBody) { Message msg = new Message(buddy.Email, MyJid, MessageType.chat, messageBody, String.Empty, buddy.GetThread()); SendMessage(buddy, msg); }
private void SeriesCompletedScanHandler(Buddy.Objects.Torrent.Series series, int episodesScanned, int newEpisodesFound) { string msg = "[" + DateTime.Now.ToString("dd/MM/yy") + " " + DateTime.Now.ToString("h:mm:ss tt") + "]"; msg += " Completed Scan: " + series.Title() + " [" + series.LatestEpisodeInSeries().EpisodeID() + "] " + " New Episodes: " + newEpisodesFound + " / " + episodesScanned; this.Invoke(new Action(() => SendToMainDisplay(msg))); this.Invoke(new Action(() => Log(msg.Trim()))); }
/// <summary> /// Send a message to a user from the current authenticated user. /// </summary> /// <param name="toUser">The user to send a message to.</param> /// <param name="message">The message to send, must be less then 200 characters.</param> /// <param name="appTag">An optional application tag to set for the message.</param> /// <returns>A Task<Boolean>that can be used to monitor progress on this call.</returns> public static System.Threading.Tasks.Task<Boolean> SendAsync(this Buddy.Messages messages, Buddy.User toUser, string message, string appTag = "") { var tcs = new System.Threading.Tasks.TaskCompletionSource<Boolean>(); messages.SendInternal(toUser, message, appTag, (bcr) => { if (bcr.Error != BuddyServiceClient.BuddyError.None) { tcs.TrySetException(new BuddyServiceException(bcr.Error)); } else { tcs.TrySetResult(bcr.Result); } }); return tcs.Task; }
internal FriendListArrayPacket[] friendListInit() { int[] userIDs = UserManager.getUserFriendIDs(userID); FriendListArrayPacket[] Buddylist = new FriendListArrayPacket[userIDs.Length]; Buddy Me = new Buddy(userID, User._Username, User._MessengerMission, ""); for (int i = 0; i < userIDs.Length; i++) { string[] buddyInfo = MySQL.runReadRow("SELECT username, messenger, last_online FROM members WHERE id = '" + userIDs[i] + "'"); Buddy Buddy = new Buddy(userIDs[i], buddyInfo[0], buddyInfo[1], buddyInfo[2]); try { if (UserManager.containsUser(Buddy.userID)) UserManager.getUser(userIDs[i]).Messenger.addBuddy(Me); Buddies.Add(userIDs[i], Buddy); } catch { } Buddylist[i] = Buddy.BuddyPacket(); } return Buddylist; }
/// <summary> /// Remove a user from the current list of friends. /// </summary> /// <param name="user">The user to remove from the friends list. Must be already on the list and can't be null.</param> /// <returns>A Task<Boolean>that can be used to monitor progress on this call.</returns> public static System.Threading.Tasks.Task<Boolean> RemoveAsync(this Buddy.Friends friends, Buddy.User user) { var tcs = new System.Threading.Tasks.TaskCompletionSource<Boolean>(); friends.RemoveInternal(user, (bcr) => { if (bcr.Error != BuddyServiceClient.BuddyError.None) { tcs.TrySetException(new BuddyServiceException(bcr.Error)); } else { tcs.TrySetResult(bcr.Result); } }); return tcs.Task; }
/// <summary> /// Create a new Buddy user. Note that this method internally does two web-service calls, and the IAsyncResult object /// returned is only valid for the first one. /// </summary> /// <param name="name">The name of the new user. Can't be null or empty.</param> /// <param name="password">The password of the new user. Can't be null.</param> /// <param name="gender">An optional gender for the user.</param> /// <param name="age">An optional age for the user.</param> /// <param name="email">An optional email for the user.</param> /// <param name="status">An optional status for the user.</param> /// <param name="fuzzLocation">Optionally set location fuzzing for this user. When enabled user location is randomized in searches.</param> /// <param name="celebrityMode">Optionally set the celebrity mode for this user. When enabled this user will be absent from all searches.</param> /// <param name="appTag">An optional custom tag for this user.</param> /// <returns>A Task<AuthenticatedUser>that can be used to monitor progress on this call.</returns> public System.Threading.Tasks.Task<AuthenticatedUser> CreateUserAsync( string name, string password, Buddy.UserGender gender = UserGender.Any, int age = 0, string email = "", Buddy.UserStatus status = UserStatus.Any, bool fuzzLocation = false, bool celebrityMode = false, string appTag = "") { var tcs = new System.Threading.Tasks.TaskCompletionSource<AuthenticatedUser>(); CreateUserInternal(name, password, gender, age, email, status, fuzzLocation, celebrityMode, appTag, (bcr) => { if (bcr.Error != BuddyServiceClient.BuddyError.None) { tcs.TrySetException(new BuddyServiceException(bcr.Error)); } else { tcs.TrySetResult(bcr.Result); } }); return tcs.Task; }
/// <summary> /// Records a session metric value /// </summary> /// <param name="user">The user that is starting this session</param> /// <param name="sessionId">The id of the session, returned from StartSessionAsync.</param> /// <param name="metricKey">A custom key describing the metric.</param> /// <param name="metricValue">The value to set.</param> /// <param name="appTag">An optional custom tag to include with the metric.</param> /// <returns></returns> public System.Threading.Tasks.Task<Boolean> RecordSessionMetricAsync( Buddy.AuthenticatedUser user, int sessionId, string metricKey, string metricValue, string appTag = null) { var tcs = new System.Threading.Tasks.TaskCompletionSource<Boolean>(); RecordSessionMetricInternal(user, sessionId, metricKey, metricValue, appTag, (bcr) => { if (bcr.Error != BuddyServiceClient.BuddyError.None) { tcs.TrySetException(new BuddyServiceException(bcr.Error)); } else { tcs.TrySetResult(bcr.Result); } }); return tcs.Task; }
/// <summary> /// Starts an analytics session /// </summary> /// <param name="user">The user that is starting this session</param> /// <param name="sessionName">The name of the session</param> /// <param name="appTag">An optional custom tag to include with the session.</param> /// <returns></returns> public System.Threading.Tasks.Task<Int32> StartSessionAsync( Buddy.AuthenticatedUser user, string sessionName, string appTag = null) { var tcs = new System.Threading.Tasks.TaskCompletionSource<Int32>(); StartSessionInternal(user, sessionName, appTag, (bcr) => { if (bcr.Error != BuddyServiceClient.BuddyError.None) { tcs.TrySetException(new BuddyServiceException(bcr.Error)); } else { tcs.TrySetResult(bcr.Result); } }); return tcs.Task; }
internal void addBuddy(Buddy Buddy) { if (Buddies.ContainsKey(Buddy.userID) == false) Buddies.Add(Buddy.userID, Buddy); User.sendData("029" + getUpdates() + "#"); }
/// <summary> /// Remove a user from this message group. /// </summary> /// <param name="userToRemove">The user to remove from the group.</param> /// <returns>A Task<Boolean>that can be used to monitor progress on this call.</returns> public static System.Threading.Tasks.Task<Boolean> RemoveUserAsync(this Buddy.MessageGroup messageGroup, Buddy.User userToRemove) { var tcs = new System.Threading.Tasks.TaskCompletionSource<Boolean>(); messageGroup.RemoveUserInternal(userToRemove, (bcr) => { if (bcr.Error != BuddyServiceClient.BuddyError.None) { tcs.TrySetException(new BuddyServiceException(bcr.Error)); } else { tcs.TrySetResult(bcr.Result); } }); return tcs.Task; }
public static void SendChatState(Chatstate state, Buddy buddy) { Message msg = new Message(buddy.Jid); msg.Chatstate = state; ThreadPool.QueueUserWorkItem(delegate { XmppClient.Send(msg); }); }
public virtual bool match(string token, Buddy buddy) { bool ret = (SwigDerivedClassHasMethod("match", swigMethodTypes0) ? pjsua2PINVOKE.FindBuddyMatch_matchSwigExplicitFindBuddyMatch(swigCPtr, token, Buddy.getCPtr(buddy)) : pjsua2PINVOKE.FindBuddyMatch_match(swigCPtr, token, Buddy.getCPtr(buddy))); if (pjsua2PINVOKE.SWIGPendingException.Pending) throw pjsua2PINVOKE.SWIGPendingException.Retrieve(); return ret; }
private void NotifyUI(object sender, Buddy.Instance.Core.NotificationArgs args) { this.Invoke(new Action(() => SendToMainDisplay(args.message))); }
public BuddyListEventArgs(Buddy buddyChanged, EventType eventType) { Buddy = buddyChanged; EventType = eventType; }
public static void SendImage(Buddy buddy, Image img) { throw new NotImplementedException(); }
public static extern void Buddy_director_connect(global::System.Runtime.InteropServices.HandleRef jarg1, Buddy.SwigDelegateBuddy_0 delegate0);
private void NewEpisodeFoundHandler(Buddy.Objects.Torrent.Series series, Buddy.Objects.Torrent.Episode ep, string message) { timer.Stop(); nextScan = new DateTime(); string msg = message + " [" + series.Title() + "] " + ep.ToString(); string hovermsg = "Buddy\nNew episode: " + series.Title(); if (InvokeRequired) { this.Invoke(new Action(() => SetIconHoverMessage(hovermsg))); //this.Invoke(new Action(() => ShowUI())); this.Invoke(new Action(() => SendToMainDisplay(msg))); this.Invoke(new Action(() => Log(msg.Trim()))); } }
private void InternalRegister(Buddy buddy) { _imManager.RegisterBuddy(buddy); }
internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Buddy obj) { return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; }