public ActionResult Create(CreateWorkDone model) { try { // Get the client and work type based on values submitted from // the form Client client = new ClientRepository(context).GetById(model.ClientId); WorkType workType = new WorkTypeRepository(context).GetById(model.WorkTypeId); // Create an instance of the work done with the client and work // type WorkDone workDone = new WorkDone(client, workType); ///////// new WorkDoneRepository(context).Insert(workDone); return(RedirectToAction("Index")); } catch (Exception ex) { } // Create a view model CreateWorkDoneView viewModel = new CreateWorkDoneView(); // Copy over the values from the values submitted viewModel.ClientId = model.ClientId; viewModel.StartedOn = model.StartedOn; viewModel.WorkTypeId = model.WorkTypeId; // Go get the value for the drop-downs, again. viewModel.Clients = new ClientRepository(context).GetClients(); viewModel.WorkTypes = new WorkTypeRepository(context).GetWorkTypes(); return(View("Create", viewModel)); }
public void Update(WorkDone workDone) { using (SqlConnection connection = new SqlConnection(_connectionString)) { connection.Open(); string sql = @" UPDATE WorkDone SET ClientId = @ClientId, WorkTypeId = @WorkTypeId, StartedOn = @StartedOn, EndedOn = @EndedOn WHERE Id = @Id "; SqlCommand command = new SqlCommand(sql, connection); command.Parameters.AddWithValue("@ClientId", workDone.ClientId); command.Parameters.AddWithValue("@WorkTypeId", workDone.WorkTypeId); command.Parameters.AddWithValue("@StartedOn", workDone.StartedOn); if (workDone.EndedOn == null) { command.Parameters.AddWithValue("@EndedOn", DBNull.Value); } else { command.Parameters.AddWithValue("@EndedOn", workDone.EndedOn); } command.Parameters.AddWithValue("@Id", workDone.Id); command.ExecuteNonQuery(); } }
public ActionResult Create(CreateWorkDone model) { try { Client client = new ClientRepo(context).GetById(model.ClientId); WorkType workType = new WorkTypeRepo(context).GetById(model.WorkTypeId); // Create an instance of the work done with the client and work // type WorkDone workDone = new WorkDone(0, client, workType); var wRepo = new WorkDoneRepo(context); wRepo.Insert(workDone); return(RedirectToAction("Index")); } catch (DbUpdateException ex) { HandleDbUpdateException(ex); } // Create a view model CreateWorkDone viewModel = new CreateWorkDone(); viewModel.PopulateSelectLists(context); viewModel.ClientId = model.ClientId; viewModel.WorkTypeId = model.WorkTypeId; return(View("Create", viewModel)); }
protected override void Run() { discoveredFeed = new NewsFeed(); try { //feedInfo = feedHandler.GetFeedDetails(this.feedUrl, this.credentials); using (Stream mem = SyncWebRequest.GetResponseStream(this.feedUrl, this.credentials, RssBanditApplication.UserAgent, this.Proxy)) { NewsFeed f = new NewsFeed(); f.link = feedUrl; if (RssParser.CanProcessUrl(feedUrl)) { feedInfo = RssParser.GetItemsForFeed(f, mem, false); if (feedInfo.ItemsList != null && feedInfo.ItemsList.Count > 0) f.containsNewMessages = true; } } } catch (ThreadAbortException) { // eat up } catch (Exception e) { // fatal errors p_operationException = e; } finally { WorkDone.Set(); } }
public ActionResult Edit(int id, EditWorkDone formModel) { var client = new Client(formModel.ClientId); var workType = new WorkType(formModel.WorkTypeId); var workDone = new WorkDone() { Id = id, ClientId = formModel.ClientId, WorkTypeId = formModel.WorkTypeId, StartedOn = formModel.StartedOn, EndedOn = formModel.EndedOn }; try { var repo = new WorkDoneRepository(_context); repo.Update(workDone); return(RedirectToAction("Index")); } catch { ModelState.AddModelError("Edit", "Unable to update work done"); return(View(formModel)); } }
public ActionResult Edit(int?id) { // Kick them out if they don't offer an ID. if (id == null) { return(RedirectToAction("Index")); } WorkDoneRepository workDoneRepo = new WorkDoneRepository(); WorkDone workDone = workDoneRepo.GetById(id.Value); // Kick them out if the try a non-existant ID. if (workDone == null) { return(RedirectToAction("Index")); } // Populate DropDownLists ClientRepository clientRepo = new ClientRepository(); List <Client> clients = clientRepo.GetClients(); WorkTypeRepository workTypeRepo = new WorkTypeRepository(); List <WorkType> workTypes = workTypeRepo.GetWorkTypes(); // Bind the View Model EditWorkDone model = new EditWorkDone(clients, workTypes); model.Id = id.Value; model.ClientId = workDone.ClientId; model.WorkTypeId = workDone.WorkTypeId; model.StartedOn = workDone.StartedOn; model.EndedOn = workDone.EndedOn; return(View("Edit", model)); }
void OnClick(GameObject sender) { Tools.PlayAudio(Constants.Audio.Audio_LobbyClickButton); if (sender.name == "Cancel" || sender.name == "Close") { string btnName = "DialogBase"; GameObject btnObj = GameObject.Find(btnName); if (null == btnObj) { DebugConsole.Log("null"); } else { DoHide(btnObj); } } else if (sender.name == "OK") { DebugConsole.Log("OK"); if (m_callBack != null) { m_callBack(); m_callBack = null; } string btnName = "DialogBase"; GameObject btnObj = GameObject.Find(btnName); DoHide(btnObj); } }
public static void Show(WorkDone cb) { GameObject canvas = GameObject.Find("Canvas"); GameObject obj = canvas.transform.Find(DialogName).gameObject; DialogBag dlg = obj.GetComponent <DialogBag>(); dlg.DoShow(obj, cb); }
public static void Show(string title, string content, WorkDone cb = null) { GameObject canvas = GameObject.Find("Canvas"); GameObject obj = canvas.transform.Find("DialogBase").gameObject; DialogBase dlg = obj.GetComponent <DialogBase>(); dlg.DoShow(obj, title, content, cb); }
public void GetFriendRequests(WorkDone callBack = null) { Empty empty = new Empty(); m_net.SendEnqueue(Constants.Lion_GetFriendRequests, 0, empty, callBack); }
public void HearBeat(WorkDone callBack = null) { Empty empty = new Empty(); m_net.SendEnqueue(-2, 0, empty, callBack); }
public void TakeFreeBonus(WorkDone callBack = null) { Empty empty = new Empty(); m_net.SendEnqueue(Constants.Lion_TakeFreeBonus, 0, empty, callBack); }
public UnityBackgroundWorker(MonoBehaviour caller, DoWork DoWorkMethod, ProgressReport ProgressReportMethod, WorkDone WorkDoneMethod, object CustomData) { Caller = caller; Data = CustomData; Information = new UnityBackgroundWorkerInformation(); WorkMethod = DoWorkMethod; ProgressMethod = ProgressReportMethod; DoneMethod = WorkDoneMethod; }
public void RunExample() { WorkDone workDoneHandler = new WorkDone(WorkDone1); workDoneHandler += WorkDone2; workDoneHandler(8, WorkType.Code); Document(WorkDone1); Document(WorkDone2); }
public ActionResult Add(ToDoListView toDoListView, FormCollection form) { if (ModelState.IsValid) { IToDoListsRepository toDoListsRepository = new ToDoListsRepository(db); ToDoList toDoList = new ToDoList(); toDoListView.ConvertTo(toDoListView, toDoList); toDoList.UserFK = SecurityHelper.GetUserPKFromCookie(); toDoList.CreationDate = DateTime.Now; toDoListsRepository.Add(toDoList); toDoListsRepository.SaveChanges(); string[] legalEntitiesSelectedValues = new string[500]; if (form["LegalEntityPK"] != null) { legalEntitiesSelectedValues = ((string)form["LegalEntityPK"]).Split(','); } else { legalEntitiesSelectedValues = null; } IWorkDonesRepository workDonesRepository = new WorkDonesRepository(db); if (legalEntitiesSelectedValues != null) { // Add work dones foreach (string legalEntity in legalEntitiesSelectedValues) { WorkDone workDone = new WorkDone(); workDone.ToDoListFK = toDoList.ToDoListPK; workDone.LegalEntityFK = Convert.ToInt32(legalEntity); workDone.CreatedWithToDo = true; workDonesRepository.Add(workDone); } workDonesRepository.SaveChanges(); } TempData["message"] = LayoutHelper.GetMessage("INSERT", toDoList.ToDoListPK); return(RedirectToAction("Index", "ToDoList")); } else { ILegalEntitiesRepository legalEntitiesRepository = new LegalEntitiesRepository(db); toDoListView.Companies = new MultiSelectList(legalEntitiesRepository.GetValidLegalEntities().OrderBy("name ASC"), "LegalEntityPK", "Name"); return(View(toDoListView)); } }
public static void Show(WorkDone cbGuest, WorkDone cbFS, WorkDone cbWechat) { GameObject canvas = GameObject.Find("Canvas"); GameObject obj = canvas.transform.Find(DialogName).gameObject; DialogLoginByEmail dlg = obj.GetComponent <DialogLoginByEmail>(); dlg.DoShow(obj, cbGuest, cbFS, cbWechat); }
public void GetTigerStatInfo(long uId, WorkDone cb) { LongValue lv = new LongValue(); lv.Value = uId; m_net.SendEnqueue(Constants.Lion_GetTigerStat, 0, lv, cb); }
public ActionResult Edit(int?workDonePK) { if (workDonePK != null) { IWorkDonesRepository workDonesRepository = new WorkDonesRepository(db); WorkDone workDone = workDonesRepository.GetWorkDoneByPK((int)workDonePK); WorkDoneView workDoneView = new WorkDoneView(); workDoneView.ConvertFrom(workDone, workDoneView); IWorkDoneAttachmentsRepository workDoneAttachmentsRepository = new WorkDoneAttachmentsRepository(db); IAttachmentsRepository attachmentsRepository = new AttachmentsRepository(db); IQueryable <WorkDoneAttachmentView> workDoneAttachments = WorkDoneAttachmentView.GetWorkDoneAttachmentView(workDoneAttachmentsRepository.GetValid(), attachmentsRepository.GetValid(), workDonesRepository.GetValid()) .Where(c => c.WorkDoneFK == workDonePK).OrderBy("WorkDoneAttachmentPK DESC"); ViewBag.Attachments = workDoneAttachments.ToList(); //to do list ddl IToDoListsRepository toDoListsRepository = new ToDoListsRepository(db); workDoneView.ToDoLists = new SelectList(toDoListsRepository.GetValid().ToList(), "ToDoListPK", "Name"); //legalEntities ddl ILegalEntitiesRepository legalEntitiesRepository = new LegalEntitiesRepository(db); workDoneView.LegalEntities = new SelectList(legalEntitiesRepository.GetValidLegalEntities().OrderBy("Name ASC").ToList(), "LegalEntityPK", "Name"); //service type ddl IServiceTypesRepository serviceTypesRepository = new ServiceTypesRepository(db); workDoneView.ServiceTypes = new SelectList(serviceTypesRepository.GetValid().OrderBy("Name ASC").ToList(), "ServiceTypePK", "Name"); //Work done ddl IWorkTypesRepository workTypesRepository = new WorkTypesRepository(db); workDoneView.WorkTypes = new SelectList(workTypesRepository.GetValid().OrderBy("Name ASC").ToList(), "WorkTypePK", "Name"); //worksubtypes ddl if (workDoneView.WorkTypeFK != null) { IWorkSubtypesRepository workSubtypesRepository = new WorkSubtypesRepository(db); workDoneView.WorkSubtypes = new SelectList(workSubtypesRepository.GetValidByWorkType(Convert.ToInt32(workDoneView.WorkTypeFK)), "WorkSubtypePK", "Name", workDoneView.WorkSubtypeFK); } else { workDoneView.WorkSubtypes = new SelectList(new List <County>(), "WorkSubtypePK", "Name"); } //hours and minutes ddl workDoneView.Hours = GeneratorView.GenerateHours(); workDoneView.Minutes = GeneratorView.GenerateMinutes(); return(View(workDoneView)); } else { return(RedirectToAction("Index", "WorkDone")); } }
public void RemoveFriend(long uId, WorkDone callBack) { LongValue lv = new LongValue(); lv.Value = uId; m_net.SendEnqueue(Constants.Lion_DeleteFriend, 0, lv, callBack); }
public void GetFriendSummaryByUId(long uId, WorkDone callBack = null) { LongArray laArray = new LongArray(); laArray.Data.Add(uId); m_net.SendEnqueue(Constants.Lion_GetFriendSummary, 0, laArray, callBack); }
public void DoShow(GameObject obj, WorkDone cb = null) { m_dialog = obj; m_dialog.transform.localScale = new Vector3(0, 0, 0); m_dialog.SetActive(true); m_showing = true; m_show = s_InitScale; // UpdateUI UpdateUI(); }
static public void GetShopItems(WorkDone cb) { StringValue sv = new StringValue(); string shopName = "GoldShop"; sv.Value = shopName; m_net.SendEnqueue(Constants.Lion_GetShopItems, 0, sv, cb); }
public void GetProfile(long uId, WorkDone callBack = null) { LongValue lv = new LongValue(); lv.Value = uId; m_net.SendEnqueue(Constants.Lion_GetProfile, 0, lv, callBack); }
/// <summary> /// Implentation required for the Thread start call /// </summary> /// <example> /// Here is the impl. recommendation: /// <code> /// try { /// // long running task /// } catch (System.Threading.ThreadAbortException) { /// // eat up: op. cancelled /// } catch(Exception ex) { /// // handle them, or publish: /// p_operationException = ex; /// } finally { /// this.WorkDone.Set(); // signal end of operation to dismiss the dialog /// } /// </code> /// </example> protected override void Run() { RssLocater locator = new RssLocater(proxy, RssBanditApplication.UserAgent, this.Credentials); List <string> arrFeedUrls; Dictionary <string, string[]> htFeedUrls = null; // can raise System.Net.WebException: The remote server returned an error: (403) Forbidden try { if (locationMethod == FeedLocationMethod.AutoDiscoverUrl) { arrFeedUrls = locator.GetRssFeedsForUrl(webPageUrl, true); htFeedUrls = new Dictionary <string, string[]>(arrFeedUrls.Count); foreach (string rssurl in arrFeedUrls) { NewsFeed discoveredFeed = new NewsFeed(); discoveredFeed.link = rssurl; IFeedDetails feedInfo; try { // can raise System.Net.WebException: The remote server returned an error: (403) Forbidden feedInfo = RssParser.GetItemsForFeed(discoveredFeed, this.GetWebResponseStream(rssurl), false); } catch (Exception) { // fatal errors feedInfo = FeedInfo.Empty; } htFeedUrls.Add(rssurl, new string[] { (!string.IsNullOrEmpty(feedInfo.Title) ? feedInfo.Title: SR.AutoDiscoveredDefaultTitle), feedInfo.Description, feedInfo.Link, rssurl }); } } else // Syndic8SearchType.Keyword { htFeedUrls = locator.GetFeedsFromSyndic8(searchTerms, locationMethod); } } catch (ThreadAbortException) { // eat up } catch (System.Net.WebException wex) { p_operationException = wex; // Would it make sense, to display a credentials dialog for error (403) here? // MessageBox.Show( // SR.WebExceptionOnUrlAccess(webPageUrl, wex.Message), // SR.GUIAutoDiscoverFeedFailedCaption, MessageBoxButtons.OK,MessageBoxIcon.Error); htFeedUrls = new Dictionary <string, string[]>(); } catch (Exception e) { // fatal errors p_operationException = e; // MessageBox.Show( // SR.WebExceptionOnUrlAccess(webPageUrl, e.Message), // SR.GUIAutoDiscoverFeedFailedCaption, MessageBoxButtons.OK,MessageBoxIcon.Error); htFeedUrls = new Dictionary <string, string[]>(); } finally { discoveredFeeds = htFeedUrls; WorkDone.Set(); } }
void OnClick(GameObject sender) { Tools.PlayAudio(Constants.Audio.Audio_LobbyClickButton); DebugConsole.Log(sender.name); int btnIndex = GetBtn(sender.name); if (btnIndex < 0) { DebugConsole.Log("Cant find button:" + sender.name); return; } switch ((DialogBtn)btnIndex) { case DialogBtn.Close: { GameObject btnObj = GameObject.Find(DialogName); if (null == btnObj) { DebugConsole.Log("null"); } else { DebugConsole.Log("DoHide"); DoHide(btnObj); } } break; case DialogBtn.OK: { if (m_callBack != null) { m_callBack(); m_callBack = null; } GameObject btnObj = GameObject.Find(DialogName); DoHide(btnObj); } break; default: if (btnIndex >= (int)DialogBtn.Head1 && btnIndex <= (int)DialogBtn.Head16) { m_headIndex = btnIndex - (int)DialogBtn.Head1 + 1; GameObject goHead = GameObject.Find(sender.name); GameObject go = GameObject.Find("Review"); go.GetComponent <Image>().sprite = goHead.GetComponent <Image>().sprite; } break; } }
public void GetFriendSummary(WorkDone callBack = null) { // 初始显示第一页 LongArray fIdArray = Lobby.getInstance().GetCurrentFriendPageArray(); DebugConsole.Log("Friend summary count:" + fIdArray.Data.Count); m_net.SendEnqueue(Constants.Lion_GetFriendSummary, 0, fIdArray, callBack); }
public ActionResult Finish(int?id) { if (!id.HasValue) { return(RedirectToAction("Index")); } WorkDoneRepository repo = new WorkDoneRepository(context); WorkDone wd = repo.GetById((int)id); wd.Finished(); repo.Update(wd); return(RedirectToAction("Index")); }
public void RegisterByEmail(string email, string pwdMd5, WorkDone cb = null) { RegisterReq regReq = new RegisterReq(); regReq.Version = 2; regReq.Args.Add(email); regReq.Args.Add(pwdMd5); m_net.SendEnqueue(Constants.Lion_Register, 0, regReq, cb); }
public void ModifyPassword(string pwdMd5, string npwdMd5, WorkDone cb = null) { RegisterReq regReq = new RegisterReq(); regReq.Version = 2; regReq.Args.Add(pwdMd5); regReq.Args.Add(npwdMd5); m_net.SendEnqueue(Constants.Lion_ModPass, 0, regReq, cb); }
void QuickLogin(WorkDone callBack = null) { QuickLoginInfo quickLoginInfo = new QuickLoginInfo(); Lobby lobby = Lobby.getInstance(); quickLoginInfo.UserId = lobby.UId; quickLoginInfo.Key = lobby.Key; m_net.SendEnqueue(Constants.Lion_QuickLoginInfo, 0, quickLoginInfo, callBack); }
private void Register_From_FormClosed(object sender, EventArgs e) { WorkDone callBack = new WorkDone(WorkDoneHandler); Working(callBack); }
void Working_3(WorkDone callBack) { //Working code. //当工作完成的时候执行这个委托. if (t3 != null) { Thread.Sleep(5000); } else { t3 = new Thread(new ThreadStart(callBack)); t3.IsBackground = true; t3.Start(); } }
void Working(WorkDone callBack) { //Working code. //当工作完成的时候执行这个委托. if (t1 != null) { ; } else { t1 = new Thread(new ThreadStart(callBack)); t1.IsBackground = true; t1.Start(); } }
void Change_Message() { //Change_Show("出货达成率", "100%"); delayTime(1); try { IsInOANet IsOANet = new IsInOANet(); string Url = AH.ReadConfig("appSettings", "NetCheck"); if (IsOANet.IsCanConnect(Url)) { string ComStr = ""; string ConStr = AH.ReadConfig("appSettings", "connectionstring"); if (Flag == "1") { ComStr = AH.ReadConfig("appSettings", "Data_for_Delivery"); if (AH.ReadConfig("appSettings", "Data_for_QC") != "") { Flag = "2"; } else if (AH.ReadConfig("appSettings", "Data_for_WIP") != "") { Flag = "3"; } else if (AH.ReadConfig("appSettings", "Data_for_Input") != "") { Flag = "4"; } } else if (Flag == "2") { ComStr = AH.ReadConfig("appSettings", "Data_for_QC"); if (AH.ReadConfig("appSettings", "Data_for_WIP") != "") { Flag = "3"; } else if (AH.ReadConfig("appSettings", "Data_for_Input") != "") { Flag = "4"; } else { Flag = "1"; } } else if (Flag == "3") { ComStr = AH.ReadConfig("appSettings", "Data_for_WIP"); if (AH.ReadConfig("appSettings", "Data_for_Input") != "") { Flag = "4"; } else { Flag = "1"; } } else if (Flag == "4") { ComStr = AH.ReadConfig("appSettings", "Data_for_Input"); Flag = "1"; } string[] resultStrSp = StrSp.StringSprint(ConStr, ComStr, "^"); Application.DoEvents(); string Rate = ""; string Title = ""; //Rate = (float.Parse(resultStrSp[0]) * 10).ToString() + "%"; Rate = resultStrSp[0].ToString() + "%"; if (resultStrSp[0].ToString() == "No Data") { //MessageBox.Show(resultStrSp[0].ToString()); Change_Show("No Data", " 0"); } //Rate = (1 * 10).ToString() + "%"; else { Title = resultStrSp[1]; Change_Show(Title, Rate); } } else { Change_Show("未連到IMESDB", "0"); //this.L_Title.Text = "未連到IMESDB"; //this.L_Rate.Text = "0"; MessageBox.Show("無法連接到OA 網絡請檢查網絡連接", "系統提示", MessageBoxButtons.OK, MessageBoxIcon.Error); if (t1 != null) { if (t3 != null) { if (!t3.IsAlive) t3.Start(); if (t3.ThreadState.ToString().IndexOf("Suspended") > 1) t3.Resume(); } else { WorkDone callBack = new WorkDone(WorkDoneHandler_forNet); Working_3(callBack); } t1.Suspend(); } else { if (t3 != null) { if (!t3.IsAlive) t3.Start(); if (t3.ThreadState.ToString().IndexOf("Suspended") > 1) t3.Resume(); } else { WorkDone callBack = new WorkDone(WorkDoneHandler_forNet); Working_3(callBack); } } } } catch(Exception e) { MessageBox.Show(e.ToString()); } // Change_Show("出货达成率", "90%"); }
private void Change_Show(string Title, string Rate) { ThreadPool.QueueUserWorkItem(h => { delayTime(2); L_Title.SafeCall((data) => { L_Title.Text = data.ToString(); }, Title); Thread.Sleep(100); }); ThreadPool.QueueUserWorkItem(h => { delayTime(2); L_Rate.SafeCall((data) => { L_Rate.Text = data.ToString(); }, Rate); Thread.Sleep(100); }); WorkDone callBack = new WorkDone(WorkDoneHandler); Working(callBack); GetRoundedRectPath_asyn(); }
public void Fly_From_Load(object sender, EventArgs e) { if (Process_Check("IMES_Reports")) { MessageBox.Show("當前程式已開啓"); Application.Exit(); } else { this.Top = 100; this.Left = Screen.PrimaryScreen.Bounds.Width - 200; DataSet ds = new DataSet(); #region 添加右鍵菜單 ContextMenuStrip docMenu = new ContextMenuStrip(); //ToolStripMenuItem OpenLable = new ToolStripMenuItem(); //OpenLable.Text = "打开"; //OpenLable.Click += new EventHandler(OpenLable_Click); if (!AH.IsActive_Check()) { ToolStripMenuItem Register = new ToolStripMenuItem(); Register.Text = "注册"; Register.Click += new EventHandler(Register_Click); docMenu.Items.AddRange(new ToolStripMenuItem[] { Register }); WorkDone callBack = new WorkDone(WorkDoneHandler_forActiveCheck); Working_2(callBack); /* if (AH.ReadConfig("appSettings", "TryOut") == "") { if (MessageBox.Show("您現在使用的版本未激活是否試用?", "系統提示", MessageBoxButtons.YesNo) == DialogResult.Yes) { AH.WriteConfig("TryOut", "30"); } else { Application.Exit(); } } else { MessageBox.Show("您還可試用:" + AH.ReadConfig("appSettings", "TryOut") + "次!"); int j; int.TryParse(AH.ReadConfig("appSettings", "TryOut"), out j ); j -= 1; AH.WriteConfig("TryOut", j.ToString()); } */ } ToolStripMenuItem ExitLable = new ToolStripMenuItem(); ExitLable.Text = "退出"; ExitLable.Click += new EventHandler(ExitLable_Click); //docMenu.Items.AddRange(new ToolStripMenuItem[] { OpenLable, ExitLable }); //set Autostart if (!AH.IsAuto_Check()) { ToolStripMenuItem Autostart = new ToolStripMenuItem(); Autostart.Text = "自动启动"; Autostart.Click += new EventHandler(AutoStart_Click); docMenu.Items.AddRange(new ToolStripMenuItem[] { Autostart }); } else { ToolStripMenuItem DisAutostart = new ToolStripMenuItem(); DisAutostart.Text = "关闭自动启动"; DisAutostart.Click += new EventHandler(DisAutoStart_Click); docMenu.Items.AddRange(new ToolStripMenuItem[] { DisAutostart }); } //docMenu.Items.AddRange(new ToolStripMenuItem[] { OpenLable, ExitLable }); docMenu.Items.AddRange(new ToolStripMenuItem[] { ExitLable }); this.ContextMenuStrip = docMenu; #endregion this.MouseHover += new EventHandler(Fly_From_MouseHover); this.MouseLeave += new EventHandler(Fly_From_MouseLeave); Flag = "1"; Change_Message(); AH.WriteConfig("IsOpen", "YES"); } }