本文整理汇总了C#中API类的典型用法代码示例。如果您正苦于以下问题:C# API类的具体用法?C# API怎么用?C# API使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
API类属于命名空间,在下文中一共展示了API类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: User
public User(StateManager stateMgr, API.Geo.World world)
{
this.mStateMgr = stateMgr;
this.mWorld = world;
this.mTimeSinceGUIOpen = new Timer();
this.mCameraMan = null;
this.IsAllowedToMoveCam = true;
this.IsFreeCamMode = true;
Camera cam = this.mStateMgr.Camera;
cam.Position = new Vector3(-203, 633, -183);
cam.Orientation = new Quaternion(0.3977548f, -0.1096644f, -0.8781486f, -0.2421133f);
this.mCameraMan = new CameraMan(cam);
this.mSelectedAllies = new HashSet<VanillaNonPlayer>();
this.mRandom = new Random();
this.mFigures = new MOIS.KeyCode[10];
for (int i = 0; i < 9; i++)
this.mFigures[i] = (MOIS.KeyCode)System.Enum.Parse(typeof(MOIS.KeyCode), "KC_" + (i + 1));
this.mFigures[9] = MOIS.KeyCode.KC_0;
this.mWireCube = this.mStateMgr.SceneMgr.RootSceneNode.CreateChildSceneNode();
this.mWireCube.AttachObject(StaticRectangle.CreateRectangle(this.mStateMgr.SceneMgr, Vector3.UNIT_SCALE * Cst.CUBE_SIDE));
this.mWireCube.SetVisible(false);
this.Inventory = new Inventory(10, 4, new int[] { 3, 0, 1, 2 }, true);
}
示例2: GitHubRequest
public GitHubRequest(string resource,
API version,
Method method,
params Parameter[] parameters)
: this(resource, version, method, /*body:*/null, parameters)
{
}
示例3: Update
internal void Update(API.Invite model)
{
if (model.Channel != null)
ChannelId = model.Channel.Id;
if (model.Inviter != null)
InviterId = model.Inviter.Id;
}
示例4: RunProcessor
private void RunProcessor(API.Request request, Processor processor, string processorName)
{
API.Response response = null;
try
{
// Threadpooling
response = processor.process(request);
}
catch (Exception e)
{
Logger.Error("Failed to process message with processor " + processor.GetType() + " : " + e.Message, e);
try
{
Type responseType = Type.GetType("Gwupe.Cloud.Messaging.Response." + processorName + "Rs");
response = (API.Response) responseType.GetConstructor(Type.EmptyTypes).Invoke(new object[] {});
response.error = "UNKNOWN_ERROR";
response.errorMessage = e.Message;
}
catch (Exception exception)
{
Logger.Error("Failed to determine return type for " + processorName);
response = new ErrorRs
{
errorMessage = "Failed to determine return type for " + processorName,
error = "INTERNAL_SERVER_ERROR"
};
}
}
finally
{
SendResponse(response, request);
}
}
示例5: A2iAOcrProcessingService
public A2iAOcrProcessingService(API a2iaEngine, string parameterPath, string tableFilename, LoadMethod loadMethod)
{
_a2iaEngine = a2iaEngine;
_parameterDirectory = parameterPath;
_documentTableFilename = tableFilename;
_loadMethod = loadMethod;
}
示例6: balanceButton_Click
private void balanceButton_Click(object sender, EventArgs e)
{
try
{
API api = new API(key.Text);
Clockwork.Balance result = api.GetBalance();
balance.Text = result.CurrencySymbol + result.Amount.ToString("#,0.00");
}
catch (APIException ex)
{
// You'll get an API exception for errors
// such as wrong key
MessageBox.Show("API Exception: " + ex.Message);
}
catch (WebException ex)
{
// Web exceptions mean you couldn't reach the mediaburst server
MessageBox.Show("Web Exception: " + ex.Message);
}
catch (ArgumentException ex)
{
// Argument exceptions are thrown for missing parameters,
// such as forgetting to set the username
MessageBox.Show("Argument Exception: " + ex.Message);
}
catch (Exception ex)
{
// Something else went wrong, the error message should help
MessageBox.Show("Unknown Exception: " + ex.Message);
}
}
示例7: Execute
public void Execute(API.CommandManager manager, IRemoteCommandArguments arguments)
{
var args = (ExpectValueArguments)arguments;
Guard.ArgumentNotNullForCommand<ExpectValue>(args.Value, args.ValueExpression);
Guard.ArgumentNotNullForCommand<ExpectValue>(args.Selector);
API.ExpectCommands.Value valueExpect = null;
if (args.Value != null)
{
valueExpect = manager.Expect.Value(args.Value);
}
else
{
valueExpect = manager.Expect.Value(args.ValueExpression);
}
if (args.MatchConditions.HasValue)
{
valueExpect.In(args.Selector, args.MatchConditions.Value);
}
else
{
valueExpect.In(args.Selector);
}
}
示例8: ListImportedKits
public static Func<List<ImportedKit>> ListImportedKits(API.V1 api)
{
return delegate() {
string root = FileUtils.Root + FileUtils.NormalizePathForPlatform ("/Fabric/Kits/");
List<ImportedKit> kits = new List<ImportedKit> ();
if (!Directory.Exists (root)) {
return kits;
}
foreach (string kit in Directory.GetDirectories (root)) {
string unqualified = kit.Substring (kit.LastIndexOf (Path.DirectorySeparatorChar) + 1);
string qualified = String.Format ("Fabric.Internal.{0}.Editor.Controller.Controller", unqualified);
Type type = Type.GetType (qualified);
// Those kits without a controller will not be displayed in the KitSelector
// as they do not have a GUI component to them.
if (type == null) {
continue;
}
object instance = Activator.CreateInstance (type, api);
kits.Add (new ImportedKit (unqualified, instance));
}
return kits;
};
}
示例9: SaveSettings
public static void SaveSettings(API.Settings.Settings s)
{
using (var sr = new StreamWriter("settings.config"))
{
sr.Write(Utilities.Serialize(s));
}
}
示例10: Autenticar
private async void Autenticar()
{
API api = new API();
string resposta;
// ObservableCollection<Users> x =await api.GetAllUser();
resposta = api.GetAsync(User, Senha);
if (resposta == "Logado")
{
await _dialogservice.DisplayAlertAsync("Sucess", "Loading...", "ok,");
await _navigationService.NavigateAsync("InicialPage");
}
else
{
await _dialogservice.DisplayAlertAsync("Erro", "Senha e/ou Usuario incorreto", "ok,");
}
}
示例11: FacebookService
/// <summary>
///
/// </summary>
/// <param name="container"></param>
public FacebookService(IContainer container)
{
if (container != null) container.Add(this);
api = new API();
InitializeComponent();
}
示例12: PostData
public void PostData(StringContent content, API api)
{
var client = PrepareHttpClient();
using (client)
{
string apiStr = Enum.GetName(typeof(API), api);
var request = client.PostAsync("api/"+apiStr, content).Result;
var result = request.Content.ReadAsStringAsync().Result;
// result = "{\"StatusCode\":201,\"StatusDescription\":\"New call was created with id : 5631004a4ca8e9290cddd46b\"}" on success
Dictionary<string, string> jsonDictionary = JsonConvert.DeserializeObject<Dictionary<string, string>>(result);
var statusCode = jsonDictionary["StatusCode"];
var statusDesc = jsonDictionary["StatusDescription"];
var seperator = statusDesc.IndexOf(":");
var callId = statusDesc.Substring(seperator+1).Trim();
MongoCallId = callId;
// If result is not as below, throw exception
if (!statusCode.Contains("201"))
{
throw new Exception("Error sending call: Response result code not 201!");
}
}
}
示例13: SendJson
protected void SendJson(API.ReturnObject o)
{
Response.ContentType = "application/json";
Response.StatusCode = 200;
Response.Write(Newtonsoft.Json.JsonConvert.SerializeObject(o));
Response.End();
}
示例14: EditAPI
public EditAPI(Project project, API api)
{
InitializeComponent();
_project = project;
_api = api;
}
示例15: TestParameters_WaitAllAny
public TestParameters_WaitAllAny(API api, int waitTime, WaitBy waitBy, TaskInfo[] allTasks)
{
Api = api;
WaitBy = waitBy;
WaitTime = waitTime;
AllTaskInfos = allTasks;
}