Example #1
0
        public MergedDataSourceViewModel(IMergedDataSource dataSource,
                                         IActionCenter actionCenter,
                                         IApplicationSettings applicationSettings)
            : base(dataSource, actionCenter, applicationSettings)
        {
            if (actionCenter == null)
            {
                throw new ArgumentNullException(nameof(actionCenter));
            }

            _actionCenter = actionCenter;
            _dataSource   = dataSource;
            _observable   = new ObservableCollection <IDataSourceViewModel>();

            AddFileMenuItems(new []
            {
                new CommandMenuViewModel(new DelegateCommand2(OpenInExplorer))
                {
                    Header  = "Open Containing Folder(s)",
                    ToolTip = "Opens the Folder(s) of the Child Data sources"
                }
            });
            AddViewMenuItems(new[]
            {
                new ToggleMenuViewModel(DisplayMode == DataSourceDisplayMode.Filename, OnToggleShowFileNames)
                {
                    Header  = "Show source name",
                    ToolTip = "Toggles between showing the full name of the data source or a character code representing the original data source"
                }
            });
            SetContextMenuItems(new IMenuViewModel[] { new IncludeAllInGroupViewModel(this), new ExcludeAllInGroupViewModel(this) });
            Update();
        }
Example #2
0
 public static void AddRange(this IActionCenter actionCenter, IEnumerable <INotification> notifications)
 {
     foreach (var notification in notifications)
     {
         actionCenter.Add(notification);
     }
 }
 internal ClientController(
     IActionCenter actionCenter,
     IApplicationMonitor applicationMonitor,
     ClientContext context,
     IDisplayMonitor displayMonitor,
     IExplorerShell explorerShell,
     IFileSystemDialog fileSystemDialog,
     IHashAlgorithm hashAlgorithm,
     ILogger logger,
     IMessageBox messageBox,
     IOperationSequence operations,
     IRuntimeProxy runtime,
     Action shutdown,
     ISplashScreen splashScreen,
     ITaskbar taskbar,
     IText text,
     IUserInterfaceFactory uiFactory)
 {
     this.actionCenter       = actionCenter;
     this.applicationMonitor = applicationMonitor;
     this.context            = context;
     this.displayMonitor     = displayMonitor;
     this.explorerShell      = explorerShell;
     this.fileSystemDialog   = fileSystemDialog;
     this.hashAlgorithm      = hashAlgorithm;
     this.logger             = logger;
     this.messageBox         = messageBox;
     this.operations         = operations;
     this.runtime            = runtime;
     this.shutdown           = shutdown;
     this.splashScreen       = splashScreen;
     this.taskbar            = taskbar;
     this.text      = text;
     this.uiFactory = uiFactory;
 }
        public FileDataSourceViewModel(IFileDataSource dataSource,
                                       IActionCenter actionCenter,
                                       IApplicationSettings applicationSettings)
            : base(dataSource, actionCenter, applicationSettings)
        {
            _actionCenter = actionCenter ?? throw new ArgumentNullException(nameof(actionCenter));
            _dataSource   = dataSource;
            _fileName     = Path.GetFileName(dataSource.FullFileName);
            _canBeRemoved = true;

            Update();
            UpdateFolder();

            AddFileMenuItems(new []
            {
                new CommandMenuViewModel(new DelegateCommand2(OpenInExplorer))
                {
                    Header  = "Open Containing Folder",
                    ToolTip = "Opens Folder the current Data Source is contained in"
                }
            });

            UpdateDisplayNoTimestampCount();
            PropertyChanged += OnPropertyChanged;
        }
