예제 #1
0
파일: Kernel.cs 프로젝트: jsakamoto/bjd5
        //���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;
                }
            }
        }
예제 #2
0
 //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, "");
             }
         }
     }
 }