public MainViewModel()
        {
            Help   = new HelpViewModel();
            Themes = new ThemesViewModel();

            Explorer    = new ExplorerViewModel();
            QuickAccess = new QuickAccessViewModel();
            QuickAccess.NavigateCallback = Explorer.NavigateToDirectory;
        }
Exemplo n.º 2
0
        public ActionResult Index(ThemesViewModel model, IFormCollection collection)
        {
            ThemesViewModel model2 = new ThemesViewModel();

            try
            {
                int itemsPerPage = 6;
                int currentPage  = model.PageNumber;

                string next = collection["next"];
                string prev = collection["prev"];

                if (next != null)
                {
                    currentPage++;
                }
                if (prev != null)
                {
                    currentPage--;
                }

                IRequestCultureFeature culture       = Request.HttpContext.Features.Get <IRequestCultureFeature>();
                List <ThemeInfo>       themeInfoList = Configuration.ThemeHelper.GetInstalledThemesInfo(culture);

                themeInfoList.OrderBy(o => o.ThemeName);
                ThemeInfo currentTheme = themeInfoList.Where(i => i.ThemeName == Configuration.GlobalWebsiteConfig.ThemeName).First();
                themeInfoList.Remove(currentTheme);
                themeInfoList.Insert(0, currentTheme);


                JasperPaging <ThemeInfo> paging = new JasperPaging <ThemeInfo>(themeInfoList, currentPage, itemsPerPage);


                model2.SelectedThemeName  = Configuration.GlobalWebsiteConfig.ThemeName;
                model2.ThemeFolder        = Configuration.ThemeFolder;
                model2.PageNumber         = paging.CurrentPageNumber;
                model2.ItemsPerPage       = paging.ItemsPerPage;
                model2.TotalNumberOfPages = paging.NumberOfPagesNeeded;
                model2.ThemeInfoList      = paging.GetCurrentPageItems();
            }
            catch
            {
                TempData["ErrorMessage"] = "Při provádění pořadavku došlo k chybě";
            }

            bool isAjaxRequest = Request.Headers["x-requested-with"] == "XMLHttpRequest";

            if (isAjaxRequest)
            {
                ModelState.Clear();
                return(PartialView("ThemesPartialView", model2));
            }
            else
            {
                return(RedirectToAction("Index"));
            }
        }
Exemplo n.º 3
0
        public ThemesViewModel UpdatePage()
        {
            try
            {
                int itemsPerPage = 6;
                int currentPage  = 1;

                IRequestCultureFeature culture = Request.HttpContext.Features.Get <IRequestCultureFeature>(); // Theme description path is based on locale e.g. (desc.cs.txt) for the Czech language

                List <ThemeInfo> themeInfoList = Configuration.ThemeHelper.GetInstalledThemesInfoByNameAndActive(culture);

                JasperPaging <ThemeInfo> paging = new JasperPaging <ThemeInfo>(themeInfoList, currentPage, itemsPerPage);

                ThemesViewModel model = new ThemesViewModel();
                model.SelectedThemeName  = Configuration.GlobalWebsiteConfig.ThemeName;
                model.ThemeFolder        = Configuration.ThemeFolder;
                model.PageNumber         = paging.CurrentPageNumber;
                model.ItemsPerPage       = paging.ItemsPerPage;
                model.TotalNumberOfPages = paging.NumberOfPagesNeeded;

                model.ThemeInfoList = paging.GetCurrentPageItems();

                // Not registered themes check


                model.NotRegisteredThemeNames   = dbHelper.CheckThemeFolderAndDatabaseIntegrity(culture);
                model.ManuallyDeletedThemeNames = dbHelper.FindManuallyDeletedThemes(culture);

                return(model);
            }
            catch (ThemeNotExistsException ex) // specified theme of jasper.json property "themeName" does not exist
            {
                ThemesViewModel model = new ThemesViewModel();
                model.ItemsPerPage = 3;
                model.ManuallyDeletedThemeNames = null;
                model.NotRegisteredThemeNames   = null;
                model.PageNumber         = 1;
                model.SelectedThemeName  = "Globální soubor jasper.json uvádí jako vzhled: " + ex.MissingThemeName + " který ale ve složce " + Configuration.ThemeFolder + " neexistuje";
                model.ThemeFolder        = Configuration.ThemeFolder;
                model.ThemeInfoList      = null;
                model.TotalNumberOfPages = default(int);
                return(model);
            }
            catch
            {
                ThemesViewModel model = new ThemesViewModel();
                model.ItemsPerPage = 3;
                model.ManuallyDeletedThemeNames = null;
                model.NotRegisteredThemeNames   = null;
                model.PageNumber         = 1;
                model.SelectedThemeName  = null;
                model.ThemeFolder        = null;
                model.ThemeInfoList      = null;
                model.TotalNumberOfPages = default(int);
                return(model);
            }
        }
        public ThemesIndexForm()
        {
            InitializeComponent();

            _dataProvider = ThemeFactory.ThemesProvider;
            _themes       = _dataProvider.Load() ?? new ThemesViewModel();

            if (_themes.ThemesList.Count == 0)
            {
                _themes.ThemesList.Add(ThemeFactory.Default);
            }

            InitTable();
        }
