예제 #1
0
        private void LoadTrackStatusObject()
        {
            this.axTetTrackStatus = new AxTetComp.AxTetTrackStatus();

            this.axTetTrackStatus.Enabled  = true;
            this.axTetTrackStatus.Name     = "axTetTrackStatus";
            this.axTetTrackStatus.OcxState = ((System.Windows.Forms.AxHost.State)(Resources.FindName("axTetTrackStatus.OcxState")));

            //used to host System.Windows.Forms control in WPF
            System.Windows.Forms.Integration.WindowsFormsHost host = new System.Windows.Forms.Integration.WindowsFormsHost();
            host.Child  = axTetTrackStatus; //add the trackstatus window to the host
            host.Width  = 120;              //Size of the host controls the size of the control
            host.Height = 70;
            Canvas.SetBottom(host, 5);      //position the host on Canvas_TrackStatus
            Canvas.SetRight(host, 10);
            //this.Canvas_TrackStatus.Children.Add(host); // add the host to the track status canvas
            _hitCanvas.Children.Add(host);

            // Retreive underlying references to ActiveX controls
            tetTrackStatus = (ITetTrackStatus)axTetTrackStatus.GetOcx();

            //*** try to contect to the server

            try
            {
                // Connect to the TET server if necessary
                if (!tetTrackStatus.IsConnected)
                {
                    tetTrackStatus.Connect("193.167.42.30", (int)TetConstants.TetConstants_DefaultServerPort);
                }

                // Start the track status meter
                if (!tetTrackStatus.IsTracking)
                {
                    tetTrackStatus.Start();
                }

                //Connect to the TET Client if necessary
                if (!tetClient.IsConnected)
                {
                    tetClient.Connect("193.167.42.30", (int)TetConstants.TetConstants_DefaultServerPort, TetSynchronizationMode.TetSynchronizationMode_Server);
                }
                tetClient.StartTracking(); //Start tracking
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString(), "Error", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
예제 #2
0
        private void trackStatusStartButton_Click(object sender, System.EventArgs e)
        {
            try
            {
                // Connect to the TET server if necessary
                if (!tetTrackStatus.IsConnected)
                {
                    tetTrackStatus.Connect(GetConnectionString(), (int)TetConstants.TetConstants_DefaultServerPort);
                }

                // Start the track status meter
                if (!tetTrackStatus.IsTracking)
                {
                    tetTrackStatus.Start();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        private void LoadTrackStatusObject()
        {
            this.axTetTrackStatus = new AxTetComp.AxTetTrackStatus();

             this.axTetTrackStatus.Enabled = true;
             this.axTetTrackStatus.Name = "axTetTrackStatus";
             this.axTetTrackStatus.OcxState = ((System.Windows.Forms.AxHost.State)(Resources.FindName("axTetTrackStatus.OcxState")));

             //used to host System.Windows.Forms control in WPF
             System.Windows.Forms.Integration.WindowsFormsHost host = new System.Windows.Forms.Integration.WindowsFormsHost();
             host.Child = axTetTrackStatus; //add the trackstatus window to the host
             host.Width = 120;       //Size of the host controls the size of the control
             host.Height = 70;
             Canvas.SetBottom(host, 5);      //position the host on Canvas_TrackStatus
             Canvas.SetRight(host, 10);
             //this.Canvas_TrackStatus.Children.Add(host); // add the host to the track status canvas
             _hitCanvas.Children.Add(host);

             // Retreive underlying references to ActiveX controls
             tetTrackStatus = (ITetTrackStatus)axTetTrackStatus.GetOcx();

             //*** try to contect to the server

             try
             {
                 // Connect to the TET server if necessary
                 if (!tetTrackStatus.IsConnected) tetTrackStatus.Connect("193.167.42.30", (int)TetConstants.TetConstants_DefaultServerPort);

                 // Start the track status meter
                 if (!tetTrackStatus.IsTracking) tetTrackStatus.Start();

                 //Connect to the TET Client if necessary
                 if (!tetClient.IsConnected)
                 {
                     tetClient.Connect("193.167.42.30", (int)TetConstants.TetConstants_DefaultServerPort, TetSynchronizationMode.TetSynchronizationMode_Server);
                 }
                 tetClient.StartTracking();//Start tracking
             }
             catch (Exception ex)
             {

                 MessageBox.Show(ex.ToString(), "Error", MessageBoxButton.OK, MessageBoxImage.Error);
             }
        }