Class: Tunnlr::Ui::MainApp
- Inherits:
-
Wx::App
- Object
- Wx::App
- Tunnlr::Ui::MainApp
- Defined in:
- lib/tunnlr/ui.rb
Instance Method Summary collapse
-
#on_init ⇒ Object
we’re defining what the application is going to do when it starts.
Instance Method Details
#on_init ⇒ Object
we’re defining what the application is going to do when it starts
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/tunnlr/ui.rb', line 5 def on_init # we're defining what the application is going to do when it starts t = Wx::Timer.new(self, 55) evt_timer(55) { Thread.pass } t.start(100) helloframe = Wx::Frame.new(nil, -1, "Tunnlr") # it's going to make a frame entitled "Hello World" @tunnlr=Tunnlr::Connector.new @start = Wx::Button.new(helloframe,-1,"Start Tunnel") @stop = Wx::Button.new(helloframe,-1,"Stop Tunnel") @configure = Wx::Button.new(helloframe,-1,"Configure") @start.(@start.id) do |event| Thread.new do begin @tunnlr.connect! rescue Exception => e puts e end end @start.hide() @stop.show() end @stop.(@stop.id) do |event| @tunnlr.disconnect! @stop.hide() @start.show() end @start.show() @stop.hide() @configure.(@configure.id) do |event| ConfigureDialog.new.show_modal end helloframe.show() # and then it's going to make the window appear end |