Example #5
0
        public FolderDataSourceViewModel(IFolderDataSource folder,
                                         IActionCenter actionCenter,
                                         IApplicationSettings applicationSettings)
            : base(folder, actionCenter, applicationSettings)
        {
            _dataSource = folder;
            var path = folder.LogFileFolderPath;

            if (!string.IsNullOrEmpty(path))
            {
                _displayName = Path.GetFileName(path);
            }
            _folderPath    = folder.LogFileFolderPath;
            _searchPattern = folder.LogFileSearchPattern;
            _recursive     = folder.Recursive;

            _actionCenter = actionCenter;
            _settings     = applicationSettings;
            _dataSourceViewModelsByDataSource = new Dictionary <IDataSource, IDataSourceViewModel>();
            _dataSourceViewModels             = new ObservableCollection <IDataSourceViewModel>();

            AddFileMenuItems(new []
            {
                new CommandMenuViewModel(new DelegateCommand2(OpenInExplorer))
                {
                    Header  = "Open Containing Folder",
                    ToolTip = "Opens the Folder being watched in Windows Explorer"
                }
            });
            SetContextMenuItems(new IMenuViewModel[] { new IncludeAllInGroupViewModel(this), new ExcludeAllInGroupViewModel(this) });

            UpdateFileReport();
        }
 public ShellOperation(
     IActionCenter actionCenter,
     IAudio audio,
     INotificationInfo aboutInfo,
     INotificationController aboutController,
     ClientContext context,
     IKeyboard keyboard,
     ILogger logger,
     INotificationInfo logInfo,
     INotificationController logController,
     IPowerSupply powerSupply,
     ISystemInfo systemInfo,
     ITaskbar taskbar,
     ITaskview taskview,
     IText text,
     IUserInterfaceFactory uiFactory,
     IWirelessAdapter wirelessAdapter) : base(context)
 {
     this.aboutInfo       = aboutInfo;
     this.aboutController = aboutController;
     this.actionCenter    = actionCenter;
     this.audio           = audio;
     this.keyboard        = keyboard;
     this.logger          = logger;
     this.logInfo         = logInfo;
     this.logController   = logController;
     this.powerSupply     = powerSupply;
     this.systemInfo      = systemInfo;
     this.text            = text;
     this.taskbar         = taskbar;
     this.taskview        = taskview;
     this.uiFactory       = uiFactory;
     this.wirelessAdapter = wirelessAdapter;
 }
Example #7
0
        public LogViewerViewModel(IDataSourceViewModel dataSource,
                                  IActionCenter actionCenter,
                                  IApplicationSettings applicationSettings,
                                  TimeSpan maximumWaitTime)
        {
            if (dataSource == null)
            {
                throw new ArgumentNullException(nameof(dataSource));
            }
            if (actionCenter == null)
            {
                throw new ArgumentNullException(nameof(actionCenter));
            }
            if (applicationSettings == null)
            {
                throw new ArgumentNullException(nameof(applicationSettings));
            }

            _actionCenter        = actionCenter;
            _applicationSettings = applicationSettings;
            _maximumWaitTime     = maximumWaitTime;
            _dataSource          = dataSource;

            _pendingSections = new List <KeyValuePair <ILogFile, LogFileSection> >();

            LogFile = _dataSource.DataSource.FilteredLogFile;
            LogFile.AddListener(this, _maximumWaitTime, 1000);
            Search = _dataSource.DataSource.Search;

            UpdateCounts();
        }
        public DataSourcesViewModel(IApplicationSettings settings, IDataSources dataSources, IActionCenter actionCenter)
        {
            if (settings == null) throw new ArgumentNullException(nameof(settings));
            if (dataSources == null) throw new ArgumentNullException(nameof(dataSources));
            if (actionCenter == null) throw  new ArgumentNullException(nameof(actionCenter));

            _actionCenter = actionCenter;
            _settings = settings;
            _observable = new ObservableCollection<IDataSourceViewModel>();
            _allDataSourceViewModels = new List<IDataSourceViewModel>();
            _addDataSourceCommand = new DelegateCommand(AddDataSource);
            _dataSources = dataSources;
            foreach (IDataSource dataSource in dataSources.Sources)
            {
                if (dataSource.ParentId == DataSourceId.Empty)
                {
                    Add(dataSource);
                }
            }

            foreach (IDataSource dataSource in dataSources.Sources)
            {
                DataSourceId parentId = dataSource.ParentId;
                if (parentId != DataSourceId.Empty)
                {
                    IDataSourceViewModel parent = _observable.First(x => x.DataSource.Id == parentId);
                    var group = (MergedDataSourceViewModel) parent;
                    IDataSourceViewModel viewModel = CreateViewModel(dataSource);
                    group.AddChild(viewModel);
                }
            }

            UpdateTooltip();
            PropertyChanged += OnPropertyChanged;
        }
 public ClientController(
     IActionCenter actionCenter,
     IDisplayMonitor displayMonitor,
     IExplorerShell explorerShell,
     IHashAlgorithm hashAlgorithm,
     ILogger logger,
     IMessageBox messageBox,
     IOperationSequence operations,
     IProcessMonitor processMonitor,
     IRuntimeProxy runtime,
     Action shutdown,
     ITaskbar taskbar,
     ITerminationActivator terminationActivator,
     IText text,
     IUserInterfaceFactory uiFactory,
     IWindowMonitor windowMonitor)
 {
     this.actionCenter         = actionCenter;
     this.displayMonitor       = displayMonitor;
     this.explorerShell        = explorerShell;
     this.hashAlgorithm        = hashAlgorithm;
     this.logger               = logger;
     this.messageBox           = messageBox;
     this.operations           = operations;
     this.processMonitor       = processMonitor;
     this.runtime              = runtime;
     this.shutdown             = shutdown;
     this.taskbar              = taskbar;
     this.terminationActivator = terminationActivator;
     this.text          = text;
     this.uiFactory     = uiFactory;
     this.windowMonitor = windowMonitor;
 }
