1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
require "silverlight"
require 'mint'
require 'controls/clock'

class App < SilverlightApplication
  use_xaml

  def initialize
    message.text = "Welcome to Ruby, Silverlight, and Mint!"
    
    # We customized the trace panel, and this will show a message
    puts "testing the trace panel"
    
    # Create a new Clock control
    clock = Clock.new       
    clock.clock_name.text = "I can access a textblock as if clock were actually the xaml"
    clock_container.children.add clock
    
    # Listen for a custom event
    clock.custom_event do |sender, event|
      puts "App: About to change clock name"
      clock.name = "Instead of directly accessing members of the xaml, I can call functions in my code-behind class"
    end
    
  end
end

$app = App.new