示例#1
0
        public async Task <HyperMission> GetMissionAsync(
            string missionId,
            CancellationToken cancellationToken = default(CancellationToken))
        {
            if (_netStore == null)
            {
                throw new ApplicationException("Node does not exist.");
            }
            if (string.IsNullOrWhiteSpace(missionId))
            {
                throw new ArgumentException(nameof(missionId));
            }

            var retrieveHyperDocumentArgs = new RetrieveHyperDocumentArgs()
            {
                DocumentId = HyperDocumentId.Create <HyperMission>(missionId)
            };

            var hyperDocument = await _netStore.ExecuteAsync(retrieveHyperDocumentArgs);

            var mission = hyperDocument.GetPayload <HyperMission>();

            if (mission.Id == missionId)
            {
                return(mission);
            }

            throw new ApplicationException("Missing mission");
        }
        private async Task Populate()
        {
            IsLoadedData = false;

            if (HyperStore == null || string.IsNullOrWhiteSpace(MissionId))
            {
                return;
            }

            var documentId  = HyperDocumentId.Create <HyperMission>(MissionId);
            var argTagonomy = new RetrieveHyperDocumentArgs(documentId);
            var doc         = await HyperStore.ExecuteAsync(argTagonomy);

            if (argTagonomy.ExecutionResult.IsNotSuccess)
            {
                return;
            }

            var data = doc?.GetPayload <HyperMission>();

            Source = new MissionItemVm(data, HyperStore);
            await Source.UpdateStatus();

            Source.OnToastMessage = OnToastMessage;

            SelectedPhase = Source.Mission?.Phases.FirstOrDefault();

            IsLoadedData = true;
        }
示例#3
0
        public async Task DeleteTheme(StyleTheme data)
        {
            var args = new DeleteHyperDocumentArgs(HyperDocumentId.Create <StyleTheme>(data.Id));
            var isDeleteSuccessful = await HyperStore.ExecuteAsync(args);

            if (isDeleteSuccessful)
            {
                DataList.RemoveAll(it => it.Id == data.Id);
            }
        }
示例#4
0
        public async Task <DashboardData> GetDashboard(string dashboardId)
        {
            var documentId = HyperDocumentId.Create <DashboardData>(dashboardId);
            var args       = new RetrieveHyperDocumentArgs(documentId);
            var doc        = await HyperStore.ExecuteAsync(args);

            if (args.ExecutionResult.IsNotSuccess)
            {
                return(null);
            }

            var dashboard = doc?.GetPayload <DashboardData>();

            return(dashboard);
        }
示例#5
0
        public ZoneOverlayEntry ToDomainModel()
        {
            var domain = new ZoneOverlayEntry();

            BaseOverlayEntryJsModel.MapBasePropertiesToDomainModel(domain, this);

            domain.Points        = this.Points;
            domain.Alias         = this.Alias;
            domain.MetadataSetId = this.MetadataSetId != null?HyperDocumentId.Create <HyperMetadataSet>(this.MetadataSetId) : (HyperDocumentId?)null;

            domain.FixedCameraEnhancementId = this.FixedCameraEnhancementId != null?HyperDocumentId.Create <FixedCameraEnhancedData>(this.FixedCameraEnhancementId) : (HyperDocumentId?)null;

            domain.View = this.View;
            return(domain);
        }
示例#6
0
        public async Task <HyperMission> GetHyperMissionAsync()
        {
            if (string.IsNullOrEmpty(Request.MissionId))
            {
                throw new ArgumentException(nameof(Request.MissionId));
            }

            var retrieveHyperDocumentArgs = new RetrieveHyperDocumentArgs()
            {
                DocumentId = HyperDocumentId.Create <HyperMission>(Request.MissionId)
            };

            var hyperDocument = await _netStore.ExecuteAsync(retrieveHyperDocumentArgs);

            var mission = hyperDocument.GetPayload <HyperMission>();

            return(mission);
        }
示例#7
0
        private async Task PopulateData()
        {
            if (HyperStore == null || string.IsNullOrWhiteSpace(WorkflowId))
            {
                return;
            }

            var documentId = HyperDocumentId.Create <HyperWorkflow>(WorkflowId);
            var args       = new RetrieveHyperDocumentArgs(documentId);
            var doc        = await HyperStore.ExecuteAsync(args);

            if (args.ExecutionResult.IsNotSuccess)
            {
                return;
            }

            Source = doc?.GetPayload <HyperWorkflow>();
        }
