void btnGenerate_Clicked(object sender, EventArgs e) { vboxResults.Clear(); Model.Uppercase = chkUppercase.Active; Model.NoDashes = chkNoDashes.Active; if (chkJoinResults.Active) { var result = new StringBuilder(); for (var i = 0; i < (int)spnNumberOfEntries.Value; i++) { result.AppendLine(Model.GenerateUuid()); } AddResult(1, (int)spnNumberOfEntries.Value, result.ToString()); } else { for (var i = 0; i < (int)spnNumberOfEntries.Value; i++) { AddResult(i + 1, i + 1, Model.GenerateUuid()); } } }
protected virtual void ShowResults() { vboxResults.Clear(); var index = 0; foreach (var result in Model.Results) { AddResult(++index, result); } }
private void UpdateTagList() { TagList.Clear(); foreach (String tag in Tags) { var tagButton = new Button(tag); tagButton.Clicked += TagClicked; TagList.PackStart(tagButton); } }
protected virtual void ClearTiles() { foreach (var r in _rows) { r.Clear(); } _rows.Clear(); _box.Clear(); PushNewRow(); }
public ProcessingOptionsWidget(IList <LabeledTextProcessing> processings) { Processings = processings; vboxOptions.Margin = 5; frmOptions.Content = vboxOptions; frmOptions.Label = T.GetString("Options:"); var vbox = new VBox(); vbox.PackStart(new Label(T.GetString("Text processing:")), false, true); vbox.PackStart(cbxProcessings, false, true); vbox.PackStart(frmOptions, true, true); cbxProcessings.Items.Add(T.GetString("<not selected>")); cbxProcessings.SelectedIndex = 0; foreach (var processing in Processings) { cbxProcessings.Items.Add(processing.Label); } cbxProcessings.SelectionChanged += (sender, e) => { var selectedIndex = ((ComboBox)sender).SelectedIndex; if (selectedIndex >= 1) { UpdateOptionsView(Processings [selectedIndex - 1].Processing); } else { vboxOptions.Clear(); } }; Content = vbox; Content.Show(); }
void ClearServices() { foreach (var widget in availableList.Children.Where((c) => c is ServiceWidget).Cast <ServiceWidget> ()) { widget.Service.StatusChanged -= HandleServiceStatusChanged; widget.ButtonReleased -= HandleServiceWidgetButtonReleased; } availableList.Clear(); foreach (var widget in enabledList.Children.Where((c) => c is ServiceWidget).Cast <ServiceWidget> ()) { widget.Service.StatusChanged -= HandleServiceStatusChanged; widget.ButtonReleased -= HandleServiceWidgetButtonReleased; } enabledList.Clear(); enabledLabel.Visible = false; availableLabel.Visible = false; }
private void ReOrderTasks() { _vBox.Clear(); _taskViews = _taskViews.Select(v => new KeyValuePair <int, TaskView>(_taskManager.IndexOf(v.Task), v)) .Where(kv => kv.Key >= 0) .Select(kv => kv.Value) .ToList(); foreach (var v in _taskViews) { _vBox.PackStart(v); } if (!_taskViews.Any()) { _vBox.PackStart(_nothingLabel, true, true); } }
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); } } }
/// <summary> /// Create overview! /// </summary> public void CreateOverview(VBox RequestOverview, Font CaptionFont) { // Overview clear RequestOverview.Clear(); // Information RequestOverview.PackStart(new Label(Director.Properties.Resources.RequestUrl + ":") { Font = CaptionFont }, false, false); // Create URL RequestOverview.PackStart(new LinkLabel(Url) { Uri = new Uri(Url), MarginLeft = 10 }, false, false); // Method RequestOverview.PackStart(new Label(Director.Properties.Resources.RequestMethod + ":") { Font = CaptionFont, MarginTop = 20 }, false, false); // Create URL RequestOverview.PackStart(new Label(HTTP_METHOD) { MarginLeft = 10 }, false, false); // Headers if (Headers.Count > 0) { RequestOverview.PackStart(new Label(Director.Properties.Resources.RequestHeaders + ":") { Font = CaptionFont, MarginTop = 20 }, false, false); foreach (var h in Headers) { RequestOverview.PackStart(new ListItem(string.Format("{0} - {1}", h.Name, h.Value))); } } // Files if (Files.Count > 0) { RequestOverview.PackStart(new Label(Director.Properties.Resources.RequestFiles + ":") { Font = CaptionFont, MarginTop = 20 }, false, false); foreach (var h in Files) { RequestOverview.PackStart(new ListItem(h.FileName)); } } // Request // Request if (RequestTemplate != null && RequestTemplate.Length > 0) { RequestOverview.PackStart(new Label(string.Format("{0} ({1}) :", Director.Properties.Resources.RequestTemplate, RequestTemplateTypeS)) { Font = CaptionFont, MarginTop = 20 }, false, false); TextEntry RequestTextEntry = new TextEntry() { Margin = 10, Sensitive = false, MultiLine = true }; if (RequestTemplateType == ContentType.JSON) { RequestTextEntry.Text = JSONFormatter.Format(RequestTemplate); if (RequestTextEntry.Text == null || RequestTextEntry.Text.Trim().Length == 0) { RequestTextEntry.Text = RequestTemplate; } } else { RequestTextEntry.Text = RequestTemplate; } RequestOverview.PackStart(RequestTextEntry); Button ClipboardButtonReq = new Button(Image.FromResource(DirectorImages.COPY_ICON), "") { WidthRequest = 30, HeightRequest = 30, ExpandHorizontal = false, ExpandVertical = false, MarginRight = 10, TooltipText = Director.Properties.Resources.CopyInClipboard }; ClipboardButtonReq.Clicked += delegate { Clipboard.SetText(RequestTextEntry.Text); }; RequestOverview.PackStart(ClipboardButtonReq, hpos: WidgetPlacement.End); } // Requested code if (ExpectedStatusCode > 0) { RequestOverview.PackStart(new Label(Director.Properties.Resources.ExpectedStatusCode + ":") { Font = CaptionFont }, false, false); RequestOverview.PackStart(new ListItem(ExpectedStatusCode + "")); } // Request if (ResponseTemplate != null && ResponseTemplate.Length > 0) { RequestOverview.PackStart(new Label(string.Format("{0} ({1}): ", Director.Properties.Resources.ResponseTemplate, ResponseTemplateTypeS)) { Font = CaptionFont, MarginTop = (ExpectedStatusCode > 0) ? 20 : 0 }, false, false); TextEntry ResponseTextEntry = new TextEntry() { Margin = 10, Sensitive = false, MultiLine = true }; if (ResponseTemplate.Trim().StartsWith("{")) { ResponseTextEntry.Text = JSONFormatter.Format(ResponseTemplate); } else { ResponseTextEntry.Text = ResponseTemplate; } RequestOverview.PackStart(ResponseTextEntry); Button ClipboardButton = new Button(Image.FromResource(DirectorImages.COPY_ICON), "") { WidthRequest = 30, HeightRequest = 30, ExpandHorizontal = false, ExpandVertical = false, MarginRight = 10, MarginBottom = 10, TooltipText = Director.Properties.Resources.CopyInClipboard }; ClipboardButton.Clicked += delegate { Clipboard.SetText(ResponseTextEntry.Text); }; RequestOverview.PackStart(ClipboardButton, hpos: WidgetPlacement.End); } }
/// <summary> /// Create result vbox data item. /// </summary> public void CreateResult(VBox RequestStatus, Font CaptionFont) { // Clear RequestStatus.Clear(); // Nothing to do! if (RequestRemoteResult == null) { RequestStatus.PackStart(new Label(Director.Properties.Resources.NoResponse) { Font = CaptionFont }); return; } // iterate bool first = true; foreach (var i in RequestRemoteResult) { if (i.Type == 1) { RequestStatus.PackStart(new Label(i.Data) { Font = CaptionFont, MarginTop = (first) ? 0 : 20 }, false, false); } else if (i.Type == 2) { RequestStatus.PackStart(new ListItem(i.Data)); } else { TextEntry RequestTextEntry = new TextEntry() { Margin = 10, Text = i.Data, Sensitive = false, MultiLine = true }; RequestStatus.PackStart(RequestTextEntry); Button ClipboardButtonReq = new Button(Image.FromResource(DirectorImages.COPY_ICON), "") { WidthRequest = 30, HeightRequest = 30, ExpandHorizontal = false, ExpandVertical = false, MarginRight = 10, TooltipText = Director.Properties.Resources.CopyInClipboard }; ClipboardButtonReq.Clicked += delegate { Clipboard.SetText(RequestTextEntry.Text); }; RequestStatus.PackStart(ClipboardButtonReq, hpos: WidgetPlacement.End); } first = false; } }
/// <summary> /// Create overview! /// </summary> public void CreateOverview(VBox RequestOverview, Font CaptionFont) { // Overview clear RequestOverview.Clear(); // Information RequestOverview.PackStart(new Label(Director.Properties.Resources.RequestUrl + ":") { Font = CaptionFont }, false, false); // Create URL RequestOverview.PackStart(new LinkLabel(Url) { Uri = new Uri(Url), MarginLeft = 10 }, false, false); // Method RequestOverview.PackStart(new Label(Director.Properties.Resources.RequestMethod + ":") { Font = CaptionFont, MarginTop = 20 }, false, false); // Create URL RequestOverview.PackStart(new Label(HTTP_METHOD) { MarginLeft = 10 }, false, false); // Headers if (Headers.Count > 0) { RequestOverview.PackStart(new Label(Director.Properties.Resources.RequestHeaders + ":") { Font = CaptionFont, MarginTop = 20 }, false, false); foreach (var h in Headers) RequestOverview.PackStart(new ListItem(string.Format("{0} - {1}", h.Name, h.Value))); } // Files if (Files.Count > 0) { RequestOverview.PackStart(new Label(Director.Properties.Resources.RequestFiles + ":") { Font = CaptionFont, MarginTop = 20 }, false, false); foreach (var h in Files) RequestOverview.PackStart(new ListItem(h.FileName)); } // Request // Request if (RequestTemplate != null && RequestTemplate.Length > 0) { RequestOverview.PackStart(new Label(string.Format("{0} ({1}) :", Director.Properties.Resources.RequestTemplate, RequestTemplateTypeS)) { Font = CaptionFont, MarginTop = 20 }, false, false); TextEntry RequestTextEntry = new TextEntry() { Margin = 10, Sensitive = false, MultiLine = true }; if (RequestTemplateType == ContentType.JSON) { RequestTextEntry.Text = JSONFormatter.Format(RequestTemplate); if (RequestTextEntry.Text == null || RequestTextEntry.Text.Trim().Length == 0) RequestTextEntry.Text = RequestTemplate; } else { RequestTextEntry.Text = RequestTemplate; } RequestOverview.PackStart(RequestTextEntry); Button ClipboardButtonReq = new Button(Image.FromResource(DirectorImages.COPY_ICON), "") { WidthRequest = 30, HeightRequest = 30, ExpandHorizontal = false, ExpandVertical = false, MarginRight = 10, TooltipText = Director.Properties.Resources.CopyInClipboard }; ClipboardButtonReq.Clicked += delegate { Clipboard.SetText(RequestTextEntry.Text); }; RequestOverview.PackStart(ClipboardButtonReq, hpos: WidgetPlacement.End); } // Requested code if (ExpectedStatusCode > 0) { RequestOverview.PackStart(new Label(Director.Properties.Resources.ExpectedStatusCode + ":") { Font = CaptionFont }, false, false); RequestOverview.PackStart(new ListItem(ExpectedStatusCode + "")); } // Request if (ResponseTemplate != null && ResponseTemplate.Length > 0) { RequestOverview.PackStart(new Label(string.Format("{0} ({1}): ", Director.Properties.Resources.ResponseTemplate, ResponseTemplateTypeS)) { Font = CaptionFont, MarginTop = (ExpectedStatusCode > 0) ? 20 : 0 }, false, false); TextEntry ResponseTextEntry = new TextEntry() { Margin = 10, Sensitive = false, MultiLine = true }; if (ResponseTemplate.Trim().StartsWith("{")) { ResponseTextEntry.Text = JSONFormatter.Format(ResponseTemplate); } else { ResponseTextEntry.Text = ResponseTemplate; } RequestOverview.PackStart(ResponseTextEntry); Button ClipboardButton = new Button(Image.FromResource(DirectorImages.COPY_ICON), "") { WidthRequest = 30, HeightRequest = 30, ExpandHorizontal = false, ExpandVertical = false, MarginRight = 10, MarginBottom = 10, TooltipText = Director.Properties.Resources.CopyInClipboard }; ClipboardButton.Clicked += delegate { Clipboard.SetText(ResponseTextEntry.Text); }; RequestOverview.PackStart(ClipboardButton, hpos: WidgetPlacement.End); } }