using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using QuickTerm; namespace Demo_Client { class Program { static void Main(string[] args) { TestTermRequestFeedback(); } private static void TestTermRequestFeedback() { var service = QuickTerm.ProxyBuilder.CreateProxy(); var host = (ProxyBase)service; host.ExceptionThrown += host_ExceptionThrown; using (host) { string baseAddress = "http://localhost:8020/QTService"; var serverIdentity = ProxyBase.GetServerIdentity(baseAddress, true); //query the server identifiers, can be cached var ver = host.GetAPIVersion(baseAddress, serverIdentity); //single-sign-on //var availableClients = host.PreAuthenticateSSO(baseAddress, serverIdentity); //get the available clients for the current user var availableClients = host.PreauthenticateUserPass(baseAddress, "terminologist", "t", serverIdentity); //get the available clients for the current user host.LoginAnyWhere("QTServiceWindows", baseAddress, availableClients[0].Key, "terminologist", "t", serverIdentity); //login to the first available client with SSO //query available termbases var u = service.GetUserInfo(); //get details about the current user var tbs = service.GetUserTermbases(); var tb = tbs.FirstOrDefault(t => t.Name == "demo"); //log a new term request service.LogTermRequest(new TermRequest(Guid.NewGuid(), "source expression", null, //the content is in MT xml format "source expression", tb.Id, tb.Languages.First(l => l.Lang == "EN"), null, DateTime.Now, null), "Some message", null); service.LogFeedback(new Feedback() { TermbaseId = tb.Id, EntryId = new EntryId(2), Keyword = "A term of the entry", Text = "Some feedback message" }, tb.Languages.First(l => l.Lang == "EN")); service.NotifyClientClosing(); } } static void host_ExceptionThrown(string methodName, Exception ex) { Console.WriteLine(ex); } } }