public void UpdateInfo( SlamPackage package, ICloudObjectsContainer <SlamPoint> pointsMap, ICloudObjectsContainer <SlamObservation> graph) { listBoxWithSpecializedObjects.Clear(); if (package == null) { commonIformation.text = ""; return; } commonIformation.text = package.ToString(); SlamPoint[] specialPts = package.Points.Where(p => p.id != -1).Where(p => p.message != null).ToArray(); Vector3[] ptsPositionsFromMap = specialPts.Select(p => pointsMap[p].position).ToArray(); SlamObservation[] specialObs = package.Observations .Where(o => o.Point.id != -1) .Where(o => o.Point.message != null) .ToArray(); Vector3[] obsPositionsFromMap = specialObs.Select(o => graph[o].Point.position).ToArray(); for (int i = 0; i < specialPts.Length; ++i) { var item = listBoxWithSpecializedObjects.Add() as SpecialInfoListBoxItem; item.SetObject(specialPts[i].id, specialPts[i].ToString(), ptsPositionsFromMap[i], specialPts[i].message); } for (int i = 0; i < specialObs.Length; ++i) { var item = listBoxWithSpecializedObjects.Add() as SpecialInfoListBoxItem; item.SetObject(specialObs[i].Point.id, specialObs[i].ToString(), obsPositionsFromMap[i], specialObs[i].Point.message); } }
void AttachBehavior2RecentConnections() { var IPs = store.Recent; foreach (var recent in store.Recent) { var recentConnectionItem = recentConnectionsListBox.Add() as RecentIPListBoxItem; recentConnectionItem.FullAddress = $"{recent[SettingName.IPAddress].As<IPAddress>()}:{recent[SettingName.Port].As<int>()}"; recentConnectionItem.Time = recent.ModificationTime; } if (store.Recent.Count > 0) { SettingsBag.Current = store.Recent.First(); } else { SettingsBag.Current = new SettingsBag(); } recentConnectionsListBox.OnSelectionChanged += RecentIPChanged; }
void AttachBehavior2RecentFiles() { var files = store.Recent; foreach (var recentFile in store.Recent) { var recentFileItem = lbRecentFiles.Add() as RecentFileListBoxItem; recentFileItem.Path = recentFile[SettingName.Path].As <string>(); recentFileItem.DateTime = recentFile.ModificationTime; } if (store.Recent.Count > 0) { SettingsBag.Current = store.Recent.First(); } else { SettingsBag.Current = new SettingsBag(); } lbRecentFiles.OnSelectionChanged += RecentFileChanged; }
private void CreateTestUI() { UIButton button; button = new UIButton(this); button.Name = "Button1"; button.Text = "Fullscreen: " + (graphics.IsFullScreen ? "On" : "Off"); button.PositionAndSize = new Rectangle(10, 10, 150, 30); button.Action += (UIButton_Action)((btn) => { SetGraphMode(graphics.PreferredBackBufferWidth, graphics.PreferredBackBufferHeight, !graphics.IsFullScreen); btn.Text = "Fullscreen: " + (graphics.IsFullScreen ? "On" : "Off"); UI["TextBox1"].Enabled = !UI["TextBox1"].Enabled; UI["Combo1"].Enabled = !UI["Combo1"].Enabled; }); UI.Add(button); button = new UIButton(this); button.Name = "Button2"; button.Text = "taaa..."; button.PositionAndSize = new Rectangle(165, 10, 100, 50); button.Action += (UIButton_Action)((btn) => { UI["Button1"].Enabled = !UI["Button1"].Enabled; UI["Label1"].Enabled = !UI["Label1"].Enabled; ((UIComboBox)UI["Combo1"]).Edible = !((UIComboBox)UI["Combo1"]).Edible; if (((UIComboBox)UI["Combo1"]).Edible) UI["Combo1"].PositionAndSize = new Rectangle(UI["Combo1"].PositionAndSize.X, UI["Combo1"].PositionAndSize.Y, 200, 50); else UI["Combo1"].PositionAndSize = new Rectangle(UI["Combo1"].PositionAndSize.X, UI["Combo1"].PositionAndSize.Y, 100, 0); switch (((UITextBox)UI["TextBox1"]).PasswordChar) { case '\0': ((UITextBox)UI["TextBox1"]).PasswordChar = '*'; break; case '*': ((UITextBox)UI["TextBox1"]).PasswordChar = '\0'; break; } ((UIListBox)UI["ListBox1"]).Add(UI["TextBox1"].Text); }); UI.Add(button); UITextBox textbox = new UITextBox(this); textbox.Name = "TextBox1"; textbox.Text = "kupa"; textbox.TextLenghtLimit = 10; textbox.PositionAndSize = new Rectangle(270, 10, 150, 30); textbox.PasswordChar = '*'; UI.Add(textbox); UILabel label = new UILabel(this); label.Name = "Label1"; label.Text = "jakis tam...\ntekst"; label.Enabled = false; label.PositionAndSize = new Rectangle(UI["Button1"].PositionAndSize.X, UI["Button1"].PositionAndSize.Y + UI["Button1"].PositionAndSize.Height + 5, 0, 0); UI.Add(label); UIComboBox combo1 = new UIComboBox(this); combo1.Name = "Combo1"; combo1.Edible = false; combo1.PositionAndSize = new Rectangle(UI["Button2"].PositionAndSize.X, UI["Button2"].PositionAndSize.Y + UI["Button2"].PositionAndSize.Height + 5, 100, 0); combo1.Values.Add("pos1"); combo1.Values.Add("pos2"); combo1.Values.Add("pos3"); combo1.Values.Add("pos4"); combo1.MaxDisplayedItems = 3; combo1.SelectionChanged += (UIComboBox_SelectionChanged)((combo, oldindex) => { UI["TextBox1"].Text = combo.SelectedValue; }); UI.Add(combo1); UIListBox listBox1 = new UIListBox(this); listBox1.Name = "ListBox1"; listBox1.PositionAndSize = new Rectangle(UI["TextBox1"].PositionAndSize.X + UI["TextBox1"].PositionAndSize.Width + 5, UI["TextBox1"].PositionAndSize.Y, 150, 0); listBox1.AutoSizeHeight = true; listBox1.MaxVisibleValues = 5; listBox1.Add("Button1"); listBox1.Add("Button2"); listBox1.Add("TextBox1"); listBox1.Add("Label1"); listBox1.Add("Combo1"); listBox1.AutoSizeHeight = false; listBox1.PositionAndSize = new Rectangle(listBox1.PositionAndSize.X, listBox1.PositionAndSize.Y, listBox1.PositionAndSize.Width, listBox1.PositionAndSize.Height + 50); listBox1.ItemHover += (UIListBox_ItemEvent)((list, itemindex) => { list.SelectedIndex = itemindex; }); listBox1.ItemClicked += (UIListBox_ItemEvent)((list, itemindex) => { if (itemindex < 5) UI[list[itemindex].Text].Enabled = !UI[list[itemindex].Text].Enabled; else ((UIListBox)UI["ListBox1"]).RemoveAt(itemindex); }); UI.Add(listBox1); UIScrollBar scroll1 = new UIScrollBar(this, false); scroll1.Name = "Scroll1"; scroll1.MinimalValue = 0; scroll1.MaximalValue = 200; scroll1.PositionAndSize = new Rectangle(label.PositionAndSize.X, label.PositionAndSize.Y + label.PositionAndSize.Height + 100, 150, 150); scroll1.Value = 0; scroll1.ValuesOnScreen = 3; scroll1.ValueChanged += (UIScrollBar_ValueChanged)((scroll, oldval) => { UI["Label1"].Text = (oldval < scroll.Value ? "zwiekszone na:\n" : "zmniejszone na:\n") + scroll.Value; ((UIProgress)UI["ProgressBar1"]).Percent = scroll.Value / 200.0; }); UI.Add(scroll1); UICheckBox checkBox1 = new UICheckBox(this); checkBox1.Name = "CheckBox1"; checkBox1.AutoSize = true; checkBox1.Text = "checkbox1"; checkBox1.PositionAndSize = new Rectangle(combo1.PositionAndSize.X, combo1.PositionAndSize.Bottom + 5, 0, 0); UI.Add(checkBox1); UIKeyPicker keypicker1 = new UIKeyPicker(this); keypicker1.Name = "KeyPicker1"; keypicker1.PositionAndSize = new Rectangle(scroll1.PositionAndSize.X, scroll1.PositionAndSize.Bottom + 5, 100, 30); keypicker1.SelectedKey = Keys.A; UI.Add(keypicker1); UIProgress progress1 = new UIProgress(this); progress1.Name = "ProgressBar1"; progress1.PositionAndSize = new Rectangle(keypicker1.PositionAndSize.X, keypicker1.PositionAndSize.Bottom + 5, 100, 20); progress1.Angular = true; progress1.color = Color.Blue; //relevant when Angular==true progress1.Percent = 0.8; UI.Add(progress1); }