/// <summary> /// The Selected has changed. /// </summary> /// <param name="control"></param> /// <param name="selectedIndex"></param> public void OnTextChanged(Control control, string text) { // first attempt casting the control as LabelTextBoxControl LabelTextBoxControl sender = control as LabelTextBoxControl; // if the sender and Options objects both exist if (NullHelper.Exists(sender, Options)) { // if this is the ResolutionControl if (sender.Name == ResolutionControl.Name) { // Set the Resolution Options.Resolution = NumericHelper.ParseInteger(text, 0, -1); } } // now try LabelTextBoxBrowserControl LabelTextBoxBrowserControl sender2 = control as LabelTextBoxBrowserControl; // if the sender2 and Options objects both exist if (NullHelper.Exists(sender2, Options)) { // verify we have the correct control if (sender2.Name == DirectoryControl.Name) { // Set the Directory Options.Directory = text; } } // Enable or disable the StartButton UIControl(); }
/// <summary> /// The Selected has changed. /// </summary> /// <param name="control"></param> /// <param name="selectedIndex"></param> public void OnTextChanged(Control control, string text) { // cast the control as a LabelTextBoxBrowser control LabelTextBoxBrowserControl sender = control as LabelTextBoxBrowserControl; // If the sender object exists if ((NullHelper.Exists(sender)) && (HasProject)) { // determine the action by the name switch (sender.Name) { case "ProjectRootControl": // Set the RootFolder Project.RootFolder = ProjectRootControl.Text; // requiered break; case "ExternalFolderControl": // Set the ExternalFolder Project.ExternalFolder = ExternalFolderControl.Text; // Set the Count this.OrphanFilesControl.Text = Project.OrphanFiles.Count.ToString(); // get the size long bytes = Project.OrphanFiles.Sum(x => x.Size); // Set the text this.SpaceSavedControl.Text = String.Format("{0:n0}", bytes) + " bytes"; // required break; } // Enable or disable controls UIEnable(); } }
/// <summary> /// event is fired when On Text Changed /// </summary> public void OnTextChanged(Control sender, string text) { // cast the sender as a LabelTextBoxBrowserControl LabelTextBoxBrowserControl labelTextBoxBrowserControl = sender as LabelTextBoxBrowserControl; // If the labelTextBoxBrowserControl object exists if (NullHelper.Exists(labelTextBoxBrowserControl)) { // determine which control was modified switch (labelTextBoxBrowserControl.Name) { case "FirstNamesControl": // if the FirstNamesControl.Text is set and the file exists if ((labelTextBoxBrowserControl.HasText) && (File.Exists(labelTextBoxBrowserControl.Text))) { // Enable the ImportFirstNamesButton ImportFirstNamesButton.Enabled = true; } else { // disable the ImportFirstNamesButton ImportFirstNamesButton.Enabled = false; } // required break; case "LastNamesControl": // if the LastNamesControl.Text is set and the file exists if ((labelTextBoxBrowserControl.HasText) && (File.Exists(labelTextBoxBrowserControl.Text))) { // Enable the ImportLastNamesButton ImportLastNamesButton.Enabled = true; } else { // disable the ImportLastNamesButton ImportLastNamesButton.Enabled = false; } // required break; case "StreetNamesControl": // if the StreetNames.Text is set and the file exists if ((labelTextBoxBrowserControl.HasText) && (File.Exists(labelTextBoxBrowserControl.Text))) { // Enable the ImportStreeNamesButton ImportStreetNamesButton.Enabled = true; } else { // disable the ImportStreetNamesButton ImportStreetNamesButton.Enabled = false; } // required break; case "ZipCodeControl": // if the StreetNames.Text is set and the file exists if ((labelTextBoxBrowserControl.HasText) && (File.Exists(labelTextBoxBrowserControl.Text))) { // Enable the ImportZipButton ImportZipButton.Enabled = true; } else { // disable the ImportZipButton ImportZipButton.Enabled = false; } // required break; } } }