示例#1
0
        /* ----------------------------------------------------------------- */
        ///
        /// MainFacade
        ///
        /// <summary>
        /// オブジェクトを初期化します。
        /// </summary>
        ///
        /// <param name="src">設定用オブジェクト</param>
        /// <param name="invoker">同期用オブジェクト</param>
        ///
        /* ----------------------------------------------------------------- */
        public MainFacade(SettingFolder src, Invoker invoker)
        {
            src.TryLoad();
            this.LogInfo($"Owner:{src.Lock.UserName}@{src.Lock.MachineName} ({src.Lock.Sid})");
            this.LogInfo($"User-Agent:{src.UserAgent}");

            Setting = src;
            Setting.PropertyChanged += WhenSettingChanged;
            Setting.AutoSave         = true;

            var feeds = Setting.IO.Combine(Setting.DataDirectory, LocalSetting.FeedFileName);
            var cache = Setting.IO.Combine(Setting.DataDirectory, LocalSetting.CacheDirectoryName);

            _core = new RssSubscriber(invoker)
            {
                IO             = Setting.IO,
                FileName       = feeds,
                CacheDirectory = cache,
                Capacity       = Setting.Shared.Capacity,
                IsReadOnly     = Setting.Lock.IsReadOnly,
                UserAgent      = Setting.UserAgent
            };
            _core.Set(RssCheckFrequency.High, Setting.Shared.HighInterval);
            _core.Set(RssCheckFrequency.Low, Setting.Shared.LowInterval);
            _core.Received += WhenReceived;

            _checker = new UpdateChecker(Setting);
            Data     = new MainBindableData(_core, Setting, invoker);
        }
示例#2
0
 /* ----------------------------------------------------------------- */
 ///
 /// MainViewModel
 ///
 /// <summary>
 /// オブジェクトを初期化します。
 /// </summary>
 ///
 /* ----------------------------------------------------------------- */
 public MainViewModel(SettingFolder settings, SynchronizationContext context) : base(
         new MainFacade(settings, new ContextInvoker(context, false)),
         new Aggregator(),
         context
         )
 {
     DropTarget = new RssDropTarget((s, d, i) => Facade.Move(s, d, i))
     {
         IsReadOnly = Data.Lock.Value.IsReadOnly
     };
 }
示例#3
0
 /* ----------------------------------------------------------------- */
 ///
 /// RssBindableData
 ///
 /// <summary>
 /// オブジェクトを初期化します。
 /// </summary>
 ///
 /// <param name="root">ルートオブジェクト</param>
 /// <param name="setting">設定用オブジェクト</param>
 /// <param name="invoker">同期用コンテキスト</param>
 ///
 /* ----------------------------------------------------------------- */
 public MainBindableData(IEnumerable <IRssEntry> root,
                         SettingFolder setting, Invoker invoker)
 {
     Root      = root;
     Lock      = new BindableValue <LockSetting>(setting.Lock, invoker);
     Local     = new BindableValue <LocalSetting>(setting.Value, invoker);
     Shared    = new BindableValue <SharedSetting>(setting.Shared, invoker);
     Current   = new BindableValue <IRssEntry>(invoker);
     LastEntry = new BindableValue <RssEntry>(invoker);
     Content   = new BindableValue <object>(invoker);
     Message   = new BindableValue <string>(invoker);
 }
示例#4
0
        /* ----------------------------------------------------------------- */
        ///
        /// UpdateChecker
        ///
        /// <summary>
        /// オブジェクトを初期化します。
        /// </summary>
        ///
        /// <param name="src">設定用オブジェクト</param>
        ///
        /* ----------------------------------------------------------------- */
        public UpdateChecker(SettingFolder src)
        {
            var io  = src.IO;
            var dir = Assembly.GetExecutingAssembly().GetDirectoryName();

            FileName = io.Combine(dir, "UpdateChecker.exe");
            Setting  = src;

            _timer.Interval = TimeSpan.FromDays(1);
            _timer.Subscribe(Synchronous.AsTask(WhenTick));

            if (Setting.Shared.CheckUpdate)
            {
                Start();
            }
        }