예제 #1
0
        public TextViewModel(SystemAdminSubMenu subMenu)
        {
            if (subMenu == null)
            {
                throw new ArgumentNullException(nameof(subMenu));
            }

            Title = subMenu.Name();

            StringBuilder newData = new StringBuilder();

            string data = subMenu.Data();

            for (int i = 0; i < data.Length; i++)
            {
                char character = data[i];

                switch (character)
                {
                case ' ':
                    newData.Append("&nbsp;");
                    break;

                case '\t':
                    newData.Append("&nbsp;&nbsp;&nbsp;&nbsp;");
                    break;

                case '\n':
                    newData.Append("<br />");
                    break;

                case '<':
                    newData.Append("&lt;");
                    break;

                case '>':
                    newData.Append("&gt;");
                    break;

                case '\r':
                    break;

                default:
                    newData.Append(character);
                    break;
                }
            }


            Text = newData.ToString();

            BreadCrumb = $"<ul><li><a href=\"/SystemAdmin/\">System Admin</a></li><li><a href=\"/SystemAdmin/Index/" +
                         $"{subMenu.ParentMenu.UniqueId}\">{subMenu.ParentMenu.Name()}</a></li><li>{Title}</li></ul>";
        }
예제 #2
0
        public MapViewModel(SystemAdminSubMenu subMenu)
        {
            if (subMenu == null)
            {
                throw new ArgumentNullException(nameof(subMenu));
            }

            Title = subMenu.Name();

            MapLocationData = subMenu.Data();

            ISettingsProvider   settingsProvider = (ISettingsProvider)Classes.PluginClass.GetServiceProvider.GetRequiredService <IPluginClassesService>();
            SystemAdminSettings settings         = settingsProvider.GetSettings <SystemAdminSettings>("SystemAdmin");

            GoogleMapApiKey = settings.GoogleMapApiKey;

            BreadCrumb = $"<ul><li><a href=\"/SystemAdmin/\">System Admin</a></li><li><a href=\"/SystemAdmin/Index/" +
                         $"{subMenu.ParentMenu.UniqueId}\">{subMenu.ParentMenu.Name()}</a></li><li>{Title}</li></ul>";
        }
예제 #3
0
        public GridViewModel(SystemAdminSubMenu subMenu)
        {
            if (subMenu == null)
            {
                throw new ArgumentNullException(nameof(subMenu));
            }

            Title = subMenu.Name();

            // data has to have the header on first row, each column seperated by a pipe |
            // the data is on all following lines and is also seperated by pipe |
            // each line is seperated with \r
            string[] allLines = subMenu.Data().Split('\r');

            // must have a header at the very least!
            if (allLines.Length == 0)
            {
                throw new ArgumentNullException(nameof(subMenu.Data));
            }

            Headers = allLines[0].Split('|');

            int columnCount = Headers.Length;

            Items = new List <string[]>();

            for (int i = 1; i < allLines.Length; i++)
            {
                string[] line = allLines[i].Split('|');

                if (line.Length != Headers.Length)
                {
                    throw new InvalidOperationException("column count much match header column count");
                }

                Items.Add(line);
            }

            BreadCrumb = $"<ul><li><a href=\"/SystemAdmin/\">System Admin</a></li><li><a href=\"/SystemAdmin/Index/" +
                         $"{subMenu.ParentMenu.UniqueId}\">{subMenu.ParentMenu.Name()}</a></li><li>{Title}</li></ul>";
        }
        public TextExViewModel(SystemAdminSubMenu subMenu)
        {
            if (subMenu == null)
            {
                throw new ArgumentNullException(nameof(subMenu));
            }

            Title = subMenu.Name();

            ISettingsProvider   settingsProvider = (ISettingsProvider)Classes.PluginClass.GetServiceProvider.GetRequiredService <IPluginClassesService>();
            SystemAdminSettings settings         = settingsProvider.GetSettings <SystemAdminSettings>("SystemAdmin");

            if (settings.DisableFormattedText)
            {
                Text = "Formatted Text is not enabed";
            }
            else
            {
                Text = subMenu.Data();
            }

            BreadCrumb = $"<ul><li><a href=\"/SystemAdmin/\">System Admin</a></li><li><a href=\"/SystemAdmin/Index/" +
                         $"{subMenu.ParentMenu.UniqueId}\">{subMenu.ParentMenu.Name()}</a></li><li>{Title}</li></ul>";
        }