Exemplo n.º 1
0
        public static async Task <bool> OkCancel(IModalService modalService, string title, string message)
        {
            if (modalService == null)
            {
                throw new NullReferenceException("modalService");
            }

            ModalParameters mp = new ModalParameters();

            mp.Add(nameof(OkCancelContent.Message), message);

            ModalOptions mo = new ModalOptions();

            mo.DisableBackgroundCancel = true;
            mo.HideCloseButton         = true;

            IModalReference result = modalService.Show <OkCancelContent>(title, mp, mo);
            ModalResult     mr     = await result.Result;

            if (mr.Cancelled)
            {
                return(false);
            }
            return(true);
        }
Exemplo n.º 2
0
        public static async Task <(bool, string)> TextInput(IModalService modalService, string title, string message, string defaultValue = null)
        {
            if (modalService == null)
            {
                throw new NullReferenceException("modalService");
            }

            ModalParameters mp = new ModalParameters();

            mp.Add(nameof(TextInputContent.Message), message);
            mp.Add(nameof(TextInputContent.Value), defaultValue);

            ModalOptions mo = new ModalOptions();

            mo.DisableBackgroundCancel = true;
            mo.HideCloseButton         = true;

            IModalReference result = modalService.Show <TextInputContent>(title, mp, mo);
            ModalResult     mr     = await result.Result;

            if (mr.Cancelled)
            {
                return(false, null);
            }
            return(true, mr.Data as string);
        }
Exemplo n.º 3
0
        public static async Task <(bool, FuzzyModelDescriptionData)> FuzzyModelDescriptionEditor(IModalService modalService, FuzzyModelDescriptionData defaultValue)
        {
            if (modalService == null)
            {
                throw new NullReferenceException("modalService");
            }

            ModalParameters mp = new ModalParameters();

            mp.Add(nameof(FuzzyModelEditorForm.Data), defaultValue);

            ModalOptions mo = new ModalOptions();

            mo.DisableBackgroundCancel = true;
            mo.HideCloseButton         = true;

            IModalReference result = modalService.Show <FuzzyModelEditorForm>("Edycja opisu modelu", mp, mo);
            ModalResult     mr     = await result.Result;

            if (mr.Cancelled)
            {
                return(false, null);
            }
            return(true, mr.Data as FuzzyModelDescriptionData);
        }