/// <summary>データベース定義情報 - データ適用</summary> private void DatabaseDefinitionEditor_Apply(object sender, CommonEventArgs e) { if (ProjectExplorer != null) { DatabaseDefinition definition = e.Parameter["Definition"]; DatabaseTreeNode node = ProjectExplorer.FindDatabaseTreeNode(definition); string oldName = null; if (node != null) { oldName = node.Text; } RefreshDatabaseNode(definition); if (oldName != definition.Name) { RenameDatabaseDefinition(new KeyValueMap() { {"Definition", definition}, {"OldName", oldName} }); } } }
/// <summary>プロジェクトプロパティタブ - データ適用</summary> private void ProjectPropertyEditor_Apply(object sender, CommonEventArgs e) { RefreshSelectedNodeProperty(); RefreshProjectNode(); MainForm.RefreshCaption(Project); RefreshObjectDefinition(); RefreshScriptWatcher(); }
/// <summary> /// アプリケーションコマンドを発行する。 /// </summary> /// <param name="command">アプリケーションコマンドのKeyValueMap。</param> protected CommonEventArgs InvokeCommand(KeyValueMap command) { var e = new CommonEventArgs() { Parameter = new KeyValueMap() }; foreach (var commandParameter in command) { e.Parameter[commandParameter.Key] = commandParameter.Value; } OnCommand(e); return e; }
/// <summary>クラス定義情報 - データ適用</summary> private void ClassDefinitionEditor_Apply(object sender, CommonEventArgs e) { if (ProjectExplorer != null) { ClassDefinition definition = e.Parameter["Definition"]; ClassTreeNode node = ProjectExplorer.FindClassTreeNode(definition); string oldName = null; if (node != null) { oldName = node.Text; } RefreshClassNode(definition); if (oldName != definition.FullName) { RenameClassDefinition(new KeyValueMap() { {"Definition", definition}, {"OldName", oldName} }); } // 親クラスとして参照しているクラス定義のアクセサ定義一覧を更新 var extendClasses = definition.GetExtendClasses(Project); foreach (var extendClass in extendClasses) { if (extendClass is ClassDefinition) { var castedExtendClass = (ClassDefinition)extendClass; if (castedExtendClass.Equals(definition)) continue; var classEditor = MainForm.FindDefinitionEditor(castedExtendClass) as ClassDefinitionEditorTab; if (classEditor != null) { classEditor.RefreshExtendAccessors(); } } } } }
/// <summary>定義情報編集タブ - データ適用</summary> private void DefinitionEditor_Apply(object sender, CommonEventArgs e) { var tab = (DefinitionEditorTab)sender; if (tab is ClassDefinitionEditorTab) { ClassDefinitionEditor_Apply(sender, e); } else if (tab is DatabaseDefinitionEditorTab) { DatabaseDefinitionEditor_Apply(sender, e); } else { throw new NotImplementedException(); } RefreshSelectedNodeProperty(); RefreshObjectDefinition(); }
/// <summary> /// アプリケーションコマンドを発行する。 /// </summary> /// <param name="commandName">コマンド名。</param> /// <param name="parameters">パラメータのKeyValueMap。</param> private void InvokeCommand( string commandName, KeyValueMap parameters = null) { var e = new CommonEventArgs() { Parameter = new KeyValueMap() { {"CommandName", commandName} } }; if (parameters != null) { foreach (var parameter in parameters) { e.Parameter[parameter.Key] = parameter.Value; } } Command(this, e); }
/// <summary> /// アプリケーションコマンドイベントを実行する。 /// </summary> /// <param name="e">イベントパラメータ。</param> protected void OnCommand(CommonEventArgs e) { if (Command != null) Command(this, e); }
protected virtual void OnApply(object sender, CommonEventArgs e) { if (Apply != null) Apply(sender, e); }
/// <summary>コマンドハンドラ</summary> private void CommandHandler(object sender, CommonEventArgs e) { var commandName = (string)e.Parameter["CommandName"]; var method = this.GetType().GetMethod( commandName, BindingFlags.Instance | BindingFlags.NonPublic, null, new[] { typeof(KeyValueMap) }, null ); if (method == null) { var message = String.Format("command is not implemented. - {0}", commandName); System.Diagnostics.Debug.WriteLine(message); throw new NotImplementedException(message); } method.Invoke(this, new[] { e.Parameter }); }
/// <summary>スクリプト編集タブ - データ適用</summary> private void ScriptEditor_Apply(object sender, CommonEventArgs e) { var tab = (ScriptEditorTab)sender; RefreshSelectedNodeProperty(); }