public MainWindow() { InitializeComponent(); this.Width = Core.Util.Preferences.Default.MainWidth; this.Height = Core.Util.Preferences.Default.MainHeight; this.WindowState = Core.Util.Preferences.Default.MainMaximized ? WindowState.Maximized : WindowState.Normal; ThemeManager.LoadTheme(); // TODO : move to program entry point progVM = this.Resources["progVM"] as ProgressBarViewModel; progVM.Subscribe(DocManager.Inst); progVM.Foreground = ThemeManager.NoteFillBrushes[0]; this.CloseButtonClicked += (o, e) => { CmdExit(); }; CompositionTargetEx.FrameUpdating += RenderLoop; viewScaler.Max = UIConstants.TrackMaxHeight; viewScaler.Min = UIConstants.TrackMinHeight; viewScaler.Value = UIConstants.TrackDefaultHeight; trackVM = this.Resources["tracksVM"] as TracksViewModel; trackVM.TimelineCanvas = this.timelineCanvas; trackVM.TrackCanvas = this.trackCanvas; trackVM.HeaderCanvas = this.headerCanvas; trackVM.Subscribe(DocManager.Inst); CmdNewFile(); initialized = true; }
public MainWindow() { InitializeComponent(); this.Width = Core.Util.Preferences.Default.MainWidth; this.Height = Core.Util.Preferences.Default.MainHeight; this.WindowState = Core.Util.Preferences.Default.MainMaximized ? WindowState.Maximized : WindowState.Normal; ThemeManager.LoadTheme(); // TODO : move to program entry point progVM = this.Resources["progVM"] as ProgressBarViewModel; progVM.Subscribe(DocManager.Inst); progVM.Foreground = ThemeManager.NoteFillBrushes[0]; this.CloseButtonClicked += (o, e) => { CmdExit(); }; CompositionTargetEx.FrameUpdating += RenderLoop; viewScaler.Max = UIConstants.TrackMaxHeight; viewScaler.Min = UIConstants.TrackMinHeight; viewScaler.Value = UIConstants.TrackDefaultHeight; trackVM = this.Resources["tracksVM"] as TracksViewModel; trackVM.TimelineCanvas = this.timelineCanvas; trackVM.TrackCanvas = this.trackCanvas; trackVM.HeaderCanvas = this.headerCanvas; trackVM.Subscribe(DocManager.Inst); CmdNewFile(); if (UpdateChecker.Check()) { var menuItem = new MenuItem() { Header = (string)FindResource("menu.updateavail"), Foreground = ThemeManager.WhiteKeyNameBrushNormal, }; menuItem.Click += (sender, e) => { System.Diagnostics.Process.Start("https://github.com/stakira/OpenUtau"); }; mainMenu.Items.Add(menuItem); } }