Пример #1
0
        public TeamspeakViewModel(ITeamspeakService teamspeakService, TeamspeakUserData userData)
        {
            this.isShuttingDown        = false;
            this.UserData              = userData;
            this.ChatMessages          = new ObservableCollection <ChatMsgViewModel>();
            this.Notifications         = new ObservableCollection <TSNotificationViewModel>();
            this.Channels              = new ObservableCollection <ChannelViewModel>();
            this.CurrentChannelClients = new ObservableCollection <ClientViewModel>();

            var channelsSource = new AutoRefreshCollectionViewSource();

            channelsSource.Source = this.Channels;
            this.ChannelsSource   = channelsSource;
            this.ChannelsSource.SortDescriptions.Add(new SortDescription("OrderIndex", ListSortDirection.Ascending));

            this.TeamspeakService = teamspeakService;
            this.TeamspeakService.NewServerInfo        += TeamspeakService_NewServerInfo;
            this.TeamspeakService.ClientChannelChanged += TeamspeakService_ClientChannelChanged;
            this.TeamspeakService.ConnectionRefused    += TeamspeakService_ConnectionRefused;
            this.TeamspeakService.TalkStatusChanged    += TeamspeakService_TalkStatusChanged;
            this.TeamspeakService.TextMessageReceived  += TeamspeakService_TextMessageReceived;
            this.TeamspeakService.ClientEnteredChannel += TeamspeakService_ClientEnteredChannel;
            this.TeamspeakService.ClientExitedChannel  += TeamspeakService_ClientExitedChannel;
            this.TeamspeakService.ChannelAdded         += TeamspeakService_ChannelAdded;
            this.TeamspeakService.ChannelRemoved       += TeamspeakService_ChannelRemoved;
            this.TeamspeakService.ChannelUpdated       += TeamspeakService_ChannelUpdated;

            Task.Factory.StartNew((state) =>
            {
                // Start this on another thread so that we don't hold up anything creating us
                this.TeamspeakService.Connect();
            }, null, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.FromCurrentSynchronizationContext());
        }
Пример #2
0
        public TeamspeakViewModel(ITeamspeakService teamspeakService, TeamspeakUserData userData)
        {
            this.isShuttingDown = false;
            this.UserData = userData;
            this.ChatMessages = new ObservableCollection<ChatMsgViewModel>();
            this.Notifications = new ObservableCollection<TSNotificationViewModel>();
            this.Channels = new ObservableCollection<ChannelViewModel>();
            this.CurrentChannelClients = new ObservableCollection<ClientViewModel>();

            var channelsSource = new AutoRefreshCollectionViewSource();
            channelsSource.Source = this.Channels;
            this.ChannelsSource = channelsSource;
            this.ChannelsSource.SortDescriptions.Add(new SortDescription("OrderIndex", ListSortDirection.Ascending));

            this.TeamspeakService = teamspeakService;
            this.TeamspeakService.NewServerInfo += TeamspeakService_NewServerInfo;
            this.TeamspeakService.ClientChannelChanged += TeamspeakService_ClientChannelChanged;
            this.TeamspeakService.ConnectionRefused += TeamspeakService_ConnectionRefused;
            this.TeamspeakService.TalkStatusChanged += TeamspeakService_TalkStatusChanged;
            this.TeamspeakService.TextMessageReceived += TeamspeakService_TextMessageReceived;
            this.TeamspeakService.ClientEnteredChannel += TeamspeakService_ClientEnteredChannel;
            this.TeamspeakService.ClientExitedChannel += TeamspeakService_ClientExitedChannel;
            this.TeamspeakService.ChannelAdded += TeamspeakService_ChannelAdded;
            this.TeamspeakService.ChannelRemoved += TeamspeakService_ChannelRemoved;
            this.TeamspeakService.ChannelUpdated += TeamspeakService_ChannelUpdated;

            Task.Factory.StartNew((state) =>
                {
                    // Start this on another thread so that we don't hold up anything creating us
                    this.TeamspeakService.Connect();
                }, null, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.FromCurrentSynchronizationContext() );
        }
