private void MainFrame_DragDrop(object sender, DragEventArgs e) { if (e.Data.GetData(DataFormats.FileDrop) is string[] file_paths) { FormUiManager.FileOpen(file_paths); } }
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; } }