// Puts all of the stuff where it belongs. public void createUI() { layout.DefaultSpacing = new Size(5, 5); layout.Padding = new Padding(10, 10, 10, 10); layout.BeginHorizontal(); layout.BeginVertical(); layout.BeginGroup("Set Current User", new Padding(10, 10, 10, 10)); layout.BeginHorizontal(); layout.BeginVertical(padding: new Padding(0, 0, 0, 10)); layout.AddAutoSized(new Label { Text = "Search User Name" }); layout.BeginHorizontal(); layout.AddAutoSized(nameBox); layout.AddAutoSized(search); layout.EndHorizontal(); layout.EndVertical(); layout.EndHorizontal(); layout.BeginHorizontal(); layout.BeginVertical(padding: new Padding(0, 0, 0, 10)); layout.AddAutoSized(new Label { Text = "User IDs" }); layout.AddAutoSized(nameList); layout.EndVertical(); layout.EndHorizontal(); layout.EndGroup(); layout.EndVertical(); layout.EndHorizontal(); }
private Control BuildBuffLayout() { var buffIdTextBox = new NumericMaskedTextBox <uint> { Value = 0 }; buffIdTextBox.ValueBinding.Bind(() => BuffId, x => BuffId = x); var buffIdCheckbox = new CheckBox { Checked = false }; buffIdCheckbox.CheckedBinding.Bind(() => BuffIdEnabled, x => BuffIdEnabled = x ?? false); var filterLayout = new DynamicLayout(); filterLayout.BeginHorizontal(); { filterLayout.BeginGroup("Buff"); { filterLayout.AddRow("Buff ID", buffIdTextBox, buffIdCheckbox, null); } filterLayout.EndGroup(); filterLayout.AddRow(null); } filterLayout.EndHorizontal(); return(filterLayout); }
public UpdateSettingsPage() { Text = "Updates"; updateCheckbox = new CheckBox { Text = "Check for updates on launch", Checked = Settings.CheckForUpdates }; var layout = new DynamicLayout(); layout.BeginVertical(new Padding(10), new Size(5, 5)); { layout.BeginGroup("Log Manager updates", new Padding(5), new Size(5, 5)); { layout.AddRow(new Label { Text = "The program can automatically look for updates on launch and inform you" + "when there is a new release available.", Wrap = WrapMode.Word, Height = 50 }); layout.AddRow(updateCheckbox); } layout.EndGroup(); layout.AddRow(null); } layout.EndVertical(); Content = layout; }
public ApiSettingsPage() { Text = "Guild Wars 2 API"; apiDataCheckbox = new CheckBox { Text = "Use the Guild Wars 2 API", Checked = Settings.UseGW2Api }; var layout = new DynamicLayout(); layout.BeginVertical(new Padding(10), new Size(5, 5)); { layout.BeginGroup("API Data", new Padding(5), new Size(5, 5)); { layout.AddRow(new Label { Text = "The program can use the official Guild Wars 2 API to retrieve guild data. " + "No API key is required. If this is not enabled, guild names and " + "tags will not be available.", Wrap = WrapMode.Word, Height = 50 }); layout.AddRow(apiDataCheckbox); } layout.EndGroup(); layout.AddRow(null); } layout.EndVertical(); Content = layout; }
// Puts all of the stuff where it belongs. public void createUI() { layout.DefaultSpacing = new Size(5, 5); layout.Padding = new Padding(10, 10, 10, 10); friendsGrid.Size = new Size(450, 650); latestTips.Size = new Size(1200, 650); layout.BeginHorizontal(); layout.BeginHorizontal(); layout.BeginGroup("Friends", new Padding(10, 10, 10, 10)); layout.AddAutoSized(friendsGrid); layout.EndGroup(); layout.BeginGroup("Latest Tips", new Padding(10, 10, 10, 10)); layout.AddAutoSized(latestTips); layout.EndGroup(); layout.EndHorizontal(); layout.EndHorizontal(); }
public AnimForm(Simulation component) { _component = component; Maximizable = false; Minimizable = false; Padding = new Padding(5); Resizable = false; ShowInTaskbar = true; Topmost = true; Title = "Playback"; WindowStyle = WindowStyle.Default; var font = new Font(FontFamilies.Sans, 12, FontStyle.None, FontDecoration.None); var size = new Size(35, 35); play = new CheckBox() { Text = "\u25B6", Size = size, Font = font, Checked = false, TabIndex = 0 }; play.CheckedChanged += component.ClickPlay; var stop = new Button() { Text = "\u25FC", Size = size, Font = font, TabIndex = 1 }; stop.Click += component.ClickStop; slider = new Slider() { Orientation = Orientation.Vertical, Size = new Size(45, 200), TabIndex = 2, MaxValue = 400, MinValue = -200, TickFrequency = 100, SnapToTick = true, Value = 100, }; slider.ValueChanged += _component.ClickScroll; var speedLabel = new Label() { Text = "100%", VerticalAlignment = VerticalAlignment.Center, }; var layout = new DynamicLayout(); layout.BeginVertical(new Padding(2), Size.Empty); layout.AddSeparateRow(padding: new Padding(10), spacing: new Size(10, 0), controls: new Control[] { play, stop }); layout.BeginGroup("Speeds"); layout.AddSeparateRow(slider, speedLabel); layout.EndGroup(); layout.EndVertical(); Content = layout; }
public LogsSettingsPage() { Text = "Logs"; var dialog = new SelectFolderDialog(); locationTextBox = new TextBox { ReadOnly = true, PlaceholderText = "Log Location", }; var locationDialogButton = new Button { Text = "Select Log Directory" }; locationDialogButton.Click += (sender, args) => { if (dialog.ShowDialog(this) == DialogResult.Ok) { locationTextBox.Text = dialog.Directory; } }; minDurationCheckBox = new CheckBox { Text = "Exclude short logs", Checked = Settings.MinimumLogDurationSeconds.HasValue, ThreeState = false }; minDurationTextBox = new NumericMaskedTextBox <int> { Value = Settings.MinimumLogDurationSeconds ?? 5, Enabled = minDurationCheckBox.Checked ?? false, Width = 50 }; minDurationCheckBox.CheckedChanged += (sender, args) => minDurationTextBox.Enabled = minDurationCheckBox.Checked ?? false; var durationLabel = new Label { Text = "Minimum duration in seconds:", VerticalAlignment = VerticalAlignment.Center }; var layout = new DynamicLayout(); layout.BeginVertical(spacing: new Size(5, 5), padding: new Padding(10)); { layout.BeginGroup("Log directory", new Padding(5), new Size(5, 5)); { layout.AddRow(new Label { Text = "The directory in which your arcdps logs are stored. Subdirectories " + "are also searched, do not choose a parent directory containing more " + "irrelevant files unless you like extra waiting.", Wrap = WrapMode.Word, Height = 70 }); layout.AddRow(locationTextBox); layout.AddRow(locationDialogButton); } layout.EndGroup(); layout.BeginGroup("Log filters", new Padding(5), new Size(5, 5)); { layout.AddRow(minDurationCheckBox); layout.AddRow(durationLabel, minDurationTextBox, null); } layout.EndGroup(); } layout.EndVertical(); Content = layout; if (Settings.LogRootPaths.Any()) { if (Settings.LogRootPaths.Count > 1) { // There is currently no interface for adding more than one log directory, so this would end up // losing some quietly when that is implemented. throw new NotImplementedException(); } string logRootPath = Settings.LogRootPaths.Single(); if (Directory.Exists(logRootPath)) { dialog.Directory = logRootPath; } locationTextBox.Text = logRootPath; } else { string defaultDirectory = GetDefaultLogDirectory(); if (Directory.Exists(defaultDirectory)) { dialog.Directory = defaultDirectory; locationTextBox.Text = defaultDirectory; } } }
public DragDropSection() { // drag data object showDragOverEvents = new CheckBox { Text = "Show DragOver Events" }; var includeImageCheck = new CheckBox { Text = "Include Image" }; descriptionTextBox = new TextBox { PlaceholderText = "Format", ToolTip = "Add {0} to insert inner text into the description, e.g. 'Move to {0}'" }; innerTextBox = new TextBox { PlaceholderText = "Inner", ToolTip = "Highlighted text to insert into description" }; var textBox = new TextBox { Text = "Some text" }; allowedEffectDropDown = new EnumDropDown <DragEffects> { SelectedValue = DragEffects.All }; dragEnterEffect = new EnumDropDown <DragEffects?> { SelectedValue = DragEffects.Copy }; dragOverEffect = new EnumDropDown <DragEffects?> { SelectedValue = null }; writeDataCheckBox = new CheckBox { Text = "Write data to log" }; useDragImage = new CheckBox { Text = "Use custom drag image" }; imageOffset = new PointEntry { Value = new Point(80, 80) }; imageOffset.Bind(c => c.Enabled, useDragImage, c => c.Checked); var htmlTextArea = new TextArea { Height = 24 }; var selectFilesButton = new Button { Text = "Select Files" }; Uri[] fileUris = null; selectFilesButton.Click += (sender, e) => { var ofd = new OpenFileDialog(); ofd.MultiSelect = true; ofd.ShowDialog(this); fileUris = ofd.Filenames.Select(r => new Uri(r)).ToArray(); if (fileUris.Length == 0) { fileUris = null; } }; var urlTextBox = new TextBox(); DataObject CreateDataObject() { var data = new DataObject(); if (!string.IsNullOrEmpty(textBox.Text)) { data.Text = textBox.Text; } var uris = new List <Uri>(); if (fileUris != null) { uris.AddRange(fileUris); } if (Uri.TryCreate(urlTextBox.Text, UriKind.Absolute, out var uri)) { uris.Add(uri); } if (uris.Count > 0) { data.Uris = uris.ToArray(); } if (!string.IsNullOrEmpty(htmlTextArea.Text)) { data.Html = htmlTextArea.Text; } if (includeImageCheck.Checked == true) { data.Image = TestIcons.Logo; } return(data); } // sources var buttonSource = new Button { Text = "Source" }; buttonSource.MouseDown += (sender, e) => { if (e.Buttons != MouseButtons.None) { DoDragDrop(buttonSource, CreateDataObject()); e.Handled = true; } }; var panelSource = new Panel { BackgroundColor = Colors.Red, Size = new Size(50, 50) }; panelSource.MouseMove += (sender, e) => { if (e.Buttons != MouseButtons.None) { DoDragDrop(panelSource, CreateDataObject()); e.Handled = true; } }; var treeSource = new TreeGridView { Size = new Size(200, 200) }; treeSource.SelectedItemsChanged += (sender, e) => Log.Write(treeSource, $"TreeGridView.SelectedItemsChanged (source) Rows: {string.Join(", ", treeSource.SelectedRows.Select(r => r.ToString()))}"); treeSource.DataStore = CreateTreeData(); SetupTreeColumns(treeSource); treeSource.MouseMove += (sender, e) => { if (e.Buttons == MouseButtons.Primary && !treeSource.IsEditing) { var cell = treeSource.GetCellAt(e.Location); if (cell.Item == null || cell.ColumnIndex == -1) { return; } var data = CreateDataObject(); var selected = treeSource.SelectedItems.OfType <TreeGridItem>().Select(r => (string)r.Values[0]); data.SetString(string.Join(";", selected), "my.tree.data"); DoDragDrop(treeSource, data); e.Handled = true; } }; var gridSource = new GridView { }; gridSource.SelectedRowsChanged += (sender, e) => Log.Write(gridSource, $"GridView.SelectedItemsChanged (source): {string.Join(", ", gridSource.SelectedRows.Select(r => r.ToString()))}"); SetupGridColumns(gridSource); gridSource.DataStore = CreateGridData(); gridSource.MouseMove += (sender, e) => { if (e.Buttons == MouseButtons.Primary && !gridSource.IsEditing) { var cell = gridSource.GetCellAt(e.Location); if (cell.RowIndex == -1 || cell.ColumnIndex == -1) { return; } var data = CreateDataObject(); var selected = gridSource.SelectedItems.OfType <GridItem>().Select(r => (string)r.Values[0]); data.SetString(string.Join(";", selected), "my.grid.data"); DoDragDrop(gridSource, data); e.Handled = true; } }; // destinations var buttonDestination = new Button { Text = "Drop here!", AllowDrop = true }; buttonDestination.DragEnter += (sender, e) => buttonDestination.Text = "Now, drop it!"; buttonDestination.DragLeave += (sender, e) => buttonDestination.Text = "Drop here!"; LogEvents(buttonDestination); var drawableDest = new Drawable { BackgroundColor = Colors.Blue, AllowDrop = true, Size = new Size(50, 50) }; LogEvents(drawableDest); drawableDest.DragEnter += (sender, e) => { if (e.Effects != DragEffects.None) { drawableDest.BackgroundColor = Colors.Green; } }; drawableDest.DragLeave += (sender, e) => { if (e.Effects != DragEffects.None) { drawableDest.BackgroundColor = Colors.Blue; } }; drawableDest.DragDrop += (sender, e) => { if (e.Effects != DragEffects.None) { drawableDest.BackgroundColor = Colors.Blue; } }; var dragMode = new RadioButtonList { Orientation = Orientation.Vertical, Items = { new ListItem { Text = "No Restriction", Key = "" }, new ListItem { Text = "RestrictToOver", Key = "over" }, new ListItem { Text = "RestrictToInsert", Key = "insert" }, new ListItem { Text = "RestrictToNode", Key = "node" }, new ListItem { Text = "No Node", Key = "none" } }, SelectedIndex = 0 }; var treeDest = new TreeGridView { AllowDrop = true, Size = new Size(200, 200) }; var treeDestData = CreateTreeData(); treeDest.DataStore = treeDestData; treeDest.DragOver += (sender, e) => { var info = treeDest.GetDragInfo(e); if (info == null) { return; // not supported } switch (dragMode.SelectedKey) { case "over": info.RestrictToOver(); break; case "insert": info.RestrictToInsert(); break; case "node": info.RestrictToNode(treeDestData[2]); break; case "none": info.Item = info.Parent = null; break; } }; SetupTreeColumns(treeDest); LogEvents(treeDest); var gridDest = new GridView { AllowDrop = true }; var gridDestData = CreateGridData(); gridDest.DataStore = gridDestData; gridDest.DragOver += (sender, e) => { var info = gridDest.GetDragInfo(e); if (info == null) { return; // not supported } switch (dragMode.SelectedKey) { case "over": info.RestrictToOver(); break; case "insert": info.RestrictToInsert(); break; case "node": info.Index = 2; info.Position = GridDragPosition.Over; break; case "none": info.Index = -1; break; } }; SetupGridColumns(gridDest); LogEvents(gridDest); // layout var layout = new DynamicLayout { Padding = 10, DefaultSpacing = new Size(4, 4) }; layout.BeginHorizontal(); layout.BeginScrollable(BorderType.None); layout.BeginCentered(); layout.AddSeparateRow(showDragOverEvents); layout.AddSeparateRow("AllowedEffect", allowedEffectDropDown, null); layout.BeginVertical(); layout.AddRow("DropDescription", descriptionTextBox); layout.AddRow(new Panel(), innerTextBox); layout.EndVertical(); layout.AddSeparateRow("DragEnter Effect", dragEnterEffect, null); layout.AddSeparateRow("DragOver Effect", dragOverEffect, null); layout.AddSeparateRow(useDragImage); layout.AddSeparateRow("Image offset:", imageOffset); layout.AddSeparateRow(writeDataCheckBox); layout.BeginGroup("DataObject", 10); layout.AddRow("Text", textBox); layout.AddRow("Html", htmlTextArea); layout.AddRow("Url", urlTextBox); layout.BeginHorizontal(); layout.AddSpace(); layout.BeginVertical(); layout.AddCentered(includeImageCheck); layout.AddCentered(selectFilesButton); layout.EndVertical(); layout.EndGroup(); layout.Add(dragMode); layout.AddSpace(); layout.EndCentered(); layout.EndScrollable(); layout.BeginVertical(xscale: true); layout.AddRange("Drag sources:", buttonSource, panelSource); layout.Add(treeSource, yscale: true); layout.Add(gridSource, yscale: true); layout.EndVertical(); layout.BeginVertical(xscale: true); layout.AddRange("Drag destinations:", buttonDestination, drawableDest); layout.Add(treeDest, yscale: true); layout.Add(gridDest, yscale: true); layout.EndVertical(); layout.EndHorizontal(); Content = layout; }
public DpsReportUploadSettingsPage() { Text = "Uploads - dps.report"; domainList = new RadioButtonList(); // The binding has to be set before the data store is as it's only used when the radio buttons are created. domainList.ItemTextBinding = new DelegateBinding <DpsReportDomain, string>(x => x.Domain); domainList.Orientation = Orientation.Vertical; domainList.DataStore = DpsReportUploader.AvailableDomains; // It is possible that the domain in settings does not exist anymore, // in case we can't match it with a current one, we add it as an extra // option to properly reflect the current state. If the user chooses // a different option after this, it won't be available anymore. var currentDomain = DpsReportUploader.AvailableDomains.FirstOrDefault(x => x.Domain == Settings.DpsReportDomain); if (currentDomain == null) { var savedDomain = new DpsReportDomain(Settings.DpsReportDomain, ""); domainList.DataStore = DpsReportUploader.AvailableDomains.Append(savedDomain).ToList(); currentDomain = savedDomain; } // The following does not work, TODO: Report // domainList.SelectedValue = currentDomain; // Because setting SelectedValue directly does not work, // we fall back to this workaround. int domainIndex = domainList.DataStore.TakeWhile(element => element != currentDomain).Count(); domainList.SelectedIndex = domainIndex; var domainDescriptionLabel = new Label { Wrap = WrapMode.Word, Height = 50, Text = ((DpsReportDomain)domainList.SelectedValue).Description }; domainList.SelectedValueChanged += (sender, args) => { domainDescriptionLabel.Text = ((DpsReportDomain)domainList.SelectedValue).Description; }; var userTokenTextBox = new TextBox { ReadOnly = true, Text = "************", Enabled = false }; var showUserTokenButton = new Button { Text = "Show user token" }; showUserTokenButton.Click += (sender, args) => { userTokenTextBox.Text = Settings.DpsReportUserToken; userTokenTextBox.Enabled = true; }; var layout = new DynamicLayout(); layout.BeginVertical(new Padding(10), new Size(5, 5)); { layout.BeginGroup("Upload domain", new Padding(5), new Size(5, 5)); { layout.AddRow(domainList); layout.AddRow(domainDescriptionLabel); } layout.EndGroup(); layout.BeginGroup("User token", new Padding(5), new Size(5, 5)); { layout.BeginVertical(); { layout.AddRow(new Label { Text = "The user token used for dps.report uploads. Treat is as a password, " + "it can be used to see all previous uploads.", Wrap = WrapMode.Word, Height = 50 }); } layout.EndVertical(); layout.BeginVertical(); { layout.BeginHorizontal(); { layout.Add(userTokenTextBox, true); layout.Add(showUserTokenButton, false); } layout.EndHorizontal(); } layout.EndVertical(); } layout.EndGroup(); } layout.EndVertical(); Content = layout; }
public MainForm() { Title = "Player 255"; MinimumSize = new Size(700, 800); var layout = new DynamicLayout { DefaultPadding = 10, DefaultSpacing = new Size(10, 10), }; layout.BeginVertical(yscale: true); layout.BeginGroup("Now Playing"); PlayingLabel = new(); layout.AddRow(PlayingLabel); layout.EndGroup(); layout.BeginGroup("Status"); StatusDropDown = new(){ SelectedValue = Status.Complete }; StatusText = new(){ Enabled = false, ReadOnly = true }; StatusDropDown.SelectedValueChanged += OnStatusChanged; layout.AddRow(null, StatusDropDown, StatusText); layout.EndGroup(); layout.BeginGroup("Rating"); var oneStar = new RadioButton { Text = "1" }; oneStar.Checked = true; StarButtons = new() { oneStar }; layout.BeginHorizontal(); layout.Add(null); layout.Add(oneStar); for (var i = 2; i <= 5; i++) { var r = new RadioButton(oneStar) { Text = $"{i}" }; StarButtons.Add(r); layout.Add(r); } layout.EndGroup(); layout.BeginGroup("Screenshots", yscale: true); var grid = new GridView(); grid.Columns.Add(new GridColumn { HeaderText = "Image Path", DataCell = new TextBoxCell("ImagePath"), Editable = true, Width = 250 }); grid.Columns.Add(new GridColumn { HeaderText = "Title", DataCell = new TextBoxCell("Title"), Editable = true, Width = 250 }); Screenshots = new(); grid.DataStore = Screenshots; grid.AllowDrop = true; grid.DragEnter += (s, e) => e.Effects = DragEffects.Link; grid.DragDrop += OnScreenshotDropped; layout.AddRow(grid); layout.EndGroup(); layout.BeginGroup("Notes", yscale: true); NotesText = new(); layout.AddRow(NotesText); layout.EndGroup(); layout.EndVertical(); layout.BeginVertical(yscale: false); var submitCommand = new Command(); submitCommand.Executed += DoSubmit; SubmitButton = new Button { Text = "Submit", Command = submitCommand }; layout.AddRow(null, SubmitButton); layout.EndVertical(); Content = layout; var quitCommand = new Command { MenuText = "Quit", Shortcut = Application.Instance.CommonModifier | Keys.Q }; quitCommand.Executed += (sender, e) => Application.Instance.Quit(); var aboutCommand = new Command { MenuText = "About..." }; aboutCommand.Executed += (sender, e) => new AboutDialog().ShowDialog(this); var regenerateCommand = new Command { MenuText = "Regenerate Website" }; regenerateCommand.Executed += (sender, e) => WebsiteManager.GenerateWebsite(); Menu = new MenuBar { QuitItem = quitCommand, AboutItem = aboutCommand, Items = { new ButtonMenuItem { Text = "&Tools", Items = { regenerateCommand, } } } }; ResetState(); // TODO: Move out, just here so I remember basics of DotLiquid. var template = Template.Parse("hi {{name}}"); var rendered = template.Render(Hash.FromAnonymousObject(new { name = "tobi" })); Console.WriteLine(rendered); } private void OnScreenshotDropped(object?sender, DragEventArgs e) { if (!e.Data.ContainsUris) { return; } foreach (var u in e.Data.Uris) { var s = new ScreenshotItem(); s.ImagePath = u.LocalPath; switch (Screenshots.Count) { case 0: s.Title = "title"; break; case 1: s.Title = "gameplay"; break; case 2: s.Title = "credits"; break; default: break; } Screenshots.Add(s); } }
public DragDropSection() { // drag data object showDragOverEvents = new CheckBox { Text = "Show DragOver Events" }; var includeImageCheck = new CheckBox { Text = "Include Image" }; var textBox = new TextBox { Text = "Some text" }; var allowedEffectDropDown = new EnumDropDown <DragEffects> { SelectedValue = DragEffects.All }; dragOverEffect = new EnumDropDown <DragEffects> { SelectedValue = DragEffects.Copy }; var htmlTextArea = new TextArea(); var selectFilesButton = new Button { Text = "Select Files" }; Uri[] uris = null; selectFilesButton.Click += (sender, e) => { var ofd = new OpenFileDialog(); ofd.MultiSelect = true; ofd.ShowDialog(this); uris = ofd.Filenames.Select(r => new Uri(r)).ToArray(); if (uris.Length == 0) { uris = null; } }; Func <DataObject> createDataObject = () => { var data = new DataObject(); if (!string.IsNullOrEmpty(textBox.Text)) { data.Text = textBox.Text; } if (uris != null) { data.Uris = uris; } if (!string.IsNullOrEmpty(htmlTextArea.Text)) { data.Html = htmlTextArea.Text; } if (includeImageCheck.Checked == true) { data.Image = TestIcons.Logo; } return(data); }; // sources var buttonSource = new Button { Text = "Source" }; buttonSource.MouseDown += (sender, e) => { buttonSource.DoDragDrop(createDataObject(), allowedEffectDropDown.SelectedValue); e.Handled = true; }; var panelSource = new Panel { BackgroundColor = Colors.Red, Size = new Size(50, 50) }; panelSource.MouseDown += (sender, e) => { panelSource.DoDragDrop(createDataObject(), allowedEffectDropDown.SelectedValue); e.Handled = true; }; var treeSource = new TreeGridView { Size = new Size(200, 200) }; treeSource.DataStore = CreateTreeData(); SetupTreeColumns(treeSource); treeSource.MouseMove += (sender, e) => { if (e.Buttons == MouseButtons.Primary) { var cell = treeSource.GetCellAt(e.Location); if (cell.Item == null || cell.ColumnIndex == -1) { return; } var data = createDataObject(); var selected = treeSource.SelectedItems.OfType <TreeGridItem>().Select(r => (string)r.Values[0]); data.SetString(string.Join(";", selected), "my-tree-data"); treeSource.DoDragDrop(data, allowedEffectDropDown.SelectedValue); e.Handled = true; } }; var gridSource = new GridView { }; SetupGridColumns(gridSource); gridSource.DataStore = CreateGridData(); gridSource.MouseMove += (sender, e) => { if (e.Buttons == MouseButtons.Primary) { var data = createDataObject(); var selected = gridSource.SelectedItems.OfType <GridItem>().Select(r => (string)r.Values[0]); data.SetString(string.Join(";", selected), "my-grid-data"); gridSource.DoDragDrop(data, allowedEffectDropDown.SelectedValue); e.Handled = true; } }; // destinations var buttonDestination = new Button { Text = "Drop here!", AllowDrop = true }; buttonDestination.DragEnter += (sender, e) => buttonDestination.Text = "Now, drop it!"; buttonDestination.DragLeave += (sender, e) => buttonDestination.Text = "Drop here!"; LogEvents(buttonDestination); var drawableDest = new Drawable { BackgroundColor = Colors.Blue, AllowDrop = true, Size = new Size(50, 50) }; LogEvents(drawableDest); drawableDest.DragEnter += (sender, e) => { if (e.Effects != DragEffects.None) { drawableDest.BackgroundColor = Colors.Green; } }; drawableDest.DragLeave += (sender, e) => { if (e.Effects != DragEffects.None) { drawableDest.BackgroundColor = Colors.Blue; } }; drawableDest.DragDrop += (sender, e) => { if (e.Effects != DragEffects.None) { drawableDest.BackgroundColor = Colors.Blue; } }; var dragMode = new RadioButtonList { Orientation = Orientation.Vertical, Items = { new ListItem { Text = "No Restriction", Key = "" }, new ListItem { Text = "RestrictToOver", Key = "over" }, new ListItem { Text = "RestrictToInsert", Key = "insert" }, new ListItem { Text = "RestrictToNode", Key = "node" }, new ListItem { Text = "No Node", Key = "none" } }, SelectedIndex = 0 }; var treeDest = new TreeGridView { AllowDrop = true, Size = new Size(200, 200) }; var treeDestData = CreateTreeData(); treeDest.DataStore = treeDestData; treeDest.DragOver += (sender, e) => { var info = treeDest.GetDragInfo(e); if (info == null) { return; // not supported } switch (dragMode.SelectedKey) { case "over": info.RestrictToOver(); break; case "insert": info.RestrictToInsert(); break; case "node": info.RestrictToNode(treeDestData[2]); break; case "none": info.Item = info.Parent = null; break; } }; SetupTreeColumns(treeDest); LogEvents(treeDest); var gridDest = new GridView { AllowDrop = true }; var gridDestData = CreateGridData(); gridDest.DataStore = gridDestData; gridDest.DragOver += (sender, e) => { var info = gridDest.GetDragInfo(e); if (info == null) { return; // not supported } switch (dragMode.SelectedKey) { case "over": info.RestrictToOver(); break; case "insert": info.RestrictToInsert(); break; case "node": info.Index = 2; info.Position = GridDragPosition.Over; break; case "none": info.Index = -1; break; } }; SetupGridColumns(gridDest); LogEvents(gridDest); // layout var layout = new DynamicLayout { Padding = 10, DefaultSpacing = new Size(4, 4) }; layout.BeginHorizontal(); layout.BeginCentered(); layout.AddSeparateRow(showDragOverEvents); layout.AddSeparateRow("AllowedEffect", allowedEffectDropDown, null); layout.AddSeparateRow("DragOver Effect", dragOverEffect, null); layout.BeginGroup("DataObject", 10); layout.AddRow("Text", textBox); layout.AddRow("Html", htmlTextArea); layout.BeginHorizontal(); layout.AddSpace(); layout.BeginVertical(); layout.AddCentered(includeImageCheck); layout.AddCentered(selectFilesButton); layout.EndVertical(); layout.EndGroup(); layout.Add(dragMode); layout.AddSpace(); layout.EndCentered(); layout.BeginVertical(xscale: true); layout.AddRange("Drag sources:", buttonSource, panelSource); layout.Add(treeSource, yscale: true); layout.Add(gridSource, yscale: true); layout.EndVertical(); layout.BeginVertical(xscale: true); layout.AddRange("Drag destinations:", buttonDestination, drawableDest); layout.Add(treeDest, yscale: true); layout.Add(gridDest, yscale: true); layout.EndVertical(); layout.EndHorizontal(); Content = layout; }
public SimulationForm(Simulation component) { _component = component; Title = "Playback"; MinimumSize = new Size(0, 200); Padding = new Padding(5); var font = new Font(FontFamilies.Sans, 14, FontStyle.None, FontDecoration.None); var size = new Size(35, 35); Play = new CheckBox { Text = "\u25B6", Size = size, Font = font, Checked = false, TabIndex = 0 }; Play.CheckedChanged += (s, e) => component.TogglePlay(); var stop = new Button { Text = "\u25FC", Size = size, Font = font, TabIndex = 1 }; stop.Click += (s, e) => component.Stop(); var slider = new Slider { Orientation = Orientation.Vertical, Size = new Size(-1, -1), TabIndex = 2, MaxValue = 400, MinValue = -200, TickFrequency = 100, SnapToTick = true, Value = 100, }; slider.ValueChanged += (s, e) => component.Speed = (double)slider.Value / 100.0;; var speedLabel = new Label { Text = "100%", VerticalAlignment = VerticalAlignment.Center, }; var layout = new DynamicLayout(); layout.BeginVertical(); layout.AddSeparateRow(padding: new Padding(10), spacing: new Size(10, 0), controls: new Control[] { Play, stop }); layout.BeginGroup("Speed"); layout.AddSeparateRow(slider, speedLabel); layout.EndGroup(); layout.EndVertical(); Content = layout; }
public Dialog_MatchRoomProperties(HB.Room sourceRoom, IEnumerable <HB.Room> targetRooms) { var vm = new MatchRoomPropertiesViewModel(sourceRoom, targetRooms); Padding = new Padding(5); Title = "Match Room Properties"; WindowStyle = WindowStyle.Default; Width = 300; this.Icon = Honeybee.UI.DialogHelper.HoneybeeIcon; var layout = new DynamicLayout(); this.DefaultButton = new Button { Text = "OK" }; DefaultButton.Click += (sender, e) => Close(vm.GetUpdatedRooms()); this.AbortButton = new Button { Text = "Close" }; AbortButton.Click += (sender, e) => Close(); // all controls var allToggle = new CheckBox() { Text = "Select/Unselect All" }; allToggle.Bind(_ => _.Checked, vm, m => m.All); layout.AddRow(allToggle); HoneybeeSchema.Room dummy = null; // General layout.BeginGroup("General"); var name = new CheckBox() { Text = "Name" }; name.CheckedBinding.Bind(vm, m => m.Name); layout.AddRow(name); var story = new CheckBox() { Text = nameof(dummy.Story) }; story.CheckedBinding.Bind(vm, m => m.Story); layout.AddRow(story); var multi = new CheckBox() { Text = nameof(dummy.Multiplier) }; multi.CheckedBinding.Bind(vm, m => m.Multiplier); layout.AddRow(multi); var mset = new CheckBox() { Text = "Modifier Set" }; mset.CheckedBinding.Bind(vm, m => m.ModifierSet); layout.AddRow(mset); var cset = new CheckBox() { Text = "Construction Set" }; cset.CheckedBinding.Bind(vm, m => m.ConstructionSet); layout.AddRow(cset); var ptype = new CheckBox() { Text = "Program Type" }; ptype.CheckedBinding.Bind(vm, m => m.ProgramType); layout.AddRow(ptype); var hvac = new CheckBox() { Text = "HVAC System" }; hvac.CheckedBinding.Bind(vm, m => m.HVAC); layout.AddRow(hvac); var user = new CheckBox() { Text = "User Data" }; user.CheckedBinding.Bind(vm, m => m.User); layout.AddRow(user); layout.EndGroup(); //Loads layout.BeginGroup("Loads"); var ltn = new CheckBox() { Text = nameof(dummy.Properties.Energy.Lighting) }; ltn.CheckedBinding.Bind(vm, m => m.Lighting); layout.AddRow(ltn); var ppl = new CheckBox() { Text = nameof(dummy.Properties.Energy.People) }; ppl.CheckedBinding.Bind(vm, m => m.People); layout.AddRow(ppl); var elecEqp = new CheckBox() { Text = "Electric Equipment" }; elecEqp.CheckedBinding.Bind(vm, m => m.ElecEquipment); layout.AddRow(elecEqp); var gas = new CheckBox() { Text = "Gas Equipment" }; gas.CheckedBinding.Bind(vm, m => m.GasEquipment); layout.AddRow(gas); var vent = new CheckBox() { Text = nameof(dummy.Properties.Energy.Ventilation) }; vent.CheckedBinding.Bind(vm, m => m.Ventilation); layout.AddRow(vent); var infil = new CheckBox() { Text = nameof(dummy.Properties.Energy.Infiltration) }; infil.CheckedBinding.Bind(vm, m => m.Infiltration); layout.AddRow(infil); var spt = new CheckBox() { Text = nameof(dummy.Properties.Energy.Setpoint) }; spt.CheckedBinding.Bind(vm, m => m.Setpoint); layout.AddRow(spt); var hotWater = new CheckBox() { Text = "Service Hot Water" }; hotWater.CheckedBinding.Bind(vm, m => m.ServiceHotWater); layout.AddRow(hotWater); var masses = new CheckBox() { Text = "Internal Masses" }; masses.CheckedBinding.Bind(vm, m => m.InternalMasses); layout.AddRow(masses); layout.EndGroup(); // Controls layout.BeginGroup("Controls"); var vCtrl = new CheckBox() { Text = "Window Ventilation Control" }; vCtrl.CheckedBinding.Bind(vm, m => m.VentControl); layout.AddRow(vCtrl); var dCtrl = new CheckBox() { Text = "Daylighting Control" }; dCtrl.CheckedBinding.Bind(vm, m => m.DaylightControl); layout.AddRow(dCtrl); layout.EndGroup(); //layout.DefaultPadding = new Padding(10); layout.DefaultSpacing = new Size(3, 3); layout.DefaultPadding = new Padding(5); layout.AddSeparateRow(null, DefaultButton, AbortButton, null); layout.AddRow(null); Content = layout; }
// Puts all of the stuff where it belongs. public void createUI(string bid) { layout.DefaultSpacing = new Size(15, 5); layout.Padding = new Padding(10, 10, 10, 10); general_grid.Size = new Size(800, 400); friend_grid.Size = new Size(800, 100); layout.BeginVertical(); layout.BeginGroup("Buisness Info", new Padding(10, 10, 200, 10)); layout.BeginHorizontal(); layout.BeginVertical(); layout.BeginHorizontal(); layout.AddAutoSized(new Label { Text = "Business Name:" }); layout.AddAutoSized(businessname); layout.EndHorizontal(); layout.BeginHorizontal(); layout.AddAutoSized(new Label { Text = "Street Address:" }); layout.AddAutoSized(streetaddress); layout.EndHorizontal(); layout.BeginHorizontal(); layout.AddAutoSized(new Label { Text = "Today's Hours:" }); layout.AddAutoSized(openHours); layout.EndHorizontal(); layout.EndBeginVertical(); layout.BeginHorizontal(); layout.BeginGroup("Business Attributes", new Padding(10, 10, 10, 10)); layout.AddAutoSized(attributes); layout.EndGroup(); layout.BeginGroup("Business Categories", new Padding(10, 10, 10, 10)); layout.AddAutoSized(categories); layout.EndGroup(); layout.EndHorizontal(); layout.EndHorizontal(); layout.EndGroup(); layout.BeginGroup("Friend Tips", new Padding(10, 10, 10, 10)); layout.BeginHorizontal(); layout.AddAutoSized(friend_grid); layout.EndHorizontal(); layout.EndGroup(); layout.BeginGroup("Tips", new Padding(10, 10, 10, 10)); layout.BeginHorizontal(); layout.AddAutoSized(general_grid); layout.BeginVertical(); layout.AddAutoSized(addLike); layout.AddAutoSized(checkIn); layout.AddAutoSized(checkinGraph); layout.EndVertical(); layout.EndHorizontal(); layout.BeginHorizontal(); layout.AddAutoSized(newTip); layout.AddAutoSized(addTip); layout.EndHorizontal(); layout.EndGroup(); layout.EndVertical(); }
public SettingsForm(ManagerForm managerForm) { Title = "Settings - arcdps Log Manager"; ClientSize = new Size(400, -1); MinimumSize = new Size(400, 300); var apiDataCheckbox = new CheckBox { Text = "Use the Guild Wars 2 API", Checked = Settings.UseGW2Api }; var dialog = new SelectFolderDialog(); var locationTextBox = new TextBox { ReadOnly = true, PlaceholderText = "Log Location", }; var locationDialogButton = new Button { Text = "Select Log Directory" }; locationDialogButton.Click += (sender, args) => { if (dialog.ShowDialog(this) == DialogResult.Ok) { locationTextBox.Text = dialog.Directory; } }; var saveButton = new Button { Text = "Save" }; saveButton.Click += (sender, args) => { Settings.UseGW2Api = apiDataCheckbox.Checked ?? false; if (locationTextBox.Text.Trim() != Settings.LogRootPaths.FirstOrDefault()) { Settings.LogRootPaths = new [] { locationTextBox.Text }; // TODO: Subscribe from the manager form, and pass if location was changed through event args managerForm?.ReloadLogs(); } SettingsSaved?.Invoke(this, EventArgs.Empty); Close(); }; var layout = new DynamicLayout(); layout.BeginVertical(spacing: new Size(5, 5), padding: new Padding(10)); { layout.BeginGroup("Logs", new Padding(5), new Size(5, 5)); { layout.AddRow(new Label { Text = "The directory in which your arcdps logs are stored. Subdirectories " + "are also searched, do not choose a parent directory containing more " + "irrelevant files unless you like extra waiting.", Wrap = WrapMode.Word, Height = 50 }); layout.AddRow(locationTextBox); layout.AddRow(locationDialogButton); } layout.EndGroup(); layout.BeginGroup("Data", new Padding(5), new Size(5, 5)); { layout.AddRow(new Label { Text = "The program can use the official Guild Wars 2 API to retrieve guild data. " + "No API key is required. If this is not enabled, guild names and " + "tags will not be available.", Wrap = WrapMode.Word, Height = 50 }); layout.AddRow(apiDataCheckbox); } layout.EndGroup(); } layout.EndVertical(); layout.Add(null); layout.BeginVertical(padding: new Padding(10)); { layout.BeginHorizontal(); { layout.Add(null, xscale: true); layout.Add(saveButton, xscale: false); } layout.EndHorizontal(); } layout.EndVertical(); Content = layout; if (Settings.LogRootPaths.Any()) { if (Settings.LogRootPaths.Count > 1) { // There is currently no interface for adding more than one log directory, so this would end up // losing some quietly when that is implemented. throw new NotImplementedException(); } string logRootPath = Settings.LogRootPaths.Single(); if (Directory.Exists(logRootPath)) { dialog.Directory = logRootPath; } locationTextBox.Text = logRootPath; } else { string defaultDirectory = GetDefaultLogDirectory(); if (Directory.Exists(defaultDirectory)) { dialog.Directory = defaultDirectory; locationTextBox.Text = defaultDirectory; } } }
// Creates and places all of the UI elements. This is particularly // nasty looking. There is probably a better way to do this, but idk. // https://github.com/picoe/Eto/wiki/DynamicLayout public void createUI() { layout.Padding = new Padding(10, 0, 10, 10); grid.Size = new Size(1000, 1000); layout.DefaultSpacing = new Size(5, 5); SelectSort.DataStore = SortStore; layout.BeginHorizontal(); layout.BeginVertical(); layout.BeginHorizontal(); layout.BeginGroup("User Info", new Padding(10, 10, 10, 10)); layout.BeginHorizontal(); layout.BeginVertical(padding: new Padding(0, 0, 0, 10)); layout.AddAutoSized(user); layout.EndVertical(); layout.AddAutoSized(userlogin); layout.EndHorizontal(); layout.BeginVertical(); layout.BeginHorizontal(); layout.AddAutoSized(new Label { Text = "User Name:" }); layout.AddAutoSized(usernameBox); layout.EndHorizontal(); layout.BeginHorizontal(); layout.AddAutoSized(new Label { Text = "Yelping Since:" }); layout.AddAutoSized(dateBox); layout.EndHorizontal(); layout.BeginHorizontal(); layout.AddAutoSized(new Label { Text = "Stars:" }); layout.AddAutoSized(starsBox); layout.EndHorizontal(); layout.BeginHorizontal(); layout.AddAutoSized(new Label { Text = "Number of Fans:" }); layout.AddAutoSized(fansBox); layout.EndHorizontal(); layout.BeginHorizontal(); layout.AddAutoSized(new Label { Text = "Funny:" }); layout.AddAutoSized(funnyBox); layout.EndHorizontal(); layout.BeginHorizontal(); layout.AddAutoSized(new Label { Text = "Cool:" }); layout.AddAutoSized(coolBox); layout.EndHorizontal(); layout.BeginHorizontal(); layout.AddAutoSized(new Label { Text = "Useful:" }); layout.AddAutoSized(usefulBox); layout.EndHorizontal(); layout.BeginHorizontal(); layout.AddAutoSized(new Label { Text = "Number of Tips:" }); layout.AddAutoSized(tipcountBox); layout.EndHorizontal(); layout.BeginHorizontal(); layout.AddAutoSized(new Label { Text = "Number of Likes:" }); layout.AddAutoSized(totallikesBox); layout.EndHorizontal(); layout.BeginHorizontal(); layout.AddAutoSized(new Label { Text = "Latitude:" }); layout.AddAutoSized(latitudeBox); layout.EndHorizontal(); layout.BeginHorizontal(); layout.AddAutoSized(new Label { Text = "Longitude:" }); layout.AddAutoSized(longitudeBox); layout.EndHorizontal(); layout.AddAutoSized(updateLocation); layout.EndVertical(); layout.EndGroup(); layout.EndHorizontal(); layout.BeginGroup("Location", new Padding(10, 10, 10, 10)); layout.BeginHorizontal(); //layout.BeginVertical(padding: new Padding(0, 10, 0, 10)); layout.AddAutoSized(new Label { Text = "State" }); layout.AddAutoSized(stateList); //layout.EndVertical(); layout.EndHorizontal(); layout.BeginHorizontal(); layout.BeginVertical(padding: new Padding(0, 0, 0, 10)); layout.AddAutoSized(new Label { Text = "City" }); layout.AddAutoSized(cityList); layout.EndVertical(); layout.EndHorizontal(); layout.BeginHorizontal(); layout.BeginVertical(padding: new Padding(0, 0, 0, 10)); layout.AddAutoSized(new Label { Text = "Zip Code" }); layout.AddAutoSized(zipList); layout.AddAutoSized(new Label { Text = "Businesses in State:" }); layout.AddAutoSized(stnum); layout.AddAutoSized(new Label { Text = "Businesses in City:" }); layout.AddAutoSized(ctnum); layout.EndVertical(); layout.EndHorizontal(); layout.EndGroup(); layout.BeginGroup("Sort By", new Padding(10, 10, 10, 10)); layout.AddAutoSized(SelectSort); layout.EndGroup(); layout.EndVertical(); layout.BeginVertical(new Padding(10, 0, 0, 0)); layout.BeginGroup("Search Results"); layout.BeginCentered(); layout.AddAutoSized(grid); layout.EndCentered(); layout.EndGroup(); layout.EndVertical(); layout.BeginVertical(); layout.BeginGroup("Categories", new Padding(10, 10, 10, 10)); layout.BeginHorizontal(); layout.BeginVertical(padding: new Padding(0, 0, 0, 10)); layout.AddAutoSized(new Label { Text = "Category" }); layout.AddAutoSized(catList); layout.EndVertical(); layout.EndHorizontal(); layout.BeginHorizontal(); layout.BeginVertical(padding: new Padding(0, 0, 0, 10)); layout.AddAutoSized(new Label { Text = "Selected Categories" }); layout.AddAutoSized(selectedCats); layout.BeginHorizontal(); layout.AddAutoSized(add_cat); layout.AddAutoSized(remove_cat); layout.EndHorizontal(); layout.EndVertical(); layout.EndHorizontal(); layout.EndGroup(); layout.BeginGroup("Filters", new Padding(10, 10, 10, 10)); layout.BeginHorizontal(); layout.BeginVertical(padding: new Padding(0, 0, 0, 10)); layout.AddAutoSized(new Label { Text = "Price" }); layout.AddAutoSized(priceFilters); layout.EndVertical(); layout.EndHorizontal(); layout.BeginHorizontal(); layout.BeginVertical(padding: new Padding(0, 0, 0, 10)); layout.AddAutoSized(new Label { Text = "Attributes" }); layout.AddAutoSized(attributeFilters); layout.EndVertical(); layout.EndHorizontal(); layout.BeginHorizontal(); layout.BeginVertical(padding: new Padding(0, 0, 0, 10)); layout.AddAutoSized(new Label { Text = "Meal" }); layout.AddAutoSized(mealFilters); layout.BeginHorizontal(); layout.AddAutoSized(add_att); layout.AddAutoSized(remove_att); layout.EndHorizontal(); layout.EndVertical(); layout.EndHorizontal(); layout.BeginHorizontal(); layout.BeginVertical(padding: new Padding(0, 0, 0, 10)); layout.AddAutoSized(new Label { Text = "Selected Attributes" }); layout.AddAutoSized(selectedAtts); layout.EndVertical(); layout.EndHorizontal(); layout.EndGroup(); layout.BeginCentered(); layout.AddAutoSized(search); layout.EndCentered(); layout.EndVertical(); layout.EndHorizontal(); }