void SetAccount(IFsAccount acc) { this.account = acc; foreach (IAccountEditor ed in editors) { if (!ed.TrySetAccount(acc)) { continue; } this.CurrentEditor = ed; return; } // 新しいエディタインスタンス IAccountEditor newEditor = acc.CreateEditorInstance(); Forms::Control ctrl = newEditor as Forms::Control; if (ctrl == null) { throw new System.Exception("IAccountEditor を実装するクラスは System.Windows.Forms.Control を継承しなければなりません。"); } if (!newEditor.TrySetAccount(acc)) { throw new System.Exception("IAccount.CreateEditorInstance によって得られたエディタは、TrySetAccount で元のアカウントを受理する必要があります。"); } // 登録 this.editors.Add(newEditor); this.editorContainer.Controls.Add(ctrl); this.CurrentEditor = newEditor; }
public ReversibleArea(Forms::Control ctrl) { this.ctrl = ctrl; }