public override void TestSetup()
        {
            base.TestSetup();

            SessionFileBase.PreventGettingMediaFileDurationsUsingDirectX = true;
            _viewModel = new NewSessionsFromFileDlgViewModel();
            _viewModel.WaitForAsyncFileLoadingToFinish = true;
        }
Exemplo n.º 2
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        ///
        /// </summary>
        /// ------------------------------------------------------------------------------------
        public NewSessionsFromFilesDlg(NewSessionsFromFileDlgViewModel viewModel)
        {
            InitializeComponent();

            _instructionsLabel.Text = string.Format(_instructionsLabel.Text, Application.ProductName);
            _progressPanel.Visible  = false;

            _noFilesSelectedCreateButtonText = LocalizationManager.LocalizeString(
                "NewSessionsFromFilesDlg.NoFilesSelectedCreateButtonText",
                "Create Sessions", "Text in create button when no files are selected.",
                "Dialog Boxes", LocalizationCategory.Button, LocalizationPriority.High);

            _filesSelectedCreateButtonText = LocalizationManager.LocalizeString(
                "NewSessionsFromFilesDlg.FilesSelectedCreateButtonText",
                "Create {0} Sessions", "Format text in create button when one or more files are selected.",
                "Dialog Boxes", LocalizationCategory.Button, LocalizationPriority.High);

            var rc = Settings.Default.NewSessionsFromFilesDlgBounds;

            if (rc.Height < 0)
            {
                StartPosition = FormStartPosition.CenterScreen;
            }
            else
            {
                Bounds = rc;
            }

            Sponge.SetGridColumnWidthsFromString(_filesGrid,
                                                 Settings.Default.NewSessionsFromFilesDlgCols);

            _folderMissingMsgCtrl = new NewSessionsFromFilesDlgFolderNotFoundMsg();
            _filesPanel.Controls.Add(_folderMissingMsgCtrl);
            _folderMissingMsgCtrl.BringToFront();

            _mediaPlayerPanel.BorderStyle = BorderStyle.None;

#if !MONO
            _winMediaPlayer = new AxWindowsMediaPlayer();
            ((ISupportInitialize)(_winMediaPlayer)).BeginInit();
            _winMediaPlayer.Dock = DockStyle.Fill;
            _winMediaPlayer.Name = "_winMediaPlayer";
            _mediaPlayerPanel.Controls.Add(_winMediaPlayer);
            ((ISupportInitialize)(_winMediaPlayer)).EndInit();
            _winMediaPlayer.settings.autoStart = false;
#endif

            DialogResult = DialogResult.Cancel;
            new CheckBoxColumnHeaderHandler(_selectedCol);
            _viewModel = viewModel;
        }
 public void GetSourceAndDestinationPairs_UnselectedFileIsIgnored()
 {
     using (var temp = new TempFile())
     {
         //var path = _mainAppFldr.Combine("dog.wav");
         //File.CreateText(path).Close();
         var sessionFile = new NewSessionFile(temp.Path);
         sessionFile.Selected = false;
         using (var model = new NewSessionsFromFileDlgViewModel())
         {
             model.Files.Add(sessionFile);
             Assert.AreEqual(0, model.GetSourceAndDestinationPairs().Count());
         }
     }
 }
        public void CreateSingleSession_SetsFirstNewSessionAddedProperly()
        {
            InitProject();            //todo: remove this when CreateSingleSession no longer uses a static

            using (var one = new TempFile())
                using (var two = new TempFile())
                {
                    using (var model = new NewSessionsFromFileDlgViewModel())
                    {
                        Assert.IsNull(model.FirstNewSessionAdded);
                        model.CreateSingleSession(one.Path);
                        model.CreateSingleSession(two.Path);
                        Assert.AreEqual(Path.GetFileNameWithoutExtension(one.Path), model.FirstNewSessionAdded);
                    }
                }
        }