Beispiel #1
0
        private void InitializeApi()
        {
            Okuma.Scout.Enums.ApiStatus status = Okuma.Scout.ThincApiReflector.InitAPI();
            THINC_API_Instantiated = status.ToString();

            if (status == Okuma.Scout.Enums.ApiStatus.Initialized)
            {
                ApiFunctionsCanExecute = true;
                // Allow Initialize to be called any time, repeatedly.
                //InitializeApiCanExecute = false;
            }
        }
Beispiel #2
0
        // Methods

        private void ExecuteThincApiTests()
        {
            // THINC API Install Info
            THINC_API_SpecCodeValid = Okuma.Scout.SpecCode.ThincApiSpec;
            THINC_API_Installed     = Okuma.Scout.ThincApi.Installed;
            THINC_API_InstallType   = Okuma.Scout.ThincApi.InstallType;

            if (Okuma.Scout.ThincApi.InstallVersion.Result == Okuma.Scout.Enums.ApiVersionCheckResult.VersionRecognized)
            {
                THINC_API_Version = Okuma.Scout.ThincApi.InstallVersion.ApiVersion.ToString();
            }
            else
            {
                THINC_API_Version = Okuma.Scout.ThincApi.InstallVersion.Result.ToString();
            }

            // THINC API Installed Libraries
            LatheCommandApi           = Okuma.Scout.ThincApi.GACExist_CommandApi_Lathe;
            LatheDataApi              = Okuma.Scout.ThincApi.GACExist_DataApi_Lathe;
            MachiningCenterCommandApi = Okuma.Scout.ThincApi.GACExist_CommandApi_MachiningCenter;
            MachiningCenterDataApi    = Okuma.Scout.ThincApi.GACExist_DataApi_MachiningCenter;
            GrinderCommandApi         = Okuma.Scout.ThincApi.GACExist_CommandApi_Grinder;
            GrinderDataApi            = Okuma.Scout.ThincApi.GACExist_DataApi_Grinder;
            FlexNetLibrary            = Okuma.Scout.ThincApi.GACExist_FlexNet;

            // THINC API Installed Library Versions
            LatheCommandApiVersion           = Okuma.Scout.ThincApi.CommandApiVersionInGAC_Lathe;
            LatheDataApiVersion              = Okuma.Scout.ThincApi.DataApiVersionInGAC_Lathe;
            MachiningCenterCommandApiVersion = Okuma.Scout.ThincApi.CommandApiVersionInGAC_MachiningCenter;
            MachiningCenterDataApiVersion    = Okuma.Scout.ThincApi.DataApiVersionInGAC_MachiningCenter;
            GrinderCommandApiVersion         = Okuma.Scout.ThincApi.CommandApiVersionInGAC_Grinder;
            GrinderDataApiVersion            = Okuma.Scout.ThincApi.DataApiVersionInGAC_Grinder;
            FlexNetLibraryVersion            = Okuma.Scout.ThincApi.FlexNetVersionInGAC;

            if (apiHasBeenInitializedOrIsReady == false)
            {
                // Check if the API is available for use
                // Note that accessing this property may result in an attempt to instantiate the
                // API and will not allow the check to be made more than once every 5 seconds.
                // Thus, the property should be temporarily kept in a local variable if it is to be
                // used multiple times in the same scope.
                Okuma.Scout.Enums.ApiStatus status = Okuma.Scout.ThincApi.ApiAvailable;

                switch (status)
                {
                case Okuma.Scout.Enums.ApiStatus.Ready:
                {
                    THINC_API_Ready                = status.ToString();
                    InitializeApiCanExecute        = true;
                    apiHasBeenInitializedOrIsReady = true;
                    break;
                }

                case Okuma.Scout.Enums.ApiStatus.NotReady:
                {
                    THINC_API_Ready = status.ToString();
                    break;
                }

                case Okuma.Scout.Enums.ApiStatus.Initialized:
                {
                    THINC_API_Ready                = "Ready";
                    THINC_API_Instantiated         = status.ToString();
                    ApiFunctionsCanExecute         = true;
                    apiHasBeenInitializedOrIsReady = true;
                    break;
                }

                case Okuma.Scout.Enums.ApiStatus.FailedToInitialize:
                {
                    THINC_API_Ready = status.ToString();
                    break;
                }

                case Okuma.Scout.Enums.ApiStatus.FiveSecondTimeOutPeriod:
                {
                    THINC_API_Ready = status.ToString();
                    break;
                }
                }
            }
        }