Exemplo n.º 1
0
        // http://www.programminghelp.com/programming/dotnet/wcf-creating-and-implementing-a-service-in-c/
        static void Main(string[] args)
        {
            string address = "http://localhost:41433/WCFService1/FTR2LO_InternalService";
            System.ServiceModel.WSHttpBinding binding = new System.ServiceModel.WSHttpBinding();
            binding.Name = "WSHttpBinding_IFTR2LO"; // not sure if this is necessary.
            System.ServiceModel.EndpointAddress endpointAddress = new System.ServiceModel.EndpointAddress(address);
            FTR2LOClient client = new FTR2LOClient(binding, endpointAddress);

            //FTR2LOClient client = new FTR2LOClient();
            bool _isconnectedtoFTR2LO = false;
            Console.Write("Is connected to FTR2LO: ");
            try
            {
                _isconnectedtoFTR2LO = client.IsConnectedToFTR2LO();
            }
            catch (Exception)
            {
                //Console.WriteLine("Error");
            }
            Console.WriteLine(_isconnectedtoFTR2LO.ToString());

            if (_isconnectedtoFTR2LO)
            {
                Console.WriteLine("Is connected to FTR: " + client.IsConnectedToFTR());
                int status = client.IPingFTR();
                Console.WriteLine("IPingFTR: " + status.ToString());
                Console.WriteLine("IPingFTRToString: " + client.IPingFTRToString(status));
            }
            if (client.State == System.ServiceModel.CommunicationState.Opened)
                client.Close();
            Console.WriteLine();
            Console.WriteLine("Press the ENTER key to terminate client.");
            Console.ReadLine();
        }
Exemplo n.º 2
0
        // http://www.programminghelp.com/programming/dotnet/wcf-creating-and-implementing-a-service-in-c/
        static void Main(string[] args)
        {
            string address = "http://localhost:41433/WCFService1/FTR2LO_InternalService";

            System.ServiceModel.WSHttpBinding binding = new System.ServiceModel.WSHttpBinding();
            binding.Name = "WSHttpBinding_IFTR2LO"; // not sure if this is necessary.
            System.ServiceModel.EndpointAddress endpointAddress = new System.ServiceModel.EndpointAddress(address);
            FTR2LOClient client = new FTR2LOClient(binding, endpointAddress);

            //FTR2LOClient client = new FTR2LOClient();
            bool _isconnectedtoFTR2LO = false;

            Console.Write("Is connected to FTR2LO: ");
            try
            {
                _isconnectedtoFTR2LO = client.IsConnectedToFTR2LO();
            }
            catch (Exception)
            {
                //Console.WriteLine("Error");
            }
            Console.WriteLine(_isconnectedtoFTR2LO.ToString());

            if (_isconnectedtoFTR2LO)
            {
                Console.WriteLine("Is connected to FTR: " + client.IsConnectedToFTR());
                int status = client.IPingFTR();
                Console.WriteLine("IPingFTR: " + status.ToString());
                Console.WriteLine("IPingFTRToString: " + client.IPingFTRToString(status));
            }
            if (client.State == System.ServiceModel.CommunicationState.Opened)
            {
                client.Close();
            }
            Console.WriteLine();
            Console.WriteLine("Press the ENTER key to terminate client.");
            Console.ReadLine();
        }
