Esempio n. 1
0
    // Class that will start the process of getting all the data from the web services.
    FutureResult BeginDataRetrieving()
    {
        var futureResult = new FutureResult();

        // GetModel Data and then download the files.
        _backendManager.GetModelInfo((BackendRequestResult result, GetModelResponse response) =>
        {
            if (result.Success)
            {
                futureResult.CompletedActions.Add("GetModelInfo");
                BeginModelDownload(futureResult, response.ObjUrl, response.MtlUrl, response.TextureUrl);
            }
            else
            {
                if (!futureResult.Completed)
                {
                    futureResult.Completed = true;
                    futureResult.Success   = false;
                    futureResult.FailureReasons.Add("Failed To Get Model Info");
                }
            }
        });

        // Get the shovel data
        _backendManager.GetShovels((BackendRequestResult result, GetShovelsResponse response) =>
        {
            if (result.Success)
            {
                futureResult.CompletedActions.Add("GetShovels");
                _shovels.Clear();
                _shovels.AddRange(response.Shovels);
            }
            else
            {
                if (!futureResult.Completed)
                {
                    futureResult.Completed = true;
                    futureResult.Success   = false;
                    futureResult.FailureReasons.Add("Failed To Get Shovels");
                }
            }
        });

        // Get the shovel report data
        _backendManager.GetShovelInfo((BackendRequestResult result, GetShovelInfoResponse response) =>
        {
            if (result.Success)
            {
                futureResult.CompletedActions.Add("GetShovelInfo");

                _shovelReports.Clear();
                _shovelReports.AddRange(response.Reports);
            }
            else
            {
                if (!futureResult.Completed)
                {
                    futureResult.Completed = true;
                    futureResult.Success   = false;
                    futureResult.FailureReasons.Add("Failed To Get Shovel Reports");
                }
            }
        });

        StartCoroutine(CheckDataRetrieveStatus(futureResult));

        return(futureResult);
    }