コード例 #1
0
 public void SetUp()
 {
     _settings = new DataSource
         {
             Id = Guid.NewGuid()
         };
     _merged = new MergedDataSource(_scheduler, _settings);
 }
コード例 #2
0
        public void TestAddGroup1()
        {
            var settings = new DataSourceSettings();

            using (var dataSources = new Tailviewer.BusinessLogic.DataSources.DataSources(_logSourceFactory, _scheduler, _filesystem, settings, _bookmarks.Object))
            {
                MergedDataSource group = dataSources.AddGroup();
                group.Should().NotBeNull();
                group.Settings.Should().NotBeNull();
                settings.Should().Equal(group.Settings);
            }
        }
コード例 #3
0
ファイル: DataSourcesTest.cs プロジェクト: tr00p3r/Tailviewer
        public void TestAddGroup1()
        {
            var settings = new Tailviewer.Settings.DataSources();

            using (var dataSources = new Tailviewer.BusinessLogic.DataSources.DataSources(_logFileFactory, _scheduler, settings))
            {
                MergedDataSource group = dataSources.AddGroup();
                group.Should().NotBeNull();
                group.Settings.Should().NotBeNull();
                settings.Should().Equal(group.Settings);
            }
        }
コード例 #4
0
 public void SetUp()
 {
     _taskScheduler  = new ManualTaskScheduler();
     _logFileFactory = new PluginLogFileFactory(_taskScheduler);
     _settings       = new DataSource
     {
         Id = DataSourceId.CreateNew(),
         MergedDataSourceDisplayMode = DataSourceDisplayMode.CharacterCode
     };
     _merged = new MergedDataSource(_taskScheduler, _settings, TimeSpan.Zero)
     {
         IsSingleLine = true
     };
 }
コード例 #5
0
        public MergedDataSourceViewModel(MergedDataSource dataSource, IActionCenter actionCenter)
            : base(dataSource)
        {
            if (actionCenter == null)
            {
                throw new ArgumentNullException(nameof(actionCenter));
            }

            _actionCenter          = actionCenter;
            _dataSource            = dataSource;
            _observable            = new ObservableCollection <IDataSourceViewModel>();
            _openInExplorerCommand = new DelegateCommand(OpenInExplorer);
            Update();
        }
コード例 #6
0
        private void Drag(IDataSourceViewModel source, IDataSourceViewModel dest)
        {
            var merged = dest as MergedDataSourceViewModel;

            if (merged != null)
            {
                // Drag from ungrouped onto an existing group
                // => add to existing group
                AddFileToGroup(source, merged);
                SelectedItem = merged;
            }
            else
            {
                // Drag from ungrouped onto a dest within a group
                // => find group of dest and addd to it
                merged = dest.Parent as MergedDataSourceViewModel;
                if (merged != null)
                {
                    AddFileToGroup(source, merged);
                    SelectedItem = merged;
                }
                else
                {
                    // Drag from ungrouped onto another ungrouped source
                    // => remove dest as well and create new group
                    int destIndex = _observable.IndexOf(dest);
                    if (destIndex != -1)
                    {
                        _observable.Remove(dest);

                        MergedDataSource mergedDataSource = _dataSources.AddGroup();
                        merged         = new MergedDataSourceViewModel(mergedDataSource, _actionCenter, _settings);
                        merged.Remove += OnRemove;
                        merged.AddChild(source);
                        merged.AddChild(dest);
                        _observable.Insert(destIndex, merged);
                        _allDataSourceViewModels.Add(merged);
                        SelectedItem = merged;
                    }
                }
            }
        }
コード例 #7
0
        public void TestAddGroup2()
        {
            MergedDataSource group = _dataSources.AddGroup();

            group.Id.Should().NotBe(Guid.Empty);
        }
コード例 #8
0
 public MergedDataSourceViewModel(MergedDataSource dataSource)
     : base(dataSource)
 {
     _dataSource = dataSource;
     _observable = new ObservableCollection<IDataSourceViewModel>();
 }
コード例 #9
0
 private MergedDataSourceViewModel CreateMergedViewModel(MergedDataSource dataSource)
 {
     return(new MergedDataSourceViewModel(dataSource, _actionCenter.Object, _applicationSettings.Object));
 }