private void AccessThreadStartingPoint() { ProgWin editor = new ProgWin(ProgWin.editorType.collaborator, SC, IP, Port, AccessString[0], username, Prog + WindowCount.ToString()); editor.CloseProgramEvent += new ProgWin.CloseProgramEventHandler(editor_CloseProgramEvent); ArrayList list = new ArrayList(); string permission = ""; if (AccessString[5].ToString() == "true") permission += "R"; if (AccessString[6].ToString() == "true") permission += "W"; list.Add(permission); list.Add(editor); AccessControlList.Add(AccessString[0], list); editor.loadProgram(AccessString[2]); foreach (string entry in userList) { string[] userInfo = entry.Split('|'); if (userInfo[1].Trim() == AccessString[1]) { editor.setOwner(userInfo[0].Trim()); break; } } //editor.setOwner(s[1]); editor.SMObj().setOwner(AccessString[1]); editor.Show(); editor.setUserList(userList); editor.setPermissions(permission); //editor.SMObj().createTheObjects(s[0], IP, Port); editor.SMObj().InitializeThePeer(AccessString[7]); editor.SMObj().adder(AccessString[3] + ":" + AccessString[4], AccessString[5], AccessString[6]); System.Windows.Threading.Dispatcher.Run(); }
private void OwnerThreadStartingPoint() { //try //{ string pid; pid = Guid.NewGuid().ToString(); ProgWin editor = new ProgWin(ProgWin.editorType.owner, SC, IP, Port, pid, username, Prog+WindowCount.ToString()); editor.CloseProgramEvent += new ProgWin.CloseProgramEventHandler(editor_CloseProgramEvent); //owner is the user itself. so pass the username here //list of the users in swarm //take the program name and send the program name editor.setUserList(userList); editor.setPermissions("RW"); editor.loadProgram(programText); editor.setOwner(username); editor.SMObj().setOwner(IP + ":" + Port); ArrayList list = new ArrayList(); list.Add("RW"); list.Add(editor); AccessControlList.Add(pid, list); //editor.Owner = this; editor.Show(); System.Windows.Threading.Dispatcher.Run(); //catch(Exception e) //{ // Console.WriteLine("**********************************************"); // Console.WriteLine(e.ToString()); // Console.WriteLine("**********************************************"); //} }