Beispiel #1
0
        public static Guid CreateNewProfile(string profile_name, UserConfig config, bool force_edit_req = false)
        {
            var profile_id = Guid.NewGuid();

            /* 重複しないIDになるまで繰り返し */
            while (ProfileIsExist(profile_id))
            {
            }

            if (config == null)
            {
                config = new UserConfig();
            }

            if (profile_name != null)
            {
                config.ProfileName.Value = profile_name;
            }

            /* 重複する名前のプロファイルが存在する場合は編集 */
            if ((ProfileIsExist(config.ProfileName.Value)) || (force_edit_req))
            {
                if (!FormUiManager.ShowProfileEditDialog("Edit Profile", config))
                {
                    return(Guid.Empty);
                }
            }

            config.Save(GetProfilePath(profile_id));

            return(profile_id);
        }
Beispiel #2
0
        public void FormKeyAction(MainWindowActionId id)
        {
            if (InvokeRequired)
            {
                Invoke((FormKeyActionHandler)FormKeyAction, id);
                return;
            }

            switch (id)
            {
            case MainWindowActionId.ApplicationExit:
                Program.ShutdownRequest();
                break;

            case MainWindowActionId.TimeStamp:
                GatePacketManager.SetTimeStamp(ConfigManager.Language.MainMessage.TimeStampManual.Value);
                break;

            case MainWindowActionId.PacketRedraw:
                FormTaskManager.RedrawPacketRequest();
                break;

            case MainWindowActionId.PacketClear:
                GatePacketManager.ClearPacket();
                break;

            case MainWindowActionId.PacketSaveConvertOff:
                FormUiManager.SavePacketLog(true, false);
                break;

            case MainWindowActionId.PacketSaveConvertOn:
                FormUiManager.SavePacketLog(true, true);
                break;

            case MainWindowActionId.PacketSaveAsConvertOff:
                FormUiManager.SavePacketLog(false, false);
                break;

            case MainWindowActionId.PacketSaveAsConvertOn:
                FormUiManager.SavePacketLog(false, true);
                break;

            case MainWindowActionId.FileOpen:
                FormUiManager.FileOpen();
                break;

            case MainWindowActionId.AutoTimeStampToggle:
                ConfigManager.System.AutoTimeStamp.Enable.Value = !ConfigManager.System.AutoTimeStamp.Enable.Value;
                FormUiManager.MainFrameMenuBarUpdate();
                break;

            case MainWindowActionId.AutoScrollToggle:
                ConfigManager.System.AutoScroll.Value = !ConfigManager.System.AutoScroll.Value;
                FormUiManager.MainFrameMenuBarUpdate();
                break;

            case MainWindowActionId.ProfileAdd:
                ConfigManager.CreateNewProfile("New Profile", null, true);
                break;

            case MainWindowActionId.ProfileRemove:
                ConfigManager.DeleteProfile(ConfigManager.GetCurrentProfileID());
                break;

            case MainWindowActionId.ProfileEdit:
                if (FormUiManager.ShowProfileEditDialog("Edit Profile", ConfigManager.User, ConfigManager.User.ProfileName.Value))
                {
                    ConfigManager.SaveCurrentProfile(true);
                    FormUiManager.MainFrameMenuBarUpdate();
                }
                break;

            case MainWindowActionId.ProfileExport:
                FormUiManager.SaveUserConfig();
                break;

            case MainWindowActionId.Gate1_Connect:
            case MainWindowActionId.Gate2_Connect:
            case MainWindowActionId.Gate3_Connect:
            case MainWindowActionId.Gate4_Connect:
            case MainWindowActionId.Gate5_Connect:
                var gate_list = GateManager.GetGateList();
                var gate_id   = (int)(id - MainWindowActionId.Gate1_Connect);

                if (gate_id < gate_list.Length)
                {
                    gate_list[gate_id].ConnectRequest = !gate_list[gate_id].ConnectRequest;
                }
                break;

            case MainWindowActionId.ShowScriptWindow:
                FormUiManager.ScriptWindowVisible(true);
                break;

            case MainWindowActionId.ShowOptionDialog:
                FormUiManager.ShowOptionDialog();
                break;

            case MainWindowActionId.ShowAppDocument:
                FormUiManager.ShowAppDocument();
                break;

            case MainWindowActionId.ShowAppDocument_PacketFilter:
                FormUiManager.ShowAppDocument();
                break;

            case MainWindowActionId.ShowAppInformation:
                FormUiManager.ShowAppInfo();
                break;
            }
        }