Esempio n. 1
0
        private void LoadCountries()
        {
            _channelInfo = new ChannelsList(_webepgFilesDir);
            string[] countries = _channelInfo.GetCountries();
            _countryList = new Dictionary <string, string>();
            cbCountry.Items.Clear();

            if (countries != null)
            {
                foreach (string country in countries)
                {
                    try
                    {
                        RegionInfo region = new RegionInfo(country);
                        cbCountry.Items.Add(region.EnglishName);
                        _countryList.Add(region.EnglishName, country);
                    }
                    catch (Exception) {}
                }
            }

            for (int i = 0; i < cbCountry.Items.Count; i++)
            {
                if (cbCountry.Items[i].ToString() == RegionInfo.CurrentRegion.EnglishName)
                {
                    cbCountry.SelectedIndex = i;
                }
            }
        }
Esempio n. 2
0
        public void It_should_be_possible_to_access_channel_information()
        {
            var          serializer = new JavaScriptSerializer();
            ChannelsList list       = serializer.Deserialize <ChannelsList>(json);

            Assert.AreEqual(list["presence-channel"]["user_count"], "300");
        }
Esempio n. 3
0
        /// <summary>
        /// Get list of user's chats
        /// </summary>
        /// <param name="token"></param>
        /// <param name="jObject"></param>
        /// <returns></returns>
        public object GetChats(string token, JObject jObject)
        {
            string userName = _validator.GetUserName(token);

            if (_validator.CheckUser(userName))
            {
                ChannelsList list = new ChannelsList();
                foreach (var chat in _repository.GetChatsList(userName))
                {
                    Channel channel = new Channel();
                    channel.ChatId = chat.Id;
                    channel.Name   = chat.Name;
                    foreach (var codeChat in _repository.GetCodeChatsList(channel.ChatId))
                    {
                        CodeChannel codeChannel = new CodeChannel();
                        codeChannel.CodeChatId   = codeChat.Id;
                        codeChannel.MainChatName = chat.Name;
                        codeChannel.Name         = codeChat.Name;
                        channel.CodeChats.Add(codeChannel);
                    }
                    list.Channels.Add(channel);
                }

                _response.Status = 20000;
                _response.Result = list;
            }
            else
            {
                _response.Status = 40002;
                _response.Result = "Validation failed!!!";
            }
            return(_response);
        }
Esempio n. 4
0
        public void It_should_make_the_channels_accessible_by_name_via_the_indexer()
        {
            var          serializer = new JavaScriptSerializer();
            ChannelsList list       = serializer.Deserialize <ChannelsList>(json);

            Assert.IsNotNull(list["test_channel"]);
        }
