void Send_Executed(object sender, ExecutedRoutedEventArgs e) { ClientStats.LogEvent("Send in realtime streams overview column"); if (String.IsNullOrEmpty(PART_StatusUpdateTextbox.Text.Trim()) || SelectedChannels.Count == 0) { return; } CommandHelper.Send(SelectedChannels.Select(ChannelsManager.GetChannelObject), ReplyTo == null ? null : ReplyTo.ChannelStatusKey, e); SaveChannelSelection(); // Reset fields if (ShowViral) { ShowViral = false; OnPropertyChanged("ShowViral"); SettingsManager.ClientSettings.AppConfiguration.IsFirstStatusUpdate = false; SettingsManager.Save(); } else { ReplyTo = null; OnPropertyChanged("ReplyTo"); } PART_StatusUpdateTextbox.Text = String.Empty; // Put focus back on listview FocusHelper.Focus(((TabItem)StreamsTab.SelectedItem)); }
void Stream_StatusUpdated(object sender, StatusUpdateEventArgs e) { ShowViral = false; ReplyTo = null; if (e.Action == StatusUpdateAction.Reply) { ReplyTo = e.Status; } SelectedChannels.Clear(); SelectedChannels.Add(e.ChannelId); PART_StatusUpdateTextbox.Text = e.StatusText; FocusHelper.Focus(PART_StatusUpdateTextbox); // Move caret to end of textbox PART_StatusUpdateTextbox.SelectionStart = PART_StatusUpdateTextbox.Text.Length; OnPropertyChanged("AllStatusChannels"); OnPropertyChanged("ReplyTo"); OnPropertyChanged("ShowViral"); OnPropertyChanged("HasTwitter"); }
void LoadSavedSelection() { SelectedChannels.Clear(); SelectedChannels.AddRange(StatusUpdateControl.GetSavedSelection()); OnPropertyChanged("HasTwitter"); }
void UpdateStatus_Execute(object sender, ExecutedRoutedEventArgs e) { var status = new UserStatus { Status = StatusTextBox.Text.Trim(), StatusType = StatusTypes.MyUpdate, SortDate = DateTime.Now, DateCreated = DateTime.Now, TargetChannelId = String.Join(";", SelectedChannels.Select(i => i.ToString()).ToArray()) }; mailbox.StatusUpdates.Add(status); ClientState.Current.DataService.Save(status); // Save command CommandQueue.Enqueue(AppCommands.SendStatusUpdate, status); if (!NetworkInterface.GetIsNetworkAvailable()) { ClientState.Current.ShowMessage( new AppMessage(Strings.StatusWillBeUpdatedLater) { EntityId = status.StatusId, EntityType = EntityType.UserStatus }, MessageType.Success); } StatusTextBox.Text = String.Empty; }
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { if (value == null) { return(false); } var channel = (ChannelInstance)value; return(SelectedChannels.Contains(channel.Configuration.ChannelId)); }
/// <summary> /// Unselects all channels from Selected and moves them to Available. /// </summary> public void UnselectAllChannels() { var indexChannel = SelectedChannels.FirstOrDefault(s => s.Equals(IndexChannel.Mnemonic)); var selected = new List <LogCurveItem>(SelectedChannels); if (indexChannel != null) { selected.Remove(indexChannel); } selected.ForEach(s => MoveChannel(s, SelectedChannels, AvailableChannels)); }
/// <summary> /// Moves a slected channel up. /// </summary> public void MoveUp() { var selectedIndex = SelectedChannelSelectedIndex; if (selectedIndex > 1) { var itemToMoveUp = SelectedChannels[selectedIndex]; SelectedChannels.RemoveAt(selectedIndex); SelectedChannels.Insert(selectedIndex - 1, itemToMoveUp); SelectedChannelSelectedIndex = selectedIndex - 1; NotifyOfPropertyChange(() => SelectedChannelSelectedIndex); } }
void ToggleChannelInstance(ChannelInstance channel) { if (SelectedChannels.Contains(channel.Configuration.ChannelId)) { SelectedChannels.Remove(channel.Configuration.ChannelId); } else { SelectedChannels.Add(channel.Configuration.ChannelId); } // Forces a propertychanged event, which resets our toggle button channel.IsVisible = channel.IsVisible; OnPropertyChanged("HasTwitter"); }
/// <summary> /// Moves a selected channel down. /// </summary> public void MoveDown() { var selectedIndex = SelectedChannelSelectedIndex; if (selectedIndex + 1 < SelectedChannels.Count) { var itemToMoveDown = SelectedChannels[selectedIndex]; if (selectedIndex == 0 && itemToMoveDown.Equals(IndexChannel.Mnemonic)) { return; } SelectedChannels.RemoveAt(selectedIndex); SelectedChannels.Insert(selectedIndex + 1, itemToMoveDown); SelectedChannelSelectedIndex = selectedIndex + 1; NotifyOfPropertyChange(() => SelectedChannelSelectedIndex); } }
private void RemoveSelectedFromAvailableChannels() { if (SelectedChannels.Count == 0) { return; } var alreadySelectedCurves = new List <LogCurveItem>(); AvailableChannels.ForEach(a => { if (SelectedChannels.FirstOrDefault(sc => sc.Mnemonic.EqualsIgnoreCase(a.Mnemonic)) != null) { alreadySelectedCurves.Add(a); } }); alreadySelectedCurves.ForEach(r => AvailableChannels.Remove(r)); }
void SaveChannelSelection() { // Save current selection ClientState.Current.Context.SaveSetting("/Settings/StatusUpdate/ChannelsSelection", String.Join(",", SelectedChannels.Select(i => i.ToString()).ToArray())); }