2008-07-29から1日間の記事一覧

__main__

if __name__ == "__main__": win = ButtonMenu_WPF() win.Title = win.__class__.__name__ # .Text Application().Run(win) Text に代えて、Title に値を設定しています。

Form1.cs

class ButtonMenu_WPF(Window): # Form Form に代えて、Window を拡張しています。 def __init__(self, **args): self.InitializeComponent() self.init() def init(self): evh = self.commandClick self.btRed.Click += evh file = MenuItem(Header="File")…

FileOpen.cs

class FileOpen(MenuItem, Command): def __init__(self): self.Header = "Open" # .Text System.Windows.Forms.MenuItem に代えて、System.Windows.Controls.MenuItem を拡張しています。 Text に代えて、Header に値を設定しています。 def Execute(self):…

Command.cs

class Command: # interface Command def Execute(self): raise NotImplementedError("Execute") interface に代えて、例外 NotImplementedError を生成しています。

ButtonMenu_WPF.py

WPF アプリケーションとして、IronPython で実現した事例を紹介します。 # -*- coding: utf-8 -*- #=============================================================================== # Copyright (C) 2000-2008, 小泉ひよ子とタマゴ倶楽部 # # History: D…

《こちらに移動中です》

C#.use(better, IronPython="GoF") 《記事一覧》 Strategy〈WPF〉Strategy -- pay a tribute to "C# Design Patterns" by James William Cooper 《著》小粒ちゃん《監修》小泉ひよ子とタマゴ倶楽部第2版♪2008/03/21 ● 改訂♪2008/10/06

《参考文献》

C# Design Patterns 29. The Strategy Pattern.

RedButton.cs

class RedButton(Button, Command): def Execute(self): c = self.Parent c.Background = Brushes.Red # .BackColor = Color self.Background = Brushes.Yellow # .BackColor = Color System.Windows.Forms.Button に代えて、System.Windows.Controls.Button…

FileExit.cs

class FileExit(MenuItem, Command): def __init__(self, frm): self.Header = "Exit" # .Text self.form = frm System.Windows.Forms.MenuItem に代えて、System.Windows.Controls.MenuItem を拡張しています。 Text に代えて、Header に値を設定しています…