本文整理汇总了C#中ResponseType类的典型用法代码示例。如果您正苦于以下问题:C# ResponseType类的具体用法?C# ResponseType怎么用?C# ResponseType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ResponseType类属于命名空间,在下文中一共展示了ResponseType类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: TSResponse
public TSResponse(XmlElement element)
{
type = (ResponseType)Enum.Parse(typeof(ResponseType), element.GetAttribute("type"), false);
XmlNodeList l = element.GetElementsByTagName("tuple");
id = element.GetAttribute("id");
tuples = new Tuple[l.Count];
for (int i = 0; i < l.Count; i++)
{
XmlElement elTuple = (XmlElement)l[i];
tuples[i] = new Tuple(elTuple);
}
}
开发者ID:pepipe,项目名称:ISEL,代码行数:12,代码来源:TSResponse.cs
示例2: OnBtnSendClicked
protected void OnBtnSendClicked (object sender, EventArgs e)
{
Response = ResponseType.Accept;
this.UserDescription = textview1.Buffer.Text;
this.HideAll ();
Send (ex, sv);
}
开发者ID:squarerootfury,项目名称:ExceptionBase.NET-GTKSharp,代码行数:7,代码来源:UserDetails.cs
示例3: HttpWorker
public HttpWorker(Uri uri, HttpMethod httpMethod = HttpMethod.Get, Dictionary<string, string> headers = null, byte[] data = null)
{
_buffer = new byte[8192];
_bufferIndex = 0;
_read = 0;
_responseType = ResponseType.Unknown;
_uri = uri;
IPAddress ip;
var headersString = string.Empty;
var contentLength = data != null ? data.Length : 0;
if (headers != null && headers.Any())
headersString = string.Concat(headers.Select(h => "\r\n" + h.Key.Trim() + ": " + h.Value.Trim()));
if (_uri.HostNameType == UriHostNameType.Dns)
{
var host = Dns.GetHostEntry(_uri.Host);
ip = host.AddressList.First(i => i.AddressFamily == AddressFamily.InterNetwork);
}
else
{
ip = IPAddress.Parse(_uri.Host);
}
_endPoint = new IPEndPoint(ip, _uri.Port);
_request = Encoding.UTF8.GetBytes($"{httpMethod.ToString().ToUpper()} {_uri.PathAndQuery} HTTP/1.1\r\nAccept-Encoding: gzip, deflate, sdch\r\nHost: {_uri.Host}\r\nContent-Length: {contentLength}{headersString}\r\n\r\n");
if (data == null)
return;
var tmpRequest = new byte[_request.Length + data.Length];
Buffer.BlockCopy(_request, 0, tmpRequest, 0, _request.Length);
Buffer.BlockCopy(data, 0, tmpRequest, _request.Length, data.Length);
_request = tmpRequest;
}
开发者ID:evest,项目名称:Netling,代码行数:35,代码来源:HttpWorker.cs
示例4: ResponseEvent
/// <summary>
/// 建構子
/// </summary>
/// <param name="tradeOrder">訂單資訊</param>
/// <param name="symbolId">商品代號</param>
/// <param name="type">回報類型</param>
/// <param name="openTrades">開倉交易單列表</param>
/// <param name="closeTrades">已平倉交易單列表</param>
public ResponseEvent(ITradeOrder tradeOrder, string symbolId, ResponseType type, TradeList<ITrade> openTrades, List<ITrade> closeTrades) {
__cTradeOrder = tradeOrder;
__sSymbolId = symbolId;
__cType = type;
__cOpenTrades = openTrades;
__cCloseTrades = closeTrades;
}
开发者ID:Zeghs,项目名称:ZeroSystem,代码行数:15,代码来源:ResponseEvent.cs
示例5: Service
public static object Service(this Uri url, RequestType requestType, ResponseType responseType, out int resultCode, string outputFilename, IDictionary<string, string> formData) {
object result = null;
resultCode = -1;
var webRequest = (HttpWebRequest)WebRequest.Create(url);
webRequest.Proxy = GetProxy();
webRequest.CookieContainer = Cookies.GetCookieContainer();
switch (requestType) {
case RequestType.POST:
webRequest.Method = "POST";
webRequest.ContentType = "application/x-www-form-urlencoded";
var encodedFormData = Encoding.UTF8.GetBytes(GetFormData(formData).ToString());
using (var requestStream = webRequest.GetRequestStream()) {
requestStream.Write(encodedFormData, 0, encodedFormData.Length);
}
break;
case RequestType.GET:
webRequest.Method = "GET";
if (formData != null) {
var ub = new UriBuilder(url) {
Query = GetFormData(formData).ToString()
};
url = ub.Uri;
}
break;
}
try {
if (credentialCache != null) {
webRequest.Credentials = credentialCache;
webRequest.PreAuthenticate = true;
}
var webResponse = webRequest.GetResponse();
if (!KeepCookiesClean) {
Cookies.AddCookies(webRequest.CookieContainer.GetCookies(webResponse.ResponseUri));
}
switch (responseType) {
case ResponseType.String:
result = GetStringResponse(webResponse);
resultCode = 200;
break;
case ResponseType.Binary:
result = GetBinaryResponse(webResponse);
resultCode = 200;
break;
case ResponseType.File:
result = GetBinaryFileResponse(webResponse, outputFilename);
resultCode = 200;
break;
}
} catch {
resultCode = 0;
}
return result;
}
开发者ID:roomaroo,项目名称:coapp.powershell,代码行数:60,代码来源:WebExtensions.cs
示例6: OnResponse
protected override void OnResponse(ResponseType response_id)
{
base.OnResponse (response_id);
if (response_id == ResponseType.Cancel)
this.Destroy();
}
开发者ID:mtanski,项目名称:drapes,代码行数:7,代码来源:About.cs
示例7: ResponseElement
/// <summary>
/// Creates a new response object with the given XML representation.
/// </summary>
/// <param name="xml">XML representation of this response</param>
public ResponseElement(XmlNode xml) : base(xml)
{
switch(xml.Name)
{
case "success":
type = ResponseType.Success;
break;
case "failure":
type = ResponseType.Failure;
break;
case "stream:error":
type = ResponseType.StreamError;
break;
case "starttls":
type = ResponseType.StartTls;
break;
case "proceed":
type = ResponseType.ProceedTls;
break;
case "challenge":
type = ResponseType.SaslChallenge;
break;
case "response":
type = ResponseType.SaslResponse;
break;
default:
throw new OpenXMPPException("An unknown response element was received.");
}
}
开发者ID:rahulaga,项目名称:irahul.com,代码行数:33,代码来源:ResponseElement.cs
示例8: OnLoginResponse
private void OnLoginResponse(ResponseType responseType, JToken responseData, string callee) {
if (responseType == ResponseType.Success) {
authenticationToken = responseData.Value<string>("token");
if (OnLoggedIn != null) {
OnLoggedIn();
}
} else if (responseType == ResponseType.ClientError) {
if (OnLoginFailed != null) {
OnLoginFailed("Could not reach the server. Please try again later.");
}
} else {
JToken fieldToken = responseData["non_field_errors"];
if (fieldToken == null || !fieldToken.HasValues) {
if (OnLoginFailed != null) {
OnLoginFailed("Login failed: unknown error.");
}
} else {
string errors = "";
JToken[] fieldValidationErrors = fieldToken.Values().ToArray();
foreach (JToken validationError in fieldValidationErrors) {
errors += validationError.Value<string>();
}
if (OnLoginFailed != null) {
OnLoginFailed("Login failed: " + errors);
}
}
}
}
开发者ID:chrisdrogaris,项目名称:django-unity3d-example,代码行数:28,代码来源:ExampleBackend.cs
示例9: NetCommand
//RESPONSE
public NetCommand(ResponseType response, int session)
{
Type = CommandType.RESPONSE;
Session = session;
Timestamp = Helper.Now;
Response = response;
}
开发者ID:Aaldert,项目名称:IP2,代码行数:8,代码来源:NetCommand.cs
示例10: BuildAuthorizeUrl
/// <summary>
/// Constructs an authorize url.
/// </summary>
public static string BuildAuthorizeUrl(
string clientId,
string redirectUrl,
IEnumerable<string> scopes,
ResponseType responseType,
DisplayType display,
ThemeType theme,
string locale,
string state)
{
Debug.Assert(!string.IsNullOrEmpty(clientId));
Debug.Assert(!string.IsNullOrEmpty(redirectUrl));
Debug.Assert(!string.IsNullOrEmpty(locale));
IDictionary<string, string> options = new Dictionary<string, string>();
options[AuthConstants.ClientId] = clientId;
options[AuthConstants.Callback] = redirectUrl;
options[AuthConstants.Scope] = BuildScopeString(scopes);
options[AuthConstants.ResponseType] = responseType.ToString().ToLowerInvariant();
options[AuthConstants.Display] = display.ToString().ToLowerInvariant();
options[AuthConstants.Locale] = locale;
options[AuthConstants.ClientState] = EncodeAppRequestState(state);
if (theme != ThemeType.None)
{
options[AuthConstants.Theme] = theme.ToString().ToLowerInvariant();
}
return BuildAuthUrl(AuthEndpointsInfo.AuthorizePath, options);
}
开发者ID:d20021,项目名称:LiveSDK-for-Windows,代码行数:33,代码来源:LiveAuthUtility.cs
示例11: OnResponse
protected override void OnResponse (ResponseType response)
{
base.OnResponse (response);
if (CurrentFolderUri != null) {
LastFileChooserUri.Set (CurrentFolderUri);
}
}
开发者ID:allquixotic,项目名称:banshee-gst-sharp-work,代码行数:8,代码来源:FileChooserDialog.cs
示例12: OnResponse
protected override void OnResponse(ResponseType response)
{
if (response == ResponseType.Ok) {
int timervalue = sleepHour.ValueAsInt * 60 + sleepMin.ValueAsInt;
service.SleepTimerDuration = timervalue;
service.SetSleepTimer (timervalue);
}
}
开发者ID:nailyk,项目名称:banshee-community-extensions,代码行数:8,代码来源:SleepTimerConfigDialog.cs
示例13: AssessmentItem
/// <summary>
/// Constructor that accepts values for all mandatory fields
/// </summary>
///<param name="refId">A RefId</param>
///<param name="assessmentFormRefId">This RefId points to the assessment form of which the item is a part.</param>
///<param name="responseType">A value that indicates the response type for the item.</param>
///<param name="itemLabel">An item number or other identifier for the item. It may be used to indicate the order or grouping of items.</param>
///
public AssessmentItem( string refId, string assessmentFormRefId, ResponseType responseType, string itemLabel )
: base(Adk.SifVersion, AssessmentDTD.ASSESSMENTITEM)
{
this.RefId = refId;
this.AssessmentFormRefId = assessmentFormRefId;
this.SetResponseType( responseType );
this.ItemLabel = itemLabel;
}
开发者ID:pgodwin,项目名称:OpenADK-csharp,代码行数:16,代码来源:AssessmentItem.cs
示例14: OnResponse
protected override void OnResponse(ResponseType response)
{
base.OnResponse (response);
if (response == ResponseType.Help)
Help.DisplayUriOnScreen ("ghelp:questar/preferences",
base.Dialog.Screen);
}
开发者ID:manicolosi,项目名称:questar,代码行数:8,代码来源:PreferenceDialog.cs
示例15: BuildAuthenticateUri
protected Uri BuildAuthenticateUri(AuthenticationPermissions scope, ResponseType responseType)
{
var builder = new HttpUriBuilder(AuthenticationUrl);
builder.AddQueryStringParameter("client_id", this.ClientId);
builder.AddQueryStringParameter("response_type", responseType.ToString().ToLower());
builder.AddQueryStringParameter("scope", scope.GetParameterValue());
builder.AddQueryStringParameter("redirect_uri", RedirectUri);
return builder.Build();
}
开发者ID:Cologler,项目名称:Jasily.SDK.OneDrive,代码行数:9,代码来源:Authenticator.cs
示例16: ProcessResponse
/* Event members */
#pragma warning disable 169 //Disables warning about handlers not being used
protected override bool ProcessResponse (ResponseType response) {
if (response == ResponseType.Ok) {
if (dialog.Uri != null) {
chosenUri = new Uri(dialog.Uri);
}
SetReturnValue(true);
}
return false;
}
开发者ID:GNOME,项目名称:gnome-subtitles,代码行数:13,代码来源:VideoOpenDialog.cs
示例17: Broadcast
public void Broadcast(dynamic data, string[] clients, ResponseType type, long timestamp)
{
ClientMessage cb = new ClientMessage();
cb.clients = clients;
cb.Data = data;
cb.Type = type;
cb.TimeStamp = timestamp;
Send(Newtonsoft.Json.JsonConvert.SerializeObject(cb));
}
开发者ID:Mondego,项目名称:rcat-gs,代码行数:10,代码来源:RCATContext.cs
示例18: MessageBox
/// <summary>
/// Creates a new message box
/// </summary>
/// <param name="parentWindow">Window this box belongs to</param>
/// <param name="messageType">Type of box</param>
/// <param name="buttons">Buttons</param>
/// <param name="message">Value</param>
/// <param name="title">Title</param>
public MessageBox(Window parentWindow, MessageType messageType, ButtonsType buttons, string message, string title)
{
Message = new MessageDialog(parentWindow, DialogFlags.Modal, messageType, buttons, false, null);
Message.WindowPosition = WindowPosition.Center;
Message.Text = message;
Message.Icon = Gdk.Pixbuf.LoadFromResource("Client.Resources.pigeon_clip_art_hight.ico");
Message.Title = title;
result = (ResponseType)Message.Run();
Message.Destroy();
}
开发者ID:JGunning,项目名称:OpenAIM,代码行数:18,代码来源:MessageBox.cs
示例19: Response
private Response(long token, ResponseType responseType, JArray data, List<ResponseNote> responseNotes, Profile profile, Backtrace backtrace, ErrorType errorType)
{
this.Token = token;
this.Type = responseType;
this.Data = data;
this.Notes = responseNotes;
this.Profile = profile;
this.Backtrace = backtrace;
this.ErrorType = errorType;
}
开发者ID:fiLLLip,项目名称:RethinkDb.Driver,代码行数:10,代码来源:Response.cs
示例20: the_LRAP1Attachment_is_submitted_to_the_AgentGateway
public void the_LRAP1Attachment_is_submitted_to_the_AgentGateway(ResponseType responseType)
{
//Arrange
A.CallTo(() => _fakeCommsService.Send(_command)).Returns(responseType);
//Act
_sut.Process(_command);
//Assert
A.CallTo(() => _fakeCommsService.Send(A<SubmitLrap1AttachmentCommand>.Ignored)).MustHaveHappened(Repeated.Exactly.Once);
}
开发者ID:ClaireCummings,项目名称:LFMSubmissionsSpike,代码行数:11,代码来源:SubmissionServiceTests.cs
注:本文中的ResponseType类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论