Пример #1
0
        public static bool TaskStateToVisibility(this TcoTask task)
        {
            try
            {
                var taskState = (eTaskState)((short)task._taskState.Synchron);

                switch (taskState)
                {
                case eTaskState.Requested:
                case eTaskState.Busy:
                case eTaskState.Error:
                    return(true);

                case eTaskState.Ready:
                case eTaskState.Done:
                    return(false);

                default:
                    return(false);
                }
            }
            catch (Exception)
            {
                // Swallow
            }

            return(false);
        }
Пример #2
0
        public static string StateToButtonClass(this TcoTask task)
        {
            var state = (eTaskState)((short)task._taskState.Synchron);

            switch (state)
            {
            case eTaskState.Ready:
                return("btn btn-primary");

            case eTaskState.Done:
                return("btn btn-primary");

            case eTaskState.Busy:
            case eTaskState.Requested:
                return("btn btn-primary active");

            case eTaskState.Error:
                return("btn btn-danger");

            default:
                break;
            }

            return("btn btn-secondary");
        }