当前位置: 首页>>代码示例>>C#>>正文


C# ISetting.Write方法代码示例

本文整理汇总了C#中ISetting.Write方法的典型用法代码示例。如果您正苦于以下问题:C# ISetting.Write方法的具体用法?C# ISetting.Write怎么用?C# ISetting.Write使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ISetting的用法示例。


在下文中一共展示了ISetting.Write方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: RecentSearchCollection

        public RecentSearchCollection(ILogger logger, ISetting<RecentSearch[]> setting)
        {
            if (logger == null) throw new ArgumentNullException("logger");
            _logger = logger;

            Items = _files.Connect()
                        .RemoveKey()
                        .AsObservableList();

            var loader = setting.Value.Subscribe(files =>
            {
                _files.Edit(innerCache =>
                {
                    //all files are loaded when state changes, so only add new ones
                    var newItems = files
                        .Where(f => !innerCache.Lookup(f.Text).HasValue)
                        .ToArray();

                    innerCache.AddOrUpdate(newItems);
                });     
            });
       
            var settingsWriter = _files.Connect()
                .ToCollection()
                .Subscribe(items =>
                {
                    setting.Write(items.ToArray());
                });

            _cleanUp = new CompositeDisposable(settingsWriter, loader, _files,Items);
        }
开发者ID:markiemarkus,项目名称:TailBlazer4.5,代码行数:31,代码来源:RecentSearchCollection.cs

示例2: GeneralOptionsViewModel

        public GeneralOptionsViewModel(ISetting<GeneralOptions> setting, ISchedulerProvider schedulerProvider)
        {
            var reader = setting.Value.Subscribe(options =>
            {
                UseDarkTheme = options.Theme== Theme.Dark;
                HighlightTail = options.HighlightTail;
                HighlightDuration = options.HighlightDuration;
                Scale = options.Scale;
            });

            var writter = this.WhenAnyPropertyChanged()
                .Subscribe(vm =>
                {
                    setting.Write(new GeneralOptions(UseDarkTheme ? Theme.Dark : Theme.Light, HighlightTail, HighlightDuration, Scale));
                });

            HighlightDurationText = this.WhenValueChanged(vm=>vm.HighlightDuration)
                                        .Select(value => value.ToString("0.00 Seconds"))
                                        .ForBinding();

            ScaleText = this.WhenValueChanged(vm => vm.Scale)

                                        .Select(value => $"{value} %" )
                                        .ForBinding();

            ScaleRatio= this.WhenValueChanged(vm => vm.Scale)
                                        .Select(value =>(decimal)value / (decimal)100)
                                       // .Sample(TimeSpan.FromMilliseconds(250))
                                        .ForBinding();

            _cleanUp = new CompositeDisposable(reader, writter,  HighlightDurationText, ScaleText, ScaleRatio);
        }
开发者ID:mgnslndh,项目名称:TailBlazer,代码行数:32,代码来源:GeneralOptionsViewModel.cs

示例3: GeneralOptionsViewModel

        public GeneralOptionsViewModel(ISetting<GeneralOptions> setting, ISchedulerProvider schedulerProvider)
        {

            var reader = setting.Value.Subscribe(options =>
            {
                UseDarkTheme = options.Theme== Theme.Dark;
                HighlightTail = options.HighlightTail;
                HighlightDuration = options.HighlightDuration;
                Scale = options.Scale;
            });

            var writter = this.WhenAnyPropertyChanged()
                .Subscribe(vm =>
                {
                    setting.Write(new GeneralOptions(UseDarkTheme ? Theme.Dark : Theme.Light, HighlightTail, HighlightDuration, Scale));
                });

            var themeSetter = setting.Value.Select(options=> options.Theme)
                .ObserveOn(schedulerProvider.MainThread)
                .Subscribe(theme =>
                {
                    new PaletteHelper().SetLightDark(theme== Theme.Dark);
                });


            HighlightDurationText = this.WhenValueChanged(vm=>vm.HighlightDuration)
                                        .Select(value => value.ToString("0.00 Seconds"))
                                        .ForBinding();

            ScaleText = this.WhenValueChanged(vm => vm.Scale)
                                        .Select(value => value+" %" )
                                        .ForBinding();


            ScaleRatio= this.WhenValueChanged(vm => vm.Scale)
                                        .Select(value =>(decimal)value / (decimal)100)
                                        //.Sample(Times)
                                        .Do(x=> { Console.WriteLine(); })
                                        
                                        .ForBinding();

            _cleanUp = new CompositeDisposable(reader, writter, themeSetter, HighlightDurationText, ScaleText, ScaleRatio);
        }
开发者ID:markiemarkus,项目名称:TailBlazer4.5,代码行数:43,代码来源:GeneralOptionsViewModel.cs


注:本文中的ISetting.Write方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。