public static Dialog Create(string message) { var dialog = new Dialog { Icon = AppImages.Xf, Title = AppResource.Error_dialog_title, Padding = AppStyles.WindowPadding, Width = 500, Height = 400, }; var container = new TableLayout(1, 3) { Spacing = new Size(0, 10) }; var about = new Label { Text = AboutResource.Save_log_before_termination }; var txtCtrl = new TextArea { ReadOnly = true, Text = message, Wrap = true }; var ok = new Button { Text = CommonResource.Ok }; var export = new LinkButton { Text = AboutResource.Export_log_and_trace }; export.Click += (s, e) => { SaveLogDialog.Show(message); }; container.Add(about, 0, 0, true, false); container.Add(txtCtrl, 0, 1, true, true); var btnRow = new TableLayout(3, 1) { Spacing = new Size(6, 0) }; btnRow.Add(export, 0, 0, false, false); btnRow.Add(null, 1, 0, true, false); btnRow.Add(ok, 2, 0, false, false); container.Add(btnRow, 0, 2, true, false); dialog.Content = container; ok.Click += (s, e) => dialog.Close(); return(dialog); }
private void DefineLayout() { var containingLayout = new TableLayout(1, 3); var filterLayout = new TableLayout(2, 1) { Padding = new Padding(5) }; var exportLayout = new TableLayout(4, 1) { Padding = new Padding(10), Spacing = new Size(10, 0) }; var okBtn = new Button { Text = CommonResource.Ok }; var clearBtn = new LinkButton { Text = LoggingResource.Clear }; _control = new SearchBox { PlaceholderText = LoggingResource.Search_logs, Width = 200 }; filterLayout.Add(null, 0, 0, true, false); filterLayout.Add(_control, 1, 0, false, false); var exportBtn = new LinkButton { Text = LoggingResource.Export_log }; exportLayout.Add(exportBtn, 0, 0, false, false); exportLayout.Add(clearBtn, 1, 0, false, false); exportLayout.Add(null, 2, 0, true, false); exportLayout.Add(okBtn, 3, 0, false, false); exportBtn.Click += (s, e) => { SaveLogDialog.Show(); }; clearBtn.Click += (s, e) => { ToolboxApp.Log.ClearLiveLog(); PopulateGridView(); }; _gridView = new GridView { AllowColumnReordering = false, ShowHeader = true, }; _gridView.Columns.Add(new GridColumn { HeaderText = LoggingResource.Header_time, AutoSize = true, DataCell = new TextBoxCell { Binding = new DelegateBinding <LogItem, string>(i => FormatEventTime(i.EventTime)) }, Editable = false, Sortable = false }); _gridView.Columns.Add(new GridColumn { HeaderText = LoggingResource.Header_severity, AutoSize = true, DataCell = new TextBoxCell { Binding = new DelegateBinding <LogItem, string>(i => i.Severity) }, Editable = false, Sortable = false }); _gridView.Columns.Add(new GridColumn { HeaderText = LoggingResource.Header_description, AutoSize = true, DataCell = new TextBoxCell { Binding = new DelegateBinding <LogItem, string>(i => i.Description) }, Editable = false, Sortable = false }); containingLayout.Add(filterLayout, 0, 0, true, false); containingLayout.Add(_gridView, 0, 1, true, true); containingLayout.Add(exportLayout, 0, 2, false, false); var size = new Size(850, 400); _dialog = new Dialog { Icon = AppImages.Xf, Title = LoggingResource.Dialog_title, Content = containingLayout, ClientSize = size, MinimumSize = size, Maximizable = false, Resizable = true, AbortButton = okBtn }; okBtn.Click += (sender, args) => _dialog.Close(); }