Exemplo n.º 1
0
        private async void Button_Click(object sender, RoutedEventArgs e)
        {
            var dialog = new OpenFileDialog();

#if DEBUG
            //懒得翻
            //dialog.InitialDirectory = @"G:\SBTest";
#endif
            //dialog.InitialDirectory = System.IO.Path.GetFullPath(@".");
            dialog.Title  = "选择一个SB文件";
            dialog.Filter = "支持的文件(*.osu;*.osb)|*.osu;*.osb|All files (*.*)|*.*";
            var result = dialog.ShowDialog();
            var path   = dialog.FileName;

            if (result == true && File.Exists(path))
            {
                MyStoryboardPlayer.InitializePlayer += OnMyStoryboardPlayerOnInitializePlayer;
                await MyStoryboardPlayer.SwitchStoryboard(path, true);

                var current_time = MyStoryboardPlayer.SourcePlayer.Length;

                var span = TimeSpan.FromMilliseconds(current_time);

                //Dispatcher.Invoke(() =>
                //{
                CurrentPlayingText = Path.GetDirectoryName(path);
                PlaybackLength     = $"{span.TotalMinutes:F0}:{span.Seconds:F0}";
                //});
            }
        }
Exemplo n.º 2
0
 private void Window_Loaded(object sender, RoutedEventArgs e)
 {
     MyStoryboardPlayer.SetPlayer(new NAudioMusicPlayer());
 }