//RunMode��Remote�̏ꍇ�AKernel��MenuOnClick����A�����炪�Ă�� public void MenuOnClick(String cmd) { //�I�v�V�������j���[�̏ꍇ if (cmd.IndexOf("Option_") == 0) { var oneOption = _kernel.ListOption.Get(cmd.Substring(7)); if (oneOption != null) { var dlg = new OptionDlg(_kernel, oneOption); if (DialogResult.OK == dlg.ShowDialog()) { oneOption.Save(_kernel.IniDb);//�I�v�V������ۑ����� //�T�[�o���֑��M���� string optionStr; using (var sr = new StreamReader(_optionFileName, Encoding.GetEncoding("Shift_JIS"))) { optionStr = sr.ReadToEnd(); sr.Close(); } //Option�̑��M(C->S) RemoteData.Send(_sockTcp, RemoteDataKind.CmdOption, optionStr); } } //�u�c�[���v���j���[�̏ꍇ } else if (cmd.IndexOf("Tool_") == 0) { var oneTool = _kernel.ListTool.Get(cmd.Substring(5)); if (oneTool != null) { _toolDlg = oneTool.CreateDlg(_sockTcp); _toolDlg.ShowDialog(); _toolDlg.Dispose(); _toolDlg = null; } //�u�N���^��~�v�̏ꍇ } else if (cmd.IndexOf("StartStop_") == 0) { string nameTag = cmd.Substring(10); if (nameTag == "Restart") { if (_sockTcp != null) { //�u�ċN���v���j���[�I��(C->S) RemoteData.Send(_sockTcp, RemoteDataKind.CmdRestart, ""); } } } }
//RunModeがRemoteの場合、KernelのMenuOnClickから、こちらが呼ばれる public void MenuOnClick(String cmd) { //オプションメニューの場合 if (cmd.IndexOf("Option_") == 0) { var oneOption = _kernel.ListOption.Get(cmd.Substring(7)); if (oneOption != null) { var dlg = new OptionDlg(_kernel, oneOption); if (DialogResult.OK == dlg.ShowDialog()) { oneOption.Save(_kernel.IniDb);//オプションを保存する //サーバ側へ送信する string optionStr; using (var sr = new StreamReader(_optionFileName, Encoding.GetEncoding("Shift_JIS"))) { optionStr = sr.ReadToEnd(); sr.Close(); } //Optionの送信(C->S) RemoteData.Send(_sockTcp, RemoteDataKind.CmdOption, optionStr); } } //「ツール」メニューの場合 } else if (cmd.IndexOf("Tool_") == 0) { var oneTool = _kernel.ListTool.Get(cmd.Substring(5)); if (oneTool != null) { _toolDlg = oneTool.CreateDlg(_sockTcp); _toolDlg.ShowDialog(); _toolDlg.Dispose(); _toolDlg = null; } //「起動/停止」の場合 } else if (cmd.IndexOf("StartStop_") == 0) { string nameTag = cmd.Substring(10); if (nameTag == "Restart") { if (_sockTcp != null) { //「再起動」メニュー選択(C->S) RemoteData.Send(_sockTcp, RemoteDataKind.CmdRestart, ""); } } } }
//���j���[�I����̏��� public void MenuOnClick(String cmd) { if (cmd.IndexOf("Option_") == 0) { if (RunMode == RunMode.Remote) { //Java fix RunMOde==Remote�̏ꍇ�̃��j���[���� RemoteClient.MenuOnClick(cmd); } else { var oneOption = ListOption.Get(cmd.Substring(7)); if (oneOption != null) { var dlg = new OptionDlg(this, oneOption); if (DialogResult.OK == dlg.ShowDialog()) { //Ver5.8.6 Java fix //oneOption.Save(OptionIni.GetInstance()); oneOption.Save(IniDb); MenuOnClick("StartStop_Reload"); } } } } else if (cmd.IndexOf("Tool_") == 0) { if (RunMode == RunMode.Remote) { //Java fix RunMOde==Remote�̏ꍇ�̃��j���[���� RemoteClient.MenuOnClick(cmd); } else { var nameTag = cmd.Substring(5); var oneTool = ListTool.Get(nameTag); if (oneTool == null) { return; } //BJD.EXE�ȊO�̏ꍇ�A�T�[�o�I�u�W�F�N�g�ւ̃|�C���^���K�v�ɂȂ� OneServer oneServer = null; if (nameTag != "BJD") { oneServer = ListServer.Get(nameTag); if (oneServer == null) { return; } } ToolDlg dlg = oneTool.CreateDlg(oneServer); dlg.ShowDialog(); } } else if (cmd.IndexOf("StartStop_") == 0) { if (RunMode == RunMode.Remote) { //Java fix RunMOde==Remote�̏ꍇ�̃��j���[���� RemoteClient.MenuOnClick(cmd); } else { switch (cmd) { case "StartStop_Start": Start(); break; case "StartStop_Stop": Stop(); break; case "StartStop_Restart": Stop(); Thread.Sleep(300); Start(); break; case "StartStop_Reload": Stop(); ListInitialize(); Start(); break; case "StartStop_Service": SetupService(); //�T�[�r�X�̐ݒ� break; default: Util.RuntimeException(string.Format("cmd={0}", cmd)); break; } View.SetColor(); //�E�C���h�̃J���[������ Menu.SetEnable(); //��Ԃɉ������L���E���� } } else { switch (cmd) { case "File_LogClear": LogView.Clear(); break; case "File_LogCopy": LogView.SetClipboard(); break; case "File_Trace": TraceDlg.Open(); break; case "File_Exit": View.MainForm.Close(); break; case "Help_Version": var dlg = new VersionDlg(this); dlg.ShowDialog(); break; case "Help_Homepage": Process.Start(Define.WebHome()); break; case "Help_Document": Process.Start(Define.WebDocument()); break; case "Help_Support": Process.Start(Define.WebSupport()); break; } } }
//メニュー選択時の処理 public void MenuOnClick(String cmd) { if (cmd.IndexOf("Option_") == 0) { if (RunMode == RunMode.Remote) { //Java fix RunMOde==Remoteの場合のメニュー処理 RemoteClient.MenuOnClick(cmd); } else { var oneOption = ListOption.Get(cmd.Substring(7)); if (oneOption != null) { var dlg = new OptionDlg(this, oneOption); if (DialogResult.OK == dlg.ShowDialog()) { //Ver5.8.6 Java fix //oneOption.Save(OptionIni.GetInstance()); oneOption.Save(IniDb); MenuOnClick("StartStop_Reload"); } } } } else if (cmd.IndexOf("Tool_") == 0) { if (RunMode == RunMode.Remote) { //Java fix RunMOde==Remoteの場合のメニュー処理 RemoteClient.MenuOnClick(cmd); } else { var nameTag = cmd.Substring(5); var oneTool = ListTool.Get(nameTag); if (oneTool == null) { return; } //BJD.EXE以外の場合、サーバオブジェクトへのポインタが必要になる OneServer oneServer = null; if (nameTag != "BJD") { oneServer = ListServer.Get(nameTag); if (oneServer == null) { return; } } ToolDlg dlg = oneTool.CreateDlg(oneServer); dlg.ShowDialog(); } } else if (cmd.IndexOf("StartStop_") == 0) { if (RunMode == RunMode.Remote) { //Java fix RunMOde==Remoteの場合のメニュー処理 RemoteClient.MenuOnClick(cmd); } else { switch (cmd) { case "StartStop_Start": Start(); break; case "StartStop_Stop": Stop(); break; case "StartStop_Restart": Stop(); Thread.Sleep(300); Start(); break; case "StartStop_Reload": Stop(); ListInitialize(); Start(); break; case "StartStop_Service": SetupService(); //サービスの設定 break; default: Util.RuntimeException(string.Format("cmd={0}", cmd)); break; } View.SetColor(); //ウインドのカラー初期化 Menu.SetEnable(); //状態に応じた有効・無効 } } else { switch (cmd) { case "File_LogClear": LogView.Clear(); break; case "File_LogCopy": LogView.SetClipboard(); break; case "File_Trace": TraceDlg.Open(); break; case "File_Exit": View.MainForm.Close(); break; case "Help_Version": var dlg = new VersionDlg(this); dlg.ShowDialog(); break; case "Help_Homepage": Process.Start(Define.WebHome()); break; case "Help_Document": Process.Start(Define.WebDocument()); break; case "Help_Support": Process.Start(Define.WebSupport()); break; } } }