Exemplo n.º 3
0
        private void update_service_status_area_Job()
        {
            Update_labelDebugInfo("GUI updatejob started: " + DateTime.Now.ToString());
            timer1.Stop();

            // Lights Out small icon
            string LOstatus = GetWindowsServiceStatus(TopLevelTabHelpers.LO_ServiceName);

            Update_label_actual_LOstatus(LOstatus);
            if (LOstatus == "Running")
            {
                Visible_loadingCircle_LO(false);
                Update_pictureBoxLO_Image(ATV2LO_TopLevelTab.Properties.Resources.Complete_OK__16x16_72);
            }
            else if (LOstatus == "Not installed.")
            {
                Visible_loadingCircle_LO(false);
                Update_pictureBoxLO_Image(ATV2LO_TopLevelTab.Properties.Resources.CriticalError_16x16_72);
            }
            else
            {
                Update_pictureBoxLO_Image(ATV2LO_TopLevelTab.Properties.Resources.Warning_16x16_72);
                Visible_loadingCircle_LO(false);
            }

            // FTR2LO and FTR icon plus large icon
            bool         _isconnectedtoFTR2LO = false;
            int          _status    = -3;
            string       _FTRStatus = "Unknown (1)";
            string       _address   = "http://localhost:41433/WCFService1/FTR2LO_InternalService";
            FTR2LOClient client     = null;

            System.ServiceModel.WSHttpBinding   binding         = null;
            System.ServiceModel.EndpointAddress endpointAddress = null;

            try
            {
                binding         = new System.ServiceModel.WSHttpBinding();
                binding.Name    = "WSHttpBinding_IFTR2LO"; // not sure if this is necessary.
                endpointAddress = new System.ServiceModel.EndpointAddress(_address);
                System.TimeSpan receiveTimeout = new System.TimeSpan();
                TimeSpan.TryParse("00:10:00", out receiveTimeout);
                binding.ReceiveTimeout = receiveTimeout;
                //FTR2LOClient client = null;
            }
            catch (Exception ex)
            {
                MessageBox.Show("A really crazy exception has occured:\n" + ex.ToString());
            }
            try
            {
                client = new FTR2LOClient(binding, endpointAddress);
                _isconnectedtoFTR2LO = client.IsConnectedToFTR2LO();
                _status    = client.IPingFTR();
                _FTRStatus = client.IPingFTRToString(_status);
            }
            catch (Exception)
            {
                //in this case, display error for FTR2LO and leave FTR loadingcircle
                Update_label_actual_server_status("Error: Not connected");
                Update_label_actual_FTRstatus("Unknown");
                Update_pictureBoxFTR2LO_Image(ATV2LO_TopLevelTab.Properties.Resources.CriticalError_16x16_72);
                Visible_loadingCircle_FTR2LO(false);
                Update_pictureBox1_Image(ATV2LO_TopLevelTab.Properties.Resources.CriticalError);
                Visible_loadingCircle1(false);
            }
            finally
            {
                if (client.State == System.ServiceModel.CommunicationState.Opened)
                {
                    client.Close();
                }
            }


            if (_isconnectedtoFTR2LO)
            {
                Visible_loadingCircle_FTR2LO(false);
                Update_label_actual_server_status("Connected");
                Update_pictureBoxFTR2LO_Image(ATV2LO_TopLevelTab.Properties.Resources.Complete_OK__16x16_72);

                // FTRL2LO icon and large icon
                Update_label_actual_FTRstatus(_FTRStatus);
                if (_status == 0)
                {
                    Visible_loadingCircle_FTR(false);
                    Update_pictureBoxFTR_Image(ATV2LO_TopLevelTab.Properties.Resources.Complete_OK__16x16_72);
                    Visible_loadingCircle1(false);
                    Update_pictureBox1_Image(ATV2LO_TopLevelTab.Properties.Resources.Complete_OK);
                }
                else
                {
                    Visible_loadingCircle_FTR(false);
                    Update_pictureBoxFTR_Image(ATV2LO_TopLevelTab.Properties.Resources.Warning_16x16_72);
                    Visible_loadingCircle1(false);
                    Update_pictureBox1_Image(ATV2LO_TopLevelTab.Properties.Resources.Warning);
                }
            }
            else
            {
                Update_label_actual_server_status("Not connected");
                Visible_loadingCircle1(false);
                Update_pictureBoxFTR_Image(ATV2LO_TopLevelTab.Properties.Resources.CriticalError_16x16_72);
                Update_label_actual_FTRstatus("Unknown");
            }
            timer1.Start();
            Update_labelDebugInfo("GUI update finished: " + DateTime.Now.ToString());
        }