Esempio n. 5
0
        // Channels

        async void SaveChannels(object sender = null, EventArgs e = null)
        {
            try
            {
                List <ComboBoxItem> items        = ChannelsList.Skip(1).SkipWhile(item => item == CollectionView.NewItemPlaceholder).ToList();
                List <string>       fileContents = items.ConvertAll(item => $"{item.Content},{item.Tag}");
                File.WriteAllLines(Directory.GetCurrentDirectory() + @"\" + "channels.txt", fileContents);
                await Console.Log("Saved all channels.");
            }
            catch (Exception ex)
            {
                await Console.Log("Failed to save channels to file." + Environment.NewLine + ex.ToString());
            }
        }
Esempio n. 6
0
 public Client(string name, ServicesCore core)
     : base(name, core)
 {
     p_host = "";
     p_vHost = "";
     p_username = "";
     p_realname = "";
     p_identNick = "";
     p_modes = "";
     p_channels = new ChannelsList();
 }
Esempio n. 7
0
 protected override void Dispose(bool disposing)
 {
     try
     {
         //Deal with the channels
         while (p_channels.Count > 0)
         {
             if (p_channels[0].channelMembers.Count == 1 && p_channels[0].channelMembers.Contains(this))
             {
                 p_core.Channels.Remove(p_channels[0]);
             }
             else
             {
                 p_core.Channels[p_channels[0].name].channelMembers.Remove(p_channels[0].channelMembers[this]);
             }
             p_channels.RemoveAt(0);
         }
         //Remove ourselves from teh list0rz
         p_host = null;
         p_vHost = null;
         p_username = null;
         p_realname = null;
         p_modes = null;
         p_channels = null;
         if (p_hostServer != null && p_hostServer.users.Contains(this))
         {
             p_hostServer.users.Remove(this);
             p_hostServer = null;
         }
     }
     catch (Exception ex)
     {
         p_core.SendLogMessage("Client", "Dispose", BlackLight.Services.Error.Errors.ERROR, "Problem", "", ex.Message, ex.StackTrace);
     }
 }
        public void It_should_be_possible_to_access_channel_information()
        {
            ChannelsList list = JsonConvert.DeserializeObject <ChannelsList>(json);

            Assert.AreEqual(list["presence-channel"]["user_count"], "300");
        }
        public void It_should_make_the_channels_accessible_by_name_via_the_indexer()
        {
            ChannelsList list = JsonConvert.DeserializeObject <ChannelsList>(json);

            Assert.IsNotNull(list["test_channel"]);
        }
    private void LoadCountries()
    {
      _channelInfo = new ChannelsList(_webepgFilesDir);
      string[] countries = _channelInfo.GetCountries();
      _countryList = new Dictionary<string, string>();
      cbCountry.Items.Clear();

      if (countries != null)
      {
        foreach (string country in countries)
        {
          try
          {
            RegionInfo region = new RegionInfo(country);
            cbCountry.Items.Add(region.EnglishName);
            _countryList.Add(region.EnglishName, country);
          }
          catch (Exception) {}
        }
      }

      for (int i = 0; i < cbCountry.Items.Count; i++)
      {
        if (cbCountry.Items[i].ToString() == RegionInfo.CurrentRegion.EnglishName)
        {
          cbCountry.SelectedIndex = i;
        }
      }
    }
Esempio n. 11
0
        private void ManageChannels()
        {
            // ******** suppression d'un channel *********
            DeleteChannelCmd = new Command(new Action(() =>
            {
                if (SelectedChannel != null)
                {
                    try
                    {
                        ChannelsList.Remove(SelectedChannel);
                        _serveur.dropChannel(SelectedChannel.IdEntity);

                        IList <RssChannel> correctList = ChannelsList;

                        ChannelsList = null;
                        ChannelsList = correctList;

                        SelectedChannel = null;
                    }
                    catch (Exception e)
                    {
                        IsProgressRingActive = false;
                        if (e.InnerException != null)
                        {
                            DebugText = e.InnerException.Message;
                        }
                        else
                        {
                            DebugText = e.Message;
                        }
                    }
                }
            }));


            // ******** ajout d'un channel *********
            AddChannelCmd = new Command(new Action(async() =>
            {
                IsFlyoutAddChannelOpenned = true;
                CurrentChannel            = new RssChannel();
                NewCategoryForChannel     = CurrentCategory;
                if (ChannelsList == null)
                {
                    ChannelsList = new List <RssChannel>();
                }
            }));

            AddChannelCmdValidate = new Command(new Action(async() =>
            {
                try
                {
                    FlyoutMessage        = "";
                    IsProgressRingActive = true;
                    CurrentChannel       = await _serveur.addChannelInCategoryWithCategoryNameAsync(CurrentChannel.RssLink, NewCategoryForChannel.Name);

                    ChannelsList.Add(CurrentChannel);
                    IList <RssChannel> correctList = ChannelsList;

                    ChannelsList = null;
                    ChannelsList = correctList;

                    IsFlyoutAddChannelOpenned = false;
                    IsProgressRingActive      = false;
                }
                catch (Exception e)
                {
                    IsProgressRingActive = false;
                    if (e.InnerException != null)
                    {
                        FlyoutMessage = e.InnerException.Message;
                    }
                    else
                    {
                        FlyoutMessage = e.Message;
                    }
                }
            }));



            // ******** edition d'un channel *********
            EditChannelCmd = new Command(new Action(async() =>
            {
                if (SelectedChannel != null)
                {
                    CurrentChannel             = SelectedChannel;
                    IsFlyoutEditChannelOpenned = true;
                    NewCategoryForChannel      = CurrentCategory;
                }
            }));

            EditChannelCmdValidate = new Command(new Action(async() =>
            {
                IsFlyoutEditChannelOpenned = false;
                try
                {
                    if (NewCategoryForChannel != CurrentCategory)
                    {
                        _serveur.moveChannelToCategory(CurrentCategory.IdEntity, NewCategoryForChannel.IdEntity, CurrentChannel.IdEntity);

                        CategoryList = _serveur.getCategories();
                        ChannelsList = _serveur.getRssChannelsInCategoryWithCategoryName(CurrentCategory.Name);
                    }
                    FlyoutMessage = "";
                }
                catch (Exception e)
                {
                    if (e.InnerException != null)
                    {
                        FlyoutMessage = e.InnerException.Message;
                    }
                    else
                    {
                        FlyoutMessage = e.Message;
                    }
                }
            }));


            // ******** Set Channel lu *********
            SetReadChannelCmd = new Command(new Action(() =>
            {
                if (SelectedChannel != null)
                {
                    try
                    {
                        if (IsOn)
                        {
                            _serveur.setChannelAsRead(SelectedChannel.IdEntity);
                        }
                    }
                    catch (Exception e)
                    {
                        if (e.InnerException != null)
                        {
                            DebugText = "[Exception]" + e.InnerException.Message;
                        }
                        else
                        {
                            DebugText = "[Exception]" + e.Message;
                        }
                    }
                }
                else
                {
                    DebugText = "[Error] SelectedChannel == null";
                }
            }));

            // ******** Set Channel non lu *********
            SetUnreadChannelCmd = new Command(new Action(() =>
            {
                if (SelectedChannel != null)
                {
                    try
                    {
                        if (IsOn)
                        {
                            _serveur.setChannelAsUnread(SelectedChannel.IdEntity);
                        }
                    }
                    catch (Exception e)
                    {
                        if (e.InnerException != null)
                        {
                            DebugText = "[Exception]" + e.InnerException.Message;
                        }
                        else
                        {
                            DebugText = "[Exception]" + e.Message;
                        }
                    }
                }
                else
                {
                    DebugText = "[Error] SelectedChannel == null";
                }
            }));
        }
Esempio n. 12
0
 private void LoadChannels(object sender = null, EventArgs e = null)
 {
     ChannelsList.Clear();
     ChannelsList.AddFile(ChannelsPath);
     ChannelsBox.SelectedIndex = 0;
 }