public void SetButtons(System.Collections.Generic.IEnumerable <DialogButton> buttonList) { buttonBox.Clear(); foreach (var b in buttonList.OrderBy(b => b == DefaultButton).Reverse()) { var button = new Button { Font = Font.SystemFont }; var tb = b; button.Clicked += delegate { OnClicked(tb); }; button.MinWidth = 77; // Dialog buttons have a minimal width of 77px on Mac if (b.PackOrigin == PackOrigin.End) { buttonBox.PackEnd(button); } else { buttonBox.PackStart(button); } buttons [b] = button; UpdateButton(b, button); } }
public void SetButtons(System.Collections.Generic.IEnumerable <DialogButton> buttonList) { buttonBox.Clear(); foreach (var b in buttonList) { var button = new Button(); var tb = b; button.Clicked += delegate { OnClicked(tb); }; buttonBox.PackEnd(button); buttons [b] = button; UpdateButton(b, button); } if (minSize != Size.Zero) { SetMinSize(minSize); } }
private void Rebuild() { Layout.Clear(); //Layout.BackgroundColor = Xwt.Drawing.Colors.Bisque; for (int i = 0; i < _Values.Length; i++) { Object Item = _Values[i]; Widget lbl; lbl = MakeWidget(Item); //lbl.BackgroundColor = Xwt.Drawing.Colors.Chocolate; if (_Cols.Count() > i && i != _Cols.Count() - 1) { lbl.WidthRequest = _Cols[i].Width; lbl.Visible = _Cols[i].Visible; } Layout.PackStart(lbl); } }
internal async Task LoadSelectedSampleAsync() { await _controller.UpdateSampleDetail(); _titleValueLabel.Text = _controller.SelectedSample.Name; _descriptionValueLabel.Text = _controller.SelectedSample.Brief; _authorTitleLabel.Visible = false; _authorLabel.Visible = false; _platformsBox.Clear(); if (!string.IsNullOrEmpty(_controller.SelectedSample.SupportedPlatforms)) { var platforms = _controller.SelectedSample.SupportedPlatforms.Split(','); foreach (var platform in platforms) { var platformLabel = new Label($"- {platform}"); _platformsBox.PackStart(platformLabel); } } else { var platformLabel = new Label($"- {_controller.SelectedSampleRepository.Platform}"); _platformsBox.PackStart(platformLabel); } _tagsBox.Clear(); if (!string.IsNullOrEmpty(_controller.SelectedSample.Tags)) { var tags = _controller.SelectedSample.Tags.Split(','); foreach (var platform in tags) { var tagWidget = new TagWidget { Text = platform }; _tagsBox.PackStart(tagWidget); } } if (!string.IsNullOrEmpty(_controller.SelectedSample.Author)) { _authorTitleLabel.Visible = true; _authorLabel.Visible = true; _authorLabel.Text = _controller.SelectedSample.Author; } _continueButton.Sensitive = !string.IsNullOrEmpty(_controller.SelectedSample.Url); _previewView.Image = null; if (_controller.SelectedSample.Pictures.Any()) { var pictureUrl = _controller.SelectedSample.Pictures.First(); var picture = _controller.LoadPicture(pictureUrl); if (picture != null) { _previewView.Image = Image.FromStream(picture).WithBoxSize(420); } } }