public MainWindow() { //Window for login LoginWindow loginWindow = new LoginWindow(this); hasLock = false; currentTextboxText = ""; //Starts Windows InitializeComponent(); this.Show(); loginWindow.ShowDialog(); //Post Start Area //Stops the text from wrapping on its own. DocumentText.Document.PageWidth = 10000; //Disables to lock options. lockRequest.IsEnabled = false; releaseLock.IsEnabled = false; //Makes document text read only until user creates new file or opens file. DocumentText.IsReadOnly = true; //diff Match stuff. diffMatch = new diff_match_patch(); //Welcome Message. richTextBoxText.AppendText("Welcome to Live Pair Coding Editor!\n"); //Thread for Messages Thread textThread = new Thread(new ThreadStart(getMessages)); textThread.Start(); //Thread for document changes Thread userThread = new Thread(new ThreadStart(getUsers)); userThread.Start(); //Gets the document Changes Thread DocChangesThread = new Thread(new ThreadStart(changes)); DocChangesThread.Start(); }
//Allows the login window to connect this form to the server. public FailureType connect(LoginWindow loginWindow, string address, Client user) { try { //Saves the address and binding mode. this.address = address; NetTcpBinding netBinding = new NetTcpBinding(); netBinding.Security.Mode = SecurityMode.None; //Creates channelfactor and network object. clientChannel = new ChannelFactory <IServer>(netBinding, BINDING + address + TARGET); network = clientChannel.CreateChannel(); return(FailureType.Good); } catch (Exception) { System.Windows.MessageBox.Show("Error: Something went wrong on connect.", "Error"); return(FailureType.FailedUnknownReason); } }
//Allows the login window to connect this form to the server. public FailureType connect(LoginWindow loginWindow, string address, Client user) { try { //Saves the address and binding mode. this.address = address; NetTcpBinding netBinding = new NetTcpBinding(); netBinding.Security.Mode = SecurityMode.None; //Creates channelfactor and network object. clientChannel = new ChannelFactory<IServer>(netBinding, BINDING + address + TARGET); network = clientChannel.CreateChannel(); return FailureType.Good; } catch (Exception) { System.Windows.MessageBox.Show("Error: Something went wrong on connect.", "Error"); return FailureType.FailedUnknownReason; } }