private static void Main(string[] args) { // Console.WriteLine("Hi, I am source!"); // WorkPerformedHandler del1 = new WorkPerformedHandler(FunctionForDelegate1); // WorkPerformedHandler del2 = new WorkPerformedHandler(FunctionForDelegate2); // WorkPerformedHandler del3 = new WorkPerformedHandler(FunctionForDelegate3); // del1 = del1 + del2 + del3; // del1(1, WorkType.Engineer); //Proces ProcessData pro = new ProcessData(); Action <int, int> action = (x, y) => Console.WriteLine(x + y); Func <int, int, int> actionFunc = (x, y) => x + y; pro.processFunc(2, 4, actionFunc); BizData del = (x, y) => x + y; pro.process(2, 4, del); Worker worker = new Worker(); worker.WorkPerformed += (s, e) => Console.WriteLine("Work performed for " + e.Hours + " hours by " + e.WorkType); worker.WorkCompleted += (s, e) => Console.WriteLine("Work Completed"); worker.DoWork(8, WorkType.Engineer); Console.ReadLine(); }
public static void Test() { // create your profile DefaultProfile profile = new DefaultProfile("cn-shanghai", "<your access key id>", "<your access key secret>"); AliYunClient client = new AliYunClient(profile); ClientInfo clientInfo = new ClientInfo(); clientInfo.ip = "127.0.0.1"; // image scan task Task imageTask = new ImageTask("https://xxx.png"); imageTask.dataId = Guid.NewGuid().ToString(); BizData imageBizData = new BizData("Image", new String[] { "p**n" }, new Task[] { imageTask }); string algoPath = "/green/image/scan"; Request req = new Request(imageBizData, algoPath); req.addQueryParameter("clientInfo", JSON.stringify(clientInfo)); string response = client.getResponse(req); // your biz code Console.WriteLine(response); Console.ReadKey(); }
public static void Main() { // create your profile DefaultProfile profile = new DefaultProfile("cn-shanghai", "<your access key id>", "<your access key secret>"); AliYunClient client = new AliYunClient(profile); ClientInfo clientInfo = new ClientInfo(); clientInfo.ip = "127.0.0.1"; // text scan task string content = "测试"; Task textTask = new TextTask(content); textTask.dataId = Guid.NewGuid().ToString(); textTask.time = DateTime.Now.Millisecond; BizData textBizData = new BizData("Text", new String[] { "antispam" }, new Task[] { textTask }); string algoPath = "/green/text/scan"; Request req = new Request(textBizData, algoPath); req.addQueryParameter("clientInfo", JSON.stringify(clientInfo)); string response = client.getResponse(req); // your biz code Console.WriteLine(response); Console.ReadKey(); }
public void AddDataItem(string dataName, BizData data) { if (HasData(dataName) == false) { _datas[dataName] = new List <BizData>(); } _datas[dataName].Add(data); }
public Request(BizData bizData, string path) { this.httpMethod = "POST"; this.protocol = "http"; this.domain = "green.cn-shanghai.aliyuncs.com"; this.version = "2017-01-12"; this.signatureMethod = "HMAC-SHA1"; this.signatureVersion = "1.0"; this.queryMap = new Dictionary <string, string>(); this.bizData = bizData; this.path = path; }
public void process(int x, int y, BizData del) { var result = del(x, y); Console.WriteLine("Result: " + result); }