public static void Main (string[] args) { Console.WriteLine ("Welcome to WolframAPI console."); Console.WriteLine ("This is a test console for the API, please type in an operation to receive results."); Console.WriteLine ("[DEBUG]: Using Wolfram AppID: {0}{1}", WolframAppId, Environment.NewLine); string operation = string.Empty; var client = new WAClient (WolframAppId); while (!operation.Equals("stop", StringComparison.InvariantCultureIgnoreCase)) { Console.Write ("> "); operation = Console.ReadLine (); if (operation.Equals ("stop", StringComparison.InvariantCulture)) break; Console.WriteLine ("Answer: {0}", client.Solve (operation)); } }
private void Button1Click(object sender, RoutedEventArgs e) { var client = new WAClient("557QYQ-UUUWTKX95V"); var expr = textBox1.Text; //var solution = client.Solve(textBox1.Text); //MessageBox.Show(solution); client.OnSolutionReceived += (solution, expression) => { MessageBox.Show(solution); Dispatcher.BeginInvoke(DispatcherPriority.Send, new Action(() => textBox1.Text = expression)); }; client.SolveAsync(expr); textBox1.Text = string.Format("Solving: {0}", expr); }
public static void Main(string[] args) { Console.WriteLine("Welcome to WolframAPI console."); Console.WriteLine("This is a test console for the API, please type in an operation to receive results."); Console.WriteLine("[DEBUG]: Using Wolfram AppID: {0}{1}", WolframAppId, Environment.NewLine); string operation = string.Empty; var client = new WAClient(WolframAppId); while (!operation.Equals("stop", StringComparison.InvariantCultureIgnoreCase)) { Console.Write("> "); operation = Console.ReadLine(); if (operation.Equals("stop", StringComparison.InvariantCulture)) { break; } Console.WriteLine("Answer: {0}", client.Solve(operation)); } }
public string GetUsefulWords(string question) { try { var client = new WAClient(LicenseKey); var solution = client.Submit(question); if (question != null) { var document = XElement.Parse(solution); var result = document.Descendants("pod").FirstOrDefault(p => p.Attribute("title").Value == "Result"); var value = result != null?result.Descendants("plaintext").FirstOrDefault() : null; return(value != null ? value.Value : null); } return(solution); } catch (Exception ex) { throw new WolframAlphaException(ex); } }