/// <summary> /// this is the method to be used by the /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void AddChannelMenuItem_OnClick(object sender, RoutedEventArgs e) { // Get user input NameChannelWindow createChannelWindow = new NameChannelWindow(); createChannelWindow.ShowDialog(); if (createChannelWindow.DialogResult == true) { // Create feed and add it Channel channel = new Channel(createChannelWindow.Channel); channel.ContextMenu.Items.Add(MakeContextMenuItem(AddFeedGestureText, AddFeedItem)); channel.ContextMenu.Items.Add(MakeContextMenuItem(AddChannelGestureText, AddChannelItem)); channel.ContextMenu.Items.Add(MakeContextMenuItem(RemoveGestureText, RemoveMenuOption)); Subscriptions.AddChannel(channel); ContentTreeView.Items.Add(channel); } }
/// <summary> /// This is the method to be used by other tree view items /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void AddChannelItem(object sender, RoutedEventArgs e) { // Get input NameChannelWindow newChannel = new NameChannelWindow(); newChannel.ShowDialog(); TreeViewItem parent = ContentTreeView.SelectedItem as TreeViewItem; if (parent != null) { if (ContentTreeView.SelectedItem != null && true == newChannel.DialogResult) { // create channel and add Channel channel = new Channel(newChannel.Channel); channel.ContextMenu.Items.Add(MakeContextMenuItem(AddFeedGestureText, AddFeedItem)); channel.ContextMenu.Items.Add(MakeContextMenuItem(AddChannelGestureText, AddChannelItem)); channel.ContextMenu.Items.Add(MakeContextMenuItem(RemoveGestureText, RemoveMenuOption)); parent.Items.Add(channel); } } }