Ejemplo n.º 1
0
        private static string GetMissionInstanceOptionText(
            string missionName,
            HyperMissionInstance instance)
        {
            if (string.IsNullOrWhiteSpace(missionName))
            {
                throw new ArgumentException(nameof(missionName));
            }
            if (instance == null)
            {
                throw new ArgumentException(nameof(instance));
            }

            var text = missionName;

            if (instance.StopAtUTC.HasValue)
            {
                text += $" ({instance.RunAtUTC:d} - {instance.StopAtUTC.Value:d})";
            }
            else
            {
                text += $" ({instance.RunAtUTC:d})";
            }

            return(text);
        }
Ejemplo n.º 2
0
        private async Task <string> LoadModelOnNodeAsync(IHyperArgsSink store, HyperMissionInstance instance = null, bool allowAutoMissionResume = true)
        {
            if (this.Mission == null)
            {
                return(string.Empty);
            }

            this.ResetModelStatus();

            if (store == null)
            {
                await OnToastMessage.InvokeAsync(new ToastMessage($"No Node selected, loading model failed.", ToastMessageType.Info));
            }

            var args = new LoadHyperMissionArgs()
            {
                AllowMissionAutoResume = allowAutoMissionResume
            };

            if (instance == null)
            {
                args.MissionConfigurationId = Mission.Id;
            }
            else
            {
                args.MissionInstance = instance;
            }

            var missionStatus = await store.ExecuteAsync(args);

            if (missionStatus == null)
            {
                if (args.ExecutionResult.IsNotSuccess)
                {
                    await OnToastMessage.InvokeAsync(new ToastMessage(args.ExecutionResult.Message, ToastMessageType.Error));
                }
                else
                {
                    await OnToastMessage.InvokeAsync(new ToastMessage($"Failed to load model instance.", ToastMessageType.Info));
                }
            }

            if (this != null)
            {
                await this.UpdateModelStatusAsync();
            }

            return("Model loading, status: " + missionStatus);
        }