public TreeViewSection() { var layout = new DynamicLayout(); layout.BeginHorizontal(); layout.Add(new Label()); layout.BeginVertical(); layout.BeginHorizontal(); layout.Add(null); layout.Add(allowExpanding = new CheckBox{ Text = "Allow Expanding", Checked = true }); layout.Add(allowCollapsing = new CheckBox{ Text = "Allow Collapsing", Checked = true }); layout.Add(RefreshButton()); layout.Add(null); layout.EndHorizontal(); layout.EndVertical(); layout.EndHorizontal(); treeView = ImagesAndMenu(); layout.AddRow(new Label{ Text = "Simple" }, Default()); layout.BeginHorizontal(); layout.Add(new Panel()); layout.BeginVertical(); layout.AddSeparateRow(InsertButton(), AddChildButton(), RemoveButton(), ExpandButton(), CollapseButton(), null); layout.AddSeparateRow(LabelEditCheck(), EnabledCheck(), null); layout.EndVertical(); layout.EndHorizontal(); layout.AddRow(new Label{ Text = "With Images\n&& Context Menu" }, treeView); layout.AddRow(new Panel(), HoverNodeLabel()); layout.Add(null, false, true); Content = layout; }
public TreeGridViewSection() { var layout = new DynamicLayout(); layout.BeginHorizontal(); layout.Add(new Label()); layout.BeginVertical(); layout.BeginHorizontal(); layout.Add(null); layout.Add(allowExpanding = new CheckBox{ Text = "Allow Expanding", Checked = true }); layout.Add(allowCollapsing = new CheckBox{ Text = "Allow Collapsing", Checked = true }); layout.Add(null); layout.EndHorizontal(); layout.EndVertical(); layout.EndHorizontal(); layout.AddRow(new Label{ Text = "Simple" }, Default()); layout.AddRow(new Label{ Text = "With Images\n&& Context Menu" }, ImagesAndMenu()); layout.AddRow(new Label{ Text = "Disabled" }, Disabled()); layout.Add(null, false, true); Content = layout; }
Control ConnectPathControl() { var control = new CheckBox { Text = "Connect Paths" }; control.Bind(cb => cb.Checked, this, r => r.ConnectPath); control.CheckedChanged += Refresh; return control; }
public RpcServerSettingsManager(string title, string rpcUrlHost, ushort rpcUrlPort, bool isProcessHostedLocally) { Text = title; TextBoxRpcUrlHost = new TextBox { Text = rpcUrlHost }; CheckBoxIsProcessHostedLocally = new CheckBox { Text = Desktop.Properties.Resources.OptionsNetworkIsProcessHostedLocally, Checked = isProcessHostedLocally }; RpcUrlPort = rpcUrlPort; Content = new TableLayout( new TableLayout( new TableRow( new Label { Text = Desktop.Properties.Resources.TextHost }, new TableCell(TextBoxRpcUrlHost, true), new Separator(SeparatorOrientation.Vertical), new Label { Text = Desktop.Properties.Resources.TextPort }, Utilities.CreateNumericUpDown(this, o => o.RpcUrlPort, 0, 1, ushort.MaxValue) ) ) { Spacing = Utilities.Spacing3 }, new TableRow(CheckBoxIsProcessHostedLocally) ) { Padding = new Padding(Utilities.Padding2), Spacing = Utilities.Spacing3 }; }
void LogEvents(CheckBox control) { control.CheckedChanged += delegate { Log.Write(control, "CheckedChanged, Value: {0}", control.Checked); }; }
Control CreateTypeControls() { typeRadio = new RadioButtonList { Items = { new ListItem { Text = "Form (modeless)", Key = "form" }, new ListItem { Text = "Dialog (modal)", Key = "dialog" } }, SelectedKey = "form" }; setOwnerCheckBox = new CheckBox { Text = "Set Owner", Checked = false }; setOwnerCheckBox.CheckedChanged += (sender, e) => { if (child != null) child.Owner = setOwnerCheckBox.Checked ?? false ? ParentWindow : null; }; return new StackLayout { Orientation = Orientation.Horizontal, Items = { typeRadio, setOwnerCheckBox } }; }
Control CloseFiguresControl() { var control = new CheckBox { Text = "Close Figures" }; control.Bind(cb => cb.Checked, this, r => r.CloseFigures); control.CheckedChanged += Refresh; return control; }
Control Default () { var control = new CheckBox { Text = "Default" }; LogEvents (control); return control; }
protected virtual void LogEvents(CheckBox control) { control.CheckedChanged += delegate { Log.Write (control, "CheckedChanged"); }; LogEvents ((Control)control); }
Control ThreeState () { var control = new CheckBox { Text = "Three State", ThreeState = true }; LogEvents (control); return control; }
Control Disabled () { var control = new CheckBox { Text = "Disabled", Enabled = false }; LogEvents (control); return control; }
Control SetInitialValue () { var control = new CheckBox{ Text = "Set initial value", Checked = true }; LogEvents (control); return control; }
void Init() { _checkBoxIsParamRandom = new CheckBox() { Text = AltStrRes.IsParamRandom }; var layout = new DynamicLayout { Padding = new Padding(20, 20), Spacing = new Size(10, 10) }; layout.AddRow(_checkBoxIsParamRandom); layout.Add(null); Content = layout; }
Control ThreeStateInitialValue () { var control = new CheckBox { Text = "Three State with Initial Value", ThreeState = true, Checked = null }; LogEvents (control); return control; }
public Control Checkbox() { var control = new CheckBox { Text = "Use Offscreen Bitmap", Checked = UseOffScreenBitmap, }; control.CheckedChanged += (sender, e) => UseOffScreenBitmap = control.Checked ?? false; return control; }
void Init() { //_textAreaWelcome _textAreaWelcome = new TextArea() {Size = new Size(418, 277), Text = AltStrRes.Disclaimer}; _textAreaWelcome.Wrap = true; _textAreaWelcome.Enabled = false; //_checkBoxNoDisplay _checkBoxNoDisplay = new CheckBox() { Text = AltStrRes.DontDisplayAgain}; //_buttonNo _buttonNo = new Button() { Text = AltStrRes.No}; _buttonNo.Click += delegate { if (_checkBoxNoDisplay.Checked == true) { _setting.IsShowDisclaimer = false; //保存Setting到xml InitWorker.SaveSettingToXml(AppEnvironment.AppPath, _setting); //重新初始化GlobalSetting InitWorker.InitGlobalSetting(AppEnvironment.AppPath); } //Application.Instance.Quit(); Environment.Exit(0); }; //_buttonYes _buttonYes = new Button() {Text = AltStrRes.Yes}; _buttonYes.Click += delegate { if (_checkBoxNoDisplay.Checked == true) { _setting.IsShowDisclaimer = false; //保存Setting到xml InitWorker.SaveSettingToXml(AppEnvironment.AppPath, _setting); //重新初始化GlobalSetting InitWorker.InitGlobalSetting(AppEnvironment.AppPath); } Close(); }; var layout = new DynamicLayout(); layout.AddRow(_textAreaWelcome); layout.AddSeparateRow(_checkBoxNoDisplay,null, _buttonNo, _buttonYes); layout.AddRow(null); Content = layout; Size = new Size(460,370); Icon = Icons.AltmanIcon; ShowInTaskbar = true; Title = AltStrRes.Welcome; }
Control Resizable() { resizableCheckBox = new CheckBox { Text = "Resizable", Checked = true }; resizableCheckBox.CheckedChanged += (sender, e) => { if (child != null) child.Resizable = resizableCheckBox.Checked ?? false; }; return resizableCheckBox; }
void Init() { _checkBoxIsRandom = new CheckBox { Text = AltStrRes.IsUserAgentRandom }; _comboBoxUserAgentList = new ComboBox {Width = 300}; var layout = new DynamicLayout { Padding = new Padding(20, 20), Spacing = new Size(10, 10) }; layout.AddRow(_checkBoxIsRandom); layout.AddRow(new Label { Text = AltStrRes.UserAgentList }); layout.AddRow(_comboBoxUserAgentList, null); layout.Add(null); this.Content = layout; }
public DynamicFocusSection() { var content = new Panel(); var focusControlCheckBox = new CheckBox { Text = "Focus Control", Checked = true }; var addContentButton = new Button { Text = "Add Control" }; var controls = new List<Func<Control>> { () => new TextBox(), () => new TextArea(), () => new CheckBox { Text = "A Check Box" }, () => new RadioButton { Text = "A Radio Button" }, () => new DropDown { Items = { "Item 1", "Item 2", "Item 3" } }, () => new DateTimePicker(), () => new ColorPicker(), () => new PasswordBox(), () => new ListBox { Items = { "Item 1", "Item 2", "Item 3" } }, () => new NumericUpDown(), }; var count = 0; addContentButton.Click += (sender, e) => { Control control = controls[(count++) % controls.Count](); if (focusControlCheckBox.Checked ?? false) control.Focus(); content.Content = new TableLayout( null, new Label { Text = string.Format("Control: {0}", control.GetType().Name) }, new TableRow(control), null ); }; Content = new TableLayout { Spacing = new Size(5, 5), Padding = new Padding(10), Rows = { new StackLayout { Orientation = Orientation.Horizontal, Spacing = 5, Items = { addContentButton, focusControlCheckBox } }, content } }; }
public SplitterSection() { var layout = new DynamicLayout { DefaultSpacing = new Size(5, 5), Padding = new Padding(10) }; layout.Add(null); var xthemed = new CheckBox { Text = "Use Themed Splitter" }; layout.AddCentered(xthemed); layout.AddSeparateRow(null, Test1WithSize(), Test1AutoSize(), null); layout.AddSeparateRow(null, Test1WithFullScreenAndSize(), Test1FullScreenAndAutoSize(), null); layout.AddSeparateRow(null, Test2WithSize(), Test2AutoSize(), null); layout.AddCentered(TestDynamic()); layout.AddCentered(TestInitResize()); layout.AddCentered(TestHiding()); layout.Add(null); Content = layout; xthemed.CheckedChanged += (s, e) => { useThemed = xthemed.Checked == true; }; }
public DynamicFocusSection() { var content = new Panel(); var focusControlCheckBox = new CheckBox { Text = "Focus Control", Checked = true }; var addContentButton = new Button { Text = "Add Control" }; var count = 0; addContentButton.Click += (sender, e) => { Control control; switch((count++) % 9) { case 0: control = new TextBox(); break; case 1: control = new TextArea(); break; case 2: control = new CheckBox { Text = "A Check Box" }; break; case 3: control = new RadioButton { Text = "A Radio Button" }; break; case 4: control = new DropDown { Items = { "Item 1", "Item 2", "Item 3" } }; break; case 5: control = new DateTimePicker(); break; case 6: control = new ColorPicker(); break; case 7: control = new PasswordBox(); break; case 8: control = new ListBox { Items = { "Item 1", "Item 2", "Item 3" } }; break; case 9: control = new PasswordBox(); break; default: throw new InvalidOperationException(); } if (focusControlCheckBox.Checked ?? false) control.Focus(); content.Content = new TableLayout( null, new Label { Text = string.Format("Control: {0}", control.GetType().Name) }, new TableRow(control), null ); }; Content = new TableLayout( new TableLayout(new TableRow(null, addContentButton, focusControlCheckBox, null)), content ); }
public ExpanderSection() { var expandedCheckBox = new CheckBox { Text = "Expanded" }; var expander = new Expander { Header = "Test Header", Content = new Panel { Size = new Size(200, 200), BackgroundColor = Colors.Blue } }; expandedCheckBox.CheckedBinding.Bind(expander, e => e.Expanded); LogEvents(expander); var expander2 = new Expander { Header = new StackLayout { Orientation = Orientation.Horizontal, Items = { "Test Expanded with custom header", new TextBox() } }, Expanded = true, Content = new Panel { Size = new Size(300, 200), BackgroundColor = Colors.Blue } }; LogEvents(expander2); Content = new StackLayout { Padding = new Padding(10), Items = { expandedCheckBox, expander, expander2 } }; }
void Init() { _dropDownLang = new DropDown {Width = 200}; var lanList = new List<IListItem> { new ListItem {Text = "EN",Key="EN"}, new ListItem {Text = "CN",Key="CN"} }; _dropDownLang.Items.AddRange(lanList); _checkBoxIsShowDisclaimer = new CheckBox { Text = AltStrRes.IsShowDisclaimer }; _checkBoxIsOpenIPythonSupport = new CheckBox {Text = AltStrRes.IsOpenIPythonSupport}; var layout = new DynamicLayout {Padding = new Padding(20, 20), Spacing = new Size(10, 10)}; layout.AddSeparateRow( new Label {Text = AltStrRes.Language, VerticalAlign = VerticalAlign.Middle}, _dropDownLang, null); layout.AddRow(_checkBoxIsShowDisclaimer, null); layout.AddRow(_checkBoxIsOpenIPythonSupport, null); layout.Add(null); Content = layout; }
Control WithContent() { var control = new CheckBox() { Text = "With Content" }; control.CheckedChanged += (s, e) => { drawable.Content = ( (CheckBox)s ).Checked == true ? TableLayout.AutoSized( new Label() { Text = "Some text", BackgroundColor = Colors.Transparent }, centered: true ).With(tl => tl.BackgroundColor = Color.FromArgb(0x40000000)) : null; }; return control; }
Control UseBackgroundColorControl() { var control = new CheckBox { Text = "Use Background Color" }; control.CheckedBinding.Bind(() => UseBackgroundColor, v => UseBackgroundColor = v ?? false); return control; }
Control AutoConnectButton () { var control = new CheckBox { Text = "Connect on Startup" }; control.Bind ("Checked", "ConnectOnStartup", DualBindingMode.OneWay); return control; }
Control EnabledCheck() { var control = new CheckBox { Text = "Enabled", Checked = treeView.Enabled }; control.CheckedChanged += (sender, e) => treeView.Enabled = control.Checked ?? false; return control; }
Control LabelEditCheck() { var control = new CheckBox { Text = "LabelEdit", Checked = treeView.LabelEdit }; control.CheckedChanged += (sender, e) => treeView.LabelEdit = control.Checked ?? false; return control; }
Control CancelLabelEdit() { var control = new CheckBox { Text = "Cancel Edit" }; control.CheckedChanged += (sender, e) => cancelLabelEdit = control.Checked ?? false; return control; }
Control CreateMinimumSizeControls() { var setMinimumSize = new CheckBox { Text = "MinimumSize" }; setMinimumSize.CheckedBinding.Bind(() => setInitialMinimumSize, v => { setInitialMinimumSize = v ?? false; if (v == true && child != null) child.MinimumSize = initialMinimumSize; }); var width = new NumericUpDown(); width.Bind(c => c.Enabled, setMinimumSize, c => c.Checked); width.ValueBinding.Bind(() => initialMinimumSize.Width, v => { initialMinimumSize.Width = (int)v; if (child != null) child.MinimumSize = initialMinimumSize; }); var height = new NumericUpDown(); height.Bind(c => c.Enabled, setMinimumSize, c => c.Checked); height.ValueBinding.Bind(() => initialMinimumSize.Height, v => initialMinimumSize.Height = (int)v); return new StackLayout { Orientation = Orientation.Horizontal, Items = { setMinimumSize, width, height } }; }