public TurnPanel() { BackColor = Color.Black; //Size = new Size(70, 700); /* refill = Image.FromFile(Settings.resButton + "refill.png"); draw = Image.FromFile(Settings.resButton + "draw.png"); main1 = Image.FromFile(Settings.resButton + "main1.png"); startCombat = Image.FromFile(Settings.resButton + "startcombat.png"); attack = Image.FromFile(Settings.resButton + "attack.png"); block = Image.FromFile(Settings.resButton + "block.png"); damage = Image.FromFile(Settings.resButton + "damage.png"); endCombat = Image.FromFile(Settings.resButton + "endcombat.png"); main2 = Image.FromFile(Settings.resButton + "main2.png"); end = Image.FromFile(Settings.resButton + "end.png"); */ for (int i = 0; i < toggleBoxes.Length; i++) { ToggleBox b = new ToggleBox(); Controls.Add(b); toggleBoxes[i] = b; var i1 = i; b.Click += (_, __) => { b.toggle(); }; } }
private void RenderYesNo() { var stk = new StackLayout() { HorizontalOptions = LayoutOptions.FillAndExpand, Orientation = StackOrientation.Horizontal }; var title = new Label() { FontSize = 14, Text = Unite.Name, TextColor = Color.Black, VerticalOptions = LayoutOptions.Center }; stk.Children.Add(title); var input = new ToggleBox() { HeightRequest = 25, WidthRequest = 25, CheckedImage = "ic_checked_box_black", UnCheckedImage = "ic_unchecked_box_black" }; input.SetBinding(ToggleBox.IsToggledProperty, new Binding("Value", BindingMode.TwoWay, converter: new IntToBoolConverter(), source: Unite)); if (!string.IsNullOrWhiteSpace(Unite.Value) && ConvertToBool(Unite.Value, out bool value)) { input.IsToggled = value; } stk.Children.Add(input); Content = stk; }
private void RenderMultiChoice() { var stk = new StackLayout() { HorizontalOptions = LayoutOptions.FillAndExpand }; var title = new Label() { FontSize = 14, Text = Unite.Name, TextColor = Color.Black, VerticalOptions = LayoutOptions.Center }; stk.Children.Add(title); string[] choice = null; if (!string.IsNullOrWhiteSpace(Unite.Value)) { choice = Unite.Value.Split(';'); } foreach (var ui in Unite.UniteItems) { var stk2 = new StackLayout() { Orientation = StackOrientation.Horizontal }; var input2 = new ToggleBox() { HeightRequest = 25, WidthRequest = 25, CheckedImage = "ic_checked_box_black", UnCheckedImage = "ic_unchecked_box_black" }; input2.SetBinding(ToggleBox.IsToggledProperty, new Binding("Selected", BindingMode.TwoWay, source: ui)); if (choice != null && choice.Any(c => c.Trim().Equals(ui.Value.Trim()))) { input2.IsToggled = true; } stk2.Children.Add(input2); var title2 = new Label() { FontSize = 14, Text = ui.Value, TextColor = Color.Black, VerticalOptions = LayoutOptions.Center }; stk2.Children.Add(title2); stk.Children.Add(stk2); } Content = stk; }
private void CreateGeneralTab(IDesignerControl parent) { int labelWidth = 200; // Space parent.AddControl <Spacer>(); // Case Sensitive Names setting HorizontalLayout a = parent.AddControl <HorizontalLayout>(); { // Create the label Label label = a.AddControl <Label>(); { label.Content.Text = "Case Sensitive Names"; label.Content.Tooltip = "Should type and member name searches be case sensitive"; label.Layout.Size = new Vector2(labelWidth, 0); } // Create the toggle box ToggleBox box = a.AddControl <ToggleBox>(); { box.Checked = DynamicCSharp.Settings.caseSensitiveNames; box.OnToggled += (object sender, bool value) => { DynamicCSharp.Settings.caseSensitiveNames = value; }; } } // Discover Non-Public Types setting HorizontalLayout b = parent.AddControl <HorizontalLayout>(); { // Create the label Label label = b.AddControl <Label>(); { label.Content.Text = "Discover non-public types"; label.Content.Tooltip = "Should types that are not marked 'public' be discovered"; label.Layout.Size = new Vector2(labelWidth, 0); } // Create the toggle box ToggleBox box = b.AddControl <ToggleBox>(); { box.Checked = DynamicCSharp.Settings.discoverNonPublicTypes; box.OnToggled += (object sender, bool value) => { DynamicCSharp.Settings.discoverNonPublicTypes = value; }; } } // Discover Non-Public Members HorizontalLayout c = parent.AddControl <HorizontalLayout>(); { // Create the label Label label = c.AddControl <Label>(); { label.Content.Text = "Discover non-public members"; label.Content.Tooltip = "Should class members that are not parked 'public' be discovered"; label.Layout.Size = new Vector2(labelWidth, 0); } // Create the toggle box ToggleBox box = c.AddControl <ToggleBox>(); { box.Checked = DynamicCSharp.Settings.discoverNonPublicMembers; box.OnToggled += (object sender, bool value) => { DynamicCSharp.Settings.discoverNonPublicMembers = value; }; } } // Debug mode HorizontalLayout d = parent.AddControl <HorizontalLayout>(); { // Create the label Label label = d.AddControl <Label>(); { label.Content.Text = "Debug Mode"; label.Content.Tooltip = "When enabled the compile will generate and load debug symbols"; label.Layout.Size = new Vector2(labelWidth, 0); } // Create the toggle box ToggleBox box = d.AddControl <ToggleBox>(); { box.Checked = DynamicCSharp.Settings.debugMode; box.OnToggled += (object sender, bool value) => { DynamicCSharp.Settings.debugMode = value; }; } } // Spacer parent.AddControl <Spacer>(); EditListBox listbox = parent.AddControl <EditListBox>(); { listbox.Content.Text = "Assembly References"; listbox.ItemStyle = new VisualStyle(EditorStyle.ToolbarButton); foreach (string value in DynamicCSharp.Settings.assemblyReferences) { listbox.AddItem(value); } // On add clicked listbox.OnAddClicked += (object sender) => { // Show an input dialog InputDialog dialog = InputDialog.ShowDialog <InputDialog>(new Vector2(0, 0)); dialog.WindowTitle = "Add Assembly Reference"; dialog.Content = "Enter the name of the assembly you want to add including the '.dll' file extension"; dialog.CenterAt(UiEvent.mouseScreenPosition); dialog.OnClosed += (object s, DialogResult result) => { // Check for dialog accepted if (result == DialogResult.OK) { InputDialog window = s as InputDialog; // Make sure the input is not empty if (string.IsNullOrEmpty(window.Text) == false) { // Add to listbox listbox.AddItem(window.Text); // Add to settings DynamicCSharp.Settings.AddAssemblyReference(window.Text); } } }; }; // On remove clicked listbox.OnRemoveClicked += (object sender) => { // Catch exceptions when the list is empty try { // Remove selection listbox.RemoveItem(listbox.SelectedItemName); // Remove from settings DynamicCSharp.Settings.RemoveAssemblyReference(listbox.SelectedIndex); } catch { } }; } }
private void CreateSecurityTab(IDesignerControl parent) { // Security check code HorizontalLayout a = parent.AddControl <HorizontalLayout>(); { // Create the label Label label = a.AddControl <Label>(); { label.Content.Text = "Security Check Code"; label.Content.Tooltip = "When enabled, all code will be security checked before it can be loaded"; } // Create the toggle box ToggleBox box = a.AddControl <ToggleBox>(); { box.Checked = DynamicCSharp.Settings.securityCheckCode; box.OnToggled += (object sender, bool value) => { DynamicCSharp.Settings.securityCheckCode = value; }; } } parent.AddControl <Spacer>(); EditListBox referenceListbox = parent.AddControl <EditListBox>(); { referenceListbox.Content.Text = "Assembly Reference Restrictions"; referenceListbox.ItemStyle = new VisualStyle(EditorStyle.ToolbarButton); foreach (ReferenceRestriction value in DynamicCSharp.Settings.referenceRestrictions) { referenceListbox.AddItem(value.RestrictedName); } // On add clicked referenceListbox.OnAddClicked += (object sender) => { // Show an input dialog InputDialog dialog = InputDialog.ShowDialog <InputDialog>(new Vector2(0, 0)); dialog.WindowTitle = "Add Assembly Reference Restriction"; dialog.Content = "Enter the name of the assembly you want to restrict including the '.dll' file extension"; dialog.CenterAt(UiEvent.mouseScreenPosition); dialog.OnClosed += (object s, DialogResult result) => { if (result == DialogResult.OK) { InputDialog window = s as InputDialog; if (string.IsNullOrEmpty(window.Text) == false) { // Add to listbox referenceListbox.AddItem(window.Text); // Add to settings DynamicCSharp.Settings.AddReferenceRestriction(window.Text); } } }; }; // On remove clicked referenceListbox.OnRemoveClicked += (object sender) => { // Catch exceptions cause by empty list try { // Remove selection referenceListbox.RemoveItem(referenceListbox.SelectedItemName); // Remove from settings DynamicCSharp.Settings.RemoveReferenceRestriction(referenceListbox.SelectedIndex); } catch { } }; } parent.AddControl <Spacer>(); EditListBox namespaceListbox = parent.AddControl <EditListBox>(); { namespaceListbox.Content.Text = "Namespace Restrictions"; namespaceListbox.ItemStyle = new VisualStyle(EditorStyle.ToolbarButton); foreach (NamespaceRestriction value in DynamicCSharp.Settings.namespaceRestrictions) { namespaceListbox.AddItem(value.RestrictedNamespace); } // On add clicked namespaceListbox.OnAddClicked += (object sender) => { // Show an input dialog InputDialog dialog = InputDialog.ShowDialog <InputDialog>(new Vector2(0, 0)); dialog.WindowTitle = "Add Namespace Restriction"; dialog.Content = "Enter the namespace you want to restrict. For example, 'System.IO'"; dialog.CenterAt(UiEvent.mouseScreenPosition); dialog.OnClosed += (object s, DialogResult result) => { if (result == DialogResult.OK) { InputDialog window = s as InputDialog; if (string.IsNullOrEmpty(window.Text) == false) { // Add to listbox namespaceListbox.AddItem(window.Text); // Add to settings DynamicCSharp.Settings.AddNamespaceRestriction(window.Text); } } }; }; // On remove clicked namespaceListbox.OnRemoveClicked += (object sender) => { // Catch exceptions cause by empty list try { // Remove selection namespaceListbox.RemoveItem(namespaceListbox.SelectedItemName); // Remove from settings DynamicCSharp.Settings.RemoveNamespaceRestriction(namespaceListbox.SelectedIndex); } catch { } }; } }
public void ClearToggleBox(ToggleBox toggleBox) { toggleBox.ClearBox(); }
public void FillToggleBox(Categories category, ToggleBox toggleBox) { toggleBox.CreatePredicates(category); }
public void FillToggleBox(Classes classes, ToggleBox toggleBox) { toggleBox.CreatePredicates(classes); }
public void FillToggleBox(Concept concept, ToggleBox toggleBox) { toggleBox.CreatePredicates(concept); }
private void RenderMultiChoice() { var stk = new StackLayout() { HorizontalOptions = LayoutOptions.FillAndExpand }; var title = new Label() { FontSize = 14, Text = Unite.Name, TextColor = Color.Black, VerticalOptions = LayoutOptions.Center }; stk.Children.Add(title); string[] choice = null; if (!string.IsNullOrWhiteSpace(Unite.Value)) { if (Unite.Value.Length > 3 && (Unite.Value.Contains(",") || Unite.Value.Contains(";"))) { string[] dataItem; if (Unite.Value.Contains(",")) { dataItem = Unite.Value.Split(','); } else { dataItem = Unite.Value.Split(';'); } int n; if (dataItem != null && dataItem.Length > 0 && int.TryParse(dataItem[0], out n)) { var temp = ""; for (int i = 0; i < dataItem.Length; i++) { var uniteItem = App.LocalDb.Table <UniteItem>().ToList().FirstOrDefault(uni => uni.ServerId == int.Parse(dataItem[i])); temp += uniteItem.Value + ";"; } if (temp.Length > 1) { Unite.Value = temp; } } } choice = Unite.Value.Split(';'); } foreach (var ui in Unite.UniteItems) { var stk2 = new StackLayout() { Orientation = StackOrientation.Horizontal, }; var input2 = new ToggleBox() { HeightRequest = 25, WidthRequest = 25, CheckedImage = "ic_checked_box_black", UnCheckedImage = "ic_unchecked_box_black" }; input2.SetBinding(ToggleBox.IsToggledProperty, new Binding("Selected", BindingMode.TwoWay, source: ui)); if (choice != null && choice.Any(c => c.Trim().Equals(ui.Value.Trim()))) { input2.IsToggled = true; } stk2.Children.Add(input2); var title2 = new Label() { FontSize = 14, Text = ui.Value, TextColor = Color.Black, VerticalOptions = LayoutOptions.Center }; stk2.Children.Add(title2); stk.Children.Add(stk2); } Content = stk; }