Example #10
0
 public ServerOperation(
     IActionCenter actionCenter,
     ClientContext context,
     ILogger logger,
     IServerProxy server,
     ITaskbar taskbar) : base(context)
 {
     this.actionCenter = actionCenter;
     this.logger       = logger;
     this.server       = server;
     this.taskbar      = taskbar;
 }
Example #11
0
        public AutoUpdater(IActionCenter actionCenter, AutoUpdateSettings settings)
        {
            if (actionCenter == null)
                throw new ArgumentNullException("actionCenter");
            if (settings == null)
                throw new ArgumentNullException("settings");

            _syncRoot = new object();
            _actionCenter = actionCenter;
            _settings = settings;
            _latestVersionChanged = new List<Action<VersionInfo>>();
        }
Example #12
0
 public BrowserOperation(
     IActionCenter actionCenter,
     IApplication browser,
     ILogger logger,
     ITaskbar taskbar,
     IUserInterfaceFactory uiFactory)
 {
     this.actionCenter = actionCenter;
     this.browser      = browser;
     this.logger       = logger;
     this.taskbar      = taskbar;
     this.uiFactory    = uiFactory;
 }
Example #13
0
 public BrowserOperation(
     IActionCenter actionCenter,
     ClientContext context,
     ILogger logger,
     ITaskbar taskbar,
     ITaskview taskview,
     IUserInterfaceFactory uiFactory) : base(context)
 {
     this.actionCenter = actionCenter;
     this.logger       = logger;
     this.taskbar      = taskbar;
     this.taskview     = taskview;
     this.uiFactory    = uiFactory;
 }
        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();
        }
        public LogViewMainPanelViewModel(IServiceContainer services,
                                         IActionCenter actionCenter,
                                         IDataSources dataSources,
                                         IQuickFilters quickFilters,
                                         IHighlighters highlighters,
                                         IApplicationSettings applicationSettings)
            : base(applicationSettings)
        {
            if (actionCenter == null)
            {
                throw new ArgumentNullException(nameof(actionCenter));
            }

            _applicationSettings = applicationSettings;
            _actionCenter        = actionCenter;

            _dataSources = new DataSourcesViewModel(applicationSettings, dataSources, _actionCenter);
            _dataSources.PropertyChanged += DataSourcesOnPropertyChanged;
            _quickFilters = new QuickFiltersSidePanelViewModel(applicationSettings, quickFilters);
            _quickFilters.OnFiltersChanged += OnFiltersChanged;

            _highlighters = new HighlightersSidePanelViewModel(highlighters);

            _goToLine = new GoToLineViewModel();
            _goToLine.LineNumberChosen += GoToLineOnLineNumberChosen;

            _quickNavigation = new QuickNavigationViewModel(dataSources);
            _quickNavigation.DataSourceChosen += QuickNavigationOnDataSourceChosen;

            _bookmarks = new BookmarksViewModel(dataSources, OnNavigateToBookmark);
            _outline   = new OutlineSidePanelViewModel(services);
            _issues    = new IssuesSidePanelViewModel(services);

            _sidePanels = new ISidePanelViewModel[]
            {
                _dataSources,
                _quickFilters,
                //_highlighters,
                _bookmarks,
                _outline,
                _issues
            };

            SelectedSidePanel = _sidePanels.FirstOrDefault(x => x.Id == _applicationSettings.MainWindow?.SelectedSidePanel);

            PropertyChanged += OnPropertyChanged;
            ChangeDataSource(CurrentDataSource);
        }
