public MainWindow() { this.InitializeComponent(); this.context = new KatatsukiContext(File.ReadAllText("path")); new LibraryManager(context); this.queryProcessor = new TrackQueryProcessor(t => { return((from track in this.context.Tracks where track.Artist == t.Artist && track.Title == t.Title && track.Album == t.Album group track by new { track.Title, track.Album, track.Artist } into dupes where dupes.Count() > 1 select dupes).Any()); }); this.viewSource = (CollectionViewSource)(this.FindResource("TracksViewSource")); this.DataContext = context; this.viewSource.Filter += TracksViewSource_Filter; this.context.VisibilityStateChanged += Context_VisibilityStateChanged; }
public LibraryManager(KatatsukiContext context) { this.icon = new NotifyIcon(); this.RecentTracks = new ConcurrentStack <Track>(); this.context = context; this.context.Watcher.NewTrackFound += Watcher_NewTrackFound; this.context.Watcher.CorruptedTrackFound += Watcher_CorruptedTrackFound; this.icon.Icon = new System.Drawing.Icon("test.ico"); this.icon.Visible = true; this.icon.DoubleClick += (s, e) => this.context.ForceVisible(true); this.icon.ContextMenu = new ContextMenu() { MenuItems = { { new MenuItem("Open Library", (s, e) => this.context.ForceVisible(true)) } } }; var timer = new System.Timers.Timer(10000); timer.AutoReset = true; //todo use an autoreset event timer.Elapsed += Timer_Elapsed; timer.Start(); }