/// <summary> /// Creates the client. Establishes a binding to the web service /// at the IP given at this.IP /// </summary> /// <returns>A handle to the client.</returns> private KanjiServiceClient CreateClient() { SMC.Binding binding = KanjiServiceClient.CreateDefaultBinding(); string remoteAddress = KanjiServiceClient.EndpointAddress.Uri.ToString(); remoteAddress = remoteAddress.Replace("localhost", IP); EndpointAddress endpoint = new EndpointAddress(remoteAddress); try { return(new KanjiServiceClient(binding, endpoint)); } catch (Exception ex) { System.Windows.Forms.MessageBox.Show(string.Format("File output.config path? probably not in the bin folder. Ex.msg: {0}", ex.Message)); return(null); } }
/// <summary> /// Sends the point list to the web service. /// </summary> /// <param name="sender">The sender.</param> /// <param name="activePoints">The active points.</param> /// <param name="activeTimes">The active times.</param> /// <returns> /// True if the transmission of the message to web service was successful, false otherwise. /// </returns> public bool SendPointList(object sender, List<System.Windows.Forms.MouseEventArgs> activePoints, List<DateTime> activeTimes) { try { if (_client == null) _client = CreateClient(); //legacy Thread t = new Thread(SendPointListThreadWorker); //legacy ThreadParameter threadParam = new ThreadParameter() { ActivePoints = activePoints, ActiveTimes = activeTimes }; //legacy t.Start(threadParam); //legacy //debug SendPointListThreadWorker(threadParam); //ThreadStart tStart = delegate { SendPointListThreadWorker(activePoints, activeTimes); }; //Thread t2 = new Thread(tStart); //t2.Start(); // return true; return SendPointListThreadWorker(activePoints, activeTimes); } catch { return false; } }
/// <summary> /// Sends the point list to the web service. /// </summary> /// <param name="sender">The sender.</param> /// <param name="activePoints">The active points.</param> /// <param name="activeTimes">The active times.</param> /// <returns> /// True if the transmission of the message to web service was successful, false otherwise. /// </returns> public bool SendPointList(object sender, List <System.Windows.Forms.MouseEventArgs> activePoints, List <DateTime> activeTimes) { try { if (_client == null) { _client = CreateClient(); } //legacy Thread t = new Thread(SendPointListThreadWorker); //legacy ThreadParameter threadParam = new ThreadParameter() { ActivePoints = activePoints, ActiveTimes = activeTimes }; //legacy t.Start(threadParam); //legacy //debug SendPointListThreadWorker(threadParam); //ThreadStart tStart = delegate { SendPointListThreadWorker(activePoints, activeTimes); }; //Thread t2 = new Thread(tStart); //t2.Start(); // return true; return(SendPointListThreadWorker(activePoints, activeTimes)); } catch { return(false); } }
/// <summary> /// Initializes a new instance of the <see cref="MobileClientCommunication"/> class. /// </summary> /// <param name="view">The view.</param> /// <param name="ipaddress">The ipaddress.</param> public ClientCommunication(IControlled view, string ipaddress) { View = view; IP = ipaddress; _client = CreateClient(); }
/// <summary> /// Initializes a new instance of the <see cref="ClientCommunication"/> class. /// </summary> /// <param name="view">The view.</param> /// <param name="ipaddress">The ipaddress.</param> public ClientCommunication(IMobileView view, string ipaddress) { _view = view; IP = ipaddress; _client = CreateClient(); }