internal void Init(string account, string password) { userInfo = new UserInfo(account, password); logger.Info($"{EnumString.GetStringValue(userInfo.userType)} {userInfo.userName} 登录"); if (taskGroupManager.Init(typeof(MainForm))) { logger.Debug($"初始化任务管理器完成,当前任务类型 {taskGroupManager.TaskGroupTypeCount()} 种"); } }
private bool initListView(Control listView) { ((FastObjectListView)listView).ClearObjects(); ((FastObjectListView)listView).Columns.Clear(); OLVColumn col1 = new OLVColumn(); col1.Text = "关键词"; col1.UseInitialLetterForGroup = true; col1.Width = 140; col1.AspectGetter = delegate(object x) { return(((TaskGroup_GetSimilarKeywords_OneData)x).Word); }; ((FastObjectListView)listView).Columns.Add(col1); OLVColumn col2 = new OLVColumn(); col2.Text = "基础词"; col2.UseInitialLetterForGroup = true; col2.Width = 140; col2.AspectGetter = delegate(object x) { return(((TaskGroup_GetSimilarKeywords_OneData)x).BaseKeyword); }; ((FastObjectListView)listView).Columns.Add(col2); OLVColumn col3 = new OLVColumn(); col3.Text = "状态"; col3.UseInitialLetterForGroup = false; col3.Width = 80; col3.AspectGetter = delegate(object x) { if (((TaskGroup_GetSimilarKeywords_OneData)x).Successed) { return("成功"); } else { return("失败"); } }; ((FastObjectListView)listView).Columns.Add(col3); OLVColumn col4 = new OLVColumn(); col4.Width = 68; col4.Text = "来源"; col4.TextAlign = HorizontalAlignment.Center; col4.AspectGetter = delegate(object x) { return(EnumString.GetStringValue(((TaskGroup_GetSimilarKeywords_OneData)x).eSource)); }; ((FastObjectListView)listView).Columns.Add(col4); OLVColumn col5 = new OLVColumn(); col5.Text = "百度PC指数"; col5.Width = 100; col5.TextAlign = HorizontalAlignment.Center; col5.Renderer = new MultiImageRenderer(Properties.Resources.star16, 5, 0, 10); col5.AspectGetter = delegate(object x) { return(((TaskGroup_GetSimilarKeywords_OneData)x).BaiduPCIndex.ToString()); }; ((FastObjectListView)listView).Columns.Add(col5); return(true); }
private void InitAppTitle() { Text = $"ザクⅡ Ver:{Assembly.GetExecutingAssembly().GetName().Version.ToString()} [ {EnumString.GetStringValue(GlobalVar.Instance.userInfo.userType)} {GlobalVar.Instance.userInfo.userName} ]"; }
public override string ExportData(object data, ResourceType type) { string strSuccessedFile = string.Empty; string strFailedFile = string.Empty; string strWorkdir = Directory.GetCurrentDirectory(); ArrayList listViewData = (ArrayList)data; switch (type) { case ResourceType.eResourceType_Txt: strSuccessedFile = strWorkdir + "\\Data\\" + this.Name + "_" + DateTime.Now.ToString("yyyyMMddHHmmssffff") + "_成功.txt"; strFailedFile = strWorkdir + "\\Data\\" + this.Name + "_" + DateTime.Now.ToString("yyyyMMddHHmmssffff") + "_失败.txt"; FileStream fs = new FileStream(strSuccessedFile, FileMode.Create); StreamWriter sw = new StreamWriter(fs); FileStream fsf = new FileStream(strFailedFile, FileMode.Create); StreamWriter swf = new StreamWriter(fsf); { foreach (var oneData in listViewData) { if (((TaskGroup_GetSimilarKeywords_OneData)oneData).Successed) { sw.WriteLine(((TaskGroup_GetSimilarKeywords_OneData)oneData).ToSuccessTxt()); } else { swf.WriteLine(((TaskGroup_GetSimilarKeywords_OneData)oneData).ToFailedTxt()); } } } sw.Flush(); sw.Close(); swf.Flush(); swf.Close(); fs.Close(); fsf.Close(); break; case ResourceType.eResourceType_Csv: strSuccessedFile = strWorkdir + "\\Data\\" + this.Name + "_" + DateTime.Now.ToString("yyyyMMddHHmmssffff") + ".csv"; var csvHelper = new CsvHelper(",", false); foreach (var oneData in listViewData) { csvHelper.AddRow(); csvHelper["关键词"] = ((TaskGroup_GetSimilarKeywords_OneData)oneData).Word; csvHelper["基础词"] = ((TaskGroup_GetSimilarKeywords_OneData)oneData).BaseKeyword; csvHelper["状态"] = ((TaskGroup_GetSimilarKeywords_OneData)oneData).Successed; csvHelper["来源"] = EnumString.GetStringValue(((TaskGroup_GetSimilarKeywords_OneData)oneData).eSource); csvHelper["百度PC指数"] = ((TaskGroup_GetSimilarKeywords_OneData)oneData).BaiduPCIndex; } File.WriteAllBytes(strSuccessedFile, csvHelper.ExportToBytes(true)); break; case ResourceType.eResourceType_MySQL: strSuccessedFile = string.Empty; // TODO: break; } this.taskGroupStatus = TaskGroupStatus.eTaskGroupStatus_Idle; if (strSuccessedFile != string.Empty) { return(Path.GetFileName(strSuccessedFile)); } return(string.Empty); }