public TwitterAccount(TwitterAccountManager mgr) { _mgr = mgr; _oauthClient = new OAuthClient(ConsumerKeyStore.Key, ConsumerKeyStore.Secret, TwitterClient.RequestTokenURL, TwitterClient.AccessTokenURL, TwitterClient.AuthorizeURL, TwitterClient.XAuthURL); _client = new TwitterClient(_oauthClient); _dispatcher = Dispatcher.CurrentDispatcher; // defaults SelfUserID = 0; RestHome = new RestUsage { Interval = TimeSpan.FromSeconds(30), Count = 200 }; RestMentions = new RestUsage { Interval = TimeSpan.FromSeconds(600), Count = 20 }; RestDirectMessages = new RestUsage { Interval = TimeSpan.FromSeconds(600), Count = 20 }; RestList = new TwitterAccount.RestUsage { Interval = TimeSpan.FromSeconds(30), Count = 200 }; RestSearch = new TwitterAccount.RestUsage { Interval = TimeSpan.FromSeconds(30), Count = 100 }; _restInfoList = new RestUsage[] { RestHome, RestMentions, RestDirectMessages }; _restSinceList = new ulong?[] { null, null, null }; }
public NewTimelineWindow(TwitterAccountManager mgr) { _mgr = mgr; DataContext = mgr; Initialized += delegate(object o, EventArgs e) { _initialized = true; Validate(); }; InitializeComponent(); }
public NewTimelineWindow(TwitterAccountManager mgr) { _mgr = mgr; DataContext = mgr; Initialized += delegate (object o, EventArgs e) { _initialized = true; Validate (); }; InitializeComponent (); }
public static void Init(TwitterAccountManager mgr) { LRU <Uri, BitmapImage> .CreateDelegate create = delegate(Uri key) { return(new BitmapImage(key)); }; _friendsCache = new LRU <Uri, BitmapImage> (create, 2048); _nonfriendCache = new LRU <Uri, BitmapImage> (create, 1024); mgr.AccountsPropertyChanged += delegate(object sender, EventArgs e) { TwitterAccount[] accounts = mgr.Accounts; for (int i = 0; i < accounts.Length; i++) { accounts[i].TwitterClient.PropertyChanged -= TwitterClient_PropertyChanged; accounts[i].TwitterClient.PropertyChanged += TwitterClient_PropertyChanged; } }; }
public TwitterAccount(TwitterAccountManager mgr) { _mgr = mgr; _oauthClient = new OAuthClient (ConsumerKeyStore.Key, ConsumerKeyStore.Secret, TwitterClient.RequestTokenURL, TwitterClient.AccessTokenURL, TwitterClient.AuthorizeURL, TwitterClient.XAuthURL); _client = new TwitterClient (_oauthClient); _dispatcher = Dispatcher.CurrentDispatcher; // defaults SelfUserID = 0; RestHome = new RestUsage {Interval = TimeSpan.FromSeconds (30), Count = 200}; RestMentions = new RestUsage {Interval = TimeSpan.FromSeconds (600), Count = 20}; RestDirectMessages = new RestUsage {Interval = TimeSpan.FromSeconds (600), Count = 20}; RestList = new TwitterAccount.RestUsage {Interval = TimeSpan.FromSeconds (30), Count = 200}; RestSearch = new TwitterAccount.RestUsage {Interval = TimeSpan.FromSeconds (30), Count = 100}; _restInfoList = new RestUsage[] {RestHome, RestMentions, RestDirectMessages}; _restSinceList = new ulong?[] {null, null, null}; }
public PreferenceWindow(TwitterAccountManager mgr, MainWindow mwin) { _mwin = mwin; _mgr = mgr; InitializeComponent(); _accounts = mgr.Accounts; _oldAccounts = (TwitterAccount[])_accounts.Clone(); _targets = new IStreamingHandler[_accounts.Length]; for (int i = 0; i < _targets.Length; i++) { _targets[i] = _accounts[i].StreamingClient == null ? null : _accounts[i].StreamingClient.Target; } StreamingTargetSelector selector = new StreamingTargetSelector(); selector.NullTemplate = (DataTemplate)Resources["nullTemplate"]; selector.HomeTemplate = (DataTemplate)Resources["homeTemplate"]; selector.SearchTemplate = (DataTemplate)Resources["searchTemplate"]; selector.ListTemplate = (DataTemplate)Resources["listTemplate"]; Resources.Add("targetTemplateSelector", selector); _observableAccountList = new ObservableCollection <TwitterAccount> (mgr.Accounts); List <object> list = new List <object> (); list.Add("null"); for (int i = 0; i < mgr.Accounts.Length; i++) { list.Add(mgr.Accounts[i]); } for (int i = 0; i < mgr.Searches.Length; i++) { list.Add(mgr.Searches[i]); } for (int i = 0; i < mgr.Lists.Length; i++) { list.Add(mgr.Lists[i]); } _targetList = list.ToArray(); this.DataContext = _observableAccountList; this.Closed += delegate(object sender, EventArgs e) { _accounts = _observableAccountList.ToArray <TwitterAccount> (); IsAccountArrayChanged = false; do { if (_accounts.Length != _oldAccounts.Length) { IsAccountArrayChanged = true; break; } for (int i = 0; i < _accounts.Length; i++) { if (_accounts[i] != _oldAccounts[i]) { IsAccountArrayChanged = true; break; } } } while (false); IsStreamingTargetsChanged = IsAccountArrayChanged; do { for (int i = 0; i < _accounts.Length; i++) { if (_accounts[i].StreamingClient == null && _targets[i] == null) { continue; } if (_accounts[i].StreamingClient != null && _accounts[i].StreamingClient.Target == _targets[i]) { continue; } IsStreamingTargetsChanged = true; break; } } while (false); }; }
public PreferenceWindow(TwitterAccountManager mgr, MainWindow mwin) { _mwin = mwin; _mgr = mgr; InitializeComponent (); _accounts = mgr.Accounts; _oldAccounts = (TwitterAccount[])_accounts.Clone (); _targets = new IStreamingHandler[_accounts.Length]; for (int i = 0; i < _targets.Length; i ++) _targets[i] = _accounts[i].StreamingClient == null ? null : _accounts[i].StreamingClient.Target; StreamingTargetSelector selector = new StreamingTargetSelector (); selector.NullTemplate = (DataTemplate)Resources["nullTemplate"]; selector.HomeTemplate = (DataTemplate)Resources["homeTemplate"]; selector.SearchTemplate = (DataTemplate)Resources["searchTemplate"]; selector.ListTemplate = (DataTemplate)Resources["listTemplate"]; Resources.Add ("targetTemplateSelector", selector); _observableAccountList = new ObservableCollection<TwitterAccount> (mgr.Accounts); List<object> list = new List<object> (); list.Add ("null"); for (int i = 0; i < mgr.Accounts.Length; i ++) list.Add (mgr.Accounts[i]); for (int i = 0; i < mgr.Searches.Length; i ++) list.Add (mgr.Searches[i]); for (int i = 0; i < mgr.Lists.Length; i ++) list.Add (mgr.Lists[i]); _targetList = list.ToArray (); this.DataContext = _observableAccountList; this.Closed += delegate (object sender, EventArgs e) { _accounts = _observableAccountList.ToArray<TwitterAccount> (); IsAccountArrayChanged = false; do { if (_accounts.Length != _oldAccounts.Length) { IsAccountArrayChanged = true; break; } for (int i = 0; i < _accounts.Length; i++) { if (_accounts[i] != _oldAccounts[i]) { IsAccountArrayChanged = true; break; } } } while (false); IsStreamingTargetsChanged = IsAccountArrayChanged; do { for (int i = 0; i < _accounts.Length; i ++) { if (_accounts[i].StreamingClient == null && _targets[i] == null) continue; if (_accounts[i].StreamingClient != null && _accounts[i].StreamingClient.Target == _targets[i]) continue; IsStreamingTargetsChanged = true; break; } } while (false); }; }
public FriendsManageWindow(TwitterAccountManager mgr) { InitializeComponent (); DataContext = mgr; }
public MainWindow() { _hashTags.Add (string.Empty); InitializeComponent (); InitCommandBinding (); InitPopup (); itemsControl.DataContext = this; _mgr = new TwitterAccountManager (); IStreamingHandler[] targets; _mgr.Load (LoadConfig, out targets); postAccount.ItemsSource = _mgr.Accounts; if (_mgr.Accounts.Length > 0) postAccount.SelectedIndex = 0; Init (targets); Predicate<object> previewCheck = delegate (object o) { if (postTextBox.IsFocused || (Keyboard.Modifiers != ModifierKeys.None && Keyboard.Modifiers != ModifierKeys.Shift)) return false; if (Keyboard.FocusedElement is TextBox) return false; return true; }; this.PreviewTextInput += delegate (object sender, TextCompositionEventArgs e) { if (!previewCheck (null)) return; ShowPostArea (true); }; this.PreviewKeyDown += delegate (object sender, KeyEventArgs e) { if (!previewCheck (null)) return; if (e.Key == Key.ImeProcessed || (e.Key >= Key.A && e.Key <= Key.Z) || (e.Key >= Key.D0 && e.Key <= Key.D9) || (e.Key >= Key.NumPad0 && e.Key <= Key.NumPad9)) ShowPostArea (true); }; this.Closed += delegate (object sender, EventArgs e) { SaveConfig (); }; }
TimelineInfo(TwitterAccountManager mgr, TimelineBase owner, TwitterTimeLine timeline, string title) : base(owner, title) { _mgr = mgr; Statuses = timeline; timeline.CollectionChanged += new NotifyCollectionChangedEventHandler (Timeline_CollectionChanged); }
public TimelineInfo(TwitterAccountManager mgr, TimelineBase owner, TwitterAccount account, TwitterTimeLine timeline) : this(mgr, owner, timeline, CreateTitle (account, timeline)) { RestAccount = account; RestUsage = (timeline == account.HomeTimeline ? account.RestHome : (timeline == account.Mentions ? account.RestMentions : account.RestDirectMessages)); }
public FriendsManageWindow(TwitterAccountManager mgr) { InitializeComponent(); DataContext = mgr; }