Created
April 7, 2010 13:12
-
-
Save bradjohansen/358861 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# TODO: Work on Initializing Constants, and finding appropriate assemblies. | |
require 'PresentationFramework' | |
require 'PresentationCore' | |
require 'WindowsBase' | |
# Initialize Constants | |
Window = System::Windows::Window | |
Application = System::Windows::Application | |
StackPanel = System::Windows::Controls::StackPanel | |
Thickness = System::Windows::Thickness | |
DropShadowBitmapEffect = System::Windows::Forms::Media::Effects::DropShadowBitmapEffect | |
Button = System::Windows::Forms::Button | |
Label = System::Windows::Forms::Label | |
# Create Window | |
my_window = Window.new | |
my_window.title = 'Welcome to IronRuby' | |
#Create StackPanel to layout UI elements | |
my_stack = StackPanel.new | |
my_stack.margin = Thickness.new 15 | |
my_window.content = my_stack | |
# Create Button | |
my_button = Button.new | |
my_button.content = 'Push me' | |
my_button.font_size = 24 | |
my_button.bitmap_effect = DropShadowBitmapEffect.new | |
#Use Ruby block to implement Button click event | |
my_button.click do |sender, args| | |
my_message = Label.new | |
my_message.font_size = 48 | |
my_message.content = 'Welcome to IronRuby' | |
# Add label into stack panel of controls | |
my_stack.children.add my_message | |
end | |
my_stack.children.add my_button | |
# Run App | |
app = Application.new | |
app.run my_window |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment