public void CreateConversationFromTab(RadegastTab Tab, bool selectConversation) { System.Windows.Forms.Control sTabControl = Tab.Control; Mode newConv = null; // Create a conversation on first appearance of its tab. if (sTabControl is InventoryConsole) newConv = inventory = new Closet(control); else if (sTabControl is ChatConsole) { if (chat != null) return; newConv = chat = new Chat(control); } else if (sTabControl is FriendsConsole) newConv = friends = new Friends(control); else if (sTabControl is VoiceConsole) newConv = voice = new Voice(control); else if (sTabControl is GroupIMTabWindow) { GroupIMTabWindow tab = (GroupIMTabWindow)sTabControl; AddConversation(new GroupIMSession(control, tab.SessionId)); return; } else if (sTabControl is ConferenceIMTabWindow) { ConferenceIMTabWindow tab = (ConferenceIMTabWindow)sTabControl; AddConversation(new ConferenceIMSession(control, tab.SessionId, tab.SessionName)); return; } else if (sTabControl is IMTabWindow) { IMTabWindow tab = (IMTabWindow)sTabControl; AddConversation(new SingleIMSession(control, tab.TargetName, tab.TargetId, tab.SessionId)); return; } else if (sTabControl is ObjectsConsole) { surroundings = new Surroundings(control); AddConversation(surroundings); } // If a conversation was created, switch to it. if (newConv != null) { AddConversation(newConv); // Select CHAT as soon as it is created. if (selectConversation && sTabControl is ChatConsole) SelectConversation(newConv); } }
public void CreateConversationFromTab(RadegastTab Tab, bool selectConversation) { System.Windows.Forms.Control sTabControl = Tab.Control; Mode newConv = null; // Create a conversation on first appearance of its tab. if (sTabControl is InventoryConsole && control.config["enabled_for_inventory"]) { newConv = inventory = new Closet(control); } else if (sTabControl is ChatConsole) { if (chat != null) { return; } newConv = chat = new Chat(control); } else if (sTabControl is FriendsConsole && control.config["enabled_for_friends"]) { newConv = friends = new Friends(control); } else if (sTabControl is VoiceConsole) { newConv = voice = new Voice(control); } else if (sTabControl is GroupIMTabWindow) { GroupIMTabWindow tab = (GroupIMTabWindow)sTabControl; AddConversation(new GroupIMSession(control, tab.SessionId)); return; } else if (sTabControl is ConferenceIMTabWindow) { ConferenceIMTabWindow tab = (ConferenceIMTabWindow)sTabControl; AddConversation(new ConferenceIMSession(control, tab.SessionId, tab.SessionName)); return; } else if (sTabControl is IMTabWindow) { IMTabWindow tab = (IMTabWindow)sTabControl; AddConversation(new SingleIMSession(control, tab.TargetName, tab.TargetId, tab.SessionId)); return; } else if (sTabControl is ObjectsConsole && control.config["enabled_for_objects"]) { surroundings = new Surroundings(control); AddConversation(surroundings); } // If a conversation was created, switch to it. if (newConv != null) { AddConversation(newConv); // Select CHAT as soon as it is created. if (selectConversation && sTabControl is ChatConsole) { SelectConversation(newConv); } } }