Exemplo n.º 4
0
        private void update_service_status_area_Job()
        {
            Update_labelDebugInfo("GUI updatejob started: " + DateTime.Now.ToString());
            timer1.Stop();

            // Lights Out small icon
            string LOstatus = GetWindowsServiceStatus(TopLevelTabHelpers.LO_ServiceName);
            Update_label_actual_LOstatus(LOstatus);
            if (LOstatus == "Running")
            {
                Visible_loadingCircle_LO(false);
                Update_pictureBoxLO_Image(ATV2LO_TopLevelTab.Properties.Resources.Complete_OK__16x16_72);
            }
            else if (LOstatus == "Not installed.")
            {
                Visible_loadingCircle_LO(false);
                Update_pictureBoxLO_Image(ATV2LO_TopLevelTab.Properties.Resources.CriticalError_16x16_72);
            }
            else
            {
                Update_pictureBoxLO_Image(ATV2LO_TopLevelTab.Properties.Resources.Warning_16x16_72);
                Visible_loadingCircle_LO(false);
            }

            // FTR2LO and FTR icon plus large icon
            bool _isconnectedtoFTR2LO = false;
            int _status = -3;
            string _FTRStatus = "Unknown (1)";
            string _address = "http://localhost:41433/WCFService1/FTR2LO_InternalService";
            FTR2LOClient client = null;
            System.ServiceModel.WSHttpBinding binding = null;
            System.ServiceModel.EndpointAddress endpointAddress = null;

            try
            {
                binding = new System.ServiceModel.WSHttpBinding();
                binding.Name = "WSHttpBinding_IFTR2LO"; // not sure if this is necessary.
                endpointAddress = new System.ServiceModel.EndpointAddress(_address);
                System.TimeSpan receiveTimeout = new System.TimeSpan();
                TimeSpan.TryParse("00:10:00", out receiveTimeout);
                binding.ReceiveTimeout = receiveTimeout;
                //FTR2LOClient client = null;
            }
            catch (Exception ex)
            {
                MessageBox.Show("A really crazy exception has occured:\n" + ex.ToString());
            }
            try
            {
                client = new FTR2LOClient(binding, endpointAddress);
                _isconnectedtoFTR2LO = client.IsConnectedToFTR2LO();
                _status = client.IPingFTR();
                _FTRStatus = client.IPingFTRToString(_status);
            }
            catch (Exception)
            {
                //in this case, display error for FTR2LO and leave FTR loadingcircle
                Update_label_actual_server_status("Error: Not connected");
                Update_label_actual_FTRstatus("Unknown");
                Update_pictureBoxFTR2LO_Image(ATV2LO_TopLevelTab.Properties.Resources.CriticalError_16x16_72);
                Visible_loadingCircle_FTR2LO(false);
                Update_pictureBox1_Image(ATV2LO_TopLevelTab.Properties.Resources.CriticalError);
                Visible_loadingCircle1(false);
            }
            finally
            {
                if (client.State == System.ServiceModel.CommunicationState.Opened)
                    client.Close();
            }

            if (_isconnectedtoFTR2LO)
            {
                Visible_loadingCircle_FTR2LO(false);
                Update_label_actual_server_status("Connected");
                Update_pictureBoxFTR2LO_Image(ATV2LO_TopLevelTab.Properties.Resources.Complete_OK__16x16_72);

                // FTRL2LO icon and large icon
                Update_label_actual_FTRstatus(_FTRStatus);
                if (_status == 0)
                {
                    Visible_loadingCircle_FTR(false);
                    Update_pictureBoxFTR_Image(ATV2LO_TopLevelTab.Properties.Resources.Complete_OK__16x16_72);
                    Visible_loadingCircle1(false);
                    Update_pictureBox1_Image(ATV2LO_TopLevelTab.Properties.Resources.Complete_OK);
                }
                else
                {
                    Visible_loadingCircle_FTR(false);
                    Update_pictureBoxFTR_Image(ATV2LO_TopLevelTab.Properties.Resources.Warning_16x16_72);
                    Visible_loadingCircle1(false);
                    Update_pictureBox1_Image(ATV2LO_TopLevelTab.Properties.Resources.Warning);
                }
            }
            else
            {
                Update_label_actual_server_status("Not connected");
                Visible_loadingCircle1(false);
                Update_pictureBoxFTR_Image(ATV2LO_TopLevelTab.Properties.Resources.CriticalError_16x16_72);
                Update_label_actual_FTRstatus("Unknown");
            }
            timer1.Start();
            Update_labelDebugInfo("GUI update finished: " + DateTime.Now.ToString());
        }