Example #16
0
        public AutoUpdater(IActionCenter actionCenter, IAutoUpdateSettings settings)
        {
            if (actionCenter == null)
            {
                throw new ArgumentNullException(nameof(actionCenter));
            }
            if (settings == null)
            {
                throw new ArgumentNullException(nameof(settings));
            }

            _syncRoot             = new object();
            _actionCenter         = actionCenter;
            _settings             = settings;
            _latestVersionChanged = new List <Action <VersionInfo> >();
        }
 public ProctoringOperation(
     IActionCenter actionCenter,
     ClientContext context,
     IProctoringController controller,
     ILogger logger,
     INotification notification,
     ITaskbar taskbar,
     IUserInterfaceFactory uiFactory) : base(context)
 {
     this.actionCenter = actionCenter;
     this.controller   = controller;
     this.logger       = logger;
     this.notification = notification;
     this.taskbar      = taskbar;
     this.uiFactory    = uiFactory;
 }
        public DataSourcesViewModel(IApplicationSettings settings, IDataSources dataSources, IActionCenter actionCenter)
        {
            _actionCenter                   = actionCenter ?? throw new ArgumentNullException(nameof(actionCenter));
            _settings                       = settings ?? throw new ArgumentNullException(nameof(settings));
            _observable                     = new ObservableCollection <IDataSourceViewModel>();
            _allDataSourceViewModels        = new List <IDataSourceViewModel>();
            _dataSources                    = dataSources ?? throw new ArgumentNullException(nameof(dataSources));
            _removeCurrentDataSourceCommand = new DelegateCommand2(CloseSelectedDataSource);
            _removeAllDataSourcesCommand    = new DelegateCommand2(CloseAllDataSources);

            foreach (IDataSource dataSource in dataSources.Sources)
            {
                if (dataSource.ParentId == DataSourceId.Empty)
                {
                    Add(dataSource);
                }
            }

            foreach (IDataSource dataSource in dataSources.Sources)
            {
                DataSourceId parentId = dataSource.ParentId;
                if (parentId != DataSourceId.Empty)
                {
                    IDataSourceViewModel parent = _observable.First(x => x.DataSource.Id == parentId);
                    var group = (MergedDataSourceViewModel)parent;
                    IDataSourceViewModel viewModel = CreateViewModel(dataSource);
                    group.AddChild(viewModel);
                }
            }

            //_customDataSources =
            //	_dataSources.CustomDataSources.Select(x => new AddCustomDataSourceViewModel(x.DisplayName, () => AddCustomDataSource(x.Id))).ToList();

            // We need to make sure that if we construct this view model *and* the data sources panel is supposed
            // to be pinned, then we also need to make sure the toggle button is checked as otherwise nothing
            // is showing up.
            IsPinned = _settings.DataSources.IsPinned;
            if (IsPinned)
            {
                IsChecked = true;
            }

            UpdateTooltip();
            UpdateRemoveCommands();

            PropertyChanged += OnPropertyChanged;
        }
        public ActionCenterViewModel(IDispatcher dispatcher, IActionCenter actionCenter)
        {
            if (dispatcher == null)
                throw new ArgumentNullException("dispatcher");
            if (actionCenter == null)
                throw new ArgumentNullException("actionCenter");

            _dispatcher = dispatcher;
            _notifications = new ObservableCollection<INotificationViewModel>();

            _actionCenter = actionCenter;
            _actionCenter.NotificationAdded += ActionCenterOnNotificationAdded;
            foreach (var notification in actionCenter.Notifications)
            {
                AddNotification(notification);
            }
        }
Example #20
0
        public SingleDataSourceViewModel(ISingleDataSource dataSource,
                                         IActionCenter actionCenter)
            : base(dataSource)
        {
            if (actionCenter == null)
            {
                throw new ArgumentNullException(nameof(actionCenter));
            }

            _actionCenter          = actionCenter;
            _dataSource            = dataSource;
            _fileName              = Path.GetFileName(dataSource.FullFileName);
            _folder                = Path.GetDirectoryName(dataSource.FullFileName);
            _openInExplorerCommand = new DelegateCommand(OpenInExplorer);
            Update();

            UpdateDisplayNoTimestampCount();
            PropertyChanged += OnPropertyChanged;
        }
        public FolderDataSourceViewModel(IFolderDataSource folder, IActionCenter actionCenter)
            : base(folder)
        {
            _dataSource = folder;
            var path = folder.LogFileFolderPath;

            if (!string.IsNullOrEmpty(path))
            {
                _displayName = Path.GetFileName(path);
            }
            _folderPath    = folder.LogFileFolderPath;
            _searchPattern = folder.LogFileSearchPattern;
            _recursive     = folder.Recursive;

            _actionCenter = actionCenter;
            _dataSourceViewModelsByDataSource = new Dictionary <IDataSource, IDataSourceViewModel>();
            _dataSourceViewModels             = new ObservableCollection <IDataSourceViewModel>();

            UpdateFileReport();
        }
        public ActionCenterViewModel(IDispatcher dispatcher, IActionCenter actionCenter)
        {
            if (dispatcher == null)
            {
                throw new ArgumentNullException(nameof(dispatcher));
            }
            if (actionCenter == null)
            {
                throw new ArgumentNullException(nameof(actionCenter));
            }

            _dispatcher    = dispatcher;
            _notifications = new ObservableCollection <INotificationViewModel>();

            _actionCenter = actionCenter;
            _actionCenter.NotificationAdded += ActionCenterOnNotificationAdded;
            foreach (var notification in actionCenter.Notifications)
            {
                AddNotification(notification);
            }
        }
 public ShellOperation(
     IActionCenter actionCenter,
     IEnumerable <IActionCenterActivator> activators,
     ActionCenterSettings actionCenterSettings,
     IAudio audio,
     INotificationInfo aboutInfo,
     INotificationController aboutController,
     IKeyboard keyboard,
     ILogger logger,
     INotificationInfo logInfo,
     INotificationController logController,
     IPowerSupply powerSupply,
     ISystemInfo systemInfo,
     ITaskbar taskbar,
     TaskbarSettings taskbarSettings,
     ITerminationActivator terminationActivator,
     IText text,
     IUserInterfaceFactory uiFactory,
     IWirelessAdapter wirelessAdapter)
 {
     this.aboutInfo            = aboutInfo;
     this.aboutController      = aboutController;
     this.actionCenter         = actionCenter;
     this.activators           = activators;
     this.actionCenterSettings = actionCenterSettings;
     this.audio                = audio;
     this.keyboard             = keyboard;
     this.logger               = logger;
     this.logInfo              = logInfo;
     this.logController        = logController;
     this.powerSupply          = powerSupply;
     this.systemInfo           = systemInfo;
     this.taskbarSettings      = taskbarSettings;
     this.terminationActivator = terminationActivator;
     this.text            = text;
     this.taskbar         = taskbar;
     this.uiFactory       = uiFactory;
     this.wirelessAdapter = wirelessAdapter;
 }
