Example #1
0
        public Scheduler(string fileName, ITwitterContextList contextList, ITwitterConfiguration twitterConfig)
        {
            FileName = fileName;
            JobProcessors.Add(SchedulerJobType.DeleteStatus, new DeleteStatusProcessor(contextList));
            JobProcessors.Add(SchedulerJobType.CreateStatus, new CreateStatusProcessor(contextList, twitterConfig));

            if (File.Exists(FileName))
            {
                var json = File.ReadAllText(FileName);
                try
                {
                    Jobs.AddRange(JsonConvert.DeserializeObject <List <SchedulerJob> >(json));
                }
                catch (Exception ex)
                {
                    LogTo.WarnException("Failed to load joblist from file", ex);
                }
            }

            JobIdCounter = Jobs.Any()
                                ? Jobs.Max(j => j.JobId) + 1
                                : 0;

            SleepTime = 1000;
        }
Example #2
0
 internal Scheduler(string fileName, ITwitterContextList contextList, ITwitterConfiguration twitterConfig,
                    IJobProcessor testProcessor, int sleepTime = 1000)
     : this(fileName, contextList, twitterConfig)
 {
     JobProcessors.Add(SchedulerJobType.Test, testProcessor);
     SleepTime = sleepTime;
 }
Example #3
0
        public AccountsDialogViewModel(IColumnDefinitionList columnList, ITwitterContextList contextList,
                                       ITwitterAuthorizer authorizer)
        {
            ContextList = contextList;
            ColumnList  = columnList;
            Authorizer  = authorizer;

            AddedAccounts = new ObservableCollection <AccountEntry>(ContextList.Contexts.Select(c => new AccountEntry(c)));
            foreach (var acc in AddedAccounts)
            {
                acc.ConfirmationChanged += Acc_ConfirmationChanged;
            }
        }
Example #4
0
        public void Start(ITwitterContextList contextList = null)
        {
            try
            {
                ContextList = contextList;
                Http.AddPrefix(Prefix);
                Http.Start();

                LogTo.Info($"Starting proxy server on {Prefix}");
                IsRunning    = true;
                ServerThread = new Thread(RunThreaded);
                ServerThread.Start();
            }
            catch (HttpListenerException ex)
            {
                LogTo.ErrorException("Failed to start media proxy server", ex);
            }
        }
        public AddColumnDialogViewModel(ITwitterContextList contextList, IColumnDefinitionList columnList,
                                        ITimerFactory timerFactory)
        {
            ColumnList = columnList;

            Pages.Add(0, new SourceAccountSelectorPage(this, contextList));
            Pages.Add(1, new ColumnTypeSelctorPage(this));
            Pages.Add(2, new UserSelectorPage(this, timerFactory));
            Pages.Add(3, new FinishPage(this));

            SetProperty(SourceAccountsKey, new ulong[0]);
            SetProperty(TargetAccountsKey, new ulong[0]);
            SetProperty(SourceAccountNamesKey, new string[0]);
            SetProperty(TargetAccountNamesKey, new string[0]);
            SetProperty(ContextsKey, new IContextEntry[0]);

            CurrentPage = Pages[0];
        }
Example #6
0
        public MainViewModel(ITwitterContextList contextList, INotifier notifier, IColumnDefinitionList columnList,
                             IColumnFactory columnFactory,
                             IMessenger messenger = null)
            : base(messenger)
        {
            ContextList = contextList;
            ContextList.ContextsChanged += ContextList_ContextsChanged;

            Columns    = new ObservableCollection <IColumnViewModel>();
            Notifier   = notifier;
            Factory    = columnFactory;
            ColumnList = columnList;
            ColumnList.ColumnsChanged += ColumnList_ColumnsChanged;
            ConstructColumns();

            DragDropHandler = new DragDropHandler(columnList, MessengerInstance);
            var rateLimitTimer = new DispatcherTimer
            {
                Interval = TimeSpan.FromMinutes(15)
            };

            rateLimitTimer.Tick += RateLimitTimer_Tick;
            rateLimitTimer.Start();

            var statusUpdateTimer = new DispatcherTimer
            {
                Interval = TimeSpan.FromSeconds(10)
            };

            statusUpdateTimer.Tick += StatusUpdateTimer_Tick;
            statusUpdateTimer.Start();

            var updateCheckTimer = new DispatcherTimer
            {
                Interval = TimeSpan.FromHours(1)
            };

            updateCheckTimer.Tick += UpdateCheckTimer_Tick;
            updateCheckTimer.Start();
        }
 public DeleteStatusProcessor(ITwitterContextList contextList)
     : base(contextList)
 {
 }
Example #8
0
 public StreamingRepository(ITwitterContextList contextList)
 {
     ContextList = contextList;
 }
Example #9
0
 protected AbstractProcessor(ITwitterContextList contextList)
 {
     ContextList = contextList;
 }
 public SourceAccountSelectorPage(IWizardViewModel wizard, ITwitterContextList contextList, bool loadImages = true)
     : base(wizard)
 {
     Accounts = contextList.Contexts.Select(c => new AccountEntry(c, loadImages)).ToList();
 }
Example #11
0
 public MediaProxyServer(IHttpClient client = null, IHttpListener listener = null, ITwitterContextList contextList = null)
 {
     ContextList = contextList;
     Client      = client ?? new HttpClientWrapper(new HttpClient());
     Http        = listener ?? new HttpListenerWrapper(new HttpListener());
 }
 public TestStreamingRepository(ITwitterContextList contextList, ICache cache)
     : base(contextList, cache)
 {
 }
Example #13
0
 public CreateStatusProcessor(ITwitterContextList contextList, ITwitterConfiguration twitterConfig)
     : base(contextList)
 {
     TwitterConfig = twitterConfig;
 }
Example #14
0
 public SourceAccountSelectorPage(IWizardViewModel wizard, ITwitterContextList contextList)
     : base(wizard)
 {
     Accounts = contextList.Contexts.Select(c => new AccountEntry(c)).ToList();
 }
Example #15
0
 // ReSharper disable once MemberCanBeProtected.Global
 public StreamingRepository(ITwitterContextList contextList, ICache cache)
 {
     ContextList = contextList;
     Cache       = cache;
 }
 public TwitterConfiguration(ICache cache, ITwitterContextList contextList)
 {
     ContextList = contextList;
     Cache       = cache;
 }
Example #17
0
 public TestStreamingRepository(ITwitterContextList contextList)
     : base(contextList)
 {
 }