Пример #1
0
 public Factory(
     IAlertPopup alerts,
     IFileDialogs fileDialogs,
     Help.IPresenter help,
     ILogProviderFactoryRegistry registry,
     IFormatDefinitionsRepository repo,
     IUserDefinedFormatsManager userDefinedFormatsManager,
     ITempFilesManager tempFilesManager,
     ITraceSourceFactory traceSourceFactory,
     RegularExpressions.IRegexFactory regexFactory,
     LogViewer.IPresenterFactory logViewerPresenterFactory,
     IViewsFactory viewFactories,
     ISynchronizationContext synchronizationContext,
     FieldsProcessor.IFactory fieldsProcessorFactory
     )
 {
     this.viewFactories             = viewFactories;
     this.alerts                    = alerts;
     this.registry                  = registry;
     this.fileDialogs               = fileDialogs;
     this.userDefinedFormatsManager = userDefinedFormatsManager;
     this.help                      = help;
     this.repo                      = repo;
     this.tempFilesManager          = tempFilesManager;
     this.logViewerPresenterFactory = logViewerPresenterFactory;
     this.traceSourceFactory        = traceSourceFactory;
     this.regexFactory              = regexFactory;
     this.synchronizationContext    = synchronizationContext;
     this.fieldsProcessorFactory    = fieldsProcessorFactory;
 }
Пример #2
0
 public FormMain()
 {
     InitializeComponent();
     DisableSideMenu();
     Presenter = new PrMain(this, new MainModel());
     FileDlgs  = new FileDialogs();
 }
Пример #3
0
        public Presenter(
            ILogSourcesManager logSources,
            IView view,
            ILogSourcesPreprocessingManager logSourcesPreprocessings,
            SourcePropertiesWindow.IPresenter propertiesWindowPresenter,
            LogViewer.IPresenter logViewerPresenter,
            IPresentersFacade navHandler,
            IAlertPopup alerts,
            IFileDialogs fileDialogs,
            IClipboardAccess clipboard,
            IShellOpen shellOpen,
            SaveJointLogInteractionPresenter.IPresenter saveJointLogInteractionPresenter
            )
        {
            this.logSources = logSources;
            this.view       = view;
            this.propertiesWindowPresenter = propertiesWindowPresenter;
            this.logViewerPresenter        = logViewerPresenter;
            this.logSourcesPreprocessings  = logSourcesPreprocessings;
            this.alerts      = alerts;
            this.fileDialogs = fileDialogs;
            this.clipboard   = clipboard;
            this.shellOpen   = shellOpen;
            this.saveJointLogInteractionPresenter = saveJointLogInteractionPresenter;

            logViewerPresenter.FocusedMessageChanged += (sender, args) =>
            {
                view.InvalidateFocusedMessageArea();
            };

            view.SetPresenter(this);
        }
        public OrdersAveragePresenter(IOrdersAverageView view, IOrdersQueries ordersQueries, IFileDialogs fileDialogs)
        {
            _view          = view;
            _ordersQueries = ordersQueries;
            _fileDialogs   = fileDialogs;

            _view.Load += OnLoad;
            _view.Save += new EventHandler(async(s, e) => await OnSaveAsync(s, e));
        }
Пример #5
0
        public AllOrdersPresenter(IAllOrdersView view, IOrdersQueries ordersQueries, IFileDialogs fileDialogs)
        {
            _view          = view;
            _ordersQueries = ordersQueries;
            _fileDialogs   = fileDialogs;

            _view.Load += OnLoad;
            _view.Save += new EventHandler(async(s, e) => await OnSaveAsync(s, e));
            _view.SelectedOrderChanged += OnSelectedOrderChanged;
        }
Пример #6
0
        public OrdersQuantityForClientPresenter(IOrdersQuantityForClientView view, IOrdersQueries ordersQueries, IFileDialogs fileDialogs)
        {
            _view          = view;
            _ordersQueries = ordersQueries;
            _fileDialogs   = fileDialogs;

            _view.Load     += OnLoad;
            _view.Save     += new EventHandler(async(s, e) => await OnSaveAsync(s, e));
            _view.Generate += OnGenerate;
        }
Пример #7
0
 public Presenter(
     IView view,
     IFileDialogs fileDialogs,
     IAlertPopup alerts
     )
 {
     this.view        = view;
     this.fileDialogs = fileDialogs;
     this.alerts      = alerts;
     this.view.SetEventsHandler(this);
 }
Пример #8
0
        public OrdersInPriceRangePresenter(IOrdersInPriceRangeView view, IOrdersQueries ordersQueries, IFileDialogs fileDialogs)
        {
            _view          = view;
            _ordersQueries = ordersQueries;
            _fileDialogs   = fileDialogs;
            _errorMessage  = new List <string>();

            _view.Load                 += OnLoad;
            _view.Save                 += new EventHandler(async(s, e) => await OnSaveAsync(s, e));
            _view.Generate             += OnGenerate;
            _view.SelectedOrderChanged += OnSelectedOrderChanged;
            _view.InputDataChanged     += OnInputDataChanged;
        }
Пример #9
0
 public Exporter([NotNull] ISerializer serializer, [NotNull] IFileDialogs fileDialogs)
 {
     if (serializer == null)
     {
         throw new ArgumentNullException(nameof(serializer));
     }
     if (fileDialogs == null)
     {
         throw new ArgumentNullException(nameof(fileDialogs));
     }
     this.serializer  = serializer;
     this.fileDialogs = fileDialogs;
 }
Пример #10
0
 public Presenter(
     IView view,
     IWizardScenarioHost host,
     IAlertPopup alerts,
     IFileDialogs fileDialogs
     )
 {
     this.view = view;
     this.view.SetEventsHandler(this);
     this.host        = host;
     this.alerts      = alerts;
     this.fileDialogs = fileDialogs;
 }
Пример #11
0
 public static PresentationObjects Create(
     ModelObjects model,
     IClipboardAccess clipboardAccess,
     IShellOpen shellOpen,
     IAlertPopup alertPopup,
     IFileDialogs fileDialogs,
     IPromptDialog promptDialog,
     About.IAboutConfig aboutConfig,
     MainForm.IDragDropHandler dragDropHandler,
     ISystemThemeDetector systemThemeDetector,
     IViewsFactory views
     )
 {
     T callOptionalFactory <T>(Func <T> factory) where T : class
Пример #12
0
 public Presenter(
     IView view,
     IAlertPopup alerts,
     IFileDialogs fileDialogs,
     ITempFilesManager tempFilesManager,
     Help.IPresenter help
     )
 {
     this.dialog           = view;
     this.alerts           = alerts;
     this.fileDialogs      = fileDialogs;
     this.tempFilesManager = tempFilesManager;
     this.help             = help;
     this.dialog.SetEventsHandler(this);
 }
 public Presenter(
     IView view,
     IAlertPopup alerts,
     IFileDialogs fileDialogs,
     FieldsProcessor.IFactory fieldsProcessorFactory,
     Help.IPresenter help
     )
 {
     this.dialog                 = view;
     this.alerts                 = alerts;
     this.fileDialogs            = fileDialogs;
     this.fieldsProcessorFactory = fieldsProcessorFactory;
     this.help = help;
     this.dialog.SetEventsHandler(this);
 }
Пример #14
0
 public Presenter(
     ILogSourcesManager logSources,
     IShutdown shutdown,
     Progress.IProgressAggregatorFactory progressFactory,
     IAlertPopup alerts,
     IFileDialogs fileDialogs,
     StatusReports.IPresenter statusReport
     )
 {
     this.logSources      = logSources;
     this.shutdown        = shutdown;
     this.progressFactory = progressFactory;
     this.alerts          = alerts;
     this.fileDialogs     = fileDialogs;
     this.statusReport    = statusReport;
 }
Пример #15
0
        public Presenter(
            IView view,
            IFileBasedLogProviderFactory factory,
            ILogSourcesManager model,
            IAlertPopup alerts,
            IFileDialogs fileDialogs
            )
        {
            this.view        = view;
            this.factory     = factory;
            this.model       = model;
            this.alerts      = alerts;
            this.fileDialogs = fileDialogs;

            view.SetEventsHandler(this);
        }
Пример #16
0
        public MainPresenter(
            IMainView view,
            IOrdersInMemoryDb orders,
            IReportPresentersFactory reportPresenterFactory,
            IFileDialogs fileDialogs)
        {
            _view   = view;
            _orders = orders;
            _reportPresenterFactory = reportPresenterFactory;
            _fileDialogs            = fileDialogs;

            _view.LoadDatabase       += new EventHandler(async(s, e) => await OnLoadDatabaseAsync(s, e));
            _view.ResetDatabase      += OnResetDatabase;
            _view.ShowReport         += OnShowReport;
            _view.ShowDatabaseReport += OnShowDatabaseReport;
            _view.DatabaseLoaded      = false;
        }
Пример #17
0
 public ObjectsFactory(
     IAlertPopup alerts,
     IFileDialogs fileDialogs,
     Help.IPresenter help,
     ILogProviderFactoryRegistry registry,
     IFormatDefinitionsRepository repo,
     IUserDefinedFormatsManager userDefinedFormatsManager,
     ITempFilesManager tempFilesManager,
     LogViewer.IPresenterFactory logViewerPresenterFactory,
     ViewFactories viewFactories
     )
 {
     this.viewFactories             = viewFactories;
     this.alerts                    = alerts;
     this.registry                  = registry;
     this.fileDialogs               = fileDialogs;
     this.userDefinedFormatsManager = userDefinedFormatsManager;
     this.help                      = help;
     this.repo                      = repo;
     this.tempFilesManager          = tempFilesManager;
     this.logViewerPresenterFactory = logViewerPresenterFactory;
 }
        public Presenter(
            IView view,
            IUserDefinedSearches userDefinedSearches,
            IAlertPopup alerts,
            IFileDialogs fileDialogs,
            SearchEditorDialog.IPresenter searchEditorDialog
            )
        {
            this.view = view;
            this.userDefinedSearches = userDefinedSearches;
            this.alerts             = alerts;
            this.fileDialogs        = fileDialogs;
            this.searchEditorDialog = searchEditorDialog;

            userDefinedSearches.OnChanged += (sender, e) =>
            {
                if (currentDialog == null)
                {
                    return;
                }
                UpdateViewItems();
                UpdateControls();
            };
        }
Пример #19
0
        public Presenter(
            ILogSourcesManager logSources,
            IView view,
            IManager logSourcesPreprocessings,
            SourcePropertiesWindow.IPresenter propertiesWindowPresenter,
            LogViewer.IPresenterInternal logViewerPresenter,
            IAlertPopup alerts,
            IFileDialogs fileDialogs,
            IClipboardAccess clipboard,
            IShellOpen shellOpen,
            SaveJointLogInteractionPresenter.IPresenter saveJointLogInteractionPresenter,
            IColorTheme theme,
            IChangeNotification changeNotification,
            IHeartBeatTimer heartbeat
            )
        {
            this.logSources = logSources;
            this.view       = view;
            this.propertiesWindowPresenter = propertiesWindowPresenter;
            this.logSourcesPreprocessings  = logSourcesPreprocessings;
            this.alerts      = alerts;
            this.fileDialogs = fileDialogs;
            this.clipboard   = clipboard;
            this.shellOpen   = shellOpen;
            this.saveJointLogInteractionPresenter = saveJointLogInteractionPresenter;
            this.changeNotification = changeNotification;

            void updateItems()
            {
                itemsRevision++;
                changeNotification.Post();
            }

            logSources.OnLogSourceVisiblityChanged  += (s, e) => updateItems();
            logSources.OnLogSourceAnnotationChanged += (s, e) => updateItems();
            logSources.OnLogSourceColorChanged      += (s, e) => updateItems();

            logSourcesPreprocessings.PreprocessingChangedAsync += (s, e) => pendingUpdateFlag.Invalidate();
            logSources.OnLogSourceStatsChanged += (s, e) =>
            {
                if ((e.Flags & (LogProviderStatsFlag.Error | LogProviderStatsFlag.CachedMessagesCount | LogProviderStatsFlag.State | LogProviderStatsFlag.BytesCount | LogProviderStatsFlag.BackgroundAcivityStatus)) != 0)
                {
                    pendingUpdateFlag.Invalidate();
                }
            };

            heartbeat.OnTimer += (s, e) =>
            {
                if (pendingUpdateFlag.Validate())
                {
                    updateItems();
                }
            };

            this.getRoot = Selectors.Create(
                () => logSources.Items,
                () => logSourcesPreprocessings.Items,
                () => theme.ThreadColors,
                () => expandedKeys,
                () => selectedKeys,
                () => itemsRevision,
                (sources, preprocessings, themeColors, expanded, selected, rev) => new RootViewItem
            {
                Items = ImmutableArray.CreateRange(
                    EnumItemsData(sources, preprocessings, themeColors, expanded, selected, logSourcesPreprocessings))
            }
                );

            this.getSelectedSources = Selectors.Create(
                getRoot,
                root => ImmutableArray.CreateRange(
                    ViewItem.Flatten(root).Where(i => i.IsSelected).SelectMany(i =>
            {
                if (i is LogSourceViewItem singleSource)
                {
                    return new[] { singleSource.LogSource }
                }
                ;
                if (i is SourcesContainerViewItem container)
                {
                    return(container.LogSources.Select(x => x.LogSource));
                }
                return(Enumerable.Empty <ILogSource>());
            })
                    .Distinct()
                    )
                );

            this.getSelectedPreprocessings = Selectors.Create(
                getRoot,
                root => ImmutableArray.CreateRange(
                    ViewItem.Flatten(root).OfType <PreprocessingViewItem>().Select(p => p.Preprocessing)
                    )
                );

            this.getFocusedMessageItem = Selectors.Create(
                () => logViewerPresenter.FocusedMessage,
                getRoot,
                (msg, root) =>
            {
                var ls = msg?.GetLogSource();
                return((IViewItem)ViewItem.Flatten(root).FirstOrDefault(
                           i => (i as LogSourceViewItem)?.LogSource == ls
                           ));
            }
                );

            view.SetViewModel(this);
        }