public void OnLevelChanged() { LayerList.BeginUpdate(); LayerList.Clear(); string active_layer = Program.engine.MainLevel.GetActiveLayer(); for (int i = 0; i < Program.engine.MainLevel.GetLayerCount(); ++i) { string text = Program.engine.MainLevel.GetLayerName(i); EXListViewItem item = new EXImageListViewItem(NexusEditor.Properties.Resources.layer); EXListViewSubItem name = new EXListViewSubItem(text); name.OnItemValueChanged = this.OnLayerNameChanged; name.UserData = item; item.AddSubItem(name); EXBoolListViewSubItem active = new EXBoolListViewSubItem(active_layer == text); active.OnItemValueChanged = this.OnActiveLayer; active.UserData = item; item.AddSubItem(active); EXBoolListViewSubItem show = new EXBoolListViewSubItem(Program.engine.MainLevel.IsLayerVisible(text)); show.OnItemValueChanged = this.OnShowLayer; show.UserData = item; item.AddSubItem(show); EXBoolListViewSubItem islock = new EXBoolListViewSubItem(Program.engine.MainLevel.IsLayerLocked(text)); islock.OnItemValueChanged = this.OnLockLayer; islock.UserData = item; item.AddSubItem(islock); LayerList.AddItem(item); } LayerList.EndUpdate(); //在右侧的列表中显示当前激活层中的所有actor UpdateActorList(Program.engine.MainLevel.GetActiveLayer()); OperationTooltip.Text = "就绪"; }
private void ConfigEditor_Load(object sender, EventArgs e) { // Load columns & co elvConfigcfgeditor.Columns.Add(new EXColumnHeader("Name", 200)); // Control textbox for edition txtbx = new TextBox(); txtbx.Visible = false; txtbx.ForeColor = Color.Blue; elvConfigcfgeditor.Controls.Add(txtbx); txtbx.Leave += new EventHandler(c_Leave); txtbx.KeyPress += new KeyPressEventHandler(txtbx_KeyPress); elvConfigcfgeditor.Columns.Add(new EXEditableColumnHeader("Value", txtbx, 400)); Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None); foreach (KeyValueConfigurationElement keyValueElement in config.AppSettings.Settings) { EXListViewItem item = new EXListViewItem(keyValueElement.Key); elvConfigcfgeditor.Items.Add(item); EXListViewSubItem subitem = new EXListViewSubItem(keyValueElement.Value); item.SubItems.Add(subitem); } }
private void toolStripButton1_Click(object sender, EventArgs e) { //添加新层 //确定可用的默认层名称 string text; for (int i = 1;; ++i) { text = "新作业层" + i.ToString(); if (!Program.engine.MainLevel.IsLayerExist(text)) { break; } } EXListViewItem item = new EXImageListViewItem(NexusEditor.Properties.Resources.layer); EXListViewSubItem name = new EXListViewSubItem(text); name.OnItemValueChanged = this.OnLayerNameChanged; name.UserData = item; item.AddSubItem(name); EXBoolListViewSubItem active = new EXBoolListViewSubItem(false); active.OnItemValueChanged = this.OnActiveLayer; active.UserData = item; item.AddSubItem(active); EXBoolListViewSubItem show = new EXBoolListViewSubItem(true); show.OnItemValueChanged = this.OnShowLayer; show.UserData = item; item.AddSubItem(show); EXBoolListViewSubItem islock = new EXBoolListViewSubItem(true); islock.OnItemValueChanged = this.OnLockLayer; islock.UserData = item; item.AddSubItem(islock); LayerList.AddItem(item); // 在编辑器中对应的增加一层 Program.engine.MainLevel.CreateNewLayer(text); OperationTooltip.Text = "就绪"; }
/// <summary> /// /// </summary> /// <param name="daddy"></param> public NotificationCreation(MainWindow daddy) { _daddy = daddy; _sErrTitle = _daddy.GetTranslator().GetString("Error"); _sErrFormat = _daddy.GetTranslator().GetString("ErrWrongParameter"); // // The InitializeComponent() call is required for Windows Forms designer support. // InitializeComponent(); if (!SpecialFeatures.SpecialFeaturesMgt.AreSpecialFeaturesEnabled()) { return; } btnGCNMap.Image = _daddy.GetImageSized("Earth"); _daddy._cacheDetail._gmap.ControlTextLatLon = tbGCNCenter; tbGCNCenter.TextChanged += new System.EventHandler(this.txtCoord_TextChanged); tbGCNCenter.Text = _daddy.HomeLat.ToString() + " " + _daddy.HomeLon.ToString(); this.Text = _daddy.GetTranslator().GetString("createpublishnotifications"); lblGCNRadius.Text = _daddy.GetTranslator().GetString("FTFDistance"); lblGCNCentre.Text = _daddy.GetTranslator().GetString("ParamCenterLatLon"); lblGCNEmail.Text = _daddy.GetTranslator().GetString("FTFEmails"); lblGCNGrid.Text = _daddy.GetTranslator().GetString("FTFCacheTypes"); lblGCNNom.Text = _daddy.GetTranslator().GetString("FTFName"); btnGCNCancel.Text = _daddy.GetTranslator().GetString("BtnCancel"); btnGCNCreate.Text = _daddy.GetTranslator().GetString("BtnOK"); daddy.UpdateHttpDefaultWebProxy(); String post_response = ""; // On checke que les L/MDP soient corrects // Et on récupère les cookies au passage CookieContainer cookieJar = daddy.CheckGCAccount(true, false); if (cookieJar == null) { return; } // Pour récupérer les emails String url = "https://www.geocaching.com/notify/edit.aspx"; HttpWebRequest objRequest = (HttpWebRequest)WebRequest.Create(url); objRequest.Proxy = daddy.GetProxy(); // Là encore, on peut virer le proxy si non utilisé (NULL) objRequest.CookieContainer = cookieJar; // surtout récupérer le container de cookie qui est maintenant renseigné avec le cookie d'authentification HttpWebResponse objResponse = (HttpWebResponse)objRequest.GetResponse(); using (StreamReader responseStream = new StreamReader(objResponse.GetResponseStream())) { post_response = responseStream.ReadToEnd(); responseStream.Close(); } if (NotificationsManager.CheckWarningMessage(_daddy, post_response)) { // Shit } List <String> lsemails = new List <string>(); String email = ""; String mails = MyTools.GetSnippetFromText("ctl00$ContentBody$LogNotify$ddlAltEmails", "select>", post_response); lsemails = MyTools.GetSnippetsFromText("value=\"", "\">", mails); if (lsemails.Count != 0) { email = lsemails[0]; } cbGCNEmails.Items.AddRange(lsemails.ToArray()); if (cbGCNEmails.Items.Count != 0) { cbGCNEmails.SelectedIndex = 0; } else { cbGCNEmails.Visible = false; lblGCNEmail.Visible = false; } // List of cache type (to associate with list of int) listOfCacheTypes = new List <string>(new String[] { "Earthcache", "Event Cache", "Cache In Trash Out Event", "Giga-Event Cache", "Mega-Event Cache", "Letterbox Hybrid", "Multi-cache", "Traditional Cache", "Unknown Cache", "Wherigo Cache", "Virtual Cache" }); // BCR 20170825 listOfCacheTypesId = new List <int>(new int[] { 137, 6, 13, 7005, 453, 5, 3, 2, 8, 1858, 4 }); // BCR 20170825 //Matrix listOfAlloweKindPerCacheType = new List <Tuple <String, List <int> > >(); // BCR 20170825 listOfAlloweKindPerCacheType.Add(new Tuple <String, List <int> >("Found it", new List <int>(new int[] { 0, -1, -1, -1, -1, 0, 0, 0, 0, 0, 0 }))); listOfAlloweKindPerCacheType.Add(new Tuple <String, List <int> >("Retract Listing", new List <int>(new int[] { 7, 8, 8, 8, 8, 7, 7, 7, 7, 7, 7 }))); listOfAlloweKindPerCacheType.Add(new Tuple <String, List <int> >("Didn't find it", new List <int>(new int[] { 1, -1, -1, -1, -1, 1, 1, 1, 1, 1, 1 }))); listOfAlloweKindPerCacheType.Add(new Tuple <String, List <int> >("Temporarily Disable Listing", new List <int>(new int[] { 8, 10, 10, 10, 9, 8, 8, 8, 8, 8, 8 }))); listOfAlloweKindPerCacheType.Add(new Tuple <String, List <int> >("Write note", new List <int>(new int[] { 2, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2 }))); listOfAlloweKindPerCacheType.Add(new Tuple <String, List <int> >("Enable Listing", new List <int>(new int[] { 9, 11, 11, 11, 10, 9, 9, 9, 9, 9, 9 }))); listOfAlloweKindPerCacheType.Add(new Tuple <String, List <int> >("Archive", new List <int>(new int[] { 3, 1, 1, 1, 1, 3, 3, 3, 3, 3, 3 }))); listOfAlloweKindPerCacheType.Add(new Tuple <String, List <int> >("Update Coordinates", new List <int>(new int[] { 10, 9, 9, 9, 11, 10, 10, 10, 10, 10, 10 }))); listOfAlloweKindPerCacheType.Add(new Tuple <String, List <int> >("Needs Archived", new List <int>(new int[] { 4, 2, 2, 2, 2, 4, 4, 4, 4, 4, 4 }))); listOfAlloweKindPerCacheType.Add(new Tuple <String, List <int> >("Needs Maintenance", new List <int>(new int[] { 11, -1, -1, -1, 12, 11, 11, 11, 11, 11, 11 }))); listOfAlloweKindPerCacheType.Add(new Tuple <String, List <int> >("Unarchive", new List <int>(new int[] { 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5 }))); listOfAlloweKindPerCacheType.Add(new Tuple <String, List <int> >("Owner Maintenance", new List <int>(new int[] { 12, -1, -1, -1, -1, 12, 12, 12, 12, 12, 12 }))); listOfAlloweKindPerCacheType.Add(new Tuple <String, List <int> >("Publish Listing", new List <int>(new int[] { 6, 7, 7, 7, 7, 6, 6, 6, 6, 6, 6 }))); listOfAlloweKindPerCacheType.Add(new Tuple <String, List <int> >("Announcement", new List <int>(new int[] { -1, 6, 6, 6, 6, -1, -1, -1, -1, -1, -1 }))); listOfAlloweKindPerCacheType.Add(new Tuple <String, List <int> >("Will Attend", new List <int>(new int[] { -1, 3, 3, 3, 3, -1, -1, -1, -1, -1, -1 }))); listOfAlloweKindPerCacheType.Add(new Tuple <String, List <int> >("Attended", new List <int>(new int[] { -1, 4, 4, 4, 4, -1, -1, -1, -1, -1, -1 }))); // Create listview lvGCNGrid.HeaderStyle = ColumnHeaderStyle.None; ImageList imglist = new ImageList(); imglist.ColorDepth = ColorDepth.Depth32Bit; imglist.ImageSize = new Size(20, 20); // this will affect the row height imglist.Images.Add(_daddy.GetImageSized("Fail")); lvGCNGrid.SmallImageList = imglist; lvGCNGrid.MouseClick += new MouseEventHandler(lstv_MouseClick); lvGCNGrid.FullRowSelect = true; lvGCNGrid.MyHighlightBrush = new SolidBrush(Color.Transparent); lvGCNGrid.MySelectBrush = new SolidBrush(Color.Transparent); // Create columns // First column is for notification kind EXColumnHeader col = new EXColumnHeader("Type", 150); lvGCNGrid.Columns.Add(col); // And a column per cache type foreach (String key in listOfCacheTypes) { EXBoolColumnHeader boolcol = new EXBoolColumnHeader("", 20); boolcol.TrueImage = _daddy.GetImageSized("Selected"); boolcol.FalseImage = _daddy.GetImageSized("NotSelected"); //col = new EXColumnHeader("", 50); lvGCNGrid.Columns.Add(boolcol); } // And a line with all cache type EXListViewItem lvi = new EXListViewItem("Cache types"); lvGCNGrid.Items.Add(lvi); foreach (String key in listOfCacheTypes) { EXImageListViewSubItem si = new EXImageListViewSubItem(MyTools.ResizeImage(_daddy.GetImageSized(key), 16, 16)); lvi.SubItems.Add(si); } // Add a line for each notification kind foreach (Tuple <String, List <int> > o in listOfAlloweKindPerCacheType) { lvi = new EXListViewItem(o.Item1); lvGCNGrid.Items.Add(lvi); foreach (int i in o.Item2) { if (i != -1) { EXBoolListViewSubItem subi = new EXBoolListViewSubItem(false); lvi.SubItems.Add(subi); } else { EXListViewSubItem subi = new EXListViewSubItem(""); subi.BackColor = Color.DarkBlue; lvi.SubItems.Add(subi); } } } }
private void AddGCNToList(GCNotification gcn, String keyIcon, List <GCNotification> lst, bool special = false, int index = -1) { String sLat2 = CoordConvHMI.ConvertDegreesToDDMM(gcn.dlat, true); String sLon2 = CoordConvHMI.ConvertDegreesToDDMM(gcn.dlon, false); String coord = /*"DD° MM.MMM: " + */ sLat2 + " " + sLon2 + "\r\n"; String radius = gcn.distance.ToString() + " Km"; String lbl = gcn.name; if (special) { lbl = gcn.GetTypeKeyInEnglish(); } EXImageListViewItem lvi = null; if (special) { lvi = new EXImageListViewItem(lbl, _daddy.GetImageSized("Nothing")); EXImageListViewSubItem svi2 = new EXImageListViewSubItem(_daddy.GetImageSized(keyIcon)); lvi.SubItems.Add(svi2); } else { lvi = new EXImageListViewItem(lbl, _daddy.GetImageSized(keyIcon)); EXImageListViewSubItem svi2 = new EXImageListViewSubItem(""); lvi.SubItems.Add(svi2); } if (lst.Count != 1) { lvi.Font = MyTools.ChangeFontStyle(lvi.Font, true, false); EXImageListViewSubItem svi2 = new EXImageListViewSubItem(""); lvi.SubItems.Add(svi2); } else { if (gcn.checknotif) { EXImageListViewSubItem svi2 = new EXImageListViewSubItem(_daddy.GetImageSized("bulletgreen")); lvi.SubItems.Add(svi2); } else { EXImageListViewSubItem svi2 = new EXImageListViewSubItem(_daddy.GetImageSized("bulletred")); lvi.SubItems.Add(svi2); } } EXListViewSubItem svi = null; if (special) { svi = new EXListViewSubItem(""); lvi.SubItems.Add(svi); svi = new EXListViewSubItem(""); lvi.SubItems.Add(svi); } else { svi = new EXListViewSubItem(coord); lvi.SubItems.Add(svi); svi = new EXListViewSubItem(radius); lvi.SubItems.Add(svi); } String kind = ""; if (lst.Count == 1) { foreach (String k in gcn.kindofnotifnames) { kind += k + " - "; } } svi = new EXListViewSubItem(kind); lvi.SubItems.Add(svi); if (special) { lvGCNListGroup.Items.Insert(index + 1, lvi); } else { lvGCNListGroup.Items.Add(lvi); } _dicoItemGCs.Add(lvi, lst); }