private bool ValidateParams()
 {
     if (Themes.Any(theme => theme.Resources.Any(x => x.Key == AddedResourceKey)))
     {
         MessageBox.Show("This key already exists");
         return(false);
     }
     if (AddedResourceValues == null || AddedResourceValues.Any(x => string.IsNullOrEmpty(x.Value)))
     {
         MessageBox.Show("Plaese add missing values");
         return(false);
     }
     return(true);
 }
Beispiel #2
0
        public void MoveNext()
        {
            if (!Themes.Any())
            {
                return;
            }

            var index = Themes.IndexOf(CurrentTheme);

            if (++index > Themes.Count - 1)
            {
                index = 0;
            }
            ChangeTheme(Themes[index].Name);
        }
Beispiel #3
0
 public bool SetTheme(string themeName)
 {
     try
     {
         if (Themes.Any(t => t.Name == themeName))
         {
             Engine.Settings["Hood.Settings.Theme"] = themeName;
             return(true);
         }
         return(false);
     }
     catch (Exception)
     {
         return(false);
     }
 }
Beispiel #4
0
        public void Initialize()
        {
            var theme  = Properties.Settings.Default.Theme;
            var accent = Properties.Settings.Default.Accent;

            if (!Themes.Any(c => c.Name == theme))
            {
                theme = defaultTheme.Item1.Name;
            }

            if (!Accents.Any(c => c.Name == accent))
            {
                accent = defaultTheme.Item2.Name;
            }

            SetTheme(theme);
            SetAccent(accent);
        }
Beispiel #5
0
        protected override void OnOK()
        {
            if (_themeChecked && Themes.Any() && Themes.All(x => !x.IsActive))
            {
                MessageBox.Show("You should select one theme.", "Warning", MessageBoxButton.OK, MessageBoxImage.Information);
                return;
            }

            if (_intervalBetweenImages <= 0)
            {
                MessageBox.Show("Interval between images must be greater than zero.", "Warning", MessageBoxButton.OK, MessageBoxImage.Error);
                return;
            }

            if (_intervalForShowImage <= 0)
            {
                MessageBox.Show("Interval for show image must be greater than zero.", "Warning", MessageBoxButton.OK, MessageBoxImage.Error);
                return;
            }

            base.OnOK();
        }
Beispiel #6
0
 public void Initialize()
 {
     this.Database.EnsureCreated();
     if (Posts.Any() && Themes.Any() && Users.Any())
     {
         return;
     }
     Themes.Add(new Theme {
         Name = "Срочное"
     });
     Themes.Add(new Theme {
         Name = "Обычное"
     });
     SaveChanges();
     Users.Add(new User {
         UserName = "******"
     });
     SaveChanges();
     Posts.Add(new Post()
     {
         ThemeId        = Themes.FirstOrDefault().Id,
         UserId         = Users.FirstOrDefault().Id,
         Content        = "На этом месте 32 мая 1985 года ничего не произошло",
         Title          = "Срочно!",
         ContentPreview = "На этом месте...",
         Date           = DateTime.Today
     });
     Posts.Add(new Post()
     {
         ThemeId        = Themes.FirstOrDefault().Id,
         UserId         = Users.FirstOrDefault().Id,
         Content        = "Фантазии нет",
         Title          = "Не очень срочно",
         ContentPreview = "Фантаз...",
         Date           = DateTime.Today.AddDays(-1)
     });
     SaveChanges();
 }