Exemplo n.º 5
0
        private string ChangeCurrentTheme(ThemesViewModel viewModel)
        {
            Theme currentSelectedTheme = _context.Themes.Where(t => t.Selected).First();

            currentSelectedTheme.Selected = false;
            _context.Update(currentSelectedTheme);

            Theme newSelectedTheme = _context.Themes.First(t => t.ThemeName == viewModel.SelectedTheme);

            newSelectedTheme.Selected = true;
            _context.Update(newSelectedTheme);

            _context.SaveChangesAsync();

            return(newSelectedTheme.ThemeName);
        }
Exemplo n.º 6
0
        public IActionResult Index(ThemesViewModel viewModel)
        {
            if (ModelState.IsValid)
            {
                string newThemeName;

                try
                {
                    newThemeName        = ChangeCurrentTheme(viewModel);
                    TempData["Success"] = $"{newThemeName} voting theme has been selected";
                }
                catch (Exception)
                {
                    //TODO Log error
                    ViewData["Error"] = $"Error occurred while changing voting theme";
                }
            }
            return(View(GetThemesViewModel()));
        }
Exemplo n.º 7
0
        private void ThemeCard_OnTapped(object sender, EventArgs e)
        {
            var currentTheme = (Theme)((ContentView)sender).BindingContext;

            ThemesViewModel.ChangeTheme(currentTheme);
        }
Exemplo n.º 8
0
        //[AdminOnly]
        public ActionResult Index(string id)
        {
            int currentTheme = id != null && id != String.Empty ? Convert.ToInt32(id) : 1;

            //ViewBag.Navigation = new List<NavigationAction>();
            ViewBag.ActionLinks = new List <NavigationAction>();
            //return View();
            ViewBag.Navigation = new List <NavigationAction>();
            //var viewModel = ThemeManager.GetViewModel();
            var viewModel = new ThemesViewModel();

            viewModel.CurrentThemeId   = currentTheme;
            viewModel.CurrentThemeName = "My Admin theme";
            viewModel.ThemeGroupings   = new List <ThemeGrouping>();

            var lista  = new List <ThemeInfo>();
            var lista2 = new List <ThemeInfo>();

            lista.Add(new ThemeInfo()
            {
                Name = "Sinisa", ThemeId = 1, PrimaryColor = "#982938", SecondaryColor = "#219423", TertiaryColor = "#09432f", IsDefault = true, IsSystem = false
            });
            lista.Add(new ThemeInfo()
            {
                Name = "Pera", ThemeId = 2, PrimaryColor = "#871827", SecondaryColor = "#198312", TertiaryColor = "#98312f", IsDefault = false, IsSystem = false
            });
            lista.Add(new ThemeInfo()
            {
                Name = "Mika", ThemeId = 3, PrimaryColor = "#769716", SecondaryColor = "#987291", TertiaryColor = "#87201f", IsDefault = false, IsSystem = false
            });
            lista.Add(new ThemeInfo()
            {
                Name = "Zika", ThemeId = 4, PrimaryColor = "#658695", SecondaryColor = "#876189", TertiaryColor = "#76190f", IsDefault = false, IsSystem = false
            });
            lista.Add(new ThemeInfo()
            {
                Name = "Laza", ThemeId = 5, PrimaryColor = "#547584", SecondaryColor = "#765978", TertiaryColor = "#65089f", IsDefault = false, IsSystem = false
            });
            lista.Add(new ThemeInfo()
            {
                Name = "Perke", ThemeId = 6, PrimaryColor = "#436473", SecondaryColor = "#654867", TertiaryColor = "#54978f", IsDefault = false, IsSystem = false
            });
            lista.Add(new ThemeInfo()
            {
                Name = "Sloba", ThemeId = 7, PrimaryColor = "#325362", SecondaryColor = "#543756", TertiaryColor = "#43867f", IsDefault = false, IsSystem = false
            });
            lista.Add(new ThemeInfo()
            {
                Name = "Saki", ThemeId = 8, PrimaryColor = "#214251", SecondaryColor = "#432645", TertiaryColor = "#32756f", IsDefault = false, IsSystem = false
            });
            lista.Add(new ThemeInfo()
            {
                Name = "Vuja", ThemeId = 9, PrimaryColor = "#193149", SecondaryColor = "#321534", TertiaryColor = "#21645f", IsDefault = false, IsSystem = false
            });
            lista.Add(new ThemeInfo()
            {
                Name = "Duka", ThemeId = 10, PrimaryColor = "#982938", SecondaryColor = "#219423", TertiaryColor = "#10534f", IsDefault = false, IsSystem = false
            });

            lista2.Add(new ThemeInfo()
            {
                Name = "Vuja", ThemeId = 9, PrimaryColor = "#193149", SecondaryColor = "#321534", TertiaryColor = "#21645f", IsDefault = false, IsSystem = true
            });

            viewModel.ThemeGroupings.Add(new ThemeGrouping("Standard Themes", lista));
            viewModel.ThemeGroupings.Add(new ThemeGrouping("Created Themes", lista2));


            return(View(viewModel));
        }