当前位置: 首页>>代码示例>>C#>>正文


C# API类代码示例

本文整理汇总了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);
        }
开发者ID:RenaudWasTaken,项目名称:SkyLands,代码行数:27,代码来源:User.cs

示例2: GitHubRequest

 public GitHubRequest(string resource,
                      API version,
                      Method method,
                      params Parameter[] parameters)
     : this(resource, version, method, /*body:*/null, parameters)
 {
 }
开发者ID:mps,项目名称:OctoNet,代码行数:7,代码来源:GitHubRequest.cs

示例3: Update

		internal void Update(API.Invite model)
		{
			if (model.Channel != null)
				ChannelId = model.Channel.Id;
			if (model.Inviter != null)
				InviterId = model.Inviter.Id;
		}
开发者ID:cillas,项目名称:Discord.Net,代码行数:7,代码来源:Invite.cs

示例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);
     }
 }
开发者ID:gwupe,项目名称:Gwupe,代码行数:33,代码来源:WebSocketServer.cs

示例5: A2iAOcrProcessingService

 public A2iAOcrProcessingService(API a2iaEngine, string parameterPath, string tableFilename, LoadMethod loadMethod)
 {
     _a2iaEngine = a2iaEngine;
     _parameterDirectory = parameterPath;
     _documentTableFilename = tableFilename;
     _loadMethod = loadMethod;
 }
开发者ID:jhonner72,项目名称:plat,代码行数:7,代码来源:A2iAOcrProcessingService.cs

示例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);
            }
        }
开发者ID:techip,项目名称:clockwork-dotnet,代码行数:33,代码来源:Form1.cs

示例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);
            }
        }
开发者ID:Genyus,项目名称:FluentAutomation,代码行数:26,代码来源:ExpectValue.cs

示例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;
            };
        }
开发者ID:Barnaff,项目名称:Chromania,代码行数:30,代码来源:KitUtils.cs

示例9: SaveSettings

 public static void SaveSettings(API.Settings.Settings s)
 {
     using (var sr = new StreamWriter("settings.config"))
     {
         sr.Write(Utilities.Serialize(s));
     }
 }
开发者ID:johnnyblissdev,项目名称:AntViewer,代码行数:7,代码来源:SettingsService.cs

示例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,");

            }

        

        }
开发者ID:bruno-wladimir,项目名称:Faculdade,代码行数:27,代码来源:MainPageViewModel.cs

示例11: FacebookService

        /// <summary>
        /// 
        /// </summary>
        /// <param name="container"></param>
        public FacebookService(IContainer container)
        {
            if (container != null) container.Add(this);

            api = new API();
            InitializeComponent();
        }
开发者ID:taoxiease,项目名称:asegrp,代码行数:11,代码来源:FacebookService.cs

示例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!");
                }

            }
        }
开发者ID:dsb92,项目名称:patientcare,代码行数:31,代码来源:HttpHandler.cs

示例13: SendJson

 protected void SendJson(API.ReturnObject o)
 {
     Response.ContentType = "application/json";
     Response.StatusCode = 200;
     Response.Write(Newtonsoft.Json.JsonConvert.SerializeObject(o));
     Response.End();
 }
开发者ID:REMSLogic,项目名称:REMSLogic,代码行数:7,代码来源:BasePage.cs

示例14: EditAPI

        public EditAPI(Project project, API api)
        {
            InitializeComponent();

            _project = project;
            _api = api;
        }
开发者ID:QuantumConcepts,项目名称:CodeGenerator,代码行数:7,代码来源:EditAPI.cs

示例15: TestParameters_WaitAllAny

 public TestParameters_WaitAllAny(API api, int waitTime, WaitBy waitBy, TaskInfo[] allTasks)
 {
     Api = api;
     WaitBy = waitBy;
     WaitTime = waitTime;
     AllTaskInfos = allTasks;
 }
开发者ID:ESgarbi,项目名称:corefx,代码行数:7,代码来源:TaskWaitAllAnyTest.cs


注:本文中的API类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。