private NewWorkspaceWindow(string ServerAndPort, string UserName, string DefaultStream, PerforceInfoRecord Info, List <PerforceClientRecord> Clients, TextWriter Log) { InitializeComponent(); this.ServerAndPort = ServerAndPort; this.UserName = UserName; this.Info = Info; this.Clients = Clients; this.Log = Log; Dictionary <string, int> RootPathToCount = new Dictionary <string, int>(StringComparer.InvariantCultureIgnoreCase); foreach (PerforceClientRecord Client in Clients) { if (Client.Host == null || String.Compare(Client.Host, Info.HostName, StringComparison.InvariantCultureIgnoreCase) == 0) { if (!String.IsNullOrEmpty(Client.Root) && Client.Root != ".") { string ParentDir; try { ParentDir = Path.GetFullPath(Path.GetDirectoryName(Client.Root)); } catch { ParentDir = null; } if (ParentDir != null) { int Count; RootPathToCount.TryGetValue(ParentDir, out Count); RootPathToCount[ParentDir] = Count + 1; } } } } int RootPathMaxCount = 0; foreach (KeyValuePair <string, int> RootPathPair in RootPathToCount) { if (RootPathPair.Value > RootPathMaxCount) { DefaultRootPath = RootPathPair.Key; RootPathMaxCount = RootPathPair.Value; } } StreamTextBox.Text = DefaultStream ?? ""; StreamTextBox.SelectionStart = StreamTextBox.Text.Length; StreamTextBox.SelectionLength = 0; StreamTextBox.Focus(); UpdateOkButton(); UpdateNameCueBanner(); UpdateRootDirCueBanner(); }
private void ClearForm() { firstNameTextBox.Clear(); secondNameTextBox.Clear(); lastNameTextBox.Clear(); SpecialtyTextBox.Clear(); FacultyTextBox.Clear(); FNumTextBox.Clear(); CourseTextBox.Clear(); StreamTextBox.Clear(); GroupTextBox.Clear(); }