buypeeb-cs/AddItemDialogue.cs
Lynne b26326baf5
code cleanup: name conventions, redundant code...
- use var instead of specific type names where applicable
- get user's home directory from Environment.SpecialFolder.UserProfile instead of reading the HOME environment variable, which isn't always set
- use object initialisers where possible
- remove redundant identifiers (e.g. "Gtk.Application.Invoke" becomes "Application.Invoke"), of which there were MANY
- remove unused local variables
- replace "variable as Class" with "(Class) variable"
- many other miscellaneous improvements

thanks rider 0u0
2021-06-15 10:20:46 +10:00

30 lines
735 B
C#

using Gtk;
namespace Buypeeb {
internal class AddItemDialogue : Dialog {
private readonly Entry entryURL;
private readonly Entry entryName;
public AddItemDialogue() : this(new Builder("add.glade")) { }
private AddItemDialogue(Builder builder) : base(builder.GetObject("DialogueAdd").Handle) {
Title = "Add item";
builder.Autoconnect(this);
entryURL = (Entry)builder.GetObject("EntryAddURL");
entryName = (Entry)builder.GetObject("EntryAddName");
DeleteEvent += Window_Shutdown;
}
private static void Window_Shutdown(object sender, DeleteEventArgs args) {
Application.Quit();
}
public string GetURL() {
return entryURL.Text;
}
public string GetName() {
return entryName.Text;
}
}
}