Exemplo n.º 1
0
        public Dictionary<string,ChanFav> GetFavoriteList(string server)
        {
            if (_ChannelFavorites == null)
            {
                _ChannelFavorites = new Dictionary<string,ChanFav>();
            }
            _ChannelFavorites.Clear();
            curServer = server;
            SavedSet.ChannelFavoritesDataTable dtFavs = GetFavorites();
            DataView dv = new DataView(dtFavs);
            dv.RowFilter = "servername = '" + server + "'";
            
            foreach (DataRowView drv in dv)
            {
                ChanFav cf = new ChanFav();
                cf.channel = drv["channel"].ToString();
                if (drv["NotifyMinute"] != DBNull.Value)
                    cf.NotifyMinute = Convert.ToInt32(drv["NotifyMinute"]);
                if (drv["phonetic"] != DBNull.Value)
                    cf.Phonetic = drv["phonetic"].ToString();
                if (drv["last"] != DBNull.Value)
                    cf.Last = Convert.ToDateTime(drv["last"]);

                _ChannelFavorites.Add(cf.channel,cf);
            }
            return _ChannelFavorites;
        }
Exemplo n.º 2
0
        public Dictionary <string, ChanFav> GetFavoriteList(string server)
        {
            if (_ChannelFavorites == null)
            {
                _ChannelFavorites = new Dictionary <string, ChanFav>();
            }
            _ChannelFavorites.Clear();
            curServer = server;
            SavedSet.ChannelFavoritesDataTable dtFavs = GetFavorites();
            DataView dv = new DataView(dtFavs);

            dv.RowFilter = "servername = '" + server + "'";

            foreach (DataRowView drv in dv)
            {
                ChanFav cf = new ChanFav();
                cf.channel = drv["channel"].ToString();
                if (drv["NotifyMinute"] != DBNull.Value)
                {
                    cf.NotifyMinute = Convert.ToInt32(drv["NotifyMinute"]);
                }
                if (drv["phonetic"] != DBNull.Value)
                {
                    cf.Phonetic = drv["phonetic"].ToString();
                }
                if (drv["last"] != DBNull.Value)
                {
                    cf.Last = Convert.ToDateTime(drv["last"]);
                }

                _ChannelFavorites.Add(cf.channel, cf);
            }
            return(_ChannelFavorites);
        }
Exemplo n.º 3
0
        public void AddChannels(string server, string[] channellist)
        {
            if (_ChannelFavorites == null)
            {
                _ChannelFavorites = new Dictionary <string, ChanFav>();
            }
            _ChannelFavorites.Clear();

            SavedSet.ChannelFavoritesDataTable dtFavs = GetFavorites();
            DataView dv = new DataView(dtFavs);

            dv.RowFilter = "servername = '" + server + "'";

            foreach (DataRowView drv in dv)
            {
                ChanFav cf = new ChanFav();
                cf.channel = drv["channel"].ToString();
                _ChannelFavorites.Add(cf.channel, cf);
            }
            foreach (string fav in channellist)
            {
                if (!_ChannelFavorites.ContainsKey(fav))
                {
                    //Add favorite to list
                    ChanFav cf = new ChanFav(fav);
                    _ChannelFavorites.Add(cf.channel, cf);
                    SavedSet.ChannelFavoritesRow cfr = dtFavs.NewChannelFavoritesRow();
                    cfr.Channel    = fav;
                    cfr.servername = server;
                    dtFavs.AddChannelFavoritesRow(cfr);
                }
            }

            data.WriteXml(Application.UserAppDataPath + "\\IRCAL.xml");
        }
Exemplo n.º 4
0
        public void RemoveChannels(string server, string[] channellist)
        {
            if (_ChannelFavorites == null)
            {
                _ChannelFavorites = new Dictionary <string, ChanFav>();
            }
            _ChannelFavorites.Clear();

            SavedSet.ChannelFavoritesDataTable dtFavs = GetFavorites();
            DataView dv = new DataView(dtFavs);

            dv.RowFilter = "servername = '" + server + "'";

            foreach (DataRowView drv in dv)
            {
                ChanFav cf = new ChanFav();
                cf.channel = drv["channel"].ToString();
                _ChannelFavorites.Add(cf.channel, cf);
            }
            SavedSet.ChannelFavoritesRow cfr;
            foreach (string fav in channellist)
            {
                if (_ChannelFavorites.ContainsKey(fav))
                {
                    //Add favorite to list
                    _ChannelFavorites.Remove(fav);
                    for (int i = 0; i < data.ChannelFavorites.Count; i++)
                    {
                        cfr = data.ChannelFavorites[i];

                        if (cfr["Channel"] != DBNull.Value && cfr.Channel == fav)
                        {
                            data.ChannelFavorites.RemoveChannelFavoritesRow(cfr);
                        }
                    }
                }
            }

            data.WriteXml(Application.UserAppDataPath + "\\IRCAL.xml");
        }
Exemplo n.º 5
0
        public void AddChannels(string server, string[] channellist)
        {
            if (_ChannelFavorites == null)
            {
                _ChannelFavorites = new Dictionary<string,ChanFav>();
            }
            _ChannelFavorites.Clear();

            SavedSet.ChannelFavoritesDataTable dtFavs = GetFavorites();
            DataView dv = new DataView(dtFavs);
            dv.RowFilter = "servername = '" + server + "'";

            foreach (DataRowView drv in dv)
            {
                ChanFav cf= new ChanFav();
                cf.channel = drv["channel"].ToString();
                _ChannelFavorites.Add(cf.channel,cf);
            }
            foreach (string fav in channellist)
            {
                if (!_ChannelFavorites.ContainsKey(fav))
                {
                    //Add favorite to list
                    ChanFav cf = new ChanFav(fav);
                    _ChannelFavorites.Add(cf.channel,cf);
                    SavedSet.ChannelFavoritesRow cfr = dtFavs.NewChannelFavoritesRow();
                    cfr.Channel = fav;
                    cfr.servername = server;
                    dtFavs.AddChannelFavoritesRow(cfr);
                }
            }

            data.WriteXml(Application.UserAppDataPath + "\\IRCAL.xml");
        }
Exemplo n.º 6
0
        public void RemoveChannels(string server, string[] channellist)
        {
            if (_ChannelFavorites == null)
            {
                _ChannelFavorites = new Dictionary<string,ChanFav>();
            }
            _ChannelFavorites.Clear();

            SavedSet.ChannelFavoritesDataTable dtFavs = GetFavorites();
            DataView dv = new DataView(dtFavs);
            dv.RowFilter = "servername = '" + server + "'";

            foreach (DataRowView drv in dv)
            {
                ChanFav cf = new ChanFav();
                cf.channel = drv["channel"].ToString();
                _ChannelFavorites.Add(cf.channel,cf);
            }
            SavedSet.ChannelFavoritesRow cfr;
            foreach (string fav in channellist)
            {
                if (_ChannelFavorites.ContainsKey(fav))
                {
                    //Add favorite to list
                    _ChannelFavorites.Remove(fav);
                    for (int i = 0; i < data.ChannelFavorites.Count; i++)
                    {
                        cfr = data.ChannelFavorites[i];

                        if (cfr["Channel"] != DBNull.Value && cfr.Channel == fav)
                        {
                            data.ChannelFavorites.RemoveChannelFavoritesRow(cfr);
                        }
                        
                    }
                    
                }
            }

            data.WriteXml(Application.UserAppDataPath + "\\IRCAL.xml");

        }