Compare commits

..

No commits in common. "e31c25db49f0e8fe7bbaa835583b7c2e84704f2d" and "f2aa387350e64fd4212f73fd4516eaf3ee4474aa" have entirely different histories.

5 changed files with 35 additions and 26 deletions

View file

@ -64,9 +64,11 @@ namespace Buypeeb {
ed.ContentArea.PackStart(edEntry, true, true, 10);
edEntry.Show();
// TODO: pressing enter should submit the form
ResponseType accepted = (ResponseType)ed.Run();
string response = edEntry.Text;
ed.Dispose();
ed.Destroy();
return (accepted == ResponseType.Ok, response);
}
@ -97,7 +99,7 @@ namespace Buypeeb {
private void ButtonQuitClicked(object sender, EventArgs a) {
MessageDialog md = new MessageDialog(null, DialogFlags.DestroyWithParent, MessageType.Question, ButtonsType.OkCancel, "Are you sure you want to quit?");
ResponseType response = (ResponseType)md.Run();
md.Dispose();
md.Destroy();
if (response == ResponseType.Ok) {
Application.Quit();
}

20
Program.cs Executable file
View file

@ -0,0 +1,20 @@
using System;
using Gtk;
namespace Buypeeb {
class Program {
[STAThread]
public static void Main(string[] args) {
Application.Init();
var app = new Application("org.buypeeb.buypeeb", GLib.ApplicationFlags.None);
app.Register(GLib.Cancellable.Current);
var win = new MainWindow();
app.AddWindow(win);
win.Show();
Application.Run();
}
}
}

View file

@ -1,2 +0,0 @@
#!/bin/sh
mcs -pkg:gtk-sharp-3.0 -resource:ui.glade *.cs

View file

@ -3,7 +3,7 @@
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<StartupObject>Buypeeb.BuypeebApp</StartupObject>
<StartupObject>Buypeeb.Program</StartupObject>
</PropertyGroup>
<ItemGroup>

View file

@ -7,13 +7,10 @@ i figured, may as well try and learn c#
## installing prerequisites
you will need either:
- [dotnet core sdk](https://dotnet.microsoft.com/) (recommended, it's the easiest to use)
- [mono](https://www.mono-project.com/download/stable/) and [gtk sharp 3](https://github.com/GtkSharp/GtkSharp/)
- [dotnet core sdk](https://dotnet.microsoft.com/)
### debian
#### dotnet
follow [these instructions](https://docs.microsoft.com/en-us/dotnet/core/install/linux-debian) to add the dotnet repo and install dotnet-sdk.
#### mono
the packages you'll need are `mono-devel` and `gtk-sharp3`, so:
```
@ -23,11 +20,6 @@ sudo apt install mono-devel gtk-sharp3
follow [these instructions](https://docs.microsoft.com/en-us/dotnet/core/install/linux-debian) to add the dotnet repo and install dotnet-sdk.
### arch linux
#### dotnet
```
sudo pacman -S dotnet-sdk
```
#### mono
```
sudo pacman -S mono gtk-sharp-3
@ -41,27 +33,24 @@ sudo pacman -S dotnet-sdk
- download and install ".NET Core SDK" from [this page](https://dotnet.microsoft.com/download)
- run `dotnet build` - this *should* pull in gtk3 automatically - if not, you'll need to [install it yourself](https://github.com/tschoonj/GTK-for-Windows-Runtime-Environment-Installer/releases/latest)
i have no idea how to install mono with gtksharp properly on windows, and believe me i tried
this will install and use .NET core instead of mono but as far as i know it should be fine. don't try to use mono or you will die
## compiling
### mono
```
mcs -pkg:gtk-sharp-3.0 -resource:ui.glade *.cs
```
### dotnet
```
dotnet build
```
### mono
```
mcs -pkg:gtk-sharp-3.0 -resource:ui.glade *.cs
```
## running
### dotnet
```
dotnet run
```
### mono
```
mono ./BuypeebApp.exe
```
### dotnet
```
dotnet run
```