private async Task OpenMetadataDetailsModalTemplate(Metadata metadata)
        {
            var templateOptions = new ViewModels.MetadataDetailsViewModel
            {
                Metadata = metadata
            };

            var modalConfig = new ModalOptions();

            modalConfig.Title          = "Metadata Preview";
            modalConfig.Width          = "90%";
            modalConfig.DestroyOnClose = true;
            modalConfig.OnCancel       = async(e) =>
            {
                await metadataDetailsModalRef.CloseAsync();
            };
            modalConfig.OnOk = async(e) =>
            {
                await metadataDetailsModalRef.CloseAsync();
            };

            modalConfig.AfterClose = () =>
            {
                InvokeAsync(StateHasChanged);

                return(Task.CompletedTask);
            };

            metadataDetailsModalRef = await ModalService
                                      .CreateModalAsync <MetadataDetailsModal, ViewModels.MetadataDetailsViewModel>(
                modalConfig, templateOptions);
        }
Example #2
0
        /// <summary>
        /// Handles the OK button click event.
        /// </summary>
        /// <returns>A task that represents the asynchronous operation.</returns>
        protected Task OnOkClicked()
        {
            return(InvokeAsync(async() =>
            {
                await Okayed.InvokeAsync();

                await ModalRef.Hide();
            }));
        }
Example #3
0
        private async Task OpenVariableModalTemplate(Variable variable)
        {
            var templateOptions = new ViewModels.VariableModalViewModel
            {
                Variable = new Variable()
                {
                    Name            = variable.Name,
                    Description     = variable.Description,
                    Units           = variable.Units,
                    Height          = variable.Height,
                    Tags            = variable.Tags,
                    Methods         = variable.Methods,
                    QCApplied       = variable.QCApplied,
                    ProcessingLevel = variable.ProcessingLevel
                },
                ProcessingLevels  = State.AppConfig.ProcessingLevels,
                QCFlags           = State.AppConfig.QCTags,
                Tags              = State.AppConfig.Tags,
                SelectedTags      = variable.Tags ??= new List <string>(),
                SelectedQCApplied = variable.QCApplied ??= new List <string>()
            };

            var modalConfig = new ModalOptions();

            modalConfig.Title    = "Variable";
            modalConfig.Width    = "70%";
            modalConfig.OnCancel = async(e) =>
            {
                await variableModalRef.CloseAsync();
            };
            modalConfig.OnOk = async(e) =>
            {
                variable.Name            = templateOptions.Variable.Name;
                variable.Description     = templateOptions.Variable.Description;
                variable.Units           = templateOptions.Variable.Units;
                variable.Height          = templateOptions.Variable.Height;
                variable.Tags            = templateOptions.SelectedTags.ToList();
                variable.Methods         = templateOptions.Variable.Methods;
                variable.QCApplied       = templateOptions.SelectedQCApplied.ToList();
                variable.ProcessingLevel = templateOptions.Variable.ProcessingLevel;

                await variableModalRef.CloseAsync();
            };

            modalConfig.AfterClose = () =>
            {
                RemoveBlankVariables();

                InvokeAsync(StateHasChanged);

                return(Task.CompletedTask);
            };

            variableModalRef = await ModalService
                               .CreateModalAsync <VariableModal, ViewModels.VariableModalViewModel>(
                modalConfig, templateOptions);
        }
Example #4
0
        /// <summary>
        /// Handles the Cancel button click event.
        /// </summary>
        /// <returns>A task that represents the asynchronous operation.</returns>
        protected Task OnCancelClicked()
        {
            return(InvokeAsync(async() =>
            {
                await ModalRef.Hide();

                if (IsConfirmation && Callback != null)
                {
                    await InvokeAsync(() => Callback.SetResult(false));
                }

                await Canceled.InvokeAsync();
            }));
        }
        /// <summary>
        /// Handles the Confirm button click event.
        /// </summary>
        /// <returns>A task that represents the asynchronous operation.</returns>
        protected Task OnConfirmClicked()
        {
            return(InvokeAsync(async() =>
            {
                ModalRef.Hide();

                if (IsConfirmation && Callback != null)
                {
                    await InvokeAsync(() => Callback.SetResult(true));
                }

                await Confirmed.InvokeAsync(null);
            }));
        }
Example #6
0
        private async Task OpenEdit(string options)
        {
            var _config = new ModalOptions();

            _config.Title  = "编辑数据";
            _config.Footer = null;

            _config.AfterClose = async() =>
            {
                Console.WriteLine("关闭编辑弹窗后刷新数据...");

                await Search();

                StateHasChanged();
            };

            _editRef = await _modal
                       .CreateModalAsync <Edit, string>(_config, options);
        }
        private async Task OpenMetadataDetailsModalTemplate(CatalogVariable catalogVariable)
        {
            var metadata = State.Catalog.Metadatas.FirstOrDefault(m =>
                                                                  (m.Dataset.Zone == catalogVariable.Zone) &&
                                                                  (m.Dataset.Project == catalogVariable.ProjectName) &&
                                                                  (m.Dataset.Name == catalogVariable.DatasetName));

            if (metadata == null)
            {
                return;
            }

            var templateOptions = new ViewModels.MetadataDetailsViewModel
            {
                Metadata = metadata
            };

            var modalConfig = new ModalOptions();

            modalConfig.Title          = "Metadata Preview";
            modalConfig.Width          = "90%";
            modalConfig.DestroyOnClose = true;
            modalConfig.OnCancel       = async(e) =>
            {
                await metadataDetailsModalRef.CloseAsync();
            };
            modalConfig.OnOk = async(e) =>
            {
                await metadataDetailsModalRef.CloseAsync();
            };

            modalConfig.AfterClose = () =>
            {
                InvokeAsync(StateHasChanged);

                return(Task.CompletedTask);
            };

            metadataDetailsModalRef = await ModalService
                                      .CreateModalAsync <MetadataDetailsModal, ViewModels.MetadataDetailsViewModel>(
                modalConfig, templateOptions);
        }
Example #8
0
        private async Task OpenPersonModalTemplate(Person contact)
        {
            var templateOptions = new ViewModels.PersonModalViewModel
            {
                Person = new Person()
                {
                    Name  = contact.Name,
                    Email = contact.Email,
                    Role  = contact.Role
                },
                Roles = State.AppConfig.Roles
            };

            var modalConfig = new ModalOptions();

            modalConfig.Title    = "Contact";
            modalConfig.OnCancel = async(e) =>
            {
                await personModalRef.CloseAsync();
            };
            modalConfig.OnOk = async(e) =>
            {
                contact.Name  = templateOptions.Person.Name;
                contact.Email = templateOptions.Person.Email;
                contact.Role  = templateOptions.Person.Role;

                await personModalRef.CloseAsync();
            };

            modalConfig.AfterClose = () =>
            {
                RemoveBlankContacts();

                InvokeAsync(StateHasChanged);

                return(Task.CompletedTask);
            };

            personModalRef = await ModalService
                             .CreateModalAsync <PersonModal, ViewModels.PersonModalViewModel>(
                modalConfig, templateOptions);
        }
Example #9
0
        private async Task OpenScan(string options)
        {
            var modalConfig = new ModalOptions();

            modalConfig.Title  = "扫描内容";
            modalConfig.Footer = null;
            modalConfig.Width  = 640;
            // modalConfig.MaskClosable = false;

            modalConfig.AfterClose = async() =>
            {
                Console.WriteLine("关闭扫描对话框");

                await Search();

                StateHasChanged();
            };

            _scanRef = await _modal
                       .CreateModalAsync <Scan, string>(modalConfig, options);
        }