Example #24
0
 public ShellOperation(
     IActionCenter actionCenter,
     IEnumerable <IActionCenterActivator> activators,
     ActionCenterSettings actionCenterSettings,
     ILogger logger,
     INotificationInfo aboutInfo,
     INotificationController aboutController,
     INotificationInfo logInfo,
     INotificationController logController,
     ISystemComponent <ISystemKeyboardLayoutControl> keyboardLayout,
     ISystemComponent <ISystemPowerSupplyControl> powerSupply,
     ISystemComponent <ISystemWirelessNetworkControl> wirelessNetwork,
     ISystemInfo systemInfo,
     ITaskbar taskbar,
     TaskbarSettings taskbarSettings,
     ITerminationActivator terminationActivator,
     IText text,
     IUserInterfaceFactory uiFactory)
 {
     this.aboutInfo            = aboutInfo;
     this.aboutController      = aboutController;
     this.actionCenter         = actionCenter;
     this.activators           = activators;
     this.actionCenterSettings = actionCenterSettings;
     this.logger               = logger;
     this.logInfo              = logInfo;
     this.logController        = logController;
     this.keyboardLayout       = keyboardLayout;
     this.powerSupply          = powerSupply;
     this.systemInfo           = systemInfo;
     this.taskbarSettings      = taskbarSettings;
     this.terminationActivator = terminationActivator;
     this.text            = text;
     this.taskbar         = taskbar;
     this.uiFactory       = uiFactory;
     this.wirelessNetwork = wirelessNetwork;
 }
        public MainWindowViewModel(ApplicationSettings settings,
		                           DataSources dataSources,
		                           QuickFilters quickFilters,
		                           IActionCenter actionCenter,
		                           IAutoUpdater updater,
		                           IDispatcher dispatcher)
        {
            if (dataSources == null) throw new ArgumentNullException("dataSources");
            if (quickFilters == null) throw new ArgumentNullException("quickFilters");
            if (updater == null) throw new ArgumentNullException("updater");
            if (dispatcher == null) throw new ArgumentNullException("dispatcher");

            _dataSourcesViewModel = new DataSourcesViewModel(settings, dataSources);
            _dataSourcesViewModel.PropertyChanged += DataSourcesViewModelOnPropertyChanged;
            _quickFilters = new QuickFiltersViewModel(settings, quickFilters);
            _quickFilters.OnFiltersChanged += OnQuickFiltersChanged;
            _settings = new SettingsViewModel(settings);
            _actionCenter = new ActionCenterViewModel(dispatcher, actionCenter);

            _timer = new DispatcherTimer
                {
                    Interval = TimeSpan.FromMilliseconds(100)
                };
            _timer.Tick += TimerOnTick;
            _timer.Start();

            _autoUpdater = new AutoUpdateViewModel(updater, settings.AutoUpdate, dispatcher);

            _dispatcher = dispatcher;
            WindowTitle = Constants.MainWindowTitle;

            _selectNextDataSourceCommand = new DelegateCommand(SelectNextDataSource);
            _selectPreviousDataSourceCommand = new DelegateCommand(SelectPreviousDataSource);
            _addDataSourceCommand = new DelegateCommand(AddDataSource);

            ChangeDataSource(CurrentDataSource);
        }
        internal void BuildObjectGraph(Action shutdown)
        {
            ValidateCommandLineArguments();

            InitializeLogging();
            InitializeText();

            context       = new ClientContext();
            uiFactory     = BuildUserInterfaceFactory();
            actionCenter  = uiFactory.CreateActionCenter();
            messageBox    = BuildMessageBox();
            nativeMethods = new NativeMethods();
            runtimeProxy  = new RuntimeProxy(runtimeHostUri, new ProxyObjectFactory(), ModuleLogger(nameof(RuntimeProxy)), Interlocutor.Client);
            systemInfo    = new SystemInfo();
            taskbar       = uiFactory.CreateTaskbar(ModuleLogger("Taskbar"));
            taskview      = uiFactory.CreateTaskview();

            var processFactory     = new ProcessFactory(ModuleLogger(nameof(ProcessFactory)));
            var applicationMonitor = new ApplicationMonitor(TWO_SECONDS, ModuleLogger(nameof(ApplicationMonitor)), nativeMethods, processFactory);
            var applicationFactory = new ApplicationFactory(applicationMonitor, ModuleLogger(nameof(ApplicationFactory)), nativeMethods, processFactory);
            var displayMonitor     = new DisplayMonitor(ModuleLogger(nameof(DisplayMonitor)), nativeMethods, systemInfo);
            var explorerShell      = new ExplorerShell(ModuleLogger(nameof(ExplorerShell)), nativeMethods);
            var fileSystemDialog   = BuildFileSystemDialog();
            var hashAlgorithm      = new HashAlgorithm();
            var splashScreen       = uiFactory.CreateSplashScreen();

            var operations = new Queue <IOperation>();

            operations.Enqueue(new I18nOperation(logger, text));
            operations.Enqueue(new RuntimeConnectionOperation(context, logger, runtimeProxy, authenticationToken));
            operations.Enqueue(new ConfigurationOperation(context, logger, runtimeProxy));
            operations.Enqueue(new DelegateOperation(UpdateAppConfig));
            operations.Enqueue(new LazyInitializationOperation(BuildClientHostOperation));
            operations.Enqueue(new ClientHostDisconnectionOperation(context, logger, FIVE_SECONDS));
            operations.Enqueue(new LazyInitializationOperation(BuildKeyboardInterceptorOperation));
            operations.Enqueue(new LazyInitializationOperation(BuildMouseInterceptorOperation));
            operations.Enqueue(new ApplicationOperation(context, applicationFactory, applicationMonitor, logger, text));
            operations.Enqueue(new DisplayMonitorOperation(context, displayMonitor, logger, taskbar));
            operations.Enqueue(new LazyInitializationOperation(BuildShellOperation));
            operations.Enqueue(new LazyInitializationOperation(BuildBrowserOperation));
            operations.Enqueue(new ClipboardOperation(context, logger, nativeMethods));

            var sequence = new OperationSequence(logger, operations);

            ClientController = new ClientController(
                actionCenter,
                applicationMonitor,
                context,
                displayMonitor,
                explorerShell,
                fileSystemDialog,
                hashAlgorithm,
                logger,
                messageBox,
                sequence,
                runtimeProxy,
                shutdown,
                splashScreen,
                taskbar,
                text,
                uiFactory);
        }
