Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft Favourites functionality #3

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions AshV.WebApiTester.XTB.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,12 @@
</ItemGroup>
<ItemGroup>
<Compile Include="CustomResponse.cs" />
<Compile Include="Forms\AddRequest.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Forms\AddRequest.Designer.cs">
<DependentUpon>AddRequest.cs</DependentUpon>
</Compile>
<Compile Include="GetMultpleResponse.cs" />
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
Expand All @@ -197,6 +203,9 @@
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Forms\AddRequest.resx">
<DependentUpon>AddRequest.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
Expand All @@ -207,6 +216,9 @@
</ItemGroup>
<ItemGroup>
<Content Include="icon.ico" />
<None Include="Resources\Rocket.png" />
<None Include="Resources\Stop.png" />
<None Include="Resources\Plus.png" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
Expand Down
226 changes: 226 additions & 0 deletions Forms/AddRequest.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

53 changes: 53 additions & 0 deletions Forms/AddRequest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
using System;
using System.Data;
using System.Linq;
using System.Windows.Forms;

namespace AshV.WebApiTester.XTB
{
public partial class AddRequest : Form
{
public Settings Settings { get; }
public string SettingName { get; private set; }
public string Description { get; private set; } = string.Empty;

public AddRequest(Settings settings)
{
InitializeComponent();
Settings = settings;
}

private void btnOK_Click(object sender, EventArgs e)
{
if (string.IsNullOrEmpty(txtSaveName.Text))
{
SettingName = cboExisting.Text;
Description = txtDescription.Text;
}
else
{
if (Settings.Requests.Any(rw => rw.Name.ToLower() == txtSaveName.Text.ToLower()))
{
MessageBox.Show("Please use a unique name for your request");
DialogResult = DialogResult.None;
return;
}
SettingName = txtSaveName.Text;
Description = txtDescription.Text;
}
}


private void cboExisting_SelectedValueChanged(object sender, EventArgs e)
{
txtSaveName.Text = string.Empty;
txtDescription.Text = ((Request)cboExisting.SelectedItem).Description;
}

private void AddRequest_Load(object sender, EventArgs e)
{
cboExisting.Items.AddRange(Settings.Requests.ToArray());

}
}
}
Loading