Пример #1
0
        internal static Channel FromChannelString(string channelString)
        {
            var parts = channelString.Split(' ', '\n', '\r');

            uint id = DecodeUtility.DecodeUIntProperty(channelString, Properties.ChannelID);

            uint parentId = 0;
            if (parts.FirstOrDefault(part => part.StartsWith(Properties.ParentID)) != null
                || parts.FirstOrDefault(part => part.StartsWith(Properties.ChannelParentID)) != null)
                parentId = DecodeUtility.DecodeUIntProperty(channelString, Properties.ParentID, Properties.ChannelParentID);

            uint order = 0;
            if (parts.FirstOrDefault(part => part.StartsWith(Properties.ChannelOrder)) != null)
                order = DecodeUtility.DecodeUIntProperty(channelString, Properties.ChannelOrder);

            string name = string.Empty;
            if (parts.FirstOrDefault(part => part.StartsWith(Properties.ChannelName)) != null)
                name = DecodeUtility.DecodeStringProperty(channelString, true, Properties.ChannelName);

            uint clientsCount = 0;
            if (parts.FirstOrDefault(part => part.StartsWith(Properties.ChannelClientsCount)) != null)
                clientsCount = DecodeUtility.DecodeUIntProperty(channelString, Properties.ChannelClientsCount);

            bool isSpacer = SpacerInfo.Parse(name) != null;

            Channel channelInfo = new Channel(id, name, isSpacer)
            {
                ParentID = parentId,
                Order = order,
                ClientsCount = clientsCount
            };

            return channelInfo;
        }
Пример #2
0
 public ChannelEventArgs(Channel channel)
 {
     this.Channel = channel;
 }
Пример #3
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));
        }