Пример #3
0
        /// <summary>
        /// Default constructor
        /// </summary>
        public TeamspeakViewModel(ITeamspeakService teamspeakService, TeamspeakSettings userSettings)
        {
            this.isShuttingDown = false;
            this.UserSettings   = userSettings;
            this.Notifications  = new ObservableCollection <TSNotificationViewModel>();
            this.Channels       = new ObservableCollection <ChannelViewModel>();

            this.TeamspeakService = teamspeakService;
            this.TeamspeakService.NewServerInfo        += TeamspeakService_NewServerInfo;
            this.TeamspeakService.ClientChannelChanged += TeamspeakService_ClientChannelChanged;
            this.TeamspeakService.ConnectionRefused    += TeamspeakService_ConnectionRefused;
            this.TeamspeakService.TalkStatusChanged    += TeamspeakService_TalkStatusChanged;
            this.TeamspeakService.TextMessageReceived  += TeamspeakService_TextMessageReceived;
            this.TeamspeakService.ClientEnteredChannel += TeamspeakService_ClientEnteredChannel;
            this.TeamspeakService.ClientExitedChannel  += TeamspeakService_ClientExitedChannel;
            this.TeamspeakService.ChannelAdded         += TeamspeakService_ChannelAdded;
            this.TeamspeakService.ChannelRemoved       += TeamspeakService_ChannelRemoved;
            this.TeamspeakService.ChannelUpdated       += TeamspeakService_ChannelUpdated;

            Task.Factory.StartNew((state) =>
            {
                // Start this on another thread so that we don't hold up anything creating us
                this.TeamspeakService.Connect();
            }, null, CancellationToken.None, TaskCreationOptions.LongRunning, TaskScheduler.FromCurrentSynchronizationContext());
        }
Пример #4
0
        /// <summary>
        /// Default constructor
        /// </summary>
        /// <param name="channelData">The channel's data</param>
        public ChannelViewModel(Channel channelData, ITeamspeakService teamspeakService)
        {
            this.ID               = channelData.ID;
            this.ParentID         = channelData.ParentID;
            this.Name             = channelData.Name;
            this.OrderIndex       = channelData.Order;
            this.ClientsCount     = channelData.ClientsCount;
            this.teamspeakService = teamspeakService;
            this.Subchannels      = new ObservableCollection <ChannelViewModel>();

            var subChannelsSource = new AutoRefreshCollectionViewSource();

            subChannelsSource.Source = this.Subchannels;
            this.ChannelsSource      = subChannelsSource;
            this.ChannelsSource.SortDescriptions.Add(new SortDescription("OrderIndex", ListSortDirection.Ascending));
        }
Пример #5
0
        /// <summary>
        /// Default constructor
        /// </summary>
        /// <param name="channelData">The channel's data</param>
        public ChannelViewModel(Channel channelData, ITeamspeakService teamspeakService)
        {
            this.ID = channelData.ID;
            this.ParentID = channelData.ParentID;
            this.Name = channelData.Name;
            this.OrderIndex = channelData.Order;
            this.ClientsCount = channelData.ClientsCount;
            this.teamspeakService = teamspeakService;
            this.Subchannels = new ObservableCollection<ChannelViewModel>();

            var subChannelsSource = new AutoRefreshCollectionViewSource();
            subChannelsSource.Source = this.Subchannels;
            this.ChannelsSource = subChannelsSource;
            this.ChannelsSource.SortDescriptions.Add(new SortDescription("OrderIndex", ListSortDirection.Ascending));
        }
Пример #6
0
 /// <summary>
 /// Default constructor
 /// </summary>
 /// <param name="channelData">The channel's data</param>
 public ChannelViewModel(Channel channelData, ITeamspeakService teamspeakService)
 {
     this.modelData        = channelData;
     this.teamspeakService = teamspeakService;
     this.Subchannels      = new ObservableCollection <ChannelViewModel>();
 }