//id转带sh或sz public static NET_ERROR IdConvert(ref string stockid) { List <string> shid = new List <string>(); List <string> szid = new List <string>(); shid.Add("0" + stockid); szid.Add("1" + stockid); StockInfo si = new Netease(); Dictionary <string, StockInfoEntity> ds; NET_ERROR NE = si.StockGetWithCheck(ref shid, out ds); if (NE == NET_ERROR.NET_REQ_OK && ds.Count > 0) { stockid = ds.First().Key; } else { return(NE); } NE = si.StockGetWithCheck(ref szid, out ds); if (NE == NET_ERROR.NET_REQ_OK && ds.Count > 0) { stockid = ds.First().Key; } return(NE); }
public MainViewModel() { Netease.fillProxies(); Messenger.Default.Register <bool>(this, "queueOpen", message => { isQOpened = message; }); Messenger.Default.Register <bool>(this, "sidebarOpen", message => { isSOpened = message; }); Messenger.Default.Register <bool>(this, "openRegister", message => { ShowRDialog(); }); Messenger.Default.Register <bool>(this, "openLogin", message => { ShowLDialog(); }); Messenger.Default.Register <bool>(this, "closeRegister", message => { ProcessRMessage(); }); Messenger.Default.Register <bool>(this, "closeLogin", message => { ProcessLMessage(); }); Messenger.Default.Register <string>(this, "searchStarted", message => { isContentVisible = true; isPbRingActive = true; }); Messenger.Default.Register <string>(this, "searchCompleted", message => { isContentVisible = false; isPbRingActive = false; }); Messenger.Default.Register <bool>(this, "loadingContent", message => { if (message) { isContentVisible = true; isPbRingActive = true; } else { isContentVisible = false; isPbRingActive = false; } }); }
private static ObservableCollection <MediaData> getAlbums(string message, int page) { ObservableCollection <MediaData> albums; albums = Netease.searchAlbums(message, 1, page); return(albums); }
//not implemented yet private static ObservableCollection <MediaData> getArtists(string message, int page) { ObservableCollection <MediaData> artists; artists = Netease.searchArtists(message, 1, page); return(artists); }
private static ObservableCollection <MediaData> getSongs(string message, bool isNetease, int page) { ObservableCollection <MediaData> songs; if (isNetease) { songs = Netease.searchSongs(message, 1, page); } else { songs = Mp3With.search(message); } return(songs); }
//批量获取名称 public static NET_ERROR CheckName(List <string> stockid, out Dictionary <string, string> name) { StockInfo si = new Netease(); Dictionary <string, StockInfoEntity> ds; NET_ERROR NE = si.StockGetWithCheck(ref stockid, out ds); name = new Dictionary <string, string>(); if (NE == NET_ERROR.NET_REQ_OK) { foreach (var s in ds) { name[s.Key] = s.Value.name; } } return(NE); }
//获取当前价 public static double PriceGet(string id) { StockInfo si = new Netease(); List <string> idl = new List <string>(); idl.Add(id); Dictionary <string, StockInfoEntity> dict; si.StockGet(ref idl, out dict); if (dict.Count == 0) { return(0); } else { return(Convert.ToDouble(dict[id].price)); } }
public PlayerViewModel() { //creates a delay of 1 second for visual effect on slider timer.Interval = new TimeSpan(0, 0, 1); timer.Tick += new EventHandler(tick); //receive a song and plays it. Messenger.Default.Register <Song>(this, "playSong", async message => { bool x; artistName = "Loading song..."; if (message.source == Song.Source.Mp3WithMe) { x = player.playSong(message.uri); } else { x = player.playSong(await Netease.getInfoSong(message)); } if (x) { artistName = message.artistName; songName = message.songName; isSongPaused = false; timer.Start(); } else { artistName = "Failed loading song..."; } }); //set nextButton enabled/disabled Messenger.Default.Register <bool>(this, "nextBtn", message => { isNextBtnEnabled = message; }); //set prevButton enabled/disabled Messenger.Default.Register <bool>(this, "prevBtn", message => { isPrevBtnEnabled = message; }); }
//获取股票名称 public static NET_ERROR CheckName(string stockid, out string name) { StockInfo si = new Netease(); List <string> id = new List <string>(); id.Add(stockid); Dictionary <string, StockInfoEntity> ds; NET_ERROR NE = si.StockGetWithCheck(ref id, out ds); if (NE == NET_ERROR.NET_REQ_OK && ds.Count > 0) { name = ds.First().Value.name; } else { name = ""; } return(NE); }
//批量转id public static NET_ERROR IdConvert(ref List <string> stockid) { List <string> shid = new List <string>(); List <string> szid = new List <string>(); foreach (string id in stockid) { shid.Add("0" + id); szid.Add("1" + id); } stockid.Clear(); StockInfo si = new Netease(); Dictionary <string, StockInfoEntity> ds; NET_ERROR NE = si.StockGetWithCheck(ref shid, out ds); if (NE == NET_ERROR.NET_REQ_OK) { foreach (var s in ds) { stockid.Add(s.Key); } } else { return(NE); } NE = si.StockGetWithCheck(ref szid, out ds); if (NE == NET_ERROR.NET_REQ_OK) { foreach (var s in ds) { stockid.Add(s.Key); } } return(NE); }