public static ResponseUser FromUser(SlackAPI.User user) { var u = new ResponseUser(); u.id = user.id; u.name = user.name; u.deleted = user.deleted; u.color = user.color; u.is_admin = user.is_admin; u.is_owner = user.is_owner; u.is_owner = user.is_owner; u.is_primary_owner = user.is_primary_owner; u.is_restricted = user.is_restricted; u.is_ultra_restricted = user.is_ultra_restricted; u.has_2fa = user.has_2fa; u.two_factor_type = user.two_factor_type; u.has_files = user.has_files; u.presence = user.presence; u.is_bot = user.is_bot; u.tz = user.tz; u.tz_label = user.tz_label; u.tz_offset = user.tz_offset; u.team_id = user.team_id; u.real_name = user.real_name; return(u); }
private (string FirstName, string LastName) GetRealName(string userId) { SlackAPI.User user = null; var mre = new ManualResetEvent(false); _slackClient.GetInfo(response => { user = response.user; mre.Set(); }, userId); mre.WaitOne(); return(user.profile.first_name, user.profile.last_name); }
Tuple<int, Label> GetUserLabel(User u) { Label l; if (u.IsSlackBot) { l = new Label() { Text = "\uF004", Location = new Point(-5, 0), Font = new Font(CustomFonts.Fonts.Families[0], 8), ForeColor = Color.FromArgb(0x4a, 0x83, 0x7d), Name = u.id, }; l.Size = new Size(20, l.PreferredHeight); userLabels.Add(new Tuple<string, Label>(u.id, l)); return new Tuple<int, Label>(-3, l); } else { l = new Label() { Text = "\u25CF", Location = new Point(0, 0), Font = new Font(CustomFonts.Fonts.Families[1], 16), Name = u.id, }; l.Size = new Size(18, l.PreferredHeight); userLabels.Add(new Tuple<string, Label>(u.id, l)); return new Tuple<int, Label>(-6, l); } }