public LyricWindow(MainWindow mainWindow) : this() { _mainWindow = mainWindow; InitializeComponent(); ViewModel = (LyricWindowViewModel)DataContext; MainWindowViewModel.Current.LyricWindowViewModel = ViewModel; //var fi = new FileInfo(Path.Combine(Domain.ExtensionPath, "font", "default.ttc")); //if (!fi.Exists) // _fontFamily = new FontFamily("等线"); //else //{ // var pfc = new PrivateFontCollection(); // pfc.AddFontFile(fi.FullName); // _fontFamily = pfc.Families[0]; //} CompositionTarget.Rendering += OnRendering; Left = 0; Top = SystemParameters.WorkArea.Height - Height - 20; Width = SystemParameters.PrimaryScreenWidth; MouseMove += LyricWindow_MouseMove; MouseLeave += LyricWindow_MouseLeave; }
public LyricWindow(MainWindow mainWindow) { _mainWindow = mainWindow; InitializeComponent(); ViewModel = (LyricWindowViewModel)DataContext; ViewModel.Player = PlayerViewModel.Current; FileInfo fi = new FileInfo(Path.Combine(Domain.ExternalPath, "font", "default.ttc")); if (!fi.Exists) { _fontFamily = new FontFamily("等线"); } else { PrivateFontCollection pfc = new PrivateFontCollection(); pfc.AddFontFile(fi.FullName); _fontFamily = pfc.Families[0]; } CompositionTarget.Rendering += OnRendering; Left = 0; Top = SystemParameters.WorkArea.Height - Height - 20; Width = SystemParameters.PrimaryScreenWidth; this.MouseMove += LyricWindow_MouseMove; this.MouseLeave += LyricWindow_MouseLeave; //this.Loaded += (sender, e) => //{ //}; }