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 ChannelListDialog (Server server) { this.ClientSize = new Size (600, 400); this.Resizable = true; this.Title = "Channel List"; grid = new GridView { AllowMultipleSelection = false }; grid.MouseDoubleClick += HandleMouseDoubleClick; grid.Columns.Add (new GridColumn { DataCell = new TextBoxCell ("Name"), HeaderText = "Channel", Width = 150, AutoSize = false }); grid.Columns.Add (new GridColumn { DataCell = new TextBoxCell ("UserCount"), HeaderText = "Users", Width = 60, AutoSize = false }); grid.Columns.Add (new GridColumn { DataCell = new TextBoxCell ("Topic"), HeaderText = "Topic", Width = 350, AutoSize = false }); var layout = new DynamicLayout (this); layout.Add (grid, yscale: true); layout.BeginVertical (); layout.AddRow (null, this.CancelButton (), this.OkButton ("Join Channel", CanJoin)); layout.EndVertical (); var channelTask = server.GetChannelList (); channelTask.ContinueWith (task => { Application.Instance.AsyncInvoke (delegate { grid.DataStore = new GridItemCollection (task.Result.OrderBy (r => r.Name).OrderByDescending (r => r.UserCount)); }); }, System.Threading.Tasks.TaskContinuationOptions.OnlyOnRanToCompletion); }
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 TestProperties() { var layout = new DynamicLayout(); DateTimePicker min, max, current, setValue; Button setButton; layout.AddRow(new Label { Text = "Min Value" }, min = new DateTimePicker()); layout.AddRow(new Label { Text = "Max Value" }, max = new DateTimePicker()); layout.BeginHorizontal(); layout.Add(new Label { Text = "Set to value" }); layout.BeginVertical(); layout.BeginHorizontal(); layout.AddAutoSized(setValue = new DateTimePicker()); layout.Add(setButton = new Button { Text = "Set" }); layout.EndHorizontal(); layout.EndVertical(); layout.EndHorizontal(); layout.AddRow(new Label { Text = "Value" }, current = new DateTimePicker()); min.ValueChanged += (sender, e) => current.MinDate = min.Value ?? DateTime.MinValue; max.ValueChanged += (sender, e) => current.MaxDate = max.Value ?? DateTime.MaxValue; setButton.Click += (sender, e) => current.Value = setValue.Value; LogEvents(current); return layout; }
public BrushSection() { var layout = new DynamicLayout { DefaultSpacing = new Size(5, 5), Padding = new Padding(10) }; // defaults ScaleX = 100f; ScaleY = 100f; Center = new PointF(100, 50); GradientOrigin = new PointF(150, 80); Radius = new SizeF(100f, 50f); StartPoint = new PointF(50, 50); EndPoint = new PointF(100, 100); drawable = new Drawable { Size = new Size(450, 400) }; drawable.Paint += (sender, pe) => Draw(pe.Graphics); layout.AddSeparateRow(null, BrushControl(), UseBackgroundColorControl(), null); if (Platform.Supports<NumericUpDown>()) { matrixRow = layout.AddSeparateRow(null, new Label { Text = "Rot" }, RotationControl(), new Label { Text = "Sx" }, ScaleXControl(), new Label { Text = "Sy" }, ScaleYControl(), new Label { Text = "Ox" }, OffsetXControl(), new Label { Text = "Oy" }, OffsetYControl(), null); matrixRow.Table.Visible = false; } gradientRow = layout.AddSeparateRow(null, GradientWrapControl(), null); gradientRow.Table.Visible = false; radialRow = layout.AddSeparateRow(null, "Center:", CenterControl(), "GradientOrigin:", GradientOriginControl(), null); radiusRow = layout.AddSeparateRow(null, "Radius:", RadiusControl(), null); linearRow = layout.AddSeparateRow(null, "Start:", StartPointControl(), "End:", EndPointControl(), null); layout.AddSeparateRow(null, drawable, null); layout.Add(null); this.Content = layout; }
Control VerticalSection () { var layout = new DynamicLayout (new Panel { BackgroundColor = Color.Blue }); layout.Add (new Panel { Size = new Size (50, 60), BackgroundColor = Color.Green }); layout.Add (new Panel { Size = new Size (50, 60), BackgroundColor = Color.Green }); return layout.Container; }
public BitmapSection() { var layout = new DynamicLayout { DefaultSpacing = new Size(5, 5), Padding = new Padding(10) }; layout.AddRow( "Load from Stream", LoadFromStream(), "Custom 24-bit", CreateCustom24(), null ); layout.AddRow( "Custom 32-bit", CreateCustom32(), "Custom 32-bit alpha", CreateCustom32Alpha(), null ); layout.AddRow( "Clone", Cloning(), "Clone rectangle", TableLayout.AutoSized(CloneRectangle(), centered: true), null); layout.AddRow( "Draw to a rect", TableLayout.AutoSized(DrawImageToRect(), centered: true) ); layout.Add(null); Content = layout; }
void Init() { _tbxShellData = new TextArea {Size = new Size(-1, 200)}; _tbxMsg = new TextBox(); _btnShowMsgInStatus = new Button {Text = "Show Msg In Status", Width = 150}; _btnShowMsgInStatus.Click+=btn_showMsgInStatus_Click; _btnShowMessageBox = new Button { Text = "Show Msg In Message", Width = 150 }; _btnShowMessageBox.Click+=btn_showMessageBox_Click; _btnCreateNewTabPage = new Button { Text = "Create New TabPage", Width = 150 }; _btnCreateNewTabPage.Click+=btn_createNewTabPage_Click; // Test var btnTest = new Button {Text = "Test", Width = 150}; btnTest.Click += btnTest_Click; var layout = new DynamicLayout {Padding = new Padding(10, 10), Size = new Size(10, 10)}; layout.AddRow(new Label() { Text = "ShellData"}); layout.AddRow(_tbxShellData); layout.AddSeparateRow(new Label() { Text = "Msg", VerticalAlign = VerticalAlign.Middle }, _tbxMsg, null); layout.AddAutoSized(_btnShowMsgInStatus); layout.AddAutoSized(_btnShowMessageBox); layout.AddAutoSized(_btnCreateNewTabPage); layout.AddAutoSized(btnTest); layout.Add(null); this.Content = layout; }
public PixelOffsetSection() { var layout = new DynamicLayout { DefaultSpacing = new Size(5, 5), Padding = new Padding(10) }; var drawable = new Drawable { Size = canvasSize }; drawable.Paint += (sender, pe) => { pe.Graphics.FillRectangle(Brushes.Black, pe.ClipRectangle); pe.Graphics.PixelOffsetMode = PixelOffsetMode.None; Draw(pe.Graphics); }; layout.AddRow(new Label { Text = "None (Default)" }, drawable); drawable = new Drawable { Size = canvasSize }; drawable.Paint += (sender, pe) => { pe.Graphics.FillRectangle(Brushes.Black, pe.ClipRectangle); pe.Graphics.PixelOffsetMode = PixelOffsetMode.Half; Draw(pe.Graphics); }; layout.AddRow(new Label { Text = "Half" }, drawable); layout.Add(null); Content = layout; }
public override Control Generate (DynamicLayout layout) { if (rows.Count == 0) return null; int cols = rows.Max (r => r.Items.Count); if (Container == null) { Container = new Panel (); this.Layout = new TableLayout (Container, cols, rows.Count); } else { this.Layout = new TableLayout (null, cols, rows.Count); Container.SetInnerLayout (); } var tableLayout = this.Layout; var padding = this.Padding ?? layout.DefaultPadding; if (padding != null) tableLayout.Padding = padding.Value; var spacing = this.Spacing ?? layout.DefaultSpacing; if (spacing != null) tableLayout.Spacing = spacing.Value; for (int cy = 0; cy < rows.Count; cy++) { var row = rows[cy]; for (int cx = 0; cx < row.Items.Count; cx++) { var item = row.Items[cx]; item.Generate (layout, tableLayout, cx, cy); } } return Container; }
public JabbRAuthDialog(string serverAddress, string appName) { this.ServerAddress = serverAddress; this.AppName = appName; this.DisplayMode = DialogDisplayMode.Attached; this.ClientSize = defaultSize; this.Resizable = true; this.Title = "JabbR Login"; var baseDir = Path.Combine(EtoEnvironment.GetFolderPath(EtoSpecialFolder.ApplicationResources), "Styles", "default"); webserver = new HttpServer(baseDir); LocalhostTokenUrl = new Uri(webserver.Url, "Authorize"); webserver.StaticContent.Add("/", AuthHtml(true)); webserver.StaticContent.Add("/Authorize", GetUserIDHtml()); webserver.ReceivedRequest += HandleReceivedRequest; web = new WebView(); web.DocumentLoaded += HandleDocumentLoaded; web.Url = webserver.Url; var layout = new DynamicLayout(); layout.Add(web, yscale: true); layout.AddSeparateRow(Padding.Empty).Add(null, this.CancelButton()); Content = layout; }
public BrushSection() { var layout = new DynamicLayout(); brush = solidBrush = Brushes.LightSkyBlue; gradientBrush = new LinearGradientBrush(Colors.AliceBlue, Colors.Black, new PointF(0, 0), new PointF(100f, 100f)); //gradientBrush = new LinearGradientBrush (new RectangleF (0, 0, 50, 50), Colors.AliceBlue, Colors.Black, 10); gradientBrush.Wrap = GradientWrapMode.Repeat; textureBrush = new TextureBrush(image, 0.5f); brush = textureBrush; ScaleX = 100f; ScaleY = 100f; drawable = new Drawable { Size = new Size(300, 200) }; drawable.Paint += (sender, pe) => Draw(pe.Graphics); layout.AddSeparateRow(null, BrushControl(), UseBackgroundColorControl(), null); if (Platform.Supports<NumericUpDown>()) { matrixRow = layout.AddSeparateRow(null, new Label { Text = "Rot" }, RotationControl(), new Label { Text = "Sx" }, ScaleXControl(), new Label { Text = "Sy" }, ScaleYControl(), new Label { Text = "Ox" }, OffsetXControl(), new Label { Text = "Oy" }, OffsetYControl(), null); matrixRow.Table.Visible = false; } gradientRow = layout.AddSeparateRow(null, GradientWrapControl(), null); gradientRow.Table.Visible = false; layout.AddSeparateRow(null, drawable, null); layout.Add(null); this.Content = layout; }
void Init() { //_textBoxUrl _textBoxUrl = new TextBox(); //_buttonReadFile _buttonReadFile = new Button { Text = StrRes.GetString("StrLoad", "Load") }; _buttonReadFile.Click += _buttonReadFile_Click; //_buttonSaveFile _buttonSaveFile = new Button {Text = StrRes.GetString("StrSave","Save")}; _buttonSaveFile.Click += _buttonSaveFile_Click; //_textAreaBody _textAreaBody = new TextArea(); var layout = new DynamicLayout { Padding = new Padding(5, 5), Spacing = new Size(5, 5) }; layout.BeginVertical(); layout.BeginHorizontal(); layout.AddCentered(_textBoxUrl, xscale: true, horizontalCenter: false); layout.AddCentered(_buttonReadFile, horizontalCenter: false); layout.AddCentered(_buttonSaveFile, horizontalCenter: false); layout.EndBeginHorizontal(); layout.EndVertical(); layout.AddRow(_textAreaBody); Content = layout; }
Control VerticalSection() { var layout = new DynamicLayout { BackgroundColor = Colors.Blue }; layout.Add(new Panel { Size = new Size(50, 60), BackgroundColor = Colors.Lime }); layout.Add(new Panel { Size = new Size(50, 60), BackgroundColor = Colors.Lime }); return layout; }
public BadgeLabelSection () { var layout = new DynamicLayout (this); layout.AddRow (null, SetBadgeLabel (), null); layout.Add (null); }
public void RemoveItemsIndividuallyShouldClearParent() { TestBase.Invoke(() => { var layout = new DynamicLayout(); var items = new Control[] { new Label(), new Button(), new TextBox() }; foreach (var item in items) layout.Add(item); CollectionAssert.AreEqual(items, layout.Children, "#1. Items do not match"); foreach (var item in items) Assert.AreEqual(layout, item.Parent, "#2. Items should have parent set to dynamic layout"); layout.Rows.RemoveAt(0); Assert.IsNull(items[0].Parent, "#3. Item should have parent cleared when removed from dynamic layout"); layout.Rows[0] = new Button(); Assert.IsNull(items[1].Parent, "#4. Item should have parent cleared when replaced with another item in the dynamic layout"); Assert.AreEqual(layout, items[2].Parent, "#5. Item should not have changed parent as it is still in the dynamic layout"); }); }
public TextureBrushesSection() { var layout = new DynamicLayout(); for (var i = 0; i < 10; ++i) { var w = image.Size.Width / 3; // same as height var img = image; if (i > 0) img = img.Clone(new Rectangle((i - 1) % 3 * w, (i - 1) / 3 * w, w, w)); var brush = new TextureBrush(img); var drawable = new Drawable { Size = image.Size * 2 }; drawable.Paint += (s, e) => { var destRect = new RectangleF(new PointF(100, 100), image.Size); var temp = brush.Transform; // save state brush.Transform = Matrix.FromRotation(90); e.Graphics.TranslateTransform(destRect.Location); e.Graphics.FillRectangle(brush, new RectangleF(destRect.Size)); brush.Transform = temp; }; layout.AddRow(drawable); } layout.Add(null); Content = layout; }
public GridViewSection() { var layout = new DynamicLayout(); layout.AddRow(new Label { Text = "Default" }, Default()); layout.AddRow(new Label { Text = "No Header,\nNon-Editable" }, NoHeader()); #if DESKTOP layout.BeginHorizontal(); layout.Add(new Label { Text = "Context Menu\n&& Multi-Select\n&& Filter" }); layout.BeginVertical(); layout.Add(filterText = new SearchBox { PlaceholderText = "Filter" }); var withContextMenuAndFilter = WithContextMenuAndFilter(); layout.Add(withContextMenuAndFilter); layout.EndVertical(); layout.EndHorizontal(); var selectionGridView = Default(addItems: false); layout.AddRow(new Label { Text = "Selected Items" }, selectionGridView); // hook up selection of main grid to the selection grid withContextMenuAndFilter.SelectionChanged += (s, e) => { var items = new DataStoreCollection(); items.AddRange(withContextMenuAndFilter.SelectedItems); selectionGridView.DataStore = items; }; #endif Content = layout; }
public TabControlSection () { var layout = new DynamicLayout (this); layout.Add (DefaultTabs ()); }
public RuntimeSection () { var layout = new DynamicLayout (this); layout.AddCentered (ToggleButton ()); layout.Add (MainTable ()); }
Control ExpandedHeight() { var layout = new DynamicLayout(); layout.Add(new Label { BackgroundColor = Colors.Red, Text = "Expanded Height" }); return new Scrollable { ExpandContentWidth = false, Content = layout }; }
Dialog CreateDialog() { var dialog = new Dialog(); dialog.DisplayMode = DisplayMode; var layout = new DynamicLayout(); layout.AddCentered(new Label { Text = "Content" }, yscale: true); dialog.DefaultButton = new Button { Text = "Default Button" }; dialog.AbortButton = new Button { Text = "Abort Button" }; dialog.DefaultButton.Click += delegate { MessageBox.Show("Default button clicked"); }; dialog.AbortButton.Click += delegate { MessageBox.Show("Abort button clicked"); dialog.Close(); }; layout.BeginVertical(); layout.AddRow(null, dialog.DefaultButton, dialog.AbortButton); layout.EndVertical(); dialog.Content = layout; return dialog; }
public ServerDialog (Server server, bool isNew, bool allowConnect) { this.isNew = isNew; this.allowConnect = allowConnect && !isNew; this.Server = server; this.Title = "Add Server"; this.MinimumSize = new Size (300, 0); this.DataContext = server; var layout = new DynamicLayout (this); layout.BeginVertical (); layout.AddRow (new Label { Text = "Server Name"}, ServerName ()); // generate server-specific edit controls server.GenerateEditControls (layout, isNew); layout.AddRow (null, AutoConnectButton()); layout.EndBeginVertical (); layout.AddRow (Connect (), Disconnect (), null, cancelButton = this.CancelButton (), this.OkButton ("Save", () => SaveData())); layout.EndVertical (); SetVisibility (); }
public About () { this.Title = "About Eto Test"; #if DESKTOP this.Resizable = true; #endif var layout = new DynamicLayout (this); layout.AddCentered(new ImageView{ Image = Icon.FromResource ("Eto.Test.TestIcon.ico"), Size = new Size(128, 128) }, true, true); layout.Add (new Label{ Text = "Test Application", Font = new Font(FontFamily.Sans, 16, FontStyle.Bold), HorizontalAlign = HorizontalAlign.Center }); var version = Assembly.GetEntryAssembly ().GetName ().Version; layout.Add (new Label { Text = string.Format("Version {0}", version), HorizontalAlign = HorizontalAlign.Center }); layout.Add (new Label{ Text = "Copyright 2011 by Curtis Wensley aka Eto", HorizontalAlign = HorizontalAlign.Center }); layout.AddCentered (CloseButton ()); }
protected virtual Control CreateLayout() { var layout = new DynamicLayout(Padding.Empty, Size.Empty); layout.Add(History, yscale: true); layout.Add(new Panel { Content = TextEntry, Padding = new Padding(10) }); return layout; }
public AboutDialog() { this.MinimumSize = new Size(250, 250); var smallFont = new Font(SystemFont.Default, 10); var largeFont = new Font(SystemFont.Bold, 14); var version = GetType().Assembly.GetName().Version; var versionString = string.Format("Version {0}.{1} ({2}.{3})", version.Major, version.Minor, version.Build, version.Revision); var layout = new DynamicLayout(); layout.AddCentered(new ImageView { Image = Icon.FromResource ("JabbR.Desktop.Resources.JabbR.ico"), Size = new Size(128, 128) }, yscale: true); layout.AddCentered(new Label { Text = Application.Instance.Name, Font = largeFont }); layout.AddCentered(new Label { Text = versionString, Font = smallFont }, new Padding(2)); layout.AddCentered(new Label { Text = "Copyright © 2013 Curtis Wensley", Font = smallFont }, new Padding(2)); if (!Generator.IsMac) { layout.AddCentered(CloseButton()); } Content = layout; }
public BitmapSection() { var layout = new DynamicLayout(); layout.AddRow(new Label { Text = "Load from Stream" }, LoadFromStream()); layout.AddRow( new Label { Text = "Custom 32-bit" }, CreateCustom32(), new Label { Text = "Custom 32-bit alpha" }, CreateCustom32Alpha(), null ); layout.AddRow( new Label { Text = "Clone" }, Cloning(), new Label { Text = "Clone rectangle" }, TableLayout.AutoSized(CloningRectangle(), centered: true), null); layout.AddRow( new Label { Text = "Clone using tiles" }, TableLayout.AutoSized(CloneTiles(), centered: true), new Label { Text = "Draw to a rect" }, TableLayout.AutoSized(DrawImageToRect(), centered: true), null); layout.Add(null); Content = layout; }
public TransformSection() { image = TestIcons.TestIcon; font = Fonts.Sans(10); var layout = new DynamicLayout(); var drawable = new Drawable { Size = canvasSize }; drawable.Paint += (sender, pe) => { pe.Graphics.FillRectangle(Brushes.Black, pe.ClipRectangle); MatrixTests(pe.Graphics); }; layout.AddRow(new Label { Text = "Matrix" }, drawable); drawable = new Drawable { Size = canvasSize }; drawable.Paint += (sender, pe) => { pe.Graphics.FillRectangle(Brushes.Black, pe.ClipRectangle); DirectTests(pe.Graphics); }; layout.AddRow(new Label { Text = "Direct" }, drawable); layout.Add(null); var m = Matrix.Create(); m.Scale(100, 100); var m2 = m.Clone(); m2.Translate(10, 10); if (m == m2) throw new Exception("Grr!"); Content = layout; }
public About () { this.Title = "About Eto Test"; #if DESKTOP this.Resizable = true; #endif var layout = new DynamicLayout (this, new Padding (20, 5), new Size(10, 10)); layout.AddCentered(new ImageView{ Image = Icon.FromResource ("Eto.Test.TestIcon.ico") }, true, true); layout.Add (new Label{ Text = "Test Application", Font = new Font(SystemFont.Bold, 16), HorizontalAlign = HorizontalAlign.Center }); var version = Assembly.GetEntryAssembly ().GetName ().Version; layout.Add (new Label { Text = string.Format("Version {0}", version), Font = new Font(SystemFont.Default, 8), HorizontalAlign = HorizontalAlign.Center }); layout.Add (new Label{ Text = "Copyright 2011 by Curtis Wensley aka Eto", Font = new Font(SystemFont.Default, 8), HorizontalAlign = HorizontalAlign.Center }); layout.AddCentered (CloseButton ()); }
public PrintDialogSection() { this.DataContext = settings; var layout = new DynamicLayout { DefaultSpacing = new Size(5, 5), Padding = new Padding(10) }; layout.BeginVertical(); layout.BeginHorizontal(); layout.Add(null); layout.BeginVertical(Padding.Empty); layout.AddSeparateRow(null, ShowPrintDialog(), null); layout.AddSeparateRow(null, PrintFromGraphicsWithDialog(), null); layout.AddSeparateRow(null, PrintFromGraphics(), null); layout.EndBeginVertical(); layout.Add(PrintDialogOptions()); layout.Add(null); layout.EndVertical(); layout.Add(null); layout.EndHorizontal(); layout.EndVertical(); layout.AddSeparateRow(null, PageRange(), Settings(), null); layout.Add(null); Content = layout; }
private Dialog_Error(HoneybeeSchema.ValidationReport report) { this.Title = $"Validation Report - {DialogHelper.PluginName}"; this.Width = 800; this.Icon = DialogHelper.HoneybeeIcon; _vm = new ErrorViewModel(report, this); _grid = GenGridView(); var nextBtn = new Button() { Text = ">>" }; var currentErrorIndex = new Label(); var preBtn = new Button() { Text = "<<" }; var showBtn = new Button() { Text = "Show" }; var showParentBtn = new Button() { Text = "Show Parent" }; var moreInfoBtn = new Button() { Text = "More Info" }; var message = new TextArea() { Height = 84 }; message.TextBinding.Bind(_vm, _ => _.CurrentErrorMessage); currentErrorIndex.TextBinding.Bind(_vm, _ => _.CurrentErrorIndex); nextBtn.Bind(_ => _.Enabled, _vm, _ => _.NextBtnEnabled); preBtn.Bind(_ => _.Enabled, _vm, _ => _.PreBtnEnabled); moreInfoBtn.Bind(_ => _.Enabled, _vm, _ => _.MoreBtnEnabled); showBtn.Bind(_ => _.Enabled, _vm, _ => _.ShowBtnEnabled); showParentBtn.Bind(_ => _.Enabled, _vm, _ => _.ShowParentBtnEnabled); nextBtn.Command = _vm.NextBtnCommand; preBtn.Command = _vm.PreBtnCommand; moreInfoBtn.Command = _vm.ErrorLinkCommand; showBtn.Command = _vm.ShowCommand; showParentBtn.Command = _vm.ShowParentCommand; //errorLink.Command = _vm.ErrorLinkCommand; var group = new GroupBox(); group.Bind(_ => _.Text, _vm, _ => _.TotalErrorMessage); group.Size = new Eto.Drawing.Size(-1, -1); var groupLayout = new DynamicLayout(); groupLayout.DefaultSpacing = new Eto.Drawing.Size(5, 5); groupLayout.DefaultPadding = new Eto.Drawing.Padding(5); groupLayout.AddSeparateRow(_grid); groupLayout.AddSeparateRow(preBtn, currentErrorIndex, nextBtn, null, showBtn, showParentBtn, moreInfoBtn); groupLayout.AddSeparateRow(message); group.Content = groupLayout; var validateBtn = new Eto.Forms.Button() { Text = "Re-Validate" }; validateBtn.Bind(_ => _.Visible, _vm, _ => _.ValidateBtnEnabled); validateBtn.Command = _vm.ValidateCommand; var abortButton = new Eto.Forms.Button() { Text = "Close", Height = 24 }; abortButton.Click += (s, e) => { this.Close(); }; var layout = new Eto.Forms.DynamicLayout(); layout.DefaultSpacing = new Eto.Drawing.Size(5, 2); layout.DefaultPadding = new Eto.Drawing.Padding(4); layout.AddSeparateRow(controls: new[] { group }, xscale: true, yscale: true); layout.AddSeparateRow(null, validateBtn, abortButton); this.Content = layout; _vm.UILoaded(); }
public Dialog_Legend(LegendParameter parameter, Action <LegendParameter> previewAction = default) { this.Title = $"Legend Parameters - {DialogHelper.PluginName}"; this.Width = 400; this.Icon = DialogHelper.HoneybeeIcon; _vm = new LegendViewModel(parameter, this); var title = new TextBox(); var x = new Eto.Forms.NumericStepper() { MinValue = 0 }; var y = new Eto.Forms.NumericStepper() { MinValue = 0 }; var w = new Eto.Forms.NumericStepper() { MinValue = 1 }; var h = new Eto.Forms.NumericStepper() { MinValue = 1 }; var fontH = new Eto.Forms.NumericStepper() { MinValue = 1 }; var fontColor = new Button(); var decimalPlaces = new Eto.Forms.NumericStepper() { DecimalPlaces = 0, MinValue = 0 }; title.TextBinding.Bind(_vm, _ => _.Title); x.ValueBinding.Bind(_vm, _ => _.X); y.ValueBinding.Bind(_vm, _ => _.Y); w.ValueBinding.Bind(_vm, _ => _.W); h.ValueBinding.Bind(_vm, _ => _.H); fontH.ValueBinding.Bind(_vm, _ => _.FontHeight); fontColor.Bind(_ => _.BackgroundColor, _vm, _ => _.FontColor); fontColor.Command = _vm.FontColorCommand; decimalPlaces.ValueBinding.Bind(_vm, _ => _.DecimalPlaces); var minNum = new Eto.Forms.NumericStepper() { MaximumDecimalPlaces = 5 }; var maxNum = new Eto.Forms.NumericStepper() { MaximumDecimalPlaces = 5 }; var numSeg = new Eto.Forms.NumericStepper() { DecimalPlaces = 0, MinValue = 1 }; var continuous = new CheckBox(); var horizontal = new CheckBox(); minNum.ValueBinding.Bind(_vm, _ => _.Min); maxNum.ValueBinding.Bind(_vm, _ => _.Max); numSeg.ValueBinding.Bind(_vm, _ => _.NumSeg); continuous.CheckedBinding.Bind(_vm, _ => _.Continuous); horizontal.CheckedBinding.Bind(_vm, _ => _.IsHorizontal); minNum.Bind(_ => _.Enabled, _vm, _ => _.IsNumberValues); maxNum.Bind(_ => _.Enabled, _vm, _ => _.IsNumberValues); numSeg.Bind(_ => _.Enabled, _vm, _ => _.IsNumberValues); continuous.Bind(_ => _.Enabled, _vm, _ => _.IsNumberValues); var colorPanel = GenColorControl(); var tb = new TabControl(); tb.Pages.Add(new TabPage(colorPanel) { Text = "Colors" }); var general = new DynamicLayout(); general.Height = 280; general.DefaultSpacing = new Eto.Drawing.Size(5, 5); general.DefaultPadding = new Eto.Drawing.Padding(5); general.AddRow("Font height:", fontH); general.AddRow("Font color:", fontColor); general.AddRow("Location X:", x); general.AddRow("Location Y:", y); general.AddRow("Width:", w); general.AddRow("Height:", h); general.AddRow("Decimal places", decimalPlaces); general.AddRow(null, null); tb.Pages.Add(new TabPage(general) { Text = "Settings" }); var OkBtn = new Eto.Forms.Button() { Text = "OK" }; OkBtn.Click += (s, e) => { if (_vm.Validate()) { var lg = _vm.GetLegend(); this.Close(lg); } }; this.AbortButton = new Eto.Forms.Button() { Text = "Cancel" }; this.AbortButton.Click += (s, e) => { this.Close(); }; var preview = new Button() { Text = "Preview", Visible = previewAction != default }; preview.Click += (s, e) => { if (_vm.Validate()) { var lg = _vm.GetLegend(); previewAction?.Invoke(lg); } }; var layout = new Eto.Forms.DynamicLayout(); layout.DefaultSpacing = new Eto.Drawing.Size(5, 2); layout.DefaultPadding = new Eto.Drawing.Padding(4); layout.AddSeparateRow("Legend title:", title); layout.AddSeparateRow("Maximum:", maxNum); layout.AddSeparateRow("Minimum:", minNum); layout.AddSeparateRow("Number of segment:", numSeg); layout.AddSeparateRow("Continuous colors:", continuous); layout.AddSeparateRow("Horizontal:", horizontal); layout.AddSeparateRow(tb); //layout.AddSeparateRow("Font height:", fontH, null, "Font color:", fontColor); //layout.AddSeparateRow("X:", x, "Y:", y, "W", w, "H", h); layout.AddSeparateRow(null, OkBtn, this.AbortButton, null, preview); layout.AddRow(null); this.Content = layout; }