public static async Task DeleteHandler(MailDelete packet, Player player) { var response = new DeleteConfirm { MailId = packet.MailId }; await using var ctx = new UchuContext(); var mail = await ctx.Mails.FirstOrDefaultAsync(m => m.Id == packet.MailId); if (mail == default) { response.Code = MailDeleteCode.MailNotFound; goto sendResponse; } response.Code = MailDeleteCode.Success; ctx.Mails.Remove(mail); sendResponse: await ctx.SaveChangesAsync(); player.Message(new ServerMailPacket { Id = ServerMailPacketId.DeleteConfirm, MailStruct = response }); }
//Delete existing Property internal void deleteProperty() { //First edit an existing property editProperty(); System.Threading.Thread.Sleep(10000); Actions actions = new Actions(Global.Driver.driver); actions.MoveToElement(ClickingAddNewProperty); actions.Perform(); //choosing delete option var editOption = Global.Driver.driver.FindElements(By.ClassName("segment"))[0].FindElement(By.ClassName("top-right-corner")).FindElement(By.TagName("i")); editOption.Click(); System.Threading.Thread.Sleep(5000); //Deleting property DeleteProperty.Click(); System.Threading.Thread.Sleep(5000); DeleteConfirm.Click(); }
private void LoadSavedReports() { ReportRepository repo = new ReportRepository(); var reports = repo.GetCustomReports(); tblReportBuilder.Visible = false; this.SuspendLayout(); tblReportBuilder.Controls.Clear(); int rowIndex = tblReportBuilder.RowStyles.Add(new RowStyle { SizeType = SizeType.AutoSize }); var tblNew = new TableLayoutPanel { AutoSize = true, AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink }; tblNew.RowStyles.Clear(); tblNew.ColumnStyles.Clear(); tblNew.ColumnStyles.Add(new ColumnStyle { SizeType = System.Windows.Forms.SizeType.AutoSize }); tblNew.ColumnStyles.Add(new ColumnStyle { SizeType = System.Windows.Forms.SizeType.AutoSize }); tblNew.RowStyles.Add(new RowStyle { SizeType = System.Windows.Forms.SizeType.AutoSize }); var name2 = new H3bLabel { Text = Translations.CustomReport, Name = "rpt_cr", AutoSize = true, }; name2.SetMaxWidth(400); var edit2 = new H3Link { Text = Translations.NewLink, Margin = new Padding(0, 2, 0, 0) }; edit2.ClickOverride += () => { WizardForm wiz = new WizardForm(new StepCategory(), Translations.CustomReportBuilder); wiz.Height = 695; wiz.OnRunReport = RunCustomReport; wiz.Show(); }; tblNew.Controls.Add(name2, 0, 0); tblNew.Controls.Add(edit2, 1, 0); tblReportBuilder.Controls.Add(tblNew, 0, rowIndex); foreach (var report in reports) { rowIndex = tblReportBuilder.RowStyles.Add(new RowStyle { SizeType = SizeType.AutoSize }); var tbl = new TableLayoutPanel { AutoSize = true, AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink }; tbl.RowStyles.Clear(); tbl.ColumnStyles.Clear(); tbl.ColumnStyles.Add(new ColumnStyle { SizeType = System.Windows.Forms.SizeType.AutoSize }); tbl.ColumnStyles.Add(new ColumnStyle { SizeType = System.Windows.Forms.SizeType.AutoSize }); tbl.ColumnStyles.Add(new ColumnStyle { SizeType = System.Windows.Forms.SizeType.AutoSize }); tbl.RowStyles.Add(new RowStyle { SizeType = System.Windows.Forms.SizeType.AutoSize }); var name = new H3bLabel { Text = report.DisplayName, Name = "rpt_" + report.DisplayName, AutoSize = true, }; name.SetMaxWidth(400); var edit = new H3Link { Text = Translations.Edit + "...", Margin = new Padding(0, 2, 0, 0) }; edit.ClickOverride += () => { WizardForm wiz = new WizardForm(new StepIndicators(report), Translations.CustomReportBuilder); wiz.Height = 695; wiz.OnRunReport = RunCustomReport; wiz.Show(); }; var delete = new H3Link { Text = Translations.Delete + "...", Margin = new Padding(0, 2, 0, 0) }; delete.ClickOverride += () => { DeleteConfirm confirm = new DeleteConfirm(Translations.Delete, Translations.DeleteConfirmMessage); if (confirm.ShowDialog() == DialogResult.OK) { repo.DeleteCustomReport(report, ApplicationData.Instance.GetUserId()); LoadSavedReports(); } }; tbl.Controls.Add(name, 0, 0); tbl.Controls.Add(edit, 1, 0); tbl.Controls.Add(delete, 2, 0); tblReportBuilder.Controls.Add(tbl, 0, rowIndex); } this.ResumeLayout(); tblReportBuilder.Visible = true; }
private void lvProcess_HyperlinkClicked(object sender, BrightIdeasSoftware.HyperlinkClickedEventArgs e) { e.Handled = true; if (e.Column.AspectName == "View") { IView process = fetcher.GetProcess((ProcessDetails)e.Model); if (process == null) return; DoLoadView(process); } else if (e.Column.AspectName == "Delete") { DeleteConfirm confirm = new DeleteConfirm(); if (confirm.ShowDialog() == DialogResult.OK) { fetcher.Delete((ProcessDetails)e.Model, ApplicationData.Instance.GetUserId()); LoadProcesses(); } } }
public override void OnInspectorGUI() { lb = (LuaBehaviour)target; base.DrawDefaultInspector(); InitFilename(lb); #region 使用DoString方式执行的节点 if (target is LuaWithNoFile) { lb.domain = EditorGUILayout.TextField(new GUIContent("Domain:"), lb.domain); return; } lb.isDoString = EditorGUILayout.Toggle(new GUIContent("DoString?"), lb.isDoString); if (lb.isDoString) { if (lb.doStringLuaFile != null && File.Exists(lb.doStringLuaFile)) { EditorGUILayout.BeginHorizontal(); if (GUILayout.Button("Open File")) { OpenLuaFile(); } if (GUILayout.Button("Copy File")) { CopyeLuaFile(); } EditorGUILayout.EndHorizontal(); } else { if (GUILayout.Button("Create File")) { CreateLuaFile(); } } lb.domain = TextArea("Domain:", lb.domain); lb.lua_OnFirstEnable = TextArea("OnFirstEnable:", lb.lua_OnFirstEnable); lb.lua_OnEnable = TextArea("OnEnable:", lb.lua_OnEnable); lb.lua_OnDisable = TextArea("OnDisable:", lb.lua_OnDisable); lb.lua_OnClick = TextArea("OnClick:", lb.lua_OnClick); lb.lua_OnCommand = TextArea("OnCommand:", lb.lua_OnCommand); lb.lua_OnReceiveData = TextArea("OnReceiveData:", lb.lua_OnReceiveData); return; } #endregion #region 处理是用lua文件执行 //处理因为节点移动而造成的文件与节点不匹配的情况 if (File.Exists(rootPath + oldFileFullname)) { if (oldFileFullname != curFileFullname || oldTablename != curTablename) { MoveFile(rootPath + oldFileFullname, rootPath + curFileFullname); } } else { lb.luaFilename = ""; lb.tableName = ""; } if (File.Exists(rootPath + curFileFullname)) { lb.luaFilename = curFileFullname; lb.tableName = curTablename; EditorGUILayout.BeginHorizontal(); if (GUILayout.Button("Open File")) { OpenFile(rootPath + curFileFullname); } if (GUILayout.Button("Delete File")) { Rect wr = new Rect(500, 200, 200, 100); DeleteConfirm window = (DeleteConfirm)EditorWindow.GetWindowWithRect(typeof(DeleteConfirm), wr, true, "widow name"); window.Show(); } EditorGUILayout.EndHorizontal(); lb.domain = EditorGUILayout.TextField(new GUIContent("Domain:"), lb.domain); EditorGUILayout.TextField(new GUIContent("Filename:"), curFileFullname); EditorGUILayout.TextField(new GUIContent("Tablename:"), curTablename); } else { if (GUILayout.Button("Create File")) { CreateFile(rootPath + curFileFullname); } } #endregion }
private void sentinelSiteListView_HyperlinkClicked(object sender, BrightIdeasSoftware.HyperlinkClickedEventArgs e) { e.Handled = true; if (e.Column.AspectName == "EditText") { SentinelSiteAdd modal = new SentinelSiteAdd((SentinelSite) e.Model); modal.OnSave += sites_OnEdit; modal.ShowDialog(); } else if (e.Column.AspectName == "DeleteText") { // The site to delete SentinelSite siteToDelete = (SentinelSite) e.Model; // Check if the site has associated data if (SurveyRepo.GetSiteSurveyCount(siteToDelete) > 0) { // The site has associated data, so display a message MessageBox.Show(Translations.CannotDeleteSentinelSiteHasData, Translations.CannotDeleteSite); return; } // Confirm the delete with the user DeleteConfirm confirm = new DeleteConfirm(); if (confirm.ShowDialog() == DialogResult.OK) { // The site has no associated data, so it is safe to delete SurveyRepo.DeleteSite(siteToDelete, ApplicationData.Instance.GetUserId()); // Get the index of the site in the collection int currentIndex = SentinelSites.IndexOf(siteToDelete); // Remove the deleted site from the collection if (currentIndex >= 0) SentinelSites.RemoveAt(currentIndex); // Update the list UpdateSiteList(null); } } }