I am trying to get a return back to the main program but it has to change on the ComboBox change. No matter what it is returning whatever the String is set to at the top of the class. If I change the result = ""; to result = "Test"; it will display Test in the TextBox I am trying to update. But it won't get anything from the IF statements.
Thanks for the help!
MAIN PROGRAM
namespace VTCPT
{
/// <summary>
///
/// </summary>
public sealed partial class MainPage : Page
{
public MainPage()
{
this.InitializeComponent();
}
private void ComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
//UPDATE THE SHORTCODE TEXTBLOCK
updateVTCShortCode display = new updateVTCShortCode();
display.mergeShortCode(longFormCodec.SelectedItem.ToString());
if (String.IsNullOrEmpty(display.finalResult()))
{ shortFormCodec.Text = ".."; }
else { shortFormCodec.Text = display.finalResult(); }
}
private void updateShortForm(object sender, SelectionChangedEventArgs e)
{
}
private void TextBlock_SelectionChanged(object sender, RoutedEventArgs e)
{
}
private void fsSiteBuild_SelectionChanged(object sender, RoutedEventArgs e)
{
}
private void updateSiteBuild(object sender, TextChangedEventArgs e)
{
int index = fsRoomDesig.Text.IndexOf(".");
if (index > 0)
{ fsSiteBuild.Text = fsRoomDesig.Text.Substring(0, index); }
else { fsSiteBuild.Text = ".."; }
}
private void vtcSystemName_SelectionChanged(object sender, RoutedEventArgs e)
{
}
}
}
updateVTCShortCode CLASS
namespace VTCPT
{
class updateVTCShortCode
{
String result = ""; //////ALWAYS RESULTS ONLY IN WHAT IS HERE
public void mergeShortCode(String longFormCodec)
{
if (longFormCodec == "Cisco SX80")
{
String sendShortForm = "SX80";
result = "V-T" + sendShortForm;
}
if (longFormCodec == "Cisco Webex Codec Plus")
{
String sendShortForm = "SRK";
result = "V-T" + sendShortForm;
}
if (longFormCodec == "Cisco Webex Codec Pro")
{
String sendShortForm = "SRK";
result = "V-T" + sendShortForm;
}
}
public String finalResult()
{ return result; }
}
}
Aucun commentaire:
Enregistrer un commentaire