Esempio n. 1
0
        private void btnAdd_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                Mouse.OverrideCursor = Cursors.Wait;
                /* Create a new environment */
                Environment environment = new Environment()
                {
                    Name   = txtName.Text,
                    Width  = int.Parse(txtWidth.Text),
                    Height = int.Parse(txtHeight.Text),
                    DistanceBetweenReferencePoints = int.Parse(txtDistanceBetweenRefPoints.Text),
                    Timestamp = DateTime.Now,
                };
                IndoorPositioningClient.AddEnvironment(environment);

                /* Load the list again */
                Load();
                Mouse.OverrideCursor = Cursors.Arrow;
            }
            catch (Exception ex)
            {
                Mouse.OverrideCursor = Cursors.Arrow;
                MessageBox.Show(ex.ToString());
            }
        }
Esempio n. 2
0
        private void btnDelete_Click(object sender, RoutedEventArgs e)
        {
            if (selectedEnvironment == null)
            {
                return;
            }
            MessageBoxResult result = MessageBox.Show("Are you sure to delete this?", "WARNING!", MessageBoxButton.YesNo);

            if (result == MessageBoxResult.No)
            {
                return;
            }

            try
            {
                Mouse.OverrideCursor = Cursors.Wait;
                IndoorPositioningClient.DeleteEnvironment(selectedEnvironment);

                /* remove selected item */
                selectedEnvironment = null;
                selectedIndex       = 0;
                /* Load the list again */
                Load();
                Mouse.OverrideCursor = Cursors.Arrow;
            }
            catch (Exception ex)
            {
                Mouse.OverrideCursor = Cursors.Arrow;
                MessageBox.Show(ex.ToString());
            }
        }
Esempio n. 3
0
        public EnvironmentsScreen()
        {
            Initialized += BeaconsScreen_Initialized;
            Loaded      += BeaconsScreen_Loaded;

            InitializeComponent();

            selectedEnvironment = new Environment();
            gridEnvironmentDetails.DataContext = selectedEnvironment;
        }
Esempio n. 4
0
        private void lstEnvironments_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (lstEnvironments.SelectedItem == null)
            {
                return;
            }

            selectedEnvironment = (Environment)lstEnvironments.SelectedItem;
            selectedIndex       = lstEnvironments.SelectedIndex;

            gridEnvironmentDetails.DataContext = selectedEnvironment;
        }
Esempio n. 5
0
        private void txtHeightOrWidth_TextChanged(object sender, TextChangedEventArgs e)
        {
            /* If there is no environment in the system, this value will be null. */
            if (selectedEnvironment == null)
            {
                selectedEnvironment = new Environment();
            }

            /* Check the values of the text boxes whether they are parsable or not */
            if (string.IsNullOrEmpty(txtHeight.Text))
            {
                return;
            }
            if (string.IsNullOrEmpty(txtWidth.Text))
            {
                return;
            }
        }