private void btnOk_Click(object sender, EventArgs e) { try { if (txtTaskName.Text == string.Empty) { txtTaskName.Select(); MessageBox.Show("任务名称不能为空!", Constants.MESSAGEBOX_CAPTION, MessageBoxButtons.OK, MessageBoxIcon.Error); return; } this.Cursor = Cursors.WaitCursor; _task.TaskName = txtTaskName.Text; string ret = ConfigCtrl.EditTask(_task); if (ret != Constants.STATUS_SUCCESS) { MessageBox.Show(ret, Constants.MESSAGEBOX_CAPTION, MessageBoxButtons.OK, MessageBoxIcon.Error); } this.DialogResult = DialogResult.OK; this.Close(); } catch (Exception ex) { ErrorHandler.ShowMessageBox(TaskConstants.EXCEPTION_MODULE, ex); } finally { this.Cursor = Cursors.Default; } }
void _toolbuildteam_AllCarsInMarketFetched(Collection <NewCarInfo> carsinmarket) { if (this.InvokeRequired) { this.Invoke(new GamePark.AllCarsInMarketFetchedEventHandler(_toolbuildteam_AllCarsInMarketFetched), new object[] { carsinmarket }); } else { if (carsinmarket != null && carsinmarket.Count > 0) { lstViewCarsInMarket.Items.Clear(); int num = 1; foreach (NewCarInfo car in carsinmarket) { string[] subItem = new string[4]; subItem[0] = num.ToString(); subItem[1] = car.CarName; subItem[2] = car.CarPrice.ToString(); subItem[3] = car.CarId.ToString(); lstViewCarsInMarket.Items.Add(new ListViewItem(subItem)); num++; } if (!ConfigCtrl.SetCarsInMarket(carsinmarket)) { MessageBox.Show("保存失败!", MainConstants.MESSAGEBOX_CAPTION, MessageBoxButtons.OK, MessageBoxIcon.Error); } } SetControlStatus(true); } }
private void btnImport_Click(object sender, EventArgs e) { try { OpenFileDialog dialog = new OpenFileDialog(); dialog.InitialDirectory = Application.ExecutablePath; dialog.Filter = "XML files (*.xml)|*.xml|All files (*.*)|*.*"; dialog.FilterIndex = 1; dialog.Multiselect = false; if (dialog.ShowDialog() == DialogResult.OK) { Collection <FriendInfo> friends = ConfigCtrl.GetContactsFromFile(dialog.FileName); if (friends == null || friends.Count == 0) { MessageBox.Show("读取联系人信息失败!", Constants.MSG_ERROR, MessageBoxButtons.OK, MessageBoxIcon.Error); return; } listBoxSelectorFriends.Clear(); listBoxSelectorFriends.AllItems = friends; } } catch (Exception ex) { Program.ShowMessageBox("FrmMaintainContact", ex); } }
private void FrmMaintainContact_Load(object sender, EventArgs e) { try { //build group combox string[] groups = ConfigCtrl.GetGroups(); if (groups != null) { foreach (string group in groups) { cmbGroup.Items.Add(group); cmbGroupAdd.Items.Add(group); } } if (cmbGroup.Items.Count > 0) { cmbGroup.SelectedIndex = 0; } if (cmbGroupAdd.Items.Count > 0) { cmbGroupAdd.SelectedIndex = 0; } cmbGroup_SelectedIndexChanged(null, null); txtRequestContent.Text = "Hi, 我是XXX,这是我的小号。"; } catch (Exception ex) { Program.ShowMessageBox("FrmMaintainContact", ex); } }
private void DlgAddAccount_Load(object sender, EventArgs e) { try { SetControls(false); if (_oldemail != null && _oldemail != string.Empty) { this.Icon = IconCtrl.GetIconFromResx(TreeConstants.ICON_KEYS); txtEmail.Text = _account.Email; txtPassword.Text = _account.Password; txtUserName.Text = _account.UserName; txtUserId.Text = _account.UserId; txtGender.Text = _account.Gender ? "ÄÐ" : "Å®"; this.Text = "±à¼Õ˺Å"; } else { _account = new AccountInfo(); this.Text = "Ìí¼ÓÕ˺Å"; } _hh = new HttpHelper(); ProxyInfo proxy = ConfigCtrl.GetProxy(); if (proxy != null && proxy.Enable == true) { _hh.SetProxy(proxy.Server, proxy.Port, proxy.UserName, proxy.Password); } } catch (Exception ex) { ErrorHandler.ShowMessageBox(TreeConstants.EXCEPTION_MODULE, ex); } }
private void DummyToolbox_Load(object sender, EventArgs e) { try { myToolbox.Categories.Clear(); XmlDocument objXmlDoc = ConfigCtrl.GetToolboxItemsConfigFile(); if (objXmlDoc == null) { return; } XmlNodeList categoryNodes = objXmlDoc.SelectNodes("ToolBox/Category"); for (int ix = 0; ix < categoryNodes.Count; ix++) { ToolboxCategory category = new ToolboxCategory(); category.Name = categoryNodes[ix].Attributes["Name"].Value; category.ImageIndex = DataConvert.GetInt32(categoryNodes[ix].Attributes["ImageIndex"].Value); category.IsOpen = true; myToolbox.Categories.Add(category); XmlNodeList toolitemNodes = categoryNodes[ix].SelectNodes("ToolItem"); for (int iy = 0; iy < toolitemNodes.Count; iy++) { ToolboxItem toolitem = new ToolboxItem(); toolitem.Name = toolitemNodes[iy].Attributes["Name"].Value; toolitem.ImageIndex = DataConvert.GetInt32(toolitemNodes[iy].Attributes["ImageIndex"].Value); toolitem.ClassName = toolitemNodes[iy].Attributes["ClassName"].Value; category.Items.Add(toolitem); } } } catch (Exception ex) { Program.ShowMessageBox("FrmToolbox", ex); } }
private void RefreshVsVersionNode(VsVersionNode vvn) { if (vvn != null) { vvn.Nodes.Clear(); //Solutions Collection <SolutionInfo> solutions = ConfigCtrl.GetSolutions(vvn.VsVersion.FullPath); foreach (SolutionInfo solution in solutions) { SolutionNode sn = new SolutionNode(solution.SolutionName); sn.Solution = solution; vvn.Nodes.Add(sn); } //Projects Collection <ProjectInfo> projects = ConfigCtrl.GetProjects(vvn.VsVersion.FullPath); foreach (ProjectInfo project in projects) { ProjectNode pn = new ProjectNode(project.ProjectName); pn.Project = project; vvn.Nodes.Add(pn); } } }
private void FrmBuildTeam_Load(object sender, EventArgs e) { try { cmbMaxCarCount.SelectedIndex = cmbMaxCarCount.Items.Count - 2; //市场上的汽车 _carsInMarket = ConfigCtrl.GetCarsInMarket(); if (_carsInMarket == null) { return; } lstViewCarsInMarket.Items.Clear(); int num = 1; foreach (NewCarInfo car in _carsInMarket) { string[] subItem = new string[4]; subItem[0] = num.ToString(); subItem[1] = car.CarName; subItem[2] = car.CarPrice.ToString(); subItem[3] = car.CarId.ToString(); lstViewCarsInMarket.Items.Add(new ListViewItem(subItem)); num++; } BuildCmbGroup(); BuildCmbAccount(cmbGroup.Text); } catch (Exception ex) { Program.ShowMessageBox("FrmBuildTeam", ex); } }
public WhiteBlackCore(string groupname, AccountInfo account) { base.Caption = account.UserName; base.Key = account.Email; base.CurrentAccount = account; base.Proxy = ConfigCtrl.GetProxy(); base.Delay = ConfigCtrl.GetDelay(); base.Initial(); Operation = ConfigCtrl.GetOperation(groupname, account); Task = ConfigCtrl.GetTask("", "", true); _gPark = new GamePark(); _gBite = new GameBite(); _gSlave = new GameSlave(); _gHouse = new GameHouse(); _gGarden = new GameGarden(); _gRanch = new GameRanch(); _gFish = new GameFish(); _gCafe = new GameCafe(); //不要clone validatecode 事件 _gPark.Clone(this, true); _gBite.Clone(this, true); _gSlave.Clone(this, true); _gHouse.Clone(this, true); _gGarden.Clone(this, true); _gRanch.Clone(this, true); _gFish.Clone(this, true); _gCafe.Clone(this, true); }
public void InitialNodes() { base.Nodes.Clear(); //build Root node BaseNode Root = new BaseNode("Templates"); base.Nodes.Add(Root); //build Template node Collection <TemplateInfo> templates = ConfigCtrl.GetTemplates(); if (templates != null) { foreach (TemplateInfo item in templates) { TemplateNode tn = new TemplateNode(item.Name); tn.Template = new TemplateInfo(item.FullPath, item.Name); Root.Nodes.Add(tn); RefreshTemplateNode(tn); } } if (Root.Nodes.Count > 0) { Root.Expand(); } }
public void InitialNodes() { //set nodes base.Nodes.Clear(); //build Root node BaseNode Root = new BaseNode("Servers"); base.Nodes.Add(Root); //build Servers node Collection <ServerInfo> servers = ConfigCtrl.GetServers(); if (servers != null) { foreach (ServerInfo server in servers) { ServerNode sn = new ServerNode(server); Root.Nodes.Add(sn); } } if (Root.Nodes.Count > 0) { Root.Expand(); } }
public void RefreshTaskNode(string taskid, string taskname) { foreach (TaskNode tasknode in base.Nodes[0].Nodes) { if (tasknode.Task.TaskId == taskid && tasknode.Task.TaskName == taskname) { TaskEventArgs te = new TaskEventArgs(); te.Operations = new Collection <OperationInfo>(); TaskInfo task = ConfigCtrl.GetTask(tasknode.Task.TaskId, tasknode.Task.TaskName, false); if (task == null) { MessageBox.Show("读取任务配置文件失败!", Constants.MESSAGEBOX_CAPTION, MessageBoxButtons.OK, MessageBoxIcon.Error); return; } tasknode.Task = task; te.Task = task; tasknode.Nodes.Clear(); foreach (AccountInfo account in task.Accounts) { OperationInfo op = ConfigCtrl.GetOperation(task.GroupName, account); OperationNode on = new OperationNode(op); tasknode.Nodes.Add(on); te.Operations.Add(op); } OnTaskNodeSelected(te); break; } } }
private void btnOK_Click(object sender, EventArgs e) { try { if (!CheckData()) { return; } SmtpInfo smtp = new SmtpInfo(); smtp.SmtpHost = txtSmtpHost.Text; smtp.SmtpPort = DataConvert.GetInt32(txtSmtpPort.Text); smtp.SenderName = txtSenderName.Text; smtp.SenderEmail = txtSenderEmail.Text; smtp.UserName = txtUserName.Text; smtp.Password = txtPassword.Text; if (!ConfigCtrl.SetSmtp(smtp)) { MessageBox.Show("保存失败!", MainConstants.MESSAGEBOX_CAPTION, MessageBoxButtons.OK, MessageBoxIcon.Error); return; } this.DialogResult = DialogResult.OK; this.Close(); } catch (Exception ex) { Program.ShowMessageBox("DlgSmtpSetting", ex); } }
private void OnDeleteClick(object sender, EventArgs e) { try { if (MessageBox.Show("确认要删除么?", Constants.MESSAGEBOX_CAPTION, MessageBoxButtons.OKCancel, MessageBoxIcon.Asterisk, MessageBoxDefaultButton.Button2) == DialogResult.OK) { TaskNode tn = this.SelectedNode as TaskNode; TaskInfo task = null; if (tn != null) { task = tn.Task; } if (task != null) { string ret = ConfigCtrl.DeleteTask(task); if (ret != Constants.STATUS_SUCCESS) { MessageBox.Show(ret, Constants.MESSAGEBOX_CAPTION, MessageBoxButtons.OK, MessageBoxIcon.Error); return; } BaseNode bn = (BaseNode)tn.Parent; bn.Nodes.Remove(tn); } } } catch (Exception ex) { ErrorHandler.ShowMessageBox(TaskConstants.EXCEPTION_MODULE, ex); } }
private void btnGenerate_Click(object sender, EventArgs e) { try { //create entity CodeGeneratorSettingsInfo folder = ConfigCtrl.GetCodeGeneratorSettings(); Collection <TableInfo> tables = Johnny.CodeGenerator.Core.DatabaseCtrl.GetTables(_connectionstring, _server, _database); foreach (TableInfo tb in tables) { if (tb.TableName == _table) { string entityFolder = Path.Combine(folder.WorkingFolder, "Temp"); entityFolder = Path.Combine(entityFolder, folder.Entity); Generator.GenerateEntityXmlFromTable(tb, entityFolder, txtNameSpacePrefix.Text, txtNameSpaceSuffix.Text); break; } } richtxtCode.Text = Johnny.CodeGenerator.Core.Generator.GenerateSingle(_connectionstring, _database, _server, GetModelName(_table), cmbTemplateGroup.Items[cmbTemplateGroup.SelectedIndex].ToString(), cmbTemplate.Items[cmbTemplate.SelectedIndex].ToString()); tabSingleGenerator.SelectedIndex = 1; } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void OnDeleteClick(object sender, EventArgs e) { try { if (MessageBox.Show("确认要删除么?", Constants.MESSAGEBOX_CAPTION, MessageBoxButtons.OKCancel, MessageBoxIcon.Asterisk, MessageBoxDefaultButton.Button2) == DialogResult.OK) { AccountNode un = this.SelectedNode as AccountNode; AccountInfo account = null; if (un != null) { account = un.Account; } if (account != null) { GroupNode gn = (GroupNode)un.Parent; string ret = ConfigCtrl.DeleteAccount(gn.GroupName, account); if (ret != Constants.STATUS_SUCCESS) { MessageBox.Show(ret, Constants.MESSAGEBOX_CAPTION, MessageBoxButtons.OK, MessageBoxIcon.Error); return; } gn.Nodes.Remove(un); gn.Text = gn.GroupName + "(" + gn.Nodes.Count + ")"; } } } catch (Exception ex) { ErrorHandler.ShowMessageBox(TreeConstants.EXCEPTION_MODULE, ex); } }
public void GetAllMyFriends() { base.Proxy = ConfigCtrl.GetProxy(); base.Delay = ConfigCtrl.GetDelay(); base.Initial(); base.GetAllMyFriendsByThread(); }
public void InitialNodes() { base.Nodes.Clear(); //build Root node BaseNode Root = new BaseNode("VS Templates"); base.Nodes.Add(Root); //build Servers node Collection <VsTemplateInfo> versions = ConfigCtrl.GetVsTemplates(); if (versions != null) { foreach (VsTemplateInfo item in versions) { VsVersionNode vvn = new VsVersionNode(item.Name); vvn.VsVersion = new VsTemplateInfo(item.FullPath, item.Name); Root.Nodes.Add(vvn); RefreshVsVersionNode(vvn); } } if (Root.Nodes.Count > 0) { Root.Expand(); } }
private void OnDeleteGroupClick(object sender, EventArgs e) { try { if (MessageBox.Show("确认要删除么?此组下的所有账号都会被删除。", Constants.MESSAGEBOX_CAPTION, MessageBoxButtons.OKCancel, MessageBoxIcon.Asterisk, MessageBoxDefaultButton.Button2) == DialogResult.OK) { GroupNode gn = this.SelectedNode as GroupNode; if (gn != null) { string ret = ConfigCtrl.DeleteGroup(gn.GroupName); if (ret != Constants.STATUS_SUCCESS) { MessageBox.Show(ret, Constants.MESSAGEBOX_CAPTION, MessageBoxButtons.OK, MessageBoxIcon.Error); return; } BaseNode bn = (BaseNode)gn.Parent; bn.Nodes.Remove(gn); } } } catch (Exception ex) { ErrorHandler.ShowMessageBox(TreeConstants.EXCEPTION_MODULE, ex); } }
private void btnOk_Click(object sender, EventArgs e) { try { if (txtSolutionName.Text == string.Empty) { txtSolutionName.Select(); MessageBox.Show("Please input the solution name!", CGConstants.MSG_ERROR, MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (ConfigCtrl.IsSolutionExist(_vsversion, txtSolutionName.Text)) { txtSolutionName.Select(); MessageBox.Show("The template has already existed!", CGConstants.MSG_ERROR, MessageBoxButtons.OK, MessageBoxIcon.Error); return; } ConfigCtrl.AddSolution(_vsversion, txtSolutionName.Text); _newsolutionname = txtSolutionName.Text; this.DialogResult = DialogResult.OK; this.Close(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void FrmUpdateData_Load(object sender, EventArgs e) { try { BuildCmbGroup(); BuildCmbAccount(cmbGroup.Text); BuildLstCars(ConfigCtrl.GetCarsInMarket()); BuildLstMatches(ConfigCtrl.GetMatches()); BuildLstFruits(ConfigCtrl.GetFruits()); BuildLstCalves(ConfigCtrl.GetCalvesInShop()); BuildLstAnimalProducts(ConfigCtrl.GetAnimalProducts()); BuildLstFishFrys(ConfigCtrl.GetFishFrysInShop()); BuildLstFishTackles(ConfigCtrl.GetFishTacklesInShop()); BuildLstFishMatured(ConfigCtrl.GetFishMaturedInMarket()); BuildLstAssets(ConfigCtrl.GetAssetsInShop()); BuildLstDishes(ConfigCtrl.GetDishesInMenu()); BuildGridViewSeeds(AddColumnsToTable(ConfigCtrl.GetSeedsToTable()), "种子列表读取失败!"); BuildRankGridViewSeeds(AddRankColumnsToTable(ConfigCtrl.GetRankSeedsToTable()), "等级种子列表读取失败!"); BuildDgvAssetRecommends(AddColumnsToAssetRecommends(ConfigCtrl.GetAssetsToTable()), "推荐买卖率表读取失败!"); BuildDgvAdvancedPurchase(AddColumnsToAdvancedPurchase(ConfigCtrl.GetAdvancedPurchaseToTable()), "高级购买配置表读取失败!"); BuildDgvTransactionDishes(AddColumnsToTransactionDishes(ConfigCtrl.GetTransactionDishesToTable()), "菜肴交易价格表读取失败!"); _shopseeds = ConfigCtrl.GetSeedsInShop(); } catch (Exception ex) { Program.ShowMessageBox("FrmUpdateData", ex); } }
private void DlgLogin_Load(object sender, EventArgs e) { try { string resname = "Johnny.Kaixin.WinUI.Resources.EncryptFriends.config"; using (StreamReader streamReader = new StreamReader(Assembly.GetExecutingAssembly().GetManifestResourceStream(resname))) { string configContent = streamReader.ReadToEnd(); _friends = ConfigCtrl.GetEncryptFriendFromFile(configContent); } if (_friends == null || _friends.Count == 0) { MessageBox.Show("无法取得好友列表!", Constants.MESSAGEBOX_CAPTION, MessageBoxButtons.OK, MessageBoxIcon.Error); this.DialogResult = DialogResult.Cancel; this.Close(); } chkRemember.Checked = Properties.Settings.Default.NeedRemember; if (chkRemember.Checked) { txtUserName.Text = Properties.Settings.Default.LoginUserName; txtUserId.Text = Properties.Settings.Default.LoginUserID; } } catch (Exception ex) { Program.ShowMessageBox("DlgLogin", ex); } }
private void SendRemindMail() { try { //load smtp config info SmtpInfo smtpInfo = ConfigCtrl.GetSmtp(); if (smtpInfo == null) { SetMessageLn("Smtp配置信息读取失败,无法发送日志!"); return; } MailHelper.SendMail(smtpInfo.SmtpHost, smtpInfo.SmtpPort, smtpInfo.SenderEmail, smtpInfo.Password, Task.ReceiverEmail, "开心助手运行日志:" + DateTime.Now.ToString(), this.ExecutionLog.ToString()); SetMessageLn("运行日志已发送到" + Task.ReceiverEmail + "!"); } catch (ThreadAbortException) { throw; } catch (ThreadInterruptedException) { throw; } catch (Exception ex) { LogHelper.Write("TaskManager.SendRemindMail", ex, LogSeverity.Error); SetMessageLn("发送日志失败!错误:" + ex.Message); } }
public ToolMaintainContact() { base.Caption = Constants.TOOL_MAINTAINCONTACT; base.Key = Constants.TOOL_MAINTAINCONTACT; base.Proxy = ConfigCtrl.GetProxy(); base.Delay = ConfigCtrl.GetDelay(); base.Initial(); }
public ToolUpdateData() { base.Caption = Constants.TOOL_UPDATEDATA; base.Key = Constants.TOOL_UPDATEDATA; base.Proxy = ConfigCtrl.GetProxy(); base.Delay = ConfigCtrl.GetDelay(); base.Initial(); }
public ToolUpgradeGarage() { base.Caption = Constants.TOOL_UPGRADEGARAGE; base.Key = Constants.TOOL_UPGRADEGARAGE; base.Proxy = ConfigCtrl.GetProxy(); base.Delay = ConfigCtrl.GetDelay(); base.Initial(); }
public ToolBuyCards() { base.Caption = Constants.TOOL_BUYCARDS; base.Key = Constants.TOOL_BUYCARDS; base.Proxy = ConfigCtrl.GetProxy(); base.Delay = ConfigCtrl.GetDelay(); base.Initial(); }
private void cmbGroup_SelectedIndexChanged(object sender, EventArgs e) { if (cmbGroup.Items.Count > 0 && cmbGroup.Text != string.Empty) { _accounts = ConfigCtrl.GetAccounts(cmbGroup.Text); listBoxSelectorAccounts.Clear(); listBoxSelectorAccounts.AllItems = _accounts; } }
public ToolBuildTeam(AccountInfo account) { base.Caption = Constants.TOOL_BUILDTEAM; base.Key = Constants.TOOL_BUILDTEAM; base.CurrentAccount = account; base.Proxy = ConfigCtrl.GetProxy(); base.Delay = ConfigCtrl.GetDelay(); base.Initial(); }
public void InitialNodes() { //set images imageListIcon.ColorDepth = ColorDepth.Depth32Bit;//不然图片会失真,周围会有黑线 imageListIcon.Images.Add(IconCtrl.GetIconFromResx(TaskConstants.ICON_TASKS)); imageListIcon.Images.Add(IconCtrl.GetIconFromResx(TaskConstants.ICON_TASK)); imageListIcon.Images.Add(IconCtrl.GetIconFromResx(TaskConstants.ICON_ADDTASK)); imageListIcon.Images.Add(IconCtrl.GetIconFromResx(TaskConstants.ICON_START)); imageListIcon.Images.Add(IconCtrl.GetIconFromResx(TaskConstants.ICON_PAUSE)); imageListIcon.Images.Add(IconCtrl.GetIconFromResx(TaskConstants.ICON_STOP)); imageListIcon.Images.Add(IconCtrl.GetIconFromResx(TaskConstants.ICON_DELETE)); imageListIcon.Images.Add(IconCtrl.GetIconFromResx(TaskConstants.ICON_OPERATION)); imageListIcon.Images.Add(IconCtrl.GetIconFromResx(TaskConstants.ICON_TASKSTART)); imageListIcon.Images.Add(ImageCtrl.GetIconFromResx(TaskConstants.IMAGE_REFRESH)); imageListIcon.Images.Add(IconCtrl.GetIconFromResx(TaskConstants.ICON_USER)); imageListIcon.Images.Add(IconCtrl.GetIconFromResx(TaskConstants.ICON_XML)); this.ImageList = imageListIcon; //set nodes base.Nodes.Clear(); //build Root node BaseNode Root = new BaseNode("所有任务"); base.Nodes.Add(Root); //build Task node Collection <TaskInfo> tasks = ConfigCtrl.GetTasks(); foreach (TaskInfo task in tasks) { if (task != null) { TaskNode tn = new TaskNode(task); Root.Nodes.Add(tn); foreach (AccountInfo account in task.Accounts) { OperationInfo operation = ConfigCtrl.GetOperation(task.GroupName, account); OperationNode on = new OperationNode(operation); tn.Nodes.Add(on); } //如果正在执行,保持箭头图标 if (_executingTaskIdList.Contains(task.TaskId)) { tn.ImageIndex = DataConvert.GetInt32(IconType.TaskStart); tn.SelectedImageIndex = DataConvert.GetInt32(IconType.TaskStart); } } } if (Root.Nodes.Count > 0) { Root.Expand(); } }