void OnCalculate(object sender, EventArgs e) { try { int m = Int32.Parse(input.Text); string res = lib.RequestToBinaryConverter(addr.Text, m); output.Text = $"Binary of {m} is: {res}"; } catch (FormatException err) { Console.WriteLine(err.Message); } }
public static void Main(string[] args) { try { BinaryConverterLib.BinaryConverterLib lib = new BinaryConverterLib.BinaryConverterLib(); string addr = "localhost:8042"; Console.Write("Enter a number: "); string n = Console.ReadLine(); int m = Int32.Parse(n); string res = lib.RequestToBinaryConverter(addr, m); Console.WriteLine($"Binary of {m} is: {res}"); Console.ReadKey(); } catch (FormatException err) { Console.WriteLine(err.Message); } }
static void Main(string[] args) { try { BinaryConverterLib.BinaryConverterLib lib = new BinaryConverterLib.BinaryConverterLib(); string myIP = lib.getMyIP(); Console.WriteLine("Your IP Address is :" + myIP); Console.Write("Enter a number: "); string n = Console.ReadLine(); int m = Int32.Parse(n); string res = lib.RequestToBinaryConverter(myIP, m); Console.WriteLine($"Binary of {m} is: {res}"); Console.ReadKey(); } catch (FormatException err) { Console.WriteLine(err.Message); } }