Compare commits

...

7 commits

5 changed files with 24 additions and 33 deletions

View file

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

View file

@ -1,20 +0,0 @@
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();
}
}
}

2
build.sh Executable file
View file

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

View file

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

View file

@ -7,10 +7,13 @@ i figured, may as well try and learn c#
## installing prerequisites ## installing prerequisites
you will need either: 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/) - [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 ### 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 #### mono
the packages you'll need are `mono-devel` and `gtk-sharp3`, so: the packages you'll need are `mono-devel` and `gtk-sharp3`, so:
``` ```
@ -20,6 +23,11 @@ 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. 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 ### arch linux
#### dotnet
```
sudo pacman -S dotnet-sdk
```
#### mono #### mono
``` ```
sudo pacman -S mono gtk-sharp-3 sudo pacman -S mono gtk-sharp-3
@ -33,24 +41,27 @@ sudo pacman -S dotnet-sdk
- download and install ".NET Core SDK" from [this page](https://dotnet.microsoft.com/download) - 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) - 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)
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 i have no idea how to install mono with gtksharp properly on windows, and believe me i tried
## compiling ## compiling
### mono
```
mcs -pkg:gtk-sharp-3.0 -resource:ui.glade *.cs
```
### dotnet ### dotnet
``` ```
dotnet build dotnet build
``` ```
## running
### mono ### mono
``` ```
mono ./BuypeebApp.exe mcs -pkg:gtk-sharp-3.0 -resource:ui.glade *.cs
``` ```
## running
### dotnet ### dotnet
``` ```
dotnet run dotnet run
``` ```
### mono
```
mono ./BuypeebApp.exe
```