Ejemplo n.º 1
0
        /// <summary>
        /// Render all session modals using a partial view
        /// </summary>
        /// <typeparam name="TModal">The type of modal to render</typeparam>
        /// <param name="helper">The <see cref="IHtmlHelper"/> to extend rendering</param>
        /// <param name="modalManager">The modal manager which contains all the modals to render</param>
        /// <param name="partialViewName">The name of the partial view to use when rendering</param>
        /// <param name="clearModalsAfterRendering">Whether to clear the modals from the session after they have all been rendered</param>
        /// <returns>All the modals rendered as HTML</returns>
        /// <exception cref="ArgumentNullException"><paramref name="helper"/> or <paramref name="modalManager"/> or <paramref name="partialViewName"/> is <see langword="null"/></exception>
        public static IHtmlContent RenderModals <TModal>(this IHtmlHelper helper, IModalManager <TModal> modalManager, string partialViewName, bool clearModalsAfterRendering = true) where TModal : IModalViewModel
        {
            if (helper is null)
            {
                throw new ArgumentNullException(nameof(helper));
            }
            if (modalManager is null)
            {
                throw new ArgumentNullException(nameof(modalManager));
            }
            if (partialViewName is null)
            {
                throw new ArgumentNullException(nameof(partialViewName));
            }

            IHtmlContentBuilder content = new HtmlContentBuilder();

            foreach (var modal in modalManager.Get())
            {
                content.AppendHtml(helper.Partial(partialViewName, modal));
            }

            if (clearModalsAfterRendering)
            {
                modalManager.Clear();
            }

            return(content);
        }
        public SelectBindingViewModel(IDataManager dataManager, IModalManager modalManager)
        {
            _dataManager = dataManager;
            _modalManager = modalManager;

            PageNames = _dataManager.GetAllPageNames().ToList();
        }
Ejemplo n.º 3
0
 public SettingsViewModel(IModalManager modalManager)
 {
     _modalManager = modalManager;
 }
        public AddBindingViewModel(IDataManager dataManager, IModalManager modalManager)
        {
            _dataManager = dataManager;
            _modalManager = modalManager;

            CastSpellGameEvents = _dataManager.CreateCastSpellGameEventsResource().ToList();
            CastSpellQuickbinds = _dataManager.CreateCastSpellQuickbindsResource().ToList();

            UseItemGameEvents = _dataManager.CreateUseItemGameEventsResource().ToList();
            UseItemQuickbinds = _dataManager.CreateUseItemQuickbindsResource().ToList();
        }
Ejemplo n.º 5
0
        public MainViewModel(IDataManager dataManager, IModalManager modalManager)
        {
            _dataManager = dataManager;

            ModalManager = modalManager;
        }
 public ConfirmationDialogViewModel(IModalManager modalManager)
 {
     _modalManager = modalManager;
 }