示例#8
0
        public async Task <StyleTheme> GetThemeAsync()
        {
            if (string.IsNullOrWhiteSpace(this.Source.Theme?.Id))
            {
                return(null);
            }

            var documentId = HyperDocumentId.Create <StyleTheme>(this.Source.Theme?.Id);
            var args       = new RetrieveHyperDocumentArgs(documentId);
            var doc        = await HyperStore.ExecuteAsync(args);

            if (args.ExecutionResult.IsNotSuccess)
            {
                return(null);
            }

            var theme = doc?.GetPayload <StyleTheme>();

            return(theme);
        }
        public async Task <DashboardData> GetDashboardAsync()
        {
            if (string.IsNullOrWhiteSpace(this.Widget.Dashboard?.Id))
            {
                return(null);
            }

            var documentId = HyperDocumentId.Create <DashboardData>(this.Widget.Dashboard?.Id);
            var args       = new RetrieveHyperDocumentArgs(documentId);
            var doc        = await HyperStore.ExecuteAsync(args);

            if (args.ExecutionResult.IsNotSuccess)
            {
                return(null);
            }

            var dashboard = doc?.GetPayload <DashboardData>();

            return(dashboard);
        }
        public async Task <HyperMission> LoadMission(HyperMetadataSet metadataset)
        {
            var missionId = metadataset?.MissionIds?.FirstOrDefault().Id;

            if (string.IsNullOrWhiteSpace(missionId))
            {
                return(null);
            }

            var retrieveHyperDocumentArgs = new RetrieveHyperDocumentArgs()
            {
                DocumentId = HyperDocumentId.Create <HyperMission>(missionId)
            };

            var hyperDocument = await _netStore.ExecuteAsync(retrieveHyperDocumentArgs);

            var mission = hyperDocument.GetPayload <HyperMission>();

            return(mission);
        }
示例#11
0
        private async Task PopulateData()
        {
            if (HyperStore == null || string.IsNullOrWhiteSpace(TagonomyId))
            {
                return;
            }

            var documentId  = HyperDocumentId.Create <Tagonomy>(TagonomyId);
            var argTagonomy = new RetrieveHyperDocumentArgs(documentId);
            var doc         = await HyperStore.ExecuteAsync(argTagonomy);

            if (argTagonomy.ExecutionResult.IsNotSuccess)
            {
                return;
            }

            Source = doc?.GetPayload <Tagonomy>();

            RefreshNavigation();
        }
        private async Task PopulateData()
        {
            if (HyperStore == null || string.IsNullOrWhiteSpace(TagonomyId))
            {
                return;
            }

            var documentId  = HyperDocumentId.Create <Tagonomy>(TagonomyId);
            var argTagonomy = new RetrieveHyperDocumentArgs(documentId);
            var doc         = await HyperStore.ExecuteAsync(argTagonomy);

            if (argTagonomy.ExecutionResult.IsNotSuccess)
            {
                return;
            }

            _rootTagonomy = doc?.GetPayload <Tagonomy>();

            _unprocessedSourceTagonomies.Clear();
            _processedSourceTagonomies.Clear();


            var args = new FindHyperDocumentsArgs(typeof(Tagonomy), true);

            _allTagonomies = ((await this.HyperStore.ExecuteAsyncThrows(args)) ?? new Node.Common.HyperDocument[0])
                             .Select(x => x.GetPayload <Tagonomy>())
                             .ToArray();

            _unprocessedSourceTagonomies.Add(_rootTagonomy.Id, _rootTagonomy);

            while (_unprocessedSourceTagonomies.Any())
            {
                foreach (var unprocTagonomie in _unprocessedSourceTagonomies.Select(x => x.Value).ToArray())
                {
                    var linkingNodesInner = GetLinkingNodes(unprocTagonomie);
                    ProcessLinkingNodes(linkingNodesInner, unprocTagonomie, true);
                }
            }

            GoBackwards();
        }
示例#13
0
        private async Task LoadHyperMissionAsync()
        {
            if (_request == null || string.IsNullOrEmpty(_request.MissionId))
            {
                return;
            }

            var retrieveHyperDocumentArgs = new RetrieveHyperDocumentArgs()
            {
                DocumentId = HyperDocumentId.Create <HyperMission>(_request.MissionId)
            };

            var hyperDocument = await _netStore.ExecuteAsync(retrieveHyperDocumentArgs);

            var mission = hyperDocument.GetPayload <HyperMission>();

            if (mission != null)
            {
                Mission = mission;
            }
        }