Пример #1
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            var memePath = Path.Combine(Directory.GetCurrentDirectory(), "memes");

            if (!File.Exists(memePath))
            {
                Directory.CreateDirectory(memePath);
            }

            this.memeRepo = new MemeRepo(Path.Combine(Directory.GetCurrentDirectory(), "memes"));

            this.RefreshKeyBindings();

            this.webInterface              = new WebInterface(this.memeRepo);
            this.webInterface.MemeClicked += m => this.Dispatcher.Invoke(() => this.ToggleMeme(m));

            this.memeRepo.Updated += () => this.Dispatcher.Invoke(this.RefreshKeyBindings);

            new HotKey(ModifierKeys.Control, Key.PageUp, this, _ => this.Storyboard.Begin());
            new HotKey(ModifierKeys.Control, Key.PageDown, this, _ => this.Storyboard.Stop());
        }
Пример #2
0
 public WebInterface(MemeRepo repo)
 {
     this.repo          = repo;
     this.repo.Updated += () => this.SendUpdate();
 }
Пример #3
0
 public ApiController(MemeRepo repo)
 {
     this.repo = repo;
 }