Ejemplo n.º 1
0
        private async void OpenSubFile(StorageFile file)
        {
            if (file != null)
            {
                using (var stream = await file.OpenReadAsync())
                //using (var streamReader = new StreamReader(stream.AsStreamForRead(), true))
                //{
                //    _openedFile = file;

                //    var content = await streamReader.ReadToEndAsync().ConfigureAwait(true);
                //    SubRipParser subRipParser = new SubRipParser();
                //    Subtitle = subRipParser.LoadFromString(content);
                //    DialoguesViewModel.LoadSubtitle(Subtitle);
                //    //修改选中编码
                //    EncodingsBox.SelectedItem = streamReader.CurrentEncoding.EncodingName;
                //}
                {
                    _openedFile = file;
                    SubRipParser subRipParser = new SubRipParser();
                    Subtitle = subRipParser.LoadFromStream(stream.AsStream(), Encoding.UTF8);
                    DialoguesViewModel.LoadSubtitle(Subtitle);
                    //修改选中编码
                    //EncodingsBox.SelectedItem = streamReader.CurrentEncoding.EncodingName;
                }

                OperationRecorderViewModel.LoadRecorder(DialoguesViewModel.OperationRecorder);
            }
        }
Ejemplo n.º 2
0
 public MainPage()
 {
     this.InitializeComponent();
     mediaPlayer.MediaOpened += MediaPlayer_MediaOpenedAsync;
     DialoguesViewModel.LoadSubtitle(Subtitle);
     OperationRecorderViewModel.LoadRecorder(DialoguesViewModel.OperationRecorder);
     OperationRecorderViewModel.PropertyChanged += OperationRecorderViewModel_PropertyChanged;
 }