private void ChangeToNumber(object sender, SelectionChangedEventArgs e) { var selectedIndex = seletlist.SelectedIndex; if (selectedIndex == 0) { ConvertionMethod = NumberUnits.Binary; } else if (selectedIndex == 1) { ConvertionMethod = NumberUnits.HexaDecimal; } else if (selectedIndex == 2) { ConvertionMethod = NumberUnits.Octal; } }
public static string GetResult(long input, NumberUnits method) { if (method == NumberUnits.Binary) { return(Convert.ToString(input, 2)); } else if (method == NumberUnits.HexaDecimal) { return(Convert.ToString(input, 16)); } else if (method == NumberUnits.Octal) { return(Convert.ToString(input, 8)); } else { return(""); } }