Esempio n. 1
0
        private WcfServicesProxy()
        {
            ServiceCallConfig = ServiceCallConfigType.UpdateServicesNoSend;

            //endpointIpAddressPart1 = "http://192.168.1.129";      //Dev environment
            //ServerType = "**Using developer server**";

            endpointIpAddressPart1 = "http://192.168.1.21";   //Live server
            ServerType             = "**Using Satchel's Server**";
            // endpointIpAddressPart1 = "http://192.168.1.122";   //Backup server
            //endpointIpAddressPart1 = "http://192.168.1";      //BAD

            if (Users.Instance.LoggedInUser != null)
            {
                UserIdDecimal = Users.Instance.LoggedInUser.UserId;
            }

            if (ServiceCallConfig != ServiceCallConfigType.AllServiceCallsOff)
            {
                try
                {
                    CreateWaiterClient();
                    CreateCheckClient();
                }

                catch (Exception ex)
                {
                    ServiceCallConfig       = ServiceCallConfigType.AllServiceCallsOff;
                    ServerConnectionProblem = true;
                }
            }
        }
Esempio n. 2
0
        private void CreateWaiterClient()
        {
            waiterClient = DependencyService.Get <IWaiterClient>().GetWaiterClient(endpointIpAddressPart1 + waiterIpAddressPart2, new TimeSpan(0, 0, 10));

            int pingResult = 0;

            try
            {
                pingResult = waiterClient.Ping(0);
            }

            catch (Exception ex)
            {
                ServiceCallConfig       = ServiceCallConfigType.AllServiceCallsOff;
                ServerConnectionProblem = true;
            }

            if (pingResult == 10)
            {
                waiterClient = DependencyService.Get <IWaiterClient>().GetWaiterClient(endpointIpAddressPart1 + waiterIpAddressPart2, new TimeSpan(0, 10, 0));
            }

            //waiterClient = new PosServiceClient(
            //             new BasicHttpBinding(),
            //             new EndpointAddress(endpointIpAddressPart1 + waiterIpAddressPart2));
            //waiterClient.Endpoint.Binding.SendTimeout = new TimeSpan(0, 10, 0);
        }