Ejemplo n.º 1
0
        /// <summary>
        /// Event listener for the Calculate button click
        /// </summary>
        /// <param name="sender">the object which sent the event, not used in this case</param>
        /// <param name="e">arguments from the event, not used in this case</param>
        private void Calculate_Button_Click(object sender, RoutedEventArgs e)
        {
            int area = -1;

            //try to parse the string into an int
            try
            {
                area = int.Parse(Area_TextBox.Text);
            }
            catch (System.FormatException fe)
            {
                Debug.WriteLine(fe.Message);
            }
            //check that there is a floor selected, the area is between 1 and 10,000, and the routerlocation is also selected
            if (Floors.SelectedItem != null && (area >= 1 && area <= 10000))
            {
                //stored the area in the application properties
                Application.Current.Properties["Area"] = Area_TextBox.Text;
                //store what the unit is
                if (SQ_Feet_Radio.IsChecked.Value)
                {
                    Application.Current.Properties["Unit"] = "Feet";
                }
                else
                {
                    Application.Current.Properties["Unit"] = "Meter";
                }
                //get the floor number only, spilt the : for only the number
                int floor_num = int.Parse(Floors.SelectedItem.ToString().Split(new string[] { ": " }, StringSplitOptions.None).Last());

                ///minus 1 since a one story house does not need to factor in height
                Application.Current.Properties["Floors"] = floor_num - 1;
                //stored the router location
                Application.Current.Properties["RouterLocation"] = RouterLocation.SelectedIndex;
                // go to the coverage page
                this.NavigationService.Navigate(new Uri("Coverage.xaml", UriKind.Relative));
            }
            //flash the area text if the inputs are not correct
            else
            {
                flashCounter = 0;
                flashAreaText.Start();
                //call the validation manually that is set on the area box
                Area_TextBox.GetBindingExpression(TextBox.TextProperty).UpdateSource();
            }
        }
Ejemplo n.º 2
0
 /// <summary>
 /// If the area textbox was clicked on, then clear the placeholder
 /// </summary>
 /// <param name="sender">where the event came from, not used in this case</param>
 /// <param name="e">arguments for the event, not used in this case</param>
 private void SQ_Feet_GotFocus(object sender, RoutedEventArgs e)
 {
     Area_TextBox.Clear();
     Area_TextBox.Foreground = new SolidColorBrush(Colors.Black);
 }