public TextMesKey(UserData user, string mes, MsType type, bool isPub) { this.User = user; this.Mes = mes; this.Type = type; this.isPublic = isPub; }
public ImgMesKey(UserData user, Image img, MsType type, bool isPub) { this.User = user; this.Img = img; this.Type = type; this.isPublic = isPub; }
public HttpClient GetClient(MsType type) { HttpClient client; // Request headers. switch (type) { case MsType.HandWritingRecognition: var requestParameters = "handwriting=true"; var uri = uriBase + "?" + requestParameters; client = new HttpClient { BaseAddress = new Uri(uri) }; client.DefaultRequestHeaders.Add("Ocp-Apim-Subscription-Key", subscriptionKey); break; case MsType.BingSearch: client = new HttpClient { BaseAddress = new Uri(bingSearch) }; client.DefaultRequestHeaders.Add("Ocp-Apim-Subscription-Key", bingSubscription); break; default: throw new ArgumentOutOfRangeException(nameof(type), type, null); } return(client); }
/// <summary> /// 添加一条图片消息 /// </summary> /// <param name="image"></param> /// <param name="type"></param> public void AppendPicMessage(Image image, UserData data, MsType type) { bool we = type == MsType.本地消息; if (type == MsType.网络消息) { this.NewMessageCount++; } MS_Label lb = new MS_Label(we, this.master.IsPub, data, this.scrollBar1); lb.Width = this.panel_sub.Width - 5; lb.SetPicMessage(image, this.showtime); AddControl(lb); }
/// <summary> /// 添加一条会话记录 /// </summary> /// <param name="message">消息</param> /// <param name="name">用户名</param> /// <param name="headImg">头像</param> /// <param name="type">气泡类型</param> public void AppendText(string message, UserData data, MsType type) { MS_Label mS_Label; //判断消息所属 if (type == MsType.本地消息) { mS_Label = new MS_Label(true, this.master.IsPub, data, this.scrollBar1); ScrollLock = true; } else { mS_Label = new MS_Label(false, this.master.IsPub, data, this.scrollBar1); this.NewMessageCount++; } mS_Label.Width = this.panel_sub.Width - 5; mS_Label.SetText(message, this.showtime); AddControl(mS_Label); }
private static NpgsqlDbType GetPgType(MsType src, bool isMax) { switch (src) { case MsType.BIGINT: return(NpgsqlDbType.Bigint); case MsType.BINARY: return(NpgsqlDbType.Bytea); case MsType.BIT: return(NpgsqlDbType.Boolean); case MsType.CHAR: return(NpgsqlDbType.Char); case MsType.CHARACTER: return(NpgsqlDbType.Char); case MsType.DATE: return(NpgsqlDbType.Date); case MsType.DATETIME: return(NpgsqlDbType.Timestamp); case MsType.DATETIME2: return(NpgsqlDbType.Timestamp); case MsType.DATETIMEOFFSET: return(NpgsqlDbType.TimestampTZ); case MsType.DECIMAL: return(NpgsqlDbType.Numeric); case MsType.DEC: return(NpgsqlDbType.Numeric); case MsType.DOUBLE_PRECISION: return(NpgsqlDbType.Double); case MsType.FLOAT: return(NpgsqlDbType.Double); case MsType.IMAGE: return(NpgsqlDbType.Bytea); case MsType.INT: return(NpgsqlDbType.Integer); case MsType.INTEGER: return(NpgsqlDbType.Integer); case MsType.MONEY: return(NpgsqlDbType.Numeric); case MsType.NCHAR: return(NpgsqlDbType.Char); case MsType.NTEXT: return(NpgsqlDbType.Text); case MsType.NUMERIC: return(NpgsqlDbType.Numeric); case MsType.NVARCHAR: return(isMax ? NpgsqlDbType.Text : NpgsqlDbType.Varchar); case MsType.REAL: return(NpgsqlDbType.Real); case MsType.ROWVERSION: return(NpgsqlDbType.Bytea); case MsType.SMALLDATETIME: return(NpgsqlDbType.Timestamp); case MsType.SMALLINT: return(NpgsqlDbType.Smallint); case MsType.SMALLMONEY: return(NpgsqlDbType.Money); case MsType.TEXT: return(NpgsqlDbType.Text); case MsType.TIME: return(NpgsqlDbType.Time); case MsType.TIMESTAMP: return(NpgsqlDbType.Bytea); case MsType.TINYINT: return(NpgsqlDbType.Smallint); case MsType.UNIQUEIDENTIFIER: return(NpgsqlDbType.Uuid); case MsType.VARBINARY: return(NpgsqlDbType.Bytea); case MsType.VARCHAR: return(isMax ? NpgsqlDbType.Text : NpgsqlDbType.Varchar); case MsType.XML: return(NpgsqlDbType.Xml); default: throw new ArgumentOutOfRangeException(nameof(src), src, null); } }