Example #27
0
 public LogViewerViewModel(IDataSourceViewModel dataSource,
                           IActionCenter actionCenter,
                           IApplicationSettings applicationSettings)
     : this(dataSource, actionCenter, applicationSettings, TimeSpan.FromMilliseconds(10))
 {
 }
 public void Setup()
 {
     _dispatcher = new ManualDispatcher();
     _actionCenter = new Tailviewer.BusinessLogic.ActionCenter.ActionCenter();
     _viewModel = new ActionCenterViewModel(_dispatcher, _actionCenter);
 }
        public MainWindowViewModel(IApplicationSettings settings,
                                   DataSources dataSources,
                                   QuickFilters quickFilters,
                                   IActionCenter actionCenter,
                                   IAutoUpdater updater,
                                   ITaskScheduler taskScheduler,
                                   IAnalysisStorage analysisStorage,
                                   IDispatcher dispatcher,
                                   IPluginLoader pluginLoader)
        {
            if (dataSources == null)
            {
                throw new ArgumentNullException(nameof(dataSources));
            }
            if (quickFilters == null)
            {
                throw new ArgumentNullException(nameof(quickFilters));
            }
            if (updater == null)
            {
                throw new ArgumentNullException(nameof(updater));
            }
            if (dispatcher == null)
            {
                throw new ArgumentNullException(nameof(dispatcher));
            }

            _applicationSettings = settings;

            _plugins  = pluginLoader.Plugins;
            _settings = new SettingsMainPanelViewModel(settings);
            _actionCenterViewModel = new ActionCenterViewModel(dispatcher, actionCenter);

            _analysePanel = new AnalyseMainPanelViewModel(_applicationSettings, dataSources, dispatcher, taskScheduler, analysisStorage, pluginLoader);
            _analysePanel.PropertyChanged += AnalysePanelOnPropertyChanged;

            _logViewPanel = new LogViewMainPanelViewModel(actionCenter,
                                                          dataSources,
                                                          quickFilters,
                                                          _applicationSettings);
            _logViewPanel.PropertyChanged += LogViewPanelOnPropertyChanged;

            _timer = new DispatcherTimer
            {
                Interval = TimeSpan.FromMilliseconds(100)
            };
            _timer.Tick += TimerOnTick;
            _timer.Start();

            _autoUpdater                   = new AutoUpdateViewModel(updater, settings.AutoUpdate, dispatcher);
            _showLogCommand                = new DelegateCommand(ShowLog);
            _showGoToLineCommand           = new DelegateCommand2(ShowGoToLine);
            _showQuickNavigationCommand    = new DelegateCommand2(ShowQuickNavigation);
            _goToNextDataSourceCommand     = new DelegateCommand2(GoToNextDataSource);
            _goToPreviousDataSourceCommand = new DelegateCommand2(GoToPreviousDataSource);

            _analyseEntry = new AnalyseMainPanelEntry();
            _rawEntry     = new LogViewMainPanelEntry();
            _topEntries   = new IMainPanelEntry[]
            {
                _rawEntry,
                _analyseEntry
            };

            _settingsEntry = new SettingsMainPanelEntry();
            _pluginsEntry  = new PluginsMainPanelEntry();
            _aboutEntry    = new AboutMainPanelEntry();
            _bottomEntries = new[]
            {
                _settingsEntry,
                _pluginsEntry,
                _aboutEntry
            };

            var selectedTopEntry    = _topEntries.FirstOrDefault(x => x.Id == _applicationSettings.MainWindow.SelectedMainPanel);
            var selectedBottomEntry = _bottomEntries.FirstOrDefault(x => x.Id == _applicationSettings.MainWindow.SelectedMainPanel);

            if (selectedTopEntry != null)
            {
                SelectedTopEntry = selectedTopEntry;
            }
            else if (selectedBottomEntry != null)
            {
                SelectedBottomEntry = selectedBottomEntry;
            }
            else
            {
                SelectedTopEntry = _rawEntry;
            }
        }
