private void b_Sender_Click(object sender, EventArgs e) { Command_info c = new Command_info(); c.type = 1; c.msg = ""; c.msg2 = ""; string str_c = Helper_Json.Encode(c); SetrichTextBox("刷新所有硬盘信息....."); long r_l = h_redis.RedisPub(str_r_rep, str_c); Helper_log.Write_log(str_r_rep + ":" + str_c); }
private void H_redis_RedisSubMessageEvent(string str) { //Add_Text_Value(str); Result_Info r = (Result_Info)Helper_Json.Decode(str, typeof(Result_Info)); if (r.type > 0) { Helper_log.Write_log(str); if (r.type == 1) { if (r.code > 0) { List <Disk_Info> ds = (List <Disk_Info>)Helper_Json.Decode(r.msg, typeof(List <Disk_Info>)); SetrichTextBox("更新成功数量:" + MyVideoBussiness.Update_Disk_Info(ds)); Refresh_DataGridView(); SetrichTextBox("更新硬盘成功"); } } else if (r.type == 2) { if (r.code == 1) { File_Info fi = (File_Info)Helper_Json.Decode(r.msg, typeof(File_Info)); MyVideoBussiness.Add_Video_Info(fi); SetrichTextBox("扫描:" + fi.fileFullPath); } } else if (r.type == 3) { string str_total_size = string.Format(str_match_file_size, Math.Round(r.code, 4)); SetMyTextBoxValue(lb_Total_Size, str_total_size); lb_Total_Size.Tag = r.code; } else if (r.type == 4) { string str_msg = ""; string[] arr_msg = Regex.Split(r.msg, ",.,", RegexOptions.IgnoreCase); if (r.flag) { str_msg = "拷贝完成:"; if (arr_msg.Length > 2) { for (int i = 0; i < dgv_Task.RowCount; i++) { Task_Info ti = dgv_Task.Rows[i].Tag as Task_Info; if (ti.id == arr_msg[0]) { ti.count_copy_files += Convert.ToInt16(arr_msg[2]); //判断是否拷贝完成 if (r.code == 0) //0单文件拷贝 { if (ti.arr_source.Length == ti.count_copy_files) { dgv_Task.Rows[i].Cells[0].Value = 1; } } else if (r.code == 1) //1目录拷贝 { //拷贝目录待判定是否拷贝完成 } MyVideoBussiness.Update_Task_Info(ti.id, ti.count_copy_files); break; } } } //待完成目录拷贝的判定 } else { str_msg = "拷贝失败:"; } str_msg += r.msg; SetrichTextBox(str_msg); } } }