public MainForm() { InitializeComponent(); AlignWindow(); //Start Dinu! Stream stream = File.Open("config.info", FileMode.Open); BinaryFormatter bformatter = new BinaryFormatter(); bformatter = new BinaryFormatter(); ConnectingSettingsData info = (ConnectingSettingsData)bformatter.Deserialize(stream); stream.Close(); int port = Int32.Parse(info.port); _chatClient = new ChatClient(info.ip, port); _chatClient.SetMessageReceiver(ReceiveMessage); _chatClient.SetFileReceiver(ConfirmFileReceivement, GetSavePath); _chatClient.SetFriendRequestConfirmation(ConfirmFriendRequest); _chatClient.SetNotifier(Notify); //or in other place //End Dinu! }
public void UpdateChatClient(string ip, int port) { _chatClient.SignOut(); _chatClient = new ChatClient(ip, port); _chatClient.SetMessageReceiver(ReceiveMessage); _chatClient.SetFileReceiver(ConfirmFileReceivement, GetSavePath); _chatClient.SetFriendRequestConfirmation(ConfirmFriendRequest); _chatClient.SetNotifier(Notify); }