Example #30
0
        public MainWindowViewModel(IServiceContainer services,
                                   IApplicationSettings settings,
                                   DataSources dataSources,
                                   QuickFilters quickFilters,
                                   IActionCenter actionCenter,
                                   IAutoUpdater updater)
        {
            if (dataSources == null)
            {
                throw new ArgumentNullException(nameof(dataSources));
            }
            if (quickFilters == null)
            {
                throw new ArgumentNullException(nameof(quickFilters));
            }
            if (updater == null)
            {
                throw new ArgumentNullException(nameof(updater));
            }

            _services            = services;
            _applicationSettings = settings;

            _plugins  = services.Retrieve <IPluginLoader>().Plugins;
            _settings = new SettingsMainPanelViewModel(settings);
            _actionCenterViewModel = new ActionCenterViewModel(services.Retrieve <IDispatcher>(), actionCenter);

            _logViewPanel = new LogViewMainPanelViewModel(services,
                                                          actionCenter,
                                                          dataSources,
                                                          quickFilters,
                                                          services.Retrieve <IHighlighters>(),
                                                          _applicationSettings);
            ((NavigationService)services.Retrieve <INavigationService>()).LogViewer = _logViewPanel;

            _logViewPanel.PropertyChanged += LogViewPanelOnPropertyChanged;

            var timer = new DispatcherTimer
            {
                Interval = TimeSpan.FromMilliseconds(100)
            };

            timer.Tick += TimerOnTick;
            timer.Start();

            _autoUpdater                   = new AutoUpdateViewModel(updater, settings.AutoUpdate, services.Retrieve <IDispatcher>());
            _showLogCommand                = new DelegateCommand(ShowLog);
            _showGoToLineCommand           = new DelegateCommand2(ShowGoToLine);
            _showQuickNavigationCommand    = new DelegateCommand2(ShowQuickNavigation);
            _goToNextDataSourceCommand     = new DelegateCommand2(GoToNextDataSource);
            _goToPreviousDataSourceCommand = new DelegateCommand2(GoToPreviousDataSource);

            _rawEntry   = new LogViewMainPanelEntry();
            _topEntries = new IMainPanelEntry[]
            {
                _rawEntry
            };

            _settingsEntry = new SettingsMainPanelEntry();
            _pluginsEntry  = new PluginsMainPanelEntry();
            _aboutEntry    = new AboutMainPanelEntry();
            _bottomEntries = new[]
            {
                _settingsEntry,
                _pluginsEntry,
                _aboutEntry
            };

            var selectedTopEntry    = _topEntries.FirstOrDefault(x => x.Id == _applicationSettings.MainWindow.SelectedMainPanel);
            var selectedBottomEntry = _bottomEntries.FirstOrDefault(x => x.Id == _applicationSettings.MainWindow.SelectedMainPanel);

            if (selectedTopEntry != null)
            {
                SelectedTopEntry = selectedTopEntry;
            }
            else if (selectedBottomEntry != null)
            {
                SelectedBottomEntry = selectedBottomEntry;
            }
            else
            {
                SelectedTopEntry = _rawEntry;
            }

            _isLeftSidePanelVisible = settings.MainWindow.IsLeftSidePanelVisible;
            UpdateLeftSidePanelExpanderTooltip();
        }
Example #31
0
 public DataSourceViewModel(IDataSource dataSource, IActionCenter actionCenter, IApplicationSettings applicationSettings)
     : base(dataSource, actionCenter, applicationSettings)
 {
     Update();
 }
Example #32
0
 public void Setup()
 {
     _dispatcher   = new ManualDispatcher();
     _actionCenter = new Tailviewer.BusinessLogic.ActionCenter.ActionCenter();
     _viewModel    = new ActionCenterViewModel(_dispatcher, _actionCenter);
 }
 public CustomDataSourceViewModel(IDataSource dataSource,
                                  IActionCenter actionCenter,
                                  IApplicationSettings applicationSettings) : base(dataSource, actionCenter, applicationSettings)
 {
 }
        public MainWindowViewModel(IServiceContainer services,
                                   IApplicationSettings settings,
                                   DataSources dataSources,
                                   QuickFilters quickFilters,
                                   IActionCenter actionCenter,
                                   IAutoUpdater updater)
        {
            if (dataSources == null)
            {
                throw new ArgumentNullException(nameof(dataSources));
            }
            if (quickFilters == null)
            {
                throw new ArgumentNullException(nameof(quickFilters));
            }
            if (updater == null)
            {
                throw new ArgumentNullException(nameof(updater));
            }

            var services1           = services;
            var applicationSettings = settings;

            _plugins = new PluginsMainPanelViewModel(applicationSettings,
                                                     services1.Retrieve <IDispatcher>(),
                                                     services1.Retrieve <IPluginUpdater>(),
                                                     services1.Retrieve <IPluginLoader>().Plugins);
            _settings = new SettingsFlyoutViewModel(settings, services);
            _actionCenterViewModel = new ActionCenterViewModel(services.Retrieve <IDispatcher>(), actionCenter);

            _logViewPanel = new LogViewMainPanelViewModel(services,
                                                          actionCenter,
                                                          dataSources,
                                                          quickFilters,
                                                          services.Retrieve <IHighlighters>(),
                                                          applicationSettings);
            WindowTitle       = _logViewPanel.WindowTitle;
            WindowTitleSuffix = _logViewPanel.WindowTitleSuffix;

            ((NavigationService)services.Retrieve <INavigationService>()).LogViewer = _logViewPanel;

            _logViewPanel.PropertyChanged += LogViewPanelOnPropertyChanged;

            var timer = new DispatcherTimer
            {
                Interval = TimeSpan.FromMilliseconds(100)
            };

            timer.Tick += TimerOnTick;
            timer.Start();

            _autoUpdater = new AutoUpdateViewModel(updater, settings.AutoUpdate, services.Retrieve <IDispatcher>());

            var fileMenuViewModel = new FileMenuViewModel(new DelegateCommand2(AddDataSourceFromFile),
                                                          new DelegateCommand2(AddDataSourceFromFolder),
                                                          _logViewPanel.DataSources.RemoveCurrentDataSourceCommand,
                                                          _logViewPanel.DataSources.RemoveAllDataSourcesCommand,
                                                          new DelegateCommand2(ShowPlugins),
                                                          new DelegateCommand2(ShowSettings),
                                                          new DelegateCommand2(Exit));
            var editMenu = new EditMenuViewModel(new DelegateCommand2(ShowGoToLine),
                                                 new DelegateCommand2(ShowGoToDataSource),
                                                 new DelegateCommand2(GoToNextDataSource),
                                                 new DelegateCommand2(GoToPreviousDataSource),
                                                 _logViewPanel);
            var viewMenu = new ViewMenuViewModel();
            var helpMenu = new HelpMenuViewModel(new DelegateCommand2(ReportIssue),
                                                 new DelegateCommand2(SuggestFeature),
                                                 new DelegateCommand2(AskQuestion),
                                                 AutoUpdater.CheckForUpdatesCommand,
                                                 new DelegateCommand(ShowLog),
                                                 new DelegateCommand2(ShowAboutFlyout));

            _mainMenu = new MainMenu(fileMenuViewModel,
                                     editMenu,
                                     viewMenu,
                                     helpMenu);
            _mainMenu.CurrentDataSource = _logViewPanel.CurrentDataSource;
        }