private async void button1_Click(object sender, EventArgs e) { //textBox1 if (!string.IsNullOrEmpty(textBox1.Text.Trim())) { var arg = new SearchArg() { Keywords = textBox1.Text.Trim() }; arg.PageSize = 100; var result = await api.SearchAsync(arg); //搜索搜索并获取结果 if (result.song.list.Count() > 0) { Console.WriteLine($"共搜索到{result.song.list.Count()}个结果"); this.tableModelBindingSource.DataSource = result.song.list.Select(x => new TableModel { AlbumName = x.album.name, Name = x.name, Singer = string.Join("、", x.singer.Select(xx => xx.name).ToArray()), SongItem = x, Ape = (x.file.size_ape > 0) ? "下载" : null, Flac = (x.file.size_flac > 0) ? "下载" : null, Mp3_128k = (x.file.size_128 > 0) ? "下载" : null, Mp3_320k = (x.file.size_320 > 0) ? "下载" : null, }); } else { this.tableModelBindingSource.DataSource = typeof(TableModel); Console.WriteLine("没找到你需要的歌曲"); } } }
/// <summary> /// 得到所有设备告警折线图数据信息 /// </summary> /// <param name="start"></param> /// <param name="end"></param> public void GetDevTypeAlarmLineData(string start, string end) { arg = new SearchArg(); arg.StartTime = start; arg.EndTime = end; GetDevAlarmTypeStatisticsChartData(start, end); }
public async void DownloadAsyncTest() { var api = new QQMusicAPI(); var arg = new SearchArg() { Keywords = "ɳĮÂæÍÕ" }; arg.PageSize = 30; var result = await api.SearchAsync(arg); //ËÑË÷ËÑË÷²¢»ñÈ¡½á¹û Assert.NotNull(result); Assert.NotNull(result.song); Assert.NotEmpty(result.song.list); }
/// <summary> /// 得到设备告警类型数据 /// </summary> /// <param name="start"></param> /// <param name="end"></param> public void GetPerAlarmStatisticsData(string start, string end) { arg = new SearchArg(); arg.StartTime = start; arg.EndTime = end; if (!IsGetPerData) { return; } IsGetPerData = false; var DevAlarmTypeStatisticsList = CommunicationObject.Instance.GetLocationAlarmStatistics(arg); IsGetPerData = true; PerAlarmCountList = new List <AlarmGroupCount>(); PerAlarmCountList.AddRange(DevAlarmTypeStatisticsList.DevTypeAlarms); PersonnelAlarmStatistics.Instance.SetDeviceAlarmTypeInfo(PerAlarmCountList); }
/// <summary> /// 得到设备告警类型折线图数据 /// </summary> /// <param name="start"></param> /// <param name="end"></param> public void GetDevAlarmTypeStatisticsChartData(string start, string end) { argChart = new SearchArg(); argChart.StartTime = start; argChart.EndTime = end; if (!IsGetDevData) { return; } IsGetDevChartData = false; var DevAlarmTypeStatisticsList = CommunicationObject.Instance.GetDevAlarmStatistics(arg); IsGetDevChartData = true; DevTypeAlarmLineList = new List <AlarmLine>(); if (DevAlarmTypeStatisticsList.Lines == null) { DevAlarmStatisticsLineChart.Instance.NullDate(); } else { DevTypeAlarmLineList.AddRange(DevAlarmTypeStatisticsList.Lines); } TypeNameList = new List <string>(); TypeNameList.AddRange(DevAlarmTypeStatisticsList.itemList); devAlarmLineChartDropdown.AddName(); TypeName = TypeNameList[Value]; devAlarmLineChartDropdown.TypeDropdown.captionText.text = TypeName; TypePosLIst = new List <AlarmLinePoint>(); foreach (var item in DevTypeAlarmLineList) { if (TypeName == item.Name) { TypePosLIst.AddRange(item.Points); } } if (TypePosLIst.Count == 0) { DevAlarmStatisticsLineChart.Instance.NullDate(); } else { DevAlarmStatisticsLineChart.Instance.SetLineChart(TypePosLIst); } }
/// <summary> /// 得到所有设备告警折线图数据信息 /// </summary> /// <param name="start"></param> /// <param name="end"></param> public void GetDevTypeAlarmLineData(string start, string end) { Chartarg = new SearchArg(); Chartarg.StartTime = start; Chartarg.EndTime = end; if (!IsGetPerChartData) { return; } IsGetPerChartData = false; var DevAlarmTypeStatisticsList = CommunicationObject.Instance.GetLocationAlarmStatistics(arg); IsGetPerChartData = true; PerAlarmLineList = new List <AlarmLine>(); PerAlarmLineList.AddRange(DevAlarmTypeStatisticsList.Lines); List <AlarmLinePoint> prePosLIst = new List <AlarmLinePoint>(); prePosLIst.AddRange(PerAlarmLineList[0].Points); PerAlarmStatisticsLineChart.Instance.SetLineChart(prePosLIst); }
public override FileItem[] Search(FileItem from) { var args = new SearchArg(from.Path, from.SecondaryPath); var response = DBClient.Files.SearchAsync(args); List <FileItem> mFileItems = new List <FileItem>(); foreach (SearchMatch result in response.Result.Matches) { var item = result.Metadata; if (!item.IsDeleted) { FileItem mFileItem = new FileItem(); mFileItem.Path = item.PathLower; mFileItem.IsDirectory = item.IsFolder; mFileItem.LastModified = item.AsFile.ClientModified.Ticks; mFileItem.Size = (long)item.AsFile.Size; mFileItems.Add(mFileItem); } } return(mFileItems.ToArray()); }
/// <summary> /// <para>Begins an asynchronous send to the search route.</para> /// </summary> /// <param name="path">The path in the user's Dropbox to search. Should probably be a /// folder.</param> /// <param name="query">The string to search for. The search string is split on spaces /// into multiple tokens. For file name searching, the last token is used for prefix /// matching (i.e. "bat c" matches "bat cave" but not "batman car").</param> /// <param name="start">The starting index within the search results (used for /// paging).</param> /// <param name="maxResults">The maximum number of search results to return.</param> /// <param name="mode">The search mode (filename, filename_and_content, or /// deleted_filename).</param> /// <param name="callback">The method to be called when the asynchronous send is /// completed.</param> /// <param name="callbackState">A user provided object that distinguished this send /// from other send requests.</param> /// <returns>An object that represents the asynchronous send request.</returns> public sys.IAsyncResult BeginSearch(string path, string query, ulong start = 0, ulong maxResults = 100, SearchMode mode = null, sys.AsyncCallback callback = null, object callbackState = null) { var searchArg = new SearchArg(path, query, start, maxResults, mode); return this.BeginSearch(searchArg, callback, callbackState); }
/// <summary> /// <para>Searches for files and folders.</para> /// </summary> /// <param name="path">The path in the user's Dropbox to search. Should probably be a /// folder.</param> /// <param name="query">The string to search for. The search string is split on spaces /// into multiple tokens. For file name searching, the last token is used for prefix /// matching (i.e. "bat c" matches "bat cave" but not "batman car").</param> /// <param name="start">The starting index within the search results (used for /// paging).</param> /// <param name="maxResults">The maximum number of search results to return.</param> /// <param name="mode">The search mode (filename, filename_and_content, or /// deleted_filename).</param> /// <returns>The task that represents the asynchronous send operation. The TResult /// parameter contains the response from the server.</returns> /// <exception cref="Dropbox.Api.ApiException{SearchError}">Thrown if there is an error /// processing the request; This will contain a <see cref="SearchError"/>.</exception> public t.Task<SearchResult> SearchAsync(string path, string query, ulong start = 0, ulong maxResults = 100, SearchMode mode = null) { var searchArg = new SearchArg(path, query, start, maxResults, mode); return this.SearchAsync(searchArg); }
/// <summary> /// <para>Begins an asynchronous send to the search route.</para> /// </summary> /// <param name="searchArg">The request parameters.</param> /// <param name="callback">The method to be called when the asynchronous send is /// completed.</param> /// <param name="state">A user provided object that distinguished this send from other /// send requests.</param> /// <returns>An object that represents the asynchronous send request.</returns> public sys.IAsyncResult BeginSearch(SearchArg searchArg, sys.AsyncCallback callback, object state = null) { var task = this.SearchAsync(searchArg); return enc.Util.ToApm(task, callback, state); }
/// <summary> /// <para>Searches for files and folders.</para> /// </summary> /// <param name="searchArg">The request parameters</param> /// <returns>The task that represents the asynchronous send operation. The TResult /// parameter contains the response from the server.</returns> /// <exception cref="Dropbox.Api.ApiException{SearchError}">Thrown if there is an error /// processing the request; This will contain a <see cref="SearchError"/>.</exception> public t.Task<SearchResult> SearchAsync(SearchArg searchArg) { return this.Transport.SendRpcRequestAsync<SearchArg, SearchResult, SearchError>(searchArg, "api", "/files/search", SearchArg.Encoder, SearchResult.Decoder, SearchError.Decoder); }
static void Main(string[] args) { var api = new QQMusicAPI(); //初始化一个实例 string songName = null; while (string.IsNullOrEmpty(songName)) { songName = GetUserInput("\r\n请输入要搜索的歌名"); } var arg = new SearchArg() { Keywords = songName }; arg.PageSize = 30; var result = api.SearchAsync(arg).Result; //搜索搜索并获取结果 if (result.song.list.Count > 0) { Console.WriteLine($"共搜索到{result.song.list.Count}个结果"); //为了简化示例,就取列表的第一条歌曲 var song = result.song.list[0]; EnumFileType type = song.file.GetAvailableFileType();//取当前歌曲可用的类型 Console.WriteLine(type); //获取当前目录用来存放音乐 string dir = AppContext.BaseDirectory; //要下载哪种类型的音乐呢? EnumFileType downloadType = 0; downloadType |= (type & EnumFileType.Ape); if (downloadType == 0) { downloadType |= (type & EnumFileType.Flac); } if (downloadType == 0) { downloadType |= (type & EnumFileType.Mp3_320k); } if (downloadType == 0) { downloadType |= (type & EnumFileType.Mp3_128k); } if (downloadType == 0) { downloadType |= (type & EnumFileType.M4a); } var t = api.downloadSongAsync(song, dir, downloadType);//建立下载的task,下载文件最大并保存到当前目录 //可选:当然也可以尝试lrc的歌词下载下来 var t2 = api.downloadLyricAsync(song, dir); Console.WriteLine("Start download:"); while (!t.IsCompleted) { Console.Write("."); System.Threading.Thread.Sleep(500); } t2.Wait(); Console.WriteLine(); if (t.IsFaulted) { Console.WriteLine($"Error:{t.Exception.Message}"); } else { Console.WriteLine("Download success!"); } } else { Console.WriteLine("没找到你需要的歌曲"); } Console.WriteLine("按任意键退出本示例"); Console.ReadKey(); }
public AlarmStatistics GetLocationAlarmStatistics(SearchArg arg) { return(service.GetLocationAlarmStatistics(arg)); }
public AlarmStatistics GetLocationAlarmStatistics(SearchArg arg) { throw new NotImplementedException(); }
public AlarmStatistics GetDevAlarmStatistics(SearchArg arg) { AlarmStatistics alarmStatistics = new AlarmStatistics(); return(alarmStatistics); }