Пример #1
0
        public TailViewModelFactory([NotNull] IObjectProvider objectProvider,
            [NotNull] ISchedulerProvider schedulerProvider, 
            [NotNull] IColourProvider colourProvider,
            [NotNull] ISearchMetadataFactory searchMetadataFactory, 
            [NotNull] IIconProvider iconProvider,
            [NotNull] ITailViewStateControllerFactory tailViewStateControllerFactory,
            [NotNull] ITextAssociationCollection textAssociationCollection,
            [NotNull]  IThemeProvider themeProvider)
        {
            if (objectProvider == null) throw new ArgumentNullException(nameof(objectProvider));
            if (schedulerProvider == null) throw new ArgumentNullException(nameof(schedulerProvider));
            if (colourProvider == null) throw new ArgumentNullException(nameof(colourProvider));
            if (searchMetadataFactory == null) throw new ArgumentNullException(nameof(searchMetadataFactory));
            if (iconProvider == null) throw new ArgumentNullException(nameof(iconProvider));
            if (tailViewStateControllerFactory == null)
                throw new ArgumentNullException(nameof(tailViewStateControllerFactory));

            _objectProvider = objectProvider;
            _schedulerProvider = schedulerProvider;
            _colourProvider = colourProvider;
            _searchMetadataFactory = searchMetadataFactory;
            _iconProvider = iconProvider;
            _tailViewStateControllerFactory = tailViewStateControllerFactory;
            _textAssociationCollection = textAssociationCollection;
            _themeProvider = themeProvider;
        }
 public SettingController(ISettingService settingService,
     ICountryService countryService, IStateProvinceService stateProvinceService,
     IAddressService addressService, ITaxCategoryService taxCategoryService,
     ICurrencyService currencyService, IPictureService pictureService, 
     ILocalizationService localizationService, IDateTimeHelper dateTimeHelper,
     IOrderService orderService, IEncryptionService encryptionService,
     IThemeProvider themeProvider, ICustomerService customerService, 
     ICustomerActivityService customerActivityService, IPermissionService permissionService,
     IWebHelper webHelper, IFulltextService fulltextService, 
     IMaintenanceService maintenanceService, IStoreService storeService,
     IWorkContext workContext, IGenericAttributeService genericAttributeService)
 {
     this._settingService = settingService;
     this._countryService = countryService;
     this._stateProvinceService = stateProvinceService;
     this._addressService = addressService;
     this._taxCategoryService = taxCategoryService;
     this._currencyService = currencyService;
     this._pictureService = pictureService;
     this._localizationService = localizationService;
     this._dateTimeHelper = dateTimeHelper;
     this._orderService = orderService;
     this._encryptionService = encryptionService;
     this._themeProvider = themeProvider;
     this._customerService = customerService;
     this._customerActivityService = customerActivityService;
     this._permissionService = permissionService;
     this._webHelper = webHelper;
     this._fulltextService = fulltextService;
     this._maintenanceService = maintenanceService;
     this._storeService = storeService;
     this._workContext = workContext;
     this._genericAttributeService = genericAttributeService;
 }
Пример #3
0
 public HomeController(IThemeProvider themeProvider, ICacheProvider cacheProvider,
                       IAppSecurityFacade appSecurityFacade, IAppAuthenticationFacade appAuthenticationFacade)
 {
     _themeProvider = themeProvider;
     _cacheProvider = cacheProvider;
     _appSecurityFacade = appSecurityFacade;
     _appAuthenticationFacade = appAuthenticationFacade;
 }
Пример #4
0
 public ThemeContext(ICurrentActivity currentActivity, IGenericAttributeService genericAttributeService,
     WebInformationSettings webInformationSettings, IThemeProvider themeProvider)
 {
     this._currentActivity = currentActivity;
     this._genericAttributeService = genericAttributeService;
     this._webInformationSettings = webInformationSettings;
     this._themeProvider = themeProvider;
 }
Пример #5
0
 public ThemeContext(IWorkContext workContext, IUserService userService,
     SiteInformationSettings siteInformationSettings, IThemeProvider themeProvider)
 {
     this._workContext             = workContext;
     this._userService             = userService;
     this._siteInformationSettings = siteInformationSettings;
     this._themeProvider           = themeProvider;
 }
Пример #6
0
 public ThemeContext(IWorkContext workContext, IGenericAttributeService genericAttributeService,
     StoreInformationSettings storeInformationSettings, IThemeProvider themeProvider)
 {
     this._workContext = workContext;
     this._genericAttributeService = genericAttributeService;
     this._storeInformationSettings = storeInformationSettings;
     this._themeProvider = themeProvider;
 }
Пример #7
0
 public ThemeContext(IWorkContext workContext, ICustomerService customerService,
     StoreInformationSettings storeInformationSettings, IThemeProvider themeProvider)
 {
     this._workContext = workContext;
     this._customerService = customerService;
     this._storeInformationSettings = storeInformationSettings;
     this._themeProvider = themeProvider;
 }
Пример #8
0
 public ThemeContext(IWorkContext workContext,
     IStoreContext storeContext,
     IThemeProvider themeProvider,
     IGenericAttributeService genericAttributeService)
 {
     this._workContext = workContext;
     this._storeContext = storeContext;
     this._themeProvider = themeProvider;
     this._genericAttributeService = genericAttributeService;
 }
 public WidgetRenderContext (IContextProvider contextProvider,
                             ILayoutProvider layoutProvider,
                             IThemeProvider themeProvider)
 {
     if (contextProvider == null) throw new ArgumentNullException ("contextProvider");
     if (layoutProvider == null) throw new ArgumentNullException ("layoutProvider");
     if (themeProvider == null) throw new ArgumentNullException ("themeProvider");
     
     this.context_provider = contextProvider;
     this.layout_provider = layoutProvider;
     this.theme_provider = themeProvider;
 }
Пример #10
0
        public LineMatchProxy(LineMatch match, IThemeProvider themeProvider)
        {
            _match = match;
            IconKind = _match.Icon.ParseEnum<PackIconKind>().ValueOr(() => PackIconKind.ArrowRightBold);

            var defaultHue = themeProvider.Accent.Select(hue => match.Hue == Hue.NotSpecified ? hue : _match.Hue);

            Foreground = defaultHue.Select(h => h.ForegroundBrush).ForBinding();
            Background = defaultHue.Select(h => h.BackgroundBrush).ForBinding();

            _cleanUp = new CompositeDisposable(Foreground, Background);
        }
Пример #11
0
        public LineProxyFactory([NotNull] ITextFormatter textFormatter, 
            [NotNull] ILineMatches lineMatches,
            [NotNull] IObservable<TextScrollInfo> textScrollObservable, 
            [NotNull] IThemeProvider themeProvider)
        {
            if (textFormatter == null) throw new ArgumentNullException(nameof(textFormatter));
            if (lineMatches == null) throw new ArgumentNullException(nameof(lineMatches));
            if (textScrollObservable == null) throw new ArgumentNullException(nameof(textScrollObservable));
            if (themeProvider == null) throw new ArgumentNullException(nameof(themeProvider));

            _textFormatter = textFormatter;
            _lineMatches = lineMatches;
            _themeProvider = themeProvider;
            _textScroll = textScrollObservable.StartWith(new TextScrollInfo(0,0));
        }
Пример #12
0
 public SettingsController(ISettingService settingService,
     IPermissionService permissionService,
     IThemeProvider themeProvider,
     CatalogSettings catalogSettings,
     WebInformationSettings webInformationSettings,
     SeoSettings seoSettings,
     AnalysisNSocialNetworkSettings analysisNSocialNetworkSettings)
 {
     _permissionService = permissionService;
     _settingService = settingService;
     _themeProvider = themeProvider;
     _catalogSettings = catalogSettings;
     _webInformationSettings = webInformationSettings;
     _analysisNSocialNetworkSettings = analysisNSocialNetworkSettings;
     _seoSettings = seoSettings;
 }
Пример #13
0
        public ThemeContext(
            WebWorkContextBase workContext,
            IGenericCharacteristicDataService genericCharacteristicService,
            StoreStateSettings storeStateSettings,
            IThemeProvider themeProvider
            )
        {
            this.workContext = workContext;
            this.genericCharacteristicService = genericCharacteristicService;
            this.storeStateSettings = storeStateSettings;
            this.themeProvider = themeProvider;

            // initial theme name using null, represent there is no theme name cached.
            desktopThemeName = null;
            mobileThemeName = null;
        }
Пример #14
0
        public CommonController(ICategoryService categoryService, IProductService productService,
            IManufacturerService manufacturerService, ITopicService topicService,
            ILanguageService languageService,
            ICurrencyService currencyService, ILocalizationService localizationService,
            IWorkContext workContext,
            IQueuedEmailService queuedEmailService, IEmailAccountService emailAccountService,
            ISitemapGenerator sitemapGenerator, IThemeContext themeContext,
            IThemeProvider themeProvider, IForumService forumService,
            ICustomerService customerService, IWebHelper webHelper,
            IPermissionService permissionService, IMobileDeviceHelper mobileDeviceHelper,
            HttpContextBase httpContext, CustomerSettings customerSettings, 
            TaxSettings taxSettings, CatalogSettings catalogSettings,
            StoreInformationSettings storeInformationSettings, EmailAccountSettings emailAccountSettings,
            CommonSettings commonSettings, BlogSettings blogSettings, ForumSettings forumSettings,
            LocalizationSettings localizationSettings, CaptchaSettings captchaSettings)
        {
            this._categoryService = categoryService;
            this._productService = productService;
            this._manufacturerService = manufacturerService;
            this._topicService = topicService;
            this._languageService = languageService;
            this._currencyService = currencyService;
            this._localizationService = localizationService;
            this._workContext = workContext;
            this._queuedEmailService = queuedEmailService;
            this._emailAccountService = emailAccountService;
            this._sitemapGenerator = sitemapGenerator;
            this._themeContext = themeContext;
            this._themeProvider = themeProvider;
            this._forumservice = forumService;
            this._customerService = customerService;
            this._webHelper = webHelper;
            this._permissionService = permissionService;
            this._mobileDeviceHelper = mobileDeviceHelper;
            this._httpContext = httpContext;

            this._customerSettings = customerSettings;
            this._taxSettings = taxSettings;
            this._catalogSettings = catalogSettings;
            this._storeInformationSettings = storeInformationSettings;
            this._emailAccountSettings = emailAccountSettings;
            this._commonSettings = commonSettings;
            this._blogSettings = blogSettings;
            this._forumSettings = forumSettings;
            this._localizationSettings = localizationSettings;
            this._captchaSettings = captchaSettings;
        }
Пример #15
0
        public ThemeEditorViewModel(IThemeProvider themeProvider,
                              IMessageBoxService messageBoxService)
        {
            _themeProvider = themeProvider;
            _messageBoxService = messageBoxService;

            AddThemeComponentCommand = new RelayCommand<ThemeComponentType>(OnAddThemeComponentCommand, t => IsMasterTheme);
            DeleteThemeComponentCommand = new RelayCommand<ThemeComponent>(OnDeleteThemeComponentCommand,
                t => IsMasterTheme && SelectedThemeComponent != null);
            CloseCommand = new RelayCommand(async () => await OnCloseCommand());

            var icon = new BitmapImage();
            icon.BeginInit();
            icon.UriSource = new Uri("pack://application:,,,/Filtration;component/Resources/Icons/Theme.ico");
            icon.EndInit();
            IconSource = icon;
            
        }
Пример #16
0
        public TailViewModel([NotNull] ILogger logger,
                             [NotNull] ISchedulerProvider schedulerProvider,
                             [NotNull] IFileWatcher fileWatcher,
                             [NotNull] ISelectionMonitor selectionMonitor,
                             [NotNull] IClipboardHandler clipboardHandler,
                             [NotNull] ISearchInfoCollection searchInfoCollection,
                             [NotNull] IInlineViewerFactory inlineViewerFactory,
                             [NotNull] ISetting <GeneralOptions> generalOptions,
                             [NotNull] ISearchMetadataCollection searchMetadataCollection,
                             [NotNull] IStateBucketService stateBucketService,
                             [NotNull] SearchOptionsViewModel searchOptionsViewModel,
                             [NotNull] ITailViewStateRestorer restorer,
                             [NotNull] SearchHints searchHints,
                             [NotNull] ITailViewStateControllerFactory tailViewStateControllerFactory,
                             [NotNull] IThemeProvider themeProvider)
        {
            if (logger == null)
            {
                throw new ArgumentNullException(nameof(logger));
            }
            if (schedulerProvider == null)
            {
                throw new ArgumentNullException(nameof(schedulerProvider));
            }
            if (fileWatcher == null)
            {
                throw new ArgumentNullException(nameof(fileWatcher));
            }
            if (selectionMonitor == null)
            {
                throw new ArgumentNullException(nameof(selectionMonitor));
            }
            if (clipboardHandler == null)
            {
                throw new ArgumentNullException(nameof(clipboardHandler));
            }
            if (searchInfoCollection == null)
            {
                throw new ArgumentNullException(nameof(searchInfoCollection));
            }
            if (inlineViewerFactory == null)
            {
                throw new ArgumentNullException(nameof(inlineViewerFactory));
            }
            if (generalOptions == null)
            {
                throw new ArgumentNullException(nameof(generalOptions));
            }
            if (searchMetadataCollection == null)
            {
                throw new ArgumentNullException(nameof(searchMetadataCollection));
            }
            if (stateBucketService == null)
            {
                throw new ArgumentNullException(nameof(stateBucketService));
            }
            if (searchOptionsViewModel == null)
            {
                throw new ArgumentNullException(nameof(searchOptionsViewModel));
            }
            if (searchHints == null)
            {
                throw new ArgumentNullException(nameof(searchHints));
            }
            if (themeProvider == null)
            {
                throw new ArgumentNullException(nameof(themeProvider));
            }

            Name             = fileWatcher.FullName;
            SelectionMonitor = selectionMonitor;
            SearchOptions    = searchOptionsViewModel;
            SearchHints      = searchHints;

            CopyToClipboardCommand     = new Command(() => clipboardHandler.WriteToClipboard(selectionMonitor.GetSelectedText()));
            OpenFileCommand            = new Command(() => Process.Start(fileWatcher.FullName));
            OpenFolderCommand          = new Command(() => Process.Start(fileWatcher.Folder));
            CopyPathToClipboardCommand = new Command(() => clipboardHandler.WriteToClipboard(fileWatcher.FullName));
            UnClearCommand             = new Command(fileWatcher.Reset);
            ClearCommand = new Command(fileWatcher.Clear);
            KeyAutoTail  = new Command(() => { AutoTail = true; });

            SearchCollection         = new SearchCollection(searchInfoCollection, schedulerProvider);
            SearchMetadataCollection = searchMetadataCollection;

            var horizonalScrollArgs = new ReplaySubject <TextScrollInfo>(1);

            HorizonalScrollChanged = args => horizonalScrollArgs.OnNext(args);

            _tailViewStateControllerFactory = tailViewStateControllerFactory;

            //Move these 2 highlight fields to a service as all views require them
            UsingDarkTheme = generalOptions.Value
                             .ObserveOn(schedulerProvider.MainThread)
                             .Select(options => options.Theme == Theme.Dark)
                             .ForBinding();

            HighlightTail = generalOptions.Value
                            .ObserveOn(schedulerProvider.MainThread)
                            .Select(options => options.HighlightTail)
                            .ForBinding();

            //this deals with state when loading the system at start up and at shut-down
            _persister = new TailViewPersister(this, restorer);

            //An observable which acts as a scroll command
            var autoChanged = this.WhenValueChanged(vm => vm.AutoTail);
            var scroller    = _userScrollRequested.CombineLatest(autoChanged, (user, auto) =>
            {
                var mode = AutoTail ? ScrollReason.Tail : ScrollReason.User;
                return(new ScrollRequest(mode, user.PageSize, user.FirstIndex));
            })
                              .Do(x => logger.Info("Scrolling to {0}/{1}", x.FirstIndex, x.PageSize))
                              .DistinctUntilChanged();

            FileStatus = fileWatcher.Status.ForBinding();

            //command to add the current search to the tail collection
            var searchInvoker = SearchHints.SearchRequested.Subscribe(request => searchInfoCollection.Add(request.Text, request.UseRegEx));

            //User feedback to show file size
            FileSizeText = fileWatcher.Latest.Select(fn => fn.Size)
                           .Select(size => size.FormatWithAbbreviation())
                           .DistinctUntilChanged()
                           .ForBinding();

            //tailer is the main object used to tail, scroll and filter in a file
            var selectedProvider = SearchCollection.Latest.ObserveOn(schedulerProvider.Background);

            var lineScroller = new LineScroller(selectedProvider, scroller);

            MaximumChars = lineScroller.MaximumLines()
                           .ObserveOn(schedulerProvider.MainThread)
                           .ForBinding();

            //load lines into observable collection
            var lineProxyFactory = new LineProxyFactory(new TextFormatter(searchMetadataCollection), new LineMatches(searchMetadataCollection), horizonalScrollArgs.DistinctUntilChanged(), themeProvider);

            var loader = lineScroller.Lines.Connect()
                         .LogChanges(logger, "Received")
                         .Transform(lineProxyFactory.Create, new ParallelisationOptions(ParallelType.Ordered, 3))
                         .LogChanges(logger, "Sorting")
                         .Sort(SortExpressionComparer <LineProxy> .Ascending(proxy => proxy))
                         .ObserveOn(schedulerProvider.MainThread)
                         .Bind(out _data, 100)
                         .LogChanges(logger, "Bound")
                         .DisposeMany()
                         .LogErrors(logger)
                         .Subscribe();

            //monitor matching lines and start index,
            Count       = searchInfoCollection.All.Select(latest => latest.Count).ForBinding();
            CountText   = searchInfoCollection.All.Select(latest => $"{latest.Count.ToString("##,###")} lines").ForBinding();
            LatestCount = SearchCollection.Latest.Select(latest => latest.Count).ForBinding();

            ////track first visible index
            var firstIndexMonitor = lineScroller.Lines.Connect()
                                    .Buffer(TimeSpan.FromMilliseconds(25)).FlattenBufferResult()
                                    .ToCollection()
                                    .Select(lines => lines.Count == 0 ? 0 : lines.Select(l => l.Index).Max() - lines.Count + 1)
                                    .ObserveOn(schedulerProvider.MainThread)
                                    .Subscribe(first =>
            {
                FirstIndex = first;
            });

            //Create objects required for inline viewing
            var isUserDefinedChanged = SearchCollection.WhenValueChanged(sc => sc.Selected)
                                       .Where(selected => selected != null)
                                       .Select(selected => selected.IsUserDefined)
                                       .DistinctUntilChanged()
                                       .Replay(1)
                                       .RefCount();

            var showInline          = this.WhenValueChanged(vm => vm.ShowInline);
            var inlineViewerVisible = isUserDefinedChanged.CombineLatest(showInline, (userDefined, showInlne) => userDefined && showInlne);

            CanViewInline       = isUserDefinedChanged.ForBinding();
            InlineViewerVisible = inlineViewerVisible.ForBinding();

            //return an empty line provider unless user is viewing inline - this saves needless trips to the file
            var inline = searchInfoCollection.All.CombineLatest(inlineViewerVisible, (index, ud) => ud ? index : new EmptyLineProvider());

            InlineViewer = inlineViewerFactory.Create(inline, this.WhenValueChanged(vm => vm.SelectedItem), searchMetadataCollection);

            _cleanUp = new CompositeDisposable(lineScroller,
                                               loader,
                                               firstIndexMonitor,
                                               FileStatus,
                                               Count,
                                               LatestCount,
                                               FileSizeText,
                                               CanViewInline,
                                               InlineViewer,
                                               InlineViewerVisible,
                                               SearchCollection,
                                               searchInfoCollection,
                                               HighlightTail,
                                               UsingDarkTheme,
                                               searchHints,
                                               searchMetadataCollection,
                                               SelectionMonitor,
                                               SearchOptions,
                                               searchInvoker,
                                               MaximumChars,
                                               _stateMonitor,
                                               horizonalScrollArgs.SetAsComplete(),
                                               _userScrollRequested.SetAsComplete());
        }
Пример #17
0
 public ThemeContext(IThemeProvider themeProvider)
 {
     this._themeProvider = themeProvider;
 }
Пример #18
0
 public SettingsController(ISettingService settingService, IModelMapper modelMapper, ICryptographyService cryptographyService, IThemeProvider themeProvider)
 {
     _settingService      = settingService;
     _modelMapper         = modelMapper;
     _cryptographyService = cryptographyService;
     _themeProvider       = themeProvider;
 }
Пример #19
0
        public MainWindowViewModel(IItemFilterScriptRepository itemFilterScriptRepository,
                                   IItemFilterScriptTranslator itemFilterScriptTranslator,
                                   IReplaceColorsViewModel replaceColorsViewModel,
                                   IAvalonDockWorkspaceViewModel avalonDockWorkspaceViewModel,
                                   ISettingsPageViewModel settingsPageViewModel,
                                   IThemeProvider themeProvider,
                                   IThemeService themeService,
                                   IMessageBoxService messageBoxService,
                                   IClipboardService clipboardService)
        {
            _itemFilterScriptRepository   = itemFilterScriptRepository;
            _itemFilterScriptTranslator   = itemFilterScriptTranslator;
            _replaceColorsViewModel       = replaceColorsViewModel;
            _avalonDockWorkspaceViewModel = avalonDockWorkspaceViewModel;
            SettingsPageViewModel         = settingsPageViewModel;
            _themeProvider     = themeProvider;
            _themeService      = themeService;
            _messageBoxService = messageBoxService;
            _clipboardService  = clipboardService;

            NewScriptCommand  = new RelayCommand(OnNewScriptCommand);
            CopyScriptCommand = new RelayCommand(OnCopyScriptCommand, () => ActiveDocumentIsScript);
            OpenScriptCommand = new RelayCommand(async() => await OnOpenScriptCommand());
            OpenThemeCommand  = new RelayCommand(async() => await OnOpenThemeCommandAsync());

            SaveCommand   = new RelayCommand(async() => await OnSaveDocumentCommandAsync(), ActiveDocumentIsEditable);
            SaveAsCommand = new RelayCommand(async() => await OnSaveAsCommandAsync(), ActiveDocumentIsEditable);
            CloseCommand  = new RelayCommand(OnCloseDocumentCommand, ActiveDocumentIsEditable);

            CopyBlockCommand       = new RelayCommand(OnCopyBlockCommand, () => ActiveDocumentIsScript && ActiveScriptHasSelectedBlock);
            CopyBlockStyleCommand  = new RelayCommand(OnCopyBlockStyleCommand, () => ActiveDocumentIsScript && ActiveScriptHasSelectedBlock);
            PasteCommand           = new RelayCommand(OnPasteCommand, () => ActiveDocumentIsScript && ActiveScriptHasSelectedBlock);
            PasteBlockStyleCommand = new RelayCommand(OnPasteBlockStyleCommand, () => ActiveDocumentIsScript && ActiveScriptHasSelectedBlock);

            // TODO: Only enabled if undo/redo available
            UndoCommand = new RelayCommand(OnUndoCommand, () => ActiveDocumentIsScript);
            RedoCommand = new RelayCommand(OnRedoCommand, () => ActiveDocumentIsScript);


            MoveBlockUpCommand       = new RelayCommand(OnMoveBlockUpCommand, () => ActiveDocumentIsScript && ActiveScriptHasSelectedBlock);
            MoveBlockDownCommand     = new RelayCommand(OnMoveBlockDownCommand, () => ActiveDocumentIsScript && ActiveScriptHasSelectedBlock);
            MoveBlockToTopCommand    = new RelayCommand(OnMoveBlockToTopCommand, () => ActiveDocumentIsScript && ActiveScriptHasSelectedBlock);
            MoveBlockToBottomCommand = new RelayCommand(OnMoveBlockToBottomCommand, () => ActiveDocumentIsScript && ActiveScriptHasSelectedBlock);

            AddBlockCommand        = new RelayCommand(OnAddBlockCommand, () => ActiveDocumentIsScript);
            AddSectionCommand      = new RelayCommand(OnAddSectionCommand, () => ActiveDocumentIsScript);
            DeleteBlockCommand     = new RelayCommand(OnDeleteBlockCommand, () => ActiveDocumentIsScript && ActiveScriptHasSelectedBlock);
            DisableBlockCommand    = new RelayCommand(OnDisableBlockCommand, () => ActiveDocumentIsScript && ActiveScriptHasSelectedEnabledBlock);
            EnableBlockCommand     = new RelayCommand(OnEnableBlockCommand, () => ActiveDocumentIsScript && ActiveScriptHasSelectedDisabledBlock);
            OpenAboutWindowCommand = new RelayCommand(OnOpenAboutWindowCommand);
            ReplaceColorsCommand   = new RelayCommand(OnReplaceColorsCommand, () => ActiveDocumentIsScript);

            CreateThemeCommand        = new RelayCommand(OnCreateThemeCommand, () => ActiveDocumentIsScript);
            ApplyThemeToScriptCommand = new RelayCommand(async() => await OnApplyThemeToScriptCommandAsync(), () => ActiveDocumentIsScript);
            EditMasterThemeCommand    = new RelayCommand(OnEditMasterThemeCommand, () => ActiveDocumentIsScript);

            AddTextColorThemeComponentCommand       = new RelayCommand(OnAddTextColorThemeComponentCommand, () => ActiveDocumentIsTheme && ActiveThemeIsEditable);
            AddBackgroundColorThemeComponentCommand = new RelayCommand(OnAddBackgroundColorThemeComponentCommand, () => ActiveDocumentIsTheme && ActiveThemeIsEditable);
            AddBorderColorThemeComponentCommand     = new RelayCommand(OnAddBorderColorThemeComponentCommand, () => ActiveDocumentIsTheme && ActiveThemeIsEditable);
            DeleteThemeComponentCommand             = new RelayCommand(OnDeleteThemeComponentCommand, () => ActiveDocumentIsTheme && ActiveThemeIsEditable && _avalonDockWorkspaceViewModel.ActiveThemeViewModel.SelectedThemeComponent != null);

            ExpandAllBlocksCommand   = new RelayCommand(OnExpandAllBlocksCommand, () => ActiveDocumentIsScript);
            CollapseAllBlocksCommand = new RelayCommand(OnCollapseAllBlocksCommand, () => ActiveDocumentIsScript);

            ToggleShowAdvancedCommand = new RelayCommand <bool>(OnToggleShowAdvancedCommand, s => ActiveDocumentIsScript);
            ClearFiltersCommand       = new RelayCommand(OnClearFiltersCommand, () => ActiveDocumentIsScript);

            if (string.IsNullOrEmpty(_itemFilterScriptRepository.GetItemFilterScriptDirectory()))
            {
                SetItemFilterScriptDirectory();
            }

            var icon = new BitmapImage();

            icon.BeginInit();
            icon.UriSource = new Uri("pack://application:,,,/Filtration;component/Resources/Icons/filtration_icon.png");
            icon.EndInit();
            Icon = icon;

            Messenger.Default.Register <ThemeClosedMessage>(this, message =>
            {
                if (message.ClosedViewModel == null)
                {
                    return;
                }
                AvalonDockWorkspaceViewModel.CloseDocument(message.ClosedViewModel);
            });

            Messenger.Default.Register <NotificationMessage>(this, message =>
            {
                switch (message.Notification)
                {
                case "ActiveDocumentChanged":
                    {
                        CopyScriptCommand.RaiseCanExecuteChanged();
                        SaveCommand.RaiseCanExecuteChanged();
                        SaveAsCommand.RaiseCanExecuteChanged();
                        CloseCommand.RaiseCanExecuteChanged();
                        CopyBlockCommand.RaiseCanExecuteChanged();
                        PasteCommand.RaiseCanExecuteChanged();
                        ReplaceColorsCommand.RaiseCanExecuteChanged();
                        ApplyThemeToScriptCommand.RaiseCanExecuteChanged();
                        EditMasterThemeCommand.RaiseCanExecuteChanged();
                        CreateThemeCommand.RaiseCanExecuteChanged();
                        RaisePropertyChanged("ActiveDocumentIsScript");
                        RaisePropertyChanged("ActiveDocumentIsTheme");
                        RaisePropertyChanged("ShowAdvancedStatus");
                        break;
                    }

                case "NewScript":
                    {
                        OnNewScriptCommand();
                        break;
                    }

                case "OpenScript":
                    {
#pragma warning disable 4014
                        OnOpenScriptCommand();
#pragma warning restore 4014
                        break;
                    }

                case "ShowLoadingBanner":
                    {
                        ShowLoadingBanner = true;
                        break;
                    }

                case "HideLoadingBanner":
                    {
                        ShowLoadingBanner = false;
                        break;
                    }
                }
            });
        }
Пример #20
0
        public LineProxy([NotNull] Line line,
                         [NotNull] IObservable <IEnumerable <DisplayText> > formattedText,
                         [NotNull] IObservable <LineMatchCollection> lineMatches,
                         [NotNull] IObservable <TextScrollInfo> textScroll,
                         [NotNull] IThemeProvider themeProvider)
        {
            if (line == null)
            {
                throw new ArgumentNullException(nameof(line));
            }
            if (formattedText == null)
            {
                throw new ArgumentNullException(nameof(formattedText));
            }
            if (lineMatches == null)
            {
                throw new ArgumentNullException(nameof(lineMatches));
            }
            if (textScroll == null)
            {
                throw new ArgumentNullException(nameof(textScroll));
            }
            if (themeProvider == null)
            {
                throw new ArgumentNullException(nameof(themeProvider));
            }

            Start = line.LineInfo.Start;
            Index = line.LineInfo.Index;
            Line  = line;
            Key   = Line.Key;

            var lineMatchesShared = lineMatches.Publish();
            var textScrollShared  = textScroll.Publish();

            PlainText = textScrollShared
                        .Select(ts => line.Text.Virtualise(ts))
                        .ForBinding();

            FormattedText = formattedText
                            .CombineLatest(textScrollShared, (fmt, scroll) => fmt.Virtualise(scroll))
                            .ForBinding();

            ShowIndicator = lineMatchesShared
                            .Select(lmc => lmc.HasMatches ? Visibility.Visible: Visibility.Collapsed)
                            .ForBinding();

            IndicatorColour = lineMatchesShared.Select(lmc => lmc.FirstMatch?.Hue)
                              .CombineLatest(themeProvider.Accent, (user, system) =>
            {
                if (user == null)
                {
                    return(null);
                }
                return(user == Hue.NotSpecified ? system.BackgroundBrush : user.BackgroundBrush);
            })
                              .ForBinding();

            IndicatorIcon = lineMatchesShared
                            .Select(lmc =>
            {
                var icon = lmc.FirstMatch?.Icon;
                return(icon.ParseEnum <PackIconKind>()
                       .ValueOr(() => PackIconKind.ArrowRightBold));
            }).StartWith(PackIconKind.ArrowRightBold).ForBinding();

            IndicatorMatches = lineMatchesShared
                               .Select(lmc =>
            {
                return(lmc.Matches.Select(m => new LineMatchProxy(m, themeProvider)).ToList());
            }).ForBinding();

            if (Line.Timestamp.HasValue && DateTime.UtcNow.Subtract(Line.Timestamp.Value).TotalSeconds < 0.25)
            {
                IsRecent = true;
                Observable.Timer(TimeSpan.FromSeconds(1))
                .Subscribe(_ => IsRecent = false);
            }


            _cleanUp = new CompositeDisposable(FormattedText,
                                               IndicatorColour,
                                               IndicatorMatches,
                                               IndicatorIcon,
                                               ShowIndicator,
                                               FormattedText,
                                               PlainText,
                                               lineMatchesShared.Connect(),
                                               textScrollShared.Connect());
        }
Пример #21
0
        public SearchProxyCollection(ISearchMetadataCollection metadataCollection,
            Guid id,
            Action<SearchMetadata> changeScopeAction,
            ISchedulerProvider schedulerProvider,
            IColourProvider colourProvider,
            IIconProvider iconsProvider,
            ITextAssociationCollection textAssociationCollection,
            IThemeProvider themeProvider)
        {
            var proxyItems = metadataCollection.Metadata.Connect()
                .WhereReasonsAre(ChangeReason.Add, ChangeReason.Remove) //ignore updates because we update from here
                .Transform(meta =>
                {
                    return new SearchOptionsProxy(meta,
                        changeScopeAction,
                        colourProvider,
                        themeProvider,
                        new IconSelector(iconsProvider, schedulerProvider),
                        m => metadataCollection.Remove(m.SearchText),
                        iconsProvider.DefaultIconSelector,
                        id);
                })
                .SubscribeMany(so =>
                {
                    //when a value changes, write the original value back to the metadata collection
                    var anyPropertyHasChanged = so.WhenAnyPropertyChanged()
                        .Select(_ => (SearchMetadata) so)
                        .Subscribe(metadataCollection.AddorUpdate);

                    //when an icon or colour has changed we need to record user choice so
                    //the same choice can be used again
                    var iconChanged = so.WhenValueChanged(proxy => proxy.IconKind, false).ToUnit();
                    var colourChanged = so.WhenValueChanged(proxy => proxy.HighlightHue, false).ToUnit();
                    var ignoreCaseChanged = so.WhenValueChanged(proxy => proxy.CaseSensitive, false).ToUnit();

                    var textAssociationChanged = iconChanged.Merge(colourChanged).Merge(ignoreCaseChanged)
                        .Throttle(TimeSpan.FromMilliseconds(250))
                        .Select(_ => new TextAssociation(so.Text, so.CaseSensitive, so.UseRegex, so.HighlightHue.Swatch,
                            so.IconKind.ToString(), so.HighlightHue.Name, DateTime.UtcNow))
                        .Subscribe(textAssociationCollection.MarkAsChanged);

                    return new CompositeDisposable(anyPropertyHasChanged, textAssociationChanged);
                })
                .AsObservableCache();

            Count = proxyItems.CountChanged.StartWith(0).ForBinding();

            var monitor = MonitorPositionalChanges().Subscribe(metadataCollection.Add);

            //load data onto grid
            var collection = new ObservableCollectionExtended<SearchOptionsProxy>();

            var includedLoader = proxyItems
                .Connect(proxy => !proxy.IsExclusion)
                .Sort(SortExpressionComparer<SearchOptionsProxy>.Ascending(proxy => proxy.Position))
                .ObserveOn(schedulerProvider.MainThread)
                //force reset for each new or removed item dues to a bug in the underlying dragablz control which inserts in an incorrect position
                .Bind(collection, new ObservableCollectionAdaptor<SearchOptionsProxy, string>(0))
                .DisposeMany()
                .Subscribe();

            ReadOnlyObservableCollection<SearchOptionsProxy> excluded;
            var excludedLoader = proxyItems
                .Connect(proxy => proxy.IsExclusion)
                .Sort(SortExpressionComparer<SearchOptionsProxy>.Ascending(proxy => proxy.Text))
                .ObserveOn(schedulerProvider.MainThread)
                //force reset for each new or removed item dues to a bug in the underlying dragablz control which inserts in an incorrect position
                .Bind(out excluded)
                .DisposeMany()
                .Subscribe();

            Excluded = excluded;
            Included = new ReadOnlyObservableCollection<SearchOptionsProxy>(collection);

            _cleanUp = new CompositeDisposable(proxyItems, includedLoader, excludedLoader, monitor);
        }
Пример #22
0
 public SettingController(ISettingService settingService,
     ICountryService countryService,
     IStateProvinceService stateProvinceService,
     IAddressService addressService,
     ITaxCategoryService taxCategoryService,
     ICurrencyService currencyService,
     IPictureService pictureService,
     ILocalizationService localizationService,
     IDateTimeHelper dateTimeHelper,
     IOrderService orderService,
     IEncryptionService encryptionService,
     IThemeProvider themeProvider,
     ICustomerService customerService,
     ICustomerActivityService customerActivityService,
     IPermissionService permissionService,
     IStoreService storeService,
     IWorkContext workContext,
     IGenericAttributeService genericAttributeService,
     IRepository<Product> productRepository,
     IReturnRequestService returnRequestService,
     ILanguageService languageService)
 {
     this._settingService = settingService;
     this._countryService = countryService;
     this._stateProvinceService = stateProvinceService;
     this._addressService = addressService;
     this._taxCategoryService = taxCategoryService;
     this._currencyService = currencyService;
     this._pictureService = pictureService;
     this._localizationService = localizationService;
     this._dateTimeHelper = dateTimeHelper;
     this._orderService = orderService;
     this._encryptionService = encryptionService;
     this._themeProvider = themeProvider;
     this._customerService = customerService;
     this._customerActivityService = customerActivityService;
     this._permissionService = permissionService;
     this._storeService = storeService;
     this._workContext = workContext;
     this._genericAttributeService = genericAttributeService;
     this._productRepository = productRepository;
     this._returnRequestService = returnRequestService;
     this._languageService = languageService;
 }
Пример #23
0
 public HomeController(IBlogProvider blogProvider, IPostProvider postProvider, IFeedProvider feedProvider, IAuthorProvider authorProvider, IThemeProvider themeProvider, IStorageProvider storageProvider)
 {
     _blogProvider    = blogProvider;
     _postProvider    = postProvider;
     _feedProvider    = feedProvider;
     _authorProvider  = authorProvider;
     _themeProvider   = themeProvider;
     _storageProvider = storageProvider;
 }
Пример #24
0
        public CommonWebService(
            //ICacheManager cacheManager,
            IStoreContext storeContext,
            IThemeContext themeContext,
            IPictureService pictureService,
            IWebHelper webHelper,
            ILanguageService languageService,
            IWorkContext workContext,
            ICurrencyService currencyService,
            IPermissionService permissionService,
            IPageHeadBuilder pageHeadBuilder,
            ITopicService topicService,
            IWorkflowMessageService workflowMessageService,
            ILocalizationService localizationService,
            ICategoryService categoryService,
            IManufacturerService manufacturerService,
            IProductService productService,
            ISitemapGenerator sitemapGenerator,
            IThemeProvider themeProvider,
            IForumService forumservice,
            IHttpContextAccessor httpContextAccessor,

            StoreInformationSettings storeInformationSettings,
            LocalizationSettings localizationSettings,
            TaxSettings taxSettings,
            CustomerSettings customerSettings,
            ForumSettings forumSettings,
            CatalogSettings catalogSettings,
            BlogSettings blogSettings,
            NewsSettings newsSettings,
            VendorSettings vendorSettings,
            CommonSettings commonSettings,
            CaptchaSettings captchaSettings
            )
        {
            //this._cacheManager = cacheManager;
            this._storeContext      = storeContext;
            this._themeContext      = themeContext;
            this._pictureService    = pictureService;
            this._webHelper         = webHelper;
            this._languageService   = languageService;
            this._workContext       = workContext;
            this._currencyService   = currencyService;
            this._permissionService = permissionService;
            //this._pageHeadBuilder = pageHeadBuilder;
            this._topicService           = topicService;
            this._workflowMessageService = workflowMessageService;
            this._localizationService    = localizationService;
            this._categoryService        = categoryService;
            this._manufacturerService    = manufacturerService;
            this._productService         = productService;
            this._sitemapGenerator       = sitemapGenerator;
            this._themeProvider          = themeProvider;
            this._forumservice           = forumservice;
            this._httpContextAccessor    = httpContextAccessor;

            this._storeInformationSettings = storeInformationSettings;
            this._localizationSettings     = localizationSettings;
            this._taxSettings      = taxSettings;
            this._customerSettings = customerSettings;
            this._forumSettings    = forumSettings;
            this._catalogSettings  = catalogSettings;
            this._blogSettings     = blogSettings;
            this._newsSettings     = newsSettings;
            this._vendorSettings   = vendorSettings;
            this._commonSettings   = commonSettings;
            this._captchaSettings  = captchaSettings;
        }
Пример #25
0
        public SettingController(ISettingService settingService,
            ICountryService countryService, IStateProvinceService stateProvinceService,
            IAddressService addressService, ITaxCategoryService taxCategoryService,
            ICurrencyService currencyService, IPictureService pictureService, 
            ILocalizationService localizationService, IDateTimeHelper dateTimeHelper,
            IOrderService orderService, IEncryptionService encryptionService,
            IThemeProvider themeProvider, ICustomerService customerService, 
            ICustomerActivityService customerActivityService, IPermissionService permissionService,
            IWebHelper webHelper, IFulltextService fulltextService,
            BlogSettings blogSettings,
            ForumSettings forumSettings, NewsSettings newsSettings,
            ShippingSettings shippingSettings, TaxSettings taxSettings,
            CatalogSettings catalogSettings, RewardPointsSettings rewardPointsSettings,
            CurrencySettings currencySettings, OrderSettings orderSettings,
            ShoppingCartSettings shoppingCartSettings, MediaSettings mediaSettings,
            CustomerSettings customerSettings,
            DateTimeSettings dateTimeSettings, StoreInformationSettings storeInformationSettings,
            SeoSettings seoSettings,SecuritySettings securitySettings, PdfSettings pdfSettings,
            LocalizationSettings localizationSettings, AdminAreaSettings adminAreaSettings,
            CaptchaSettings captchaSettings, ExternalAuthenticationSettings externalAuthenticationSettings,
            CommonSettings commonSettings)
        {
            this._settingService = settingService;
            this._countryService = countryService;
            this._stateProvinceService = stateProvinceService;
            this._addressService = addressService;
            this._taxCategoryService = taxCategoryService;
            this._currencyService = currencyService;
            this._pictureService = pictureService;
            this._localizationService = localizationService;
            this._dateTimeHelper = dateTimeHelper;
            this._orderService = orderService;
            this._encryptionService = encryptionService;
            this._themeProvider = themeProvider;
            this._customerService = customerService;
            this._customerActivityService = customerActivityService;
            this._permissionService = permissionService;
            this._webHelper = webHelper;
            this._fulltextService = fulltextService;

            this._blogSettings = blogSettings;
            this._forumSettings = forumSettings;
            this._newsSettings = newsSettings;
            this._shippingSettings = shippingSettings;
            this._taxSettings = taxSettings;
            this._catalogSettings = catalogSettings;
            this._rewardPointsSettings = rewardPointsSettings;
            this._currencySettings = currencySettings;
            this._orderSettings = orderSettings;
            this._shoppingCartSettings = shoppingCartSettings;
            this._mediaSettings = mediaSettings;
            this._customerSettings = customerSettings;
            this._dateTimeSettings = dateTimeSettings;
            this._storeInformationSettings = storeInformationSettings;
            this._seoSettings = seoSettings;
            this._securitySettings = securitySettings;
            this._pdfSettings = pdfSettings;
            this._localizationSettings = localizationSettings;
            this._adminAreaSettings = adminAreaSettings;
            this._captchaSettings = captchaSettings;
            this._externalAuthenticationSettings = externalAuthenticationSettings;
            this._commonSettings = commonSettings;
        }
Пример #26
0
        public SearchOptionsViewModel(ISearchMetadataCollection metadataCollection,
                                      ISearchMetadataFactory searchMetadataFactory,
                                      ISchedulerProvider schedulerProvider,
                                      IColourProvider colourProvider,
                                      IIconProvider iconsProvider,
                                      ITextAssociationCollection textAssociationCollection,
                                      SearchHints searchHints,
                                      IThemeProvider themeProvider)
        {
            SearchHints = searchHints;

            var proxyItems = metadataCollection.Metadata.Connect()
                             .WhereReasonsAre(ChangeReason.Add, ChangeReason.Remove) //ignore updates because we update from here
                             .Transform(meta =>
            {
                return(new SearchOptionsProxy(meta,
                                              colourProvider,
                                              themeProvider,
                                              new IconSelector(iconsProvider, schedulerProvider),
                                              m => metadataCollection.Remove(m.SearchText),
                                              iconsProvider.DefaultIconSelector,
                                              Id));
            })
                             .SubscribeMany(so =>
            {
                //when a value changes, write the original value back to the metadata collection
                var anyPropertyHasChanged = so.WhenAnyPropertyChanged()
                                            .Select(_ => (SearchMetadata)so)
                                            .Subscribe(metadataCollection.AddorUpdate);

                //when an icon or colour has changed we need to record user choice so
                //the same choice can be used again
                var iconChanged       = so.WhenValueChanged(proxy => proxy.IconKind, false).ToUnit();
                var colourChanged     = so.WhenValueChanged(proxy => proxy.HighlightHue, false).ToUnit();
                var ignoreCaseChanged = so.WhenValueChanged(proxy => proxy.IgnoreCase, false).ToUnit();

                var textAssociationChanged = iconChanged.Merge(colourChanged).Merge(ignoreCaseChanged)
                                             .Throttle(TimeSpan.FromMilliseconds(250))
                                             .Select(_ => new TextAssociation(so.Text, so.IgnoreCase, so.UseRegex, so.HighlightHue.Swatch, so.IconKind.ToString(), so.HighlightHue.Name, DateTime.UtcNow))
                                             .Subscribe(textAssociationCollection.MarkAsChanged);

                return(new CompositeDisposable(anyPropertyHasChanged, textAssociationChanged));
            })
                             .AsObservableCache();

            var monitor = MonitorPositionalChanges()
                          .Subscribe(metadataCollection.Add);


            //load data onto grid
            var collection = new ObservableCollectionExtended <SearchOptionsProxy>();

            var userOptions = proxyItems.Connect()
                              .Sort(SortExpressionComparer <SearchOptionsProxy> .Ascending(proxy => proxy.Position))
                              .ObserveOn(schedulerProvider.MainThread)
                              //force reset for each new or removed item dues to a bug in the underlying dragablz control which inserts in an incorrect position
                              .Bind(collection, new ObservableCollectionAdaptor <SearchOptionsProxy, string>(0))
                              .DisposeMany()
                              .Subscribe();

            Data = new ReadOnlyObservableCollection <SearchOptionsProxy>(collection);

            //command to add the current search to the tail collection
            var searchInvoker = SearchHints.SearchRequested
                                .ObserveOn(schedulerProvider.Background)
                                .Subscribe(request =>
            {
                var meta = searchMetadataFactory.Create(request.Text,
                                                        request.UseRegEx,
                                                        metadataCollection.NextIndex(),
                                                        false);
                metadataCollection.AddorUpdate(meta);
            });

            _cleanUp = new CompositeDisposable(searchInvoker,
                                               userOptions,
                                               searchInvoker,
                                               monitor,
                                               SearchHints);
        }
Пример #27
0
 static FingerColorsImporter()
 {
     ThemeProvider = new DefaultThemeProvider();
 }
Пример #28
0
        public SearchOptionsProxy([NotNull] SearchMetadata searchMetadata,
                                  [NotNull] IColourProvider colourProvider,
                                  [NotNull] IThemeProvider themeProvider,
                                  [NotNull] IconSelector iconSelector,
                                  [NotNull] Action <SearchMetadata> removeAction,
                                  [NotNull] IDefaultIconSelector defaultIconSelector,
                                  Guid parentId)
        {
            if (searchMetadata == null)
            {
                throw new ArgumentNullException(nameof(searchMetadata));
            }
            if (colourProvider == null)
            {
                throw new ArgumentNullException(nameof(colourProvider));
            }
            if (themeProvider == null)
            {
                throw new ArgumentNullException(nameof(themeProvider));
            }
            if (iconSelector == null)
            {
                throw new ArgumentNullException(nameof(iconSelector));
            }
            if (removeAction == null)
            {
                throw new ArgumentNullException(nameof(removeAction));
            }
            if (defaultIconSelector == null)
            {
                throw new ArgumentNullException(nameof(defaultIconSelector));
            }

            _searchMetadata      = searchMetadata;
            _defaultIconSelector = defaultIconSelector;

            IconSelector = iconSelector;
            ParentId     = parentId;
            Highlight    = _searchMetadata.Highlight;
            Filter       = _searchMetadata.Filter;
            UseRegex     = searchMetadata.UseRegex;
            IgnoreCase   = searchMetadata.IgnoreCase;
            Position     = searchMetadata.Position;
            Hues         = colourProvider.Hues;
            HighlightHue = searchMetadata.HighlightHue;

            ShowIconSelectorCommand = new Command(ShowIconSelector);
            RemoveCommand           = new Command(() => removeAction(searchMetadata));
            HighlightCommand        = new Command <Hue>(newHue =>
            {
                HighlightHue = newHue;
            });

            IconKind = _searchMetadata.IconKind.ParseEnum <PackIconKind>()
                       .ValueOr(() => PackIconKind.ArrowRightBold);

            //combine system with user choice.
            var defaultHue = this.WhenValueChanged(vm => vm.HighlightHue)
                             .CombineLatest(themeProvider.Accent, (user, system) => user == Hue.NotSpecified ? system : user)
                             .Publish();

            Foreground = defaultHue.Select(h => h.ForegroundBrush).ForBinding();
            Background = defaultHue.Select(h => h.BackgroundBrush).ForBinding();

            _cleanUp = new CompositeDisposable(IconSelector, Foreground, Background, defaultHue.Connect());
        }
Пример #29
0
 public UploadService(INopFileProvider fileProvider,
                      IThemeProvider themeProvider)
 {
     this._fileProvider  = fileProvider;
     this._themeProvider = themeProvider;
 }
Пример #30
0
        public InlineViewer([NotNull] InlineViewerArgs args,
                            [NotNull] IClipboardHandler clipboardHandler,
                            [NotNull] ISchedulerProvider schedulerProvider,
                            [NotNull] ISelectionMonitor selectionMonitor,
                            [NotNull] ILogger logger,
                            [NotNull] IThemeProvider themeProvider)
        {
            if (args == null)
            {
                throw new ArgumentNullException(nameof(args));
            }
            if (clipboardHandler == null)
            {
                throw new ArgumentNullException(nameof(clipboardHandler));
            }
            if (schedulerProvider == null)
            {
                throw new ArgumentNullException(nameof(schedulerProvider));
            }
            if (selectionMonitor == null)
            {
                throw new ArgumentNullException(nameof(selectionMonitor));
            }
            if (themeProvider == null)
            {
                throw new ArgumentNullException(nameof(themeProvider));
            }
            SelectionMonitor       = selectionMonitor;
            CopyToClipboardCommand = new Command(() => clipboardHandler.WriteToClipboard(selectionMonitor.GetSelectedText()));

            _isSettingScrollPosition = false;

            var lineProvider    = args.LineProvider;
            var selectedChanged = args.SelectedChanged;
            var pageSize        = this.WhenValueChanged(vm => vm.PageSize);

            //if use selection is null, tail the file
            var scrollSelected = selectedChanged
                                 .CombineLatest(lineProvider, pageSize, (proxy, lp, pge) => proxy == null ? new ScrollRequest(pge, 0) : new ScrollRequest(pge, proxy.Start))
                                 .DistinctUntilChanged();



            var horizonalScrollArgs = new ReplaySubject <TextScrollInfo>(1);

            HorizonalScrollChanged = hargs =>
            {
                horizonalScrollArgs.OnNext(hargs);
            };

            var scrollUser = _userScrollRequested
                             .Where(x => !_isSettingScrollPosition)
                             .Select(request => new ScrollRequest(ScrollReason.User, request.PageSize, request.FirstIndex));

            var scroller = scrollSelected.Merge(scrollUser)
                           .ObserveOn(schedulerProvider.Background)
                           .DistinctUntilChanged();


            var lineScroller = new LineScroller(lineProvider, scroller);

            Count = lineProvider.Select(lp => lp.Count).ForBinding();

            MaximumChars = lineScroller.MaximumLines()
                           .ObserveOn(schedulerProvider.MainThread)
                           .ForBinding();

            var proxyFactory = new LineProxyFactory(new TextFormatter(args.SearchMetadataCollection), new LineMatches(args.SearchMetadataCollection), horizonalScrollArgs.DistinctUntilChanged(), themeProvider);

            //load lines into observable collection
            var loader = lineScroller.Lines.Connect()
                         .Transform(proxyFactory.Create, new ParallelisationOptions(ParallelType.Ordered, 3))
                         .Sort(SortExpressionComparer <LineProxy> .Ascending(proxy => proxy))
                         .ObserveOn(schedulerProvider.MainThread)
                         .Bind(out _data)
                         .DisposeMany()
                         .LogErrors(logger)
                         .Subscribe();

            // track first visible index [required to set scroll extent]
            var firstIndexMonitor = lineScroller.Lines.Connect()
                                    .Buffer(TimeSpan.FromMilliseconds(250)).FlattenBufferResult()
                                    .ToCollection()
                                    .Select(lines => lines.Count == 0 ? 0 : lines.Select(l => l.Index).Max() - lines.Count + 1)
                                    .ObserveOn(schedulerProvider.MainThread)
                                    .Subscribe(first =>
            {
                try
                {
                    _isSettingScrollPosition = true;
                    FirstIndex = first;
                }
                finally
                {
                    _isSettingScrollPosition = false;
                }
            });

            _cleanUp = new CompositeDisposable(lineScroller,
                                               loader,
                                               Count,
                                               firstIndexMonitor,
                                               SelectionMonitor,
                                               MaximumChars,
                                               horizonalScrollArgs.SetAsComplete(),
                                               _userScrollRequested.SetAsComplete());
        }
Пример #31
0
 public CommonModelFactory(BlogSettings blogSettings,
                           CaptchaSettings captchaSettings,
                           CatalogSettings catalogSettings,
                           CommonSettings commonSettings,
                           CustomerSettings customerSettings,
                           DisplayDefaultFooterItemSettings displayDefaultFooterItemSettings,
                           ForumSettings forumSettings,
                           IActionContextAccessor actionContextAccessor,
                           IBlogService blogService,
                           ICacheKeyService cacheKeyService,
                           ICategoryService categoryService,
                           ICurrencyService currencyService,
                           ICustomerService customerService,
                           IForumService forumService,
                           IGenericAttributeService genericAttributeService,
                           IHttpContextAccessor httpContextAccessor,
                           ILanguageService languageService,
                           ILocalizationService localizationService,
                           IManufacturerService manufacturerService,
                           INewsService newsService,
                           INopFileProvider fileProvider,
                           IPageHeadBuilder pageHeadBuilder,
                           IPermissionService permissionService,
                           IPictureService pictureService,
                           IProductService productService,
                           IProductTagService productTagService,
                           IShoppingCartService shoppingCartService,
                           ISitemapGenerator sitemapGenerator,
                           IStaticCacheManager staticCacheManager,
                           IStoreContext storeContext,
                           IThemeContext themeContext,
                           IThemeProvider themeProvider,
                           ITopicService topicService,
                           IUrlHelperFactory urlHelperFactory,
                           IUrlRecordService urlRecordService,
                           IWebHelper webHelper,
                           IWorkContext workContext,
                           LocalizationSettings localizationSettings,
                           MediaSettings mediaSettings,
                           NewsSettings newsSettings,
                           SitemapSettings sitemapSettings,
                           SitemapXmlSettings sitemapXmlSettings,
                           StoreInformationSettings storeInformationSettings,
                           VendorSettings vendorSettings)
 {
     _blogSettings     = blogSettings;
     _captchaSettings  = captchaSettings;
     _catalogSettings  = catalogSettings;
     _commonSettings   = commonSettings;
     _customerSettings = customerSettings;
     _displayDefaultFooterItemSettings = displayDefaultFooterItemSettings;
     _forumSettings           = forumSettings;
     _actionContextAccessor   = actionContextAccessor;
     _blogService             = blogService;
     _cacheKeyService         = cacheKeyService;
     _categoryService         = categoryService;
     _currencyService         = currencyService;
     _customerService         = customerService;
     _forumService            = forumService;
     _genericAttributeService = genericAttributeService;
     _httpContextAccessor     = httpContextAccessor;
     _languageService         = languageService;
     _localizationService     = localizationService;
     _manufacturerService     = manufacturerService;
     _newsService             = newsService;
     _fileProvider            = fileProvider;
     _pageHeadBuilder         = pageHeadBuilder;
     _permissionService       = permissionService;
     _pictureService          = pictureService;
     _productService          = productService;
     _productTagService       = productTagService;
     _shoppingCartService     = shoppingCartService;
     _sitemapGenerator        = sitemapGenerator;
     _staticCacheManager      = staticCacheManager;
     _storeContext            = storeContext;
     _themeContext            = themeContext;
     _themeProvider           = themeProvider;
     _topicService            = topicService;
     _urlHelperFactory        = urlHelperFactory;
     _urlRecordService        = urlRecordService;
     _webHelper                = webHelper;
     _workContext              = workContext;
     _mediaSettings            = mediaSettings;
     _localizationSettings     = localizationSettings;
     _newsSettings             = newsSettings;
     _sitemapSettings          = sitemapSettings;
     _sitemapXmlSettings       = sitemapXmlSettings;
     _storeInformationSettings = storeInformationSettings;
     _vendorSettings           = vendorSettings;
 }
Пример #32
0
 public ThemeContext(IWorkContext workContext, IThemeProvider themeProvider)
 {
     this.workContext = workContext;
     this.themeProvider = themeProvider;
 }
Пример #33
0
        public CommonController(ICategoryService categoryService,
                                IProductService productService,
                                IManufacturerService manufacturerService,
                                ITopicService topicService,
                                ILanguageService languageService,
                                ICurrencyService currencyService,
                                ILocalizationService localizationService,
                                IWorkContext workContext,
                                IStoreContext storeContext,
                                IQueuedEmailService queuedEmailService,
                                IEmailAccountService emailAccountService,
                                ISitemapGenerator sitemapGenerator,
                                IThemeContext themeContext,
                                IThemeProvider themeProvider,
                                IForumService forumService,
                                IGenericAttributeService genericAttributeService,
                                IWebHelper webHelper,
                                IPermissionService permissionService,
                                ICacheManager cacheManager,
                                ICustomerActivityService customerActivityService,
                                IVendorService vendorService,
                                CustomerSettings customerSettings,
                                TaxSettings taxSettings,
                                CatalogSettings catalogSettings,
                                StoreInformationSettings storeInformationSettings,
                                EmailAccountSettings emailAccountSettings,
                                CommonSettings commonSettings,
                                BlogSettings blogSettings,
                                NewsSettings newsSettings,
                                ForumSettings forumSettings,
                                LocalizationSettings localizationSettings,
                                CaptchaSettings captchaSettings,
                                VendorSettings vendorSettings)
        {
            this._categoryService         = categoryService;
            this._productService          = productService;
            this._manufacturerService     = manufacturerService;
            this._topicService            = topicService;
            this._languageService         = languageService;
            this._currencyService         = currencyService;
            this._localizationService     = localizationService;
            this._workContext             = workContext;
            this._storeContext            = storeContext;
            this._queuedEmailService      = queuedEmailService;
            this._emailAccountService     = emailAccountService;
            this._sitemapGenerator        = sitemapGenerator;
            this._themeContext            = themeContext;
            this._themeProvider           = themeProvider;
            this._forumservice            = forumService;
            this._genericAttributeService = genericAttributeService;
            this._webHelper               = webHelper;
            this._permissionService       = permissionService;
            this._cacheManager            = cacheManager;
            this._customerActivityService = customerActivityService;
            this._vendorService           = vendorService;

            this._customerSettings         = customerSettings;
            this._taxSettings              = taxSettings;
            this._catalogSettings          = catalogSettings;
            this._storeInformationSettings = storeInformationSettings;
            this._emailAccountSettings     = emailAccountSettings;
            this._commonSettings           = commonSettings;
            this._blogSettings             = blogSettings;
            this._newsSettings             = newsSettings;
            this._forumSettings            = forumSettings;
            this._localizationSettings     = localizationSettings;
            this._captchaSettings          = captchaSettings;
            this._vendorSettings           = vendorSettings;
        }
Пример #34
0
 public UploadService(IThemeProvider themeProvider)
 {
     this._themeProvider = themeProvider;
 }
Пример #35
0
        public SearchOptionsViewModel(ISearchMetadataCollection metadataCollection,
            ISearchMetadataFactory searchMetadataFactory,
            ISchedulerProvider schedulerProvider,
            IColourProvider colourProvider,
            IIconProvider iconsProvider,
            ITextAssociationCollection textAssociationCollection,
            SearchHints searchHints,
            IThemeProvider themeProvider)
        {
            SearchHints = searchHints;

            var proxyItems = metadataCollection.Metadata.Connect()
                .WhereReasonsAre(ChangeReason.Add, ChangeReason.Remove) //ignore updates because we update from here
                .Transform(meta =>
                {
                    return new SearchOptionsProxy(meta,
                        colourProvider,
                        themeProvider,
                        new IconSelector(iconsProvider, schedulerProvider),
                        m => metadataCollection.Remove(m.SearchText),
                        iconsProvider.DefaultIconSelector,
                        Id);
                })
                .SubscribeMany(so =>
                {
                    //when a value changes, write the original value back to the metadata collection
                    var anyPropertyHasChanged = so.WhenAnyPropertyChanged()
                        .Select(_ => (SearchMetadata) so)
                        .Subscribe(metadataCollection.AddorUpdate);

                    //when an icon or colour has changed we need to record user choice so
                    //the same choice can be used again
                    var iconChanged = so.WhenValueChanged(proxy => proxy.IconKind,false).ToUnit();
                    var colourChanged = so.WhenValueChanged(proxy => proxy.HighlightHue, false).ToUnit();
                    var ignoreCaseChanged = so.WhenValueChanged(proxy => proxy.IgnoreCase, false).ToUnit();

                    var textAssociationChanged = iconChanged.Merge(colourChanged).Merge(ignoreCaseChanged)
                                .Throttle(TimeSpan.FromMilliseconds(250))
                                .Select(_=> new TextAssociation(so.Text, so.IgnoreCase, so.UseRegex, so.HighlightHue.Swatch, so.IconKind.ToString(), so.HighlightHue.Name, DateTime.Now))
                                .Subscribe(textAssociationCollection.MarkAsChanged);

                    return new CompositeDisposable(anyPropertyHasChanged, textAssociationChanged);
                })
                .AsObservableCache();

            var monitor = MonitorPositionalChanges()
                .Subscribe(metadataCollection.Add);

            //load data onto grid
            var collection = new ObservableCollectionExtended<SearchOptionsProxy>();

            var userOptions = proxyItems.Connect()
                .Sort(SortExpressionComparer<SearchOptionsProxy>.Ascending(proxy => proxy.Position))
                .ObserveOn(schedulerProvider.MainThread)
                //force reset for each new or removed item dues to a bug in the underlying dragablz control which inserts in an incorrect position
                .Bind(collection, new ObservableCollectionAdaptor<SearchOptionsProxy, string>(0))
                .DisposeMany()
                .Subscribe();

            Data = new ReadOnlyObservableCollection<SearchOptionsProxy>(collection);

            //command to add the current search to the tail collection
            var searchInvoker = SearchHints.SearchRequested
                .ObserveOn(schedulerProvider.Background)
                .Subscribe(request =>
                {
                    var meta = searchMetadataFactory.Create(request.Text,
                        request.UseRegEx,
                        metadataCollection.NextIndex(),
                        false);
                    metadataCollection.AddorUpdate(meta);
                });

            _cleanUp = new CompositeDisposable(searchInvoker,
                userOptions,
                searchInvoker,
                monitor,
                SearchHints);
        }
        public CommonController(ICategoryService categoryService,
            IProductService productService,
            IManufacturerService manufacturerService,
            ITopicService topicService,
            ILanguageService languageService,
            ICurrencyService currencyService,
            ILocalizationService localizationService,
            IWorkContext workContext, 
            IStoreContext storeContext,
            IQueuedEmailService queuedEmailService, 
            IEmailAccountService emailAccountService,
            ISitemapGenerator sitemapGenerator,
            IThemeContext themeContext,
            IThemeProvider themeProvider,
            IForumService forumService,
            IGenericAttributeService genericAttributeService, 
            IWebHelper webHelper,
            IPermissionService permissionService,
            ICacheManager cacheManager,
            ICustomerActivityService customerActivityService,
            IVendorService vendorService,
            CustomerSettings customerSettings, 
            TaxSettings taxSettings, 
            CatalogSettings catalogSettings,
            StoreInformationSettings storeInformationSettings,
            EmailAccountSettings emailAccountSettings,
            CommonSettings commonSettings, 
            BlogSettings blogSettings, 
            NewsSettings newsSettings,
            ForumSettings forumSettings,
            LocalizationSettings localizationSettings, 
            CaptchaSettings captchaSettings,
            VendorSettings vendorSettings)
        {
            this._categoryService = categoryService;
            this._productService = productService;
            this._manufacturerService = manufacturerService;
            this._topicService = topicService;
            this._languageService = languageService;
            this._currencyService = currencyService;
            this._localizationService = localizationService;
            this._workContext = workContext;
            this._storeContext = storeContext;
            this._queuedEmailService = queuedEmailService;
            this._emailAccountService = emailAccountService;
            this._sitemapGenerator = sitemapGenerator;
            this._themeContext = themeContext;
            this._themeProvider = themeProvider;
            this._forumservice = forumService;
            this._genericAttributeService = genericAttributeService;
            this._webHelper = webHelper;
            this._permissionService = permissionService;
            this._cacheManager = cacheManager;
            this._customerActivityService = customerActivityService;
            this._vendorService = vendorService;

            this._customerSettings = customerSettings;
            this._taxSettings = taxSettings;
            this._catalogSettings = catalogSettings;
            this._storeInformationSettings = storeInformationSettings;
            this._emailAccountSettings = emailAccountSettings;
            this._commonSettings = commonSettings;
            this._blogSettings = blogSettings;
            this._newsSettings = newsSettings;
            this._forumSettings = forumSettings;
            this._localizationSettings = localizationSettings;
            this._captchaSettings = captchaSettings;
            this._vendorSettings = vendorSettings;
        }
Пример #37
0
 public CommonModelFactory(ICategoryService categoryService,
                           IProductService productService,
                           IManufacturerService manufacturerService,
                           ITopicService topicService,
                           ILanguageService languageService,
                           ICurrencyService currencyService,
                           ILocalizationService localizationService,
                           IWorkContext workContext,
                           IStoreContext storeContext,
                           ISitemapGenerator sitemapGenerator,
                           IThemeContext themeContext,
                           IThemeProvider themeProvider,
                           IForumService forumService,
                           IGenericAttributeService genericAttributeService,
                           IWebHelper webHelper,
                           IPermissionService permissionService,
                           IStaticCacheManager cacheManager,
                           IPageHeadBuilder pageHeadBuilder,
                           IPictureService pictureService,
                           IHostingEnvironment hostingEnvironment,
                           CatalogSettings catalogSettings,
                           StoreInformationSettings storeInformationSettings,
                           CommonSettings commonSettings,
                           BlogSettings blogSettings,
                           NewsSettings newsSettings,
                           ForumSettings forumSettings,
                           LocalizationSettings localizationSettings,
                           CaptchaSettings captchaSettings,
                           VendorSettings vendorSettings,
                           IProductTagService productTagService)
 {
     this._categoryService         = categoryService;
     this._productService          = productService;
     this._manufacturerService     = manufacturerService;
     this._topicService            = topicService;
     this._languageService         = languageService;
     this._currencyService         = currencyService;
     this._localizationService     = localizationService;
     this._workContext             = workContext;
     this._storeContext            = storeContext;
     this._sitemapGenerator        = sitemapGenerator;
     this._themeContext            = themeContext;
     this._themeProvider           = themeProvider;
     this._forumservice            = forumService;
     this._genericAttributeService = genericAttributeService;
     this._webHelper                = webHelper;
     this._permissionService        = permissionService;
     this._cacheManager             = cacheManager;
     this._pageHeadBuilder          = pageHeadBuilder;
     this._pictureService           = pictureService;
     this._hostingEnvironment       = hostingEnvironment;
     this._catalogSettings          = catalogSettings;
     this._storeInformationSettings = storeInformationSettings;
     this._commonSettings           = commonSettings;
     this._blogSettings             = blogSettings;
     this._newsSettings             = newsSettings;
     this._forumSettings            = forumSettings;
     this._localizationSettings     = localizationSettings;
     this._captchaSettings          = captchaSettings;
     this._vendorSettings           = vendorSettings;
     this._productTagService        = productTagService;
 }
Пример #38
0
 public WebWorkContext(IThemeProvider themeProvider,
                       StoreSettings storeSettings)
 {
     _storeSettings = storeSettings;
     _themeProvider = themeProvider;
 }
Пример #39
0
        public MainWindowViewModel(IItemFilterScriptRepository itemFilterScriptRepository,
                                   IItemFilterScriptTranslator itemFilterScriptTranslator,
                                   IReplaceColorsViewModel replaceColorsViewModel,
                                   IAvalonDockWorkspaceViewModel avalonDockWorkspaceViewModel,
                                   ISettingsPageViewModel settingsPageViewModel,
                                   IThemeProvider themeProvider,
                                   IThemeService themeService,
                                   IMessageBoxService messageBoxService,
                                   IClipboardService clipboardService)
        {
            _itemFilterScriptRepository = itemFilterScriptRepository;
            _itemFilterScriptTranslator = itemFilterScriptTranslator;
            _replaceColorsViewModel = replaceColorsViewModel;
            _avalonDockWorkspaceViewModel = avalonDockWorkspaceViewModel;
            SettingsPageViewModel = settingsPageViewModel;
            _themeProvider = themeProvider;
            _themeService = themeService;
            _messageBoxService = messageBoxService;
            _clipboardService = clipboardService;

            NewScriptCommand = new RelayCommand(OnNewScriptCommand);
            CopyScriptCommand = new RelayCommand(OnCopyScriptCommand, () => ActiveDocumentIsScript);
            OpenScriptCommand = new RelayCommand(async () => await OnOpenScriptCommand());
            OpenThemeCommand = new RelayCommand(async () => await OnOpenThemeCommandAsync());

            SaveCommand = new RelayCommand(async () => await OnSaveDocumentCommandAsync(), ActiveDocumentIsEditable);
            SaveAsCommand = new RelayCommand(async () => await OnSaveAsCommandAsync(), ActiveDocumentIsEditable);
            CloseCommand = new RelayCommand(OnCloseDocumentCommand, ActiveDocumentIsEditable);

            CopyBlockCommand = new RelayCommand(OnCopyBlockCommand, () => ActiveDocumentIsScript && ActiveScriptHasSelectedBlock);
            CopyBlockStyleCommand = new RelayCommand(OnCopyBlockStyleCommand, () => ActiveDocumentIsScript && ActiveScriptHasSelectedBlock);
            PasteCommand = new RelayCommand(OnPasteCommand, () => ActiveDocumentIsScript && ActiveScriptHasSelectedBlock);
            PasteBlockStyleCommand = new RelayCommand(OnPasteBlockStyleCommand, () => ActiveDocumentIsScript && ActiveScriptHasSelectedBlock);

            MoveBlockUpCommand = new RelayCommand(OnMoveBlockUpCommand, () => ActiveDocumentIsScript && ActiveScriptHasSelectedBlock);
            MoveBlockDownCommand = new RelayCommand(OnMoveBlockDownCommand, () => ActiveDocumentIsScript && ActiveScriptHasSelectedBlock);
            MoveBlockToTopCommand = new RelayCommand(OnMoveBlockToTopCommand, () => ActiveDocumentIsScript && ActiveScriptHasSelectedBlock);
            MoveBlockToBottomCommand = new RelayCommand(OnMoveBlockToBottomCommand, () => ActiveDocumentIsScript && ActiveScriptHasSelectedBlock);

            AddBlockCommand = new RelayCommand(OnAddBlockCommand, () => ActiveDocumentIsScript);
            AddSectionCommand = new RelayCommand(OnAddSectionCommand, () => ActiveDocumentIsScript);
            DeleteBlockCommand = new RelayCommand(OnDeleteBlockCommand, () => ActiveDocumentIsScript && ActiveScriptHasSelectedBlock);
            DisableBlockCommand = new RelayCommand(OnDisableBlockCommand, () => ActiveDocumentIsScript && ActiveScriptHasSelectedEnabledBlock);
            EnableBlockCommand = new RelayCommand(OnEnableBlockCommand, () => ActiveDocumentIsScript && ActiveScriptHasSelectedDisabledBlock);
            OpenAboutWindowCommand = new RelayCommand(OnOpenAboutWindowCommand);
            ReplaceColorsCommand = new RelayCommand(OnReplaceColorsCommand, () => ActiveDocumentIsScript);

            CreateThemeCommand = new RelayCommand(OnCreateThemeCommand, () => ActiveDocumentIsScript);
            ApplyThemeToScriptCommand = new RelayCommand(async () => await OnApplyThemeToScriptCommandAsync(), () => ActiveDocumentIsScript);
            EditMasterThemeCommand = new RelayCommand(OnEditMasterThemeCommand, () => ActiveDocumentIsScript);

            AddTextColorThemeComponentCommand = new RelayCommand(OnAddTextColorThemeComponentCommand, () => ActiveDocumentIsTheme && ActiveThemeIsEditable);
            AddBackgroundColorThemeComponentCommand = new RelayCommand(OnAddBackgroundColorThemeComponentCommand, () => ActiveDocumentIsTheme && ActiveThemeIsEditable);
            AddBorderColorThemeComponentCommand = new RelayCommand(OnAddBorderColorThemeComponentCommand, () => ActiveDocumentIsTheme && ActiveThemeIsEditable);
            DeleteThemeComponentCommand = new RelayCommand(OnDeleteThemeComponentCommand, () => ActiveDocumentIsTheme && ActiveThemeIsEditable && _avalonDockWorkspaceViewModel.ActiveThemeViewModel.SelectedThemeComponent != null);

            ExpandAllBlocksCommand = new RelayCommand(OnExpandAllBlocksCommand, () => ActiveDocumentIsScript);
            CollapseAllBlocksCommand = new RelayCommand(OnCollapseAllBlocksCommand, () => ActiveDocumentIsScript);

            ToggleShowAdvancedCommand = new RelayCommand<bool>(OnToggleShowAdvancedCommand, s => ActiveDocumentIsScript);
            ClearFiltersCommand = new RelayCommand(OnClearFiltersCommand, () => ActiveDocumentIsScript);

            if (string.IsNullOrEmpty(_itemFilterScriptRepository.GetItemFilterScriptDirectory()))
            {
                SetItemFilterScriptDirectory();
            }

            var icon = new BitmapImage();
            icon.BeginInit();
            icon.UriSource = new Uri("pack://application:,,,/Filtration;component/Resources/Icons/filtration_icon.png");
            icon.EndInit();
            Icon = icon;

            Messenger.Default.Register<ThemeClosedMessage>(this, message =>
            {
                if (message.ClosedViewModel == null) return;
                AvalonDockWorkspaceViewModel.CloseDocument(message.ClosedViewModel);
            });

            Messenger.Default.Register<NotificationMessage>(this, message =>
            {
                switch (message.Notification)
                {
                    case "ActiveDocumentChanged":
                    {
                        CopyScriptCommand.RaiseCanExecuteChanged();
                        SaveCommand.RaiseCanExecuteChanged();
                        SaveAsCommand.RaiseCanExecuteChanged();
                        CloseCommand.RaiseCanExecuteChanged();
                        CopyBlockCommand.RaiseCanExecuteChanged();
                        PasteCommand.RaiseCanExecuteChanged();
                        ReplaceColorsCommand.RaiseCanExecuteChanged();
                        ApplyThemeToScriptCommand.RaiseCanExecuteChanged();
                        EditMasterThemeCommand.RaiseCanExecuteChanged();
                        CreateThemeCommand.RaiseCanExecuteChanged();
                        RaisePropertyChanged("ActiveDocumentIsScript");
                        RaisePropertyChanged("ActiveDocumentIsTheme");
                        RaisePropertyChanged("ShowAdvancedStatus");
                        break;
                    }
                    case "NewScript":
                    {
                        OnNewScriptCommand();
                        break;
                    }
                    case "OpenScript":
                    {
#pragma warning disable 4014
                        OnOpenScriptCommand();
#pragma warning restore 4014
                        break;
                    }
                    case "ShowLoadingBanner":
                    {
                        ShowLoadingBanner = true;
                        break;
                    }
                    case "HideLoadingBanner":
                    {
                        ShowLoadingBanner = false;
                        break;
                    }
                }
            });
        }
Пример #40
0
        public FingerColors(IThemeProvider themesProvider)
        {
            _themesProvider = themesProvider;

            SetDefaultColors();
        }
 public CommonModelFactory(BlogSettings blogSettings,
                           CaptchaSettings captchaSettings,
                           CatalogSettings catalogSettings,
                           CommonSettings commonSettings,
                           CustomerSettings customerSettings,
                           DisplayDefaultFooterItemSettings displayDefaultFooterItemSettings,
                           ForumSettings forumSettings,
                           IActionContextAccessor actionContextAccessor,
                           ICategoryService categoryService,
                           ICurrencyService currencyService,
                           ICustomerService customerService,
                           IForumService forumService,
                           IGenericAttributeService genericAttributeService,
                           IHostingEnvironment hostingEnvironment,
                           ILanguageService languageService,
                           ILocalizationService localizationService,
                           IManufacturerService manufacturerService,
                           INopFileProvider fileProvider,
                           IPageHeadBuilder pageHeadBuilder,
                           IPermissionService permissionService,
                           IPictureService pictureService,
                           IProductService productService,
                           IProductTagService productTagService,
                           ISitemapGenerator sitemapGenerator,
                           IStaticCacheManager cacheManager,
                           IStoreContext storeContext,
                           IThemeContext themeContext,
                           IThemeProvider themeProvider,
                           ITopicService topicService,
                           IUrlHelperFactory urlHelperFactory,
                           IUrlRecordService urlRecordService,
                           IWebHelper webHelper,
                           IWorkContext workContext,
                           LocalizationSettings localizationSettings,
                           NewsSettings newsSettings,
                           StoreInformationSettings storeInformationSettings,
                           VendorSettings vendorSettings)
 {
     this._blogSettings     = blogSettings;
     this._captchaSettings  = captchaSettings;
     this._catalogSettings  = catalogSettings;
     this._commonSettings   = commonSettings;
     this._customerSettings = customerSettings;
     this._displayDefaultFooterItemSettings = displayDefaultFooterItemSettings;
     this._forumSettings           = forumSettings;
     this._actionContextAccessor   = actionContextAccessor;
     this._categoryService         = categoryService;
     this._currencyService         = currencyService;
     this._customerService         = customerService;
     this._forumService            = forumService;
     this._genericAttributeService = genericAttributeService;
     this._hostingEnvironment      = hostingEnvironment;
     this._languageService         = languageService;
     this._localizationService     = localizationService;
     this._manufacturerService     = manufacturerService;
     this._fileProvider            = fileProvider;
     this._pageHeadBuilder         = pageHeadBuilder;
     this._permissionService       = permissionService;
     this._pictureService          = pictureService;
     this._productService          = productService;
     this._productTagService       = productTagService;
     this._sitemapGenerator        = sitemapGenerator;
     this._cacheManager            = cacheManager;
     this._storeContext            = storeContext;
     this._themeContext            = themeContext;
     this._themeProvider           = themeProvider;
     this._topicService            = topicService;
     this._urlHelperFactory        = urlHelperFactory;
     this._urlRecordService        = urlRecordService;
     this._webHelper                = webHelper;
     this._workContext              = workContext;
     this._localizationSettings     = localizationSettings;
     this._newsSettings             = newsSettings;
     this._storeInformationSettings = storeInformationSettings;
     this._vendorSettings           = vendorSettings;
 }
        public SearchProxyCollection(ISearchMetadataCollection metadataCollection,
                                     Guid id,
                                     Action <SearchMetadata> changeScopeAction,
                                     ISchedulerProvider schedulerProvider,
                                     IColourProvider colourProvider,
                                     IIconProvider iconsProvider,
                                     ITextAssociationCollection textAssociationCollection,
                                     IThemeProvider themeProvider)
        {
            var proxyItems = metadataCollection.Metadata.Connect()
                             .WhereReasonsAre(ChangeReason.Add, ChangeReason.Remove) //ignore updates because we update from here
                             .Transform(meta =>
            {
                return(new SearchOptionsProxy(meta,
                                              changeScopeAction,
                                              colourProvider,
                                              themeProvider,
                                              new IconSelector(iconsProvider, schedulerProvider),
                                              m => metadataCollection.Remove(m.SearchText),
                                              iconsProvider.DefaultIconSelector,
                                              id));
            })
                             .SubscribeMany(so =>
            {
                //when a value changes, write the original value back to the metadata collection
                var anyPropertyHasChanged = so.WhenAnyPropertyChanged()
                                            .Select(_ => (SearchMetadata)so)
                                            .Subscribe(metadataCollection.AddorUpdate);

                //when an icon or colour has changed we need to record user choice so
                //the same choice can be used again
                var iconChanged       = so.WhenValueChanged(proxy => proxy.IconKind, false).ToUnit();
                var colourChanged     = so.WhenValueChanged(proxy => proxy.HighlightHue, false).ToUnit();
                var ignoreCaseChanged = so.WhenValueChanged(proxy => proxy.CaseSensitive, false).ToUnit();

                var textAssociationChanged = iconChanged.Merge(colourChanged).Merge(ignoreCaseChanged)
                                             .Throttle(TimeSpan.FromMilliseconds(250))
                                             .Select(_ => new TextAssociation(so.Text, so.CaseSensitive, so.UseRegex, so.HighlightHue.Swatch,
                                                                              so.IconKind.ToString(), so.HighlightHue.Name, DateTime.UtcNow))
                                             .Subscribe(textAssociationCollection.MarkAsChanged);

                return(new CompositeDisposable(anyPropertyHasChanged, textAssociationChanged));
            })
                             .AsObservableCache();

            Count = proxyItems.CountChanged.StartWith(0).ForBinding();

            var monitor = MonitorPositionalChanges().Subscribe(metadataCollection.Add);

            //load data onto grid
            var collection = new ObservableCollectionExtended <SearchOptionsProxy>();

            var includedLoader = proxyItems
                                 .Connect(proxy => !proxy.IsExclusion)
                                 .Sort(SortExpressionComparer <SearchOptionsProxy> .Ascending(proxy => proxy.Position))
                                 .ObserveOn(schedulerProvider.MainThread)
                                 //force reset for each new or removed item dues to a bug in the underlying dragablz control which inserts in an incorrect position
                                 .Bind(collection, new ObservableCollectionAdaptor <SearchOptionsProxy, string>(0))
                                 .DisposeMany()
                                 .Subscribe();

            ReadOnlyObservableCollection <SearchOptionsProxy> excluded;
            var excludedLoader = proxyItems
                                 .Connect(proxy => proxy.IsExclusion)
                                 .Sort(SortExpressionComparer <SearchOptionsProxy> .Ascending(proxy => proxy.Text))
                                 .ObserveOn(schedulerProvider.MainThread)
                                 //force reset for each new or removed item dues to a bug in the underlying dragablz control which inserts in an incorrect position
                                 .Bind(out excluded)
                                 .DisposeMany()
                                 .Subscribe();


            Excluded = excluded;
            Included = new ReadOnlyObservableCollection <SearchOptionsProxy>(collection);

            _cleanUp = new CompositeDisposable(proxyItems, includedLoader, excludedLoader, monitor);
        }
Пример #43
0
 public OutputView(IThemeProvider themeProvider, IMessenger messenger)
     : base(themeProvider, messenger)
 {
     this.RegisterHelp(messenger, Topics.Output);
 }