protected virtual async Task OnLoad() { var statuses = await Context.Twitter.Statuses.Filter(CountExpression, StatusFilterExpression); var list = new List <StatusViewModel>(); foreach (var s in statuses.Where(s => !Muter.IsMuted(s))) { list.Add(await CreateViewModel(s)); } await AddStatuses(list); }
private async Task LoadTopData() { var statuses = await Context.Twitter.Statuses.Filter(CountExpression, StatusFilterExpression, SinceIdFilterExpression); var list = new List <StatusViewModel>(); foreach (var s in statuses.Where(s => !Muter.IsMuted(s)).Reverse()) { list.Add(await CreateViewModel(s)); } await AddStatuses(list, false); }
protected override async Task LoadTopData() { var statuses = await Context.Twitter.Favorites.List(Context.UserId, SinceIdFilterExpressionFavorites); var list = new List <StatusViewModel>(); foreach (var s in statuses.Where(s => !Muter.IsMuted(s)).Reverse()) { list.Add(await CreateViewModel(s)); } await AddItems(list); }
private async void OnFiltersUpdated(FilterUpdateMessage msg) { var toDelete = new List <StatusViewModel>(); foreach (var item in Items.OfType <StatusViewModel>()) { if (Muter.IsMuted(item.Model)) { toDelete.Add(item); } } msg.RemoveCount += toDelete.Count; await Dispatcher.RunAsync(() => toDelete.ForEach(it => Items.Remove(it))); }
protected virtual async Task LoadMoreData() { var statuses = await Context.Twitter.Statuses.Filter(CountExpression, StatusFilterExpression, MaxIdFilterExpression); var list = new List <StatusViewModel>(); await Cache.MapStatusesToColumn(statuses, Definition.Id); foreach (var s in statuses.Where(s => !Muter.IsMuted(s))) { list.Add(await CreateViewModel(s)); } await AddItems(list); }
private async void Parser_StatusReceived(object sender, StatusStreamEventArgs e) { if (Muter.IsMuted(e.Status)) { return; } if (!IsSuitableForColumn(e.Status)) { return; } var s = await CreateViewModel(e.Status); await AddStatus(s, false); }
public MuteForm() { InitializeComponent(); this.muter = new Muter(SynchronizationContext.Current); Guid lastUsedUnmuteDeviceId = Properties.Settings.Default.DeviceId; if (muter.Devices.Count == 0) { MessageBox.Show("No capture device found"); System.Windows.Forms.Application.Exit(); return; } int unmuteTime = Properties.Settings.Default.UnmuteTimeMs; Debug.WriteLine($"Loaded settings, using unmute time {unmuteTime} ms, deviceid={lastUsedUnmuteDeviceId}"); Text = ProgramInfo.NameAndVersion; Icon = Resources.Unmute; ShowIcon = true; SetAutorunState(); muter.DeviceListChanged += (s, e) => InvokeIfRequired(() => LoadDevices(muter.Device.Id)); autoStartCheckbox.CheckedChanged += (s, e) => { AutoRun.Enable(autoStartCheckbox.Checked, $"\"{Assembly.GetEntryAssembly().Location}\" /background"); SetAutorunState(); }; pausedCheckbox.CheckedChanged += (s, e) => muter.Pause(pausedCheckbox.Checked); deviceCombo.SelectedIndexChanged += (s, e) => muter.SetDevice(((ComboBoxItem)deviceCombo.SelectedItem).Value as CoreAudioDevice); unmuteTimeTrackbar.ValueChanged += (s, e) => { int t = UnmuteTimeSliderIncrement * unmuteTimeTrackbar.Value; muter.UnmuteTimeMs = t; unmuteTimeLabel.Text = $"{t} ms"; }; if (unmuteTime > unmuteTimeTrackbar.Maximum * UnmuteTimeSliderIncrement || unmuteTime < unmuteTimeTrackbar.Minimum * UnmuteTimeSliderIncrement) { unmuteTime = GetDefaultsettingsInt(nameof(Properties.Settings.UnmuteTimeMs)); } unmuteTimeTrackbar.Value = unmuteTime / UnmuteTimeSliderIncrement; LoadDevices(lastUsedUnmuteDeviceId); }
protected virtual async Task OnLoad(AsyncLoadContext context) { var list = new List <StatusViewModel>(); var cachedStatuses = await Cache.GetStatusesForColumn(Definition.Id, Configuration.General.TweetFetchCount); foreach (var s in cachedStatuses.Where(s => !Muter.IsMuted(s))) { list.Add(await CreateViewModel(s, context)); } await AddItems(list); var filterList = new List <Expression <Func <Status, bool> > >(3) { CountExpression, StatusFilterExpression }; if (SinceId != 0) { filterList.Add(SinceIdFilterExpression); } var statuses = await Context.Twitter.Statuses.Filter(filterList.ToArray()); await Cache.MapStatusesToColumn(statuses, Definition.Id); list.Clear(); foreach (var s in statuses.Where(s => !Muter.IsMuted(s))) { list.Add(await CreateViewModel(s, context)); } await AddItems(list); }