示例#1
0
        private async void Submit()
        {
            if (!ValidateInputData())
            {
                return;
            }

            var filepondStatus = await JsModule.InvokeAsync <bool>("checkIfFilepondBusy");

            if (filepondStatus)
            {
                CurrentPage.ShowNotification("Files are still uploading.");
                return;
            }

            _showLoadingIndicator = true;
            await InvokeAsync(StateHasChanged);

            var newBriefing = new Briefing
            {
                Server            = Server,
                Origin            = DepartureAirport.ToUpper(),
                Destination       = ArrivalAirport.ToUpper(),
                OriginRunway      = DepartureRunway.ToUpper(),
                DestinationRunway = ArrivalRunway.ToUpper(),
                FlightLevel       = FlightLevel,
                CruiseSpeed       = GetActualCruiseSpeed(CruiseSpeed),
                DepartureTime     = DepartureTimeSelect.GetDateTime(),
                TimeEnroute       = TimeEnrouteSelect.GetTimeSpan().Ticks,
                FlightPlan        = FlightPlan.ToUpper(),
                Author            = Author,
                Remarks           = Remarks,
                EditPassword      = EditPassword,
                ViewPassword      = ViewPassword,
                CreatedOn         = DateTime.UtcNow
            };

            var attachments = await JsModule.InvokeAsync <string[]>("getFilepondFileIds");

            newBriefing.AttachmentsArray = attachments;

            _newBriefingId = int.Parse(await ApiService.MakeBriefing(newBriefing));

            _showLoadingIndicator = false;
            _showCompleted        = true;

            await JsModule.InvokeVoidAsync("unregisterEvents");

            await InvokeAsync(StateHasChanged);
        }
示例#2
0
        private async void Submit()
        {
            if (!_authenticated)
            {
                return;
            }
            if (!ValidateInputData())
            {
                return;
            }

            var filepondStatus = await JsModule.InvokeAsync <bool>("checkIfFilepondBusy");

            if (filepondStatus)
            {
                CurrentPage.ShowNotification("Files are still uploading.");
                return;
            }

            _showLoadingIndicator = true;
            await InvokeAsync(StateHasChanged);

            var attachments = await JsModule.InvokeAsync <string[]>("getFilepondFileIds");

            // Edit the original briefing entity
            _editedBriefing.Server            = Server;
            _editedBriefing.Origin            = DepartureAirport.ToUpper();
            _editedBriefing.OriginRunway      = DepartureRunway.ToUpper();
            _editedBriefing.Destination       = ArrivalAirport.ToUpper();
            _editedBriefing.DestinationRunway = ArrivalRunway.ToUpper();
            _editedBriefing.FlightLevel       = FlightLevel;
            _editedBriefing.CruiseSpeed       = GetActualCruiseSpeed(CruiseSpeed);
            _editedBriefing.DepartureTime     = DepartureTimeSelect.GetDateTime();
            _editedBriefing.TimeEnroute       = TimeEnrouteSelect.GetTimeSpan().Ticks;
            _editedBriefing.FlightPlan        = FlightPlan.ToUpper();
            _editedBriefing.Author            = Author;
            _editedBriefing.Remarks           = Remarks;
            _editedBriefing.LastEdited        = DateTime.UtcNow;

            _editedBriefing.AttachmentsArray = attachments;

            _editedBriefing.ViewPassword = _briefingType == "Public" ? "none" : ViewPassword;

            await ApiService.EditBriefing(_actualBriefingId, _editedBriefing, _editPassword);

            // Done editing, return to the briefing page.
            NavManager.NavigateTo($"/b/{BriefingId}");
        }