Forum

Page 5 of 10 FirstFirst ... 34567 ... LastLast
Results 61 to 75 of 136
  1. #61
    Join Date
    December 2009
    Location
    Germany
    Posts
    118
    Which dispatcher are you using? Notifications only work with the Async one.

    The sync one is, as the name suggests, not meant to be async like events.
    Last edited by Scordo; October 28th, 2010 at 07:34 PM.

  2. #62
    Join Date
    October 2010
    Location
    Germany
    Posts
    13
    Okay, that explains it.

  3. #63
    Join Date
    December 2009
    Location
    Germany
    Posts
    118
    An example on how to use the asnyc one can be found within the project "TS3ServerManager" on the project page.

  4. #64
    Join Date
    November 2010
    Location
    Germany
    Posts
    3
    hi ,

    i try to use the lib with wpf vb.net
    connecting to a server,selectserverbyid, recieving client or channel list are no problem
    but if i try to use the getchanneltree function

    i get a list of channels i think but they are all named

    "Ts3QueryLib.Core.Common.ChannelTreeItem"

    i get 3 of them and i have 3 channels on my test server
    but no clients in this list and no channel names xD

    the two code snippets below show how i try to call the function
    i hope you can explain me how to call it right



    Code:
    Dim cl As List(Of ChannelListEntry) = Ts3qr.GetChannelList.Values
    
    Dim clientl As List(Of ClientListEntry) = Ts3qr.GetClientList.Values
    
    TreeView1.ItemsSource = QueryUtils.GetChannelTree(cl, clientl)

    Code:
      TreeView1.ItemsSource = Ts3qr.Utils.GetChannelTree(True)
    Last edited by Nerenye; November 2nd, 2010 at 08:01 PM.

  5. #65
    Join Date
    January 2010
    Location
    Germany
    Posts
    29
    Sorry I'm not familiar with VB

    The TreeView needs to know which properties you want to display.

    I think I converted the ChannelTreeItems to my own class like this:

    Code:
    public class TeamspeakTreeItem
    {
    	private List<TeamspeakTreeItem> _subItems;
    	public List<TeamspeakTreeItem> SubItems
    	{
    		get { return _subItems; }
    		set { _subItems = value; }
    	}
    	
    	public string Name { get; set; }
    	public Uri ImageSource { get; set; }
    	public ChannelTreeItem OriginalItem { get; set; }
    	
    	public TeamspeakTreeItem (string name, Uri imageSource, ChannelTreeItem originalItem)
    	{
    		this._subItems = new List<TeamspeakTreeItem>();
    		this.Name = name;
    		this.ImageSource = imageSource;
    		this.OriginalItem = originalItem;
    	}
    }
    This way it is easy to display the stuff you want in the TreeView with an ItemTemplate like this.

    Code:
    <TreeView.ItemTemplate>
    	<HierarchicalDataTemplate ItemsSource="{Binding SubItems}">
    		<StackPanel Orientation="Horizontal">
    			<Image Source="{Binding ImageSource}" Width="15" Height="15"/>
    			<TextBlock Text="{Binding Name}"/>
    		</StackPanel>
            </HierarchicalDataTemplate>
    </TreeView.ItemTemplate>

  6. #66
    Join Date
    November 2010
    Location
    Germany
    Posts
    3
    HI thanks for the quick reply but i have problems with your solution

    you said i have to show the items with an item template but how can i set it
    in my settings tab of treeview i can take a resource or databinding

    how can i set the template or where i have to write the template?

    and i aktually donīt understand how to call these functions
    had i to call the original function on one of the ways i postet below ?

  7. #67
    Join Date
    December 2009
    Location
    Germany
    Posts
    118
    Here is how to get it all mixed up for WPF.

    C#
    Code:
    private void button1_Click(object sender, System.Windows.RoutedEventArgs e)
    {
    	ChannelTreeView.ItemsSource = GetChannelTreeForTreeView(QueryRunner);
    }
    
    private static IEnumerable<TreeItem> GetChannelTreeForTreeView(QueryRunner queryRunner)
    {
    	List<ChannelTreeItem> channelTree = queryRunner.Utils.GetChannelTree(false);
    
    	foreach (ChannelTreeItem channelTreeItem in channelTree)
    	{
    		TreeItem treeViewItem = new TreeItem { Data = channelTreeItem.Channel };
    		FillTreeViewItem(treeViewItem, channelTreeItem);
    		yield return treeViewItem;
    	}
    }
    
    private static void FillTreeViewItem(TreeItem treeViewItem, ChannelTreeItem channelTreeItem)
    {
    	foreach (ClientListEntry clientListEntry in channelTreeItem.Clients)
    		treeViewItem.Children.Add(new TreeItem { Data = clientListEntry });
    
    	foreach (ChannelTreeItem childChannelTreeItem in channelTreeItem.Children)
    	{
    		TreeItem childTreeViewItem = new TreeItem { Data = childChannelTreeItem.Channel };
    		treeViewItem.Children.Add(childTreeViewItem);
    		FillTreeViewItem(childTreeViewItem, childChannelTreeItem);
    	}
    }
    
    public class TreeItem
    {
    	public object Data { get; set; }
    	public List<TreeItem> Children { get; private set; }
    
    	public TreeItem()
    	{
    		Children = new List<TreeItem>();
    	}
    }
    XAML
    Code:
    <TreeView x:Name="ChannelTreeView" Height="398" HorizontalAlignment="Left" Margin="26,18,0,0" VerticalAlignment="Top" Width="372">
    	<TreeView.Resources>
    		<HierarchicalDataTemplate DataType="{x:Type Controls:MainAreaControl+TreeItem}" ItemsSource="{Binding Children}">
    			<ContentPresenter Content="{Binding Data}"/>
    		</HierarchicalDataTemplate>
    		<DataTemplate DataType="{x:Type HelperClasses:ChannelListEntry}">
    			<TextBlock Text="{Binding Path=Name}" />
    		</DataTemplate>
    		<DataTemplate DataType="{x:Type HelperClasses:ClientListEntry}" >
    			<TextBlock Text="{Binding Path=Nickname}" />
    		</DataTemplate>
    	</TreeView.Resources>
    </TreeView>
    You can change the DataTemplates to extend the style and to include more info or images.

    The "false" in the following code means "do not use cached values, always do a call to the queryport to get channels and users". When using "true" the channels and users are only received once and then cached for further calls to "GetChannelTree":

    queryRunner.Utils.GetChannelTree(false);

    Bye,
    SCO

  8. #68
    Join Date
    November 2010
    Location
    Germany
    Posts
    3
    Sry but this is not working vor me
    iīm working with vb and not with c#
    i tryed to convert the code but i still have errors left

    thanks for your help
    i try to write my own funktion to show channels and clients
    with labels

  9. #69
    Join Date
    December 2009
    Location
    Germany
    Posts
    118
    I've created a little sample app about how to use the AsyncTcpDispatcher.

    You can download it here:
    Attachment 4272

  10. #70
    Join Date
    December 2009
    Location
    Germany
    Posts
    118

    New Version 0.30.25.0

    Due to the recent beta 30 release I've created a new release of the library. You can download it here:
    http://ts3querylib.codeplex.com/releases/view/54586

    Changes:
    - Added new event "TokenUsed" to QueryRunner.Notifications (beta 30 change)
    - Added properties SortId and NameMode to ChannelGroup class which is used by QueryRunner.GetChannelGrouLists(). (beta 30 change)
    - Added method GetOwnPermissionDetails to QueryRunner class. This method reflects the new "permget" command. (beta 30 change)
    - Added property ParentChannelId to class ChannelInfoResponse which is used in QueryRunner.GetChannelInfo(..) (beta 30 change)
    - Added properties ClientCreated and ClientLastConnected to ClientListEntry class used by QueryRunner.GetClientList (beta 30 change)
    - Added ServerPort to WhoAmIResponse class which is used in QueryRunner.SendWhoAmI(). (beta 30 change)

    Please report bugs and feel free to criticize me
    SCO

  11. #71
    Join Date
    December 2009
    Posts
    244
    Thx for the great job

  12. #72
    Join Date
    December 2009
    Location
    Germany
    Posts
    118
    Just to let you know: This project is alive and with the new Windows Phone 7.1 SDK Release I'm going to implement support for Windows Phone 7 - Sockets are available there .

  13. #73
    Join Date
    December 2009
    Posts
    244
    Thx for the info

  14. #74
    Join Date
    January 2010
    Location
    US
    Posts
    133
    Quote Originally Posted by Scordo View Post
    Just to let you know: This project is alive and with the new Windows Phone 7.1 SDK Release I'm going to implement support for Windows Phone 7 - Sockets are available there .
    That's pretty cool, too bad for me I just bought the Droid Charge phone... hehe Cool for everyone else though. =)

  15. #75
    Join Date
    December 2009
    Location
    Germany
    Posts
    118
    The version under source control @ codeplex already supports wp7 but i had no verve to release a new version.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [WIP] JTS3ServerQuery - Java Server Query Library
    By Stefan1200 in forum Tools / Web Based
    Replies: 78
    Last Post: November 20th, 2016, 12:29 PM
  2. Replies: 6
    Last Post: May 21st, 2013, 02:10 PM
  3. Replies: 9
    Last Post: January 3rd, 2010, 02:26 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •