Exemplo n.º 1
0
        private void DrawImportButton()
        {
            // Reserve space for this part
            EditorGUILayout.Space();
            Rect bounds = GUILayoutUtility.GetRect(EmptyLabel, "button");

            // Calculate the progress bar bounds
            float originalWidth = bounds.width;

            bounds.width = originalWidth - (ImportButtonWidth + Space);

            // Check if we need to show the progress bar
            if (IsInMiddleOfImporting == true)
            {
                EditorGUI.ProgressBar(bounds, Progress, ProgressMessage.ToString());
            }
            else
            {
                EditorGUI.ProgressBar(bounds, 1, "Waiting...");
            }

            // Only enable if no error messages are there
            bool isEnabled = GUI.enabled;

            GUI.enabled = ((ErrorMessage.Length == 0) && (IsInMiddleOfImporting == false));

            // Calculate the button bounds
            bounds.width = ImportButtonWidth;
            bounds.x     = (bounds.x + originalWidth) - ImportButtonWidth;

            // Draw the button
            if ((GUI.Button(bounds, "Import") == true) && (GUI.enabled == true))
            {
                // Reset the progress
                Progress            = 0f;
                currentStatus.Value = ImportState.ReadFile;
                progressReport.SetTotalSteps(1);

                // Start a new thread
                ThreadPool.QueueUserWorkItem(ImportCsvFile);
            }

            // Revert enable behavior
            GUI.enabled = isEnabled;
        }
Exemplo n.º 2
0
        private void ProgressLogging(ProgressMessage progressMessage)
        {
            var mqProgressEvent = new TaskProgress()
            {
                TaskId  = progressMessage.TaskId,
                Status  = progressMessage.Phase,
                Message = progressMessage.ToString()
            };

            if (progressMessage is BlockUpscalling)
            {
                var upscallingProgressMessage = progressMessage as BlockUpscalling;

                mqProgressEvent.BlockNumber   = upscallingProgressMessage.BlockNumber;
                mqProgressEvent.BlocksCount   = upscallingProgressMessage.TotalBlocks;
                mqProgressEvent.ProgressRatio = upscallingProgressMessage.Percent;
            }

            _mqBus.Send(MqUtils.UpscallingProgressQueue, mqProgressEvent);
            Console.WriteLine(progressMessage);
        }