示例#1
0
        private async void BtnNewSensor_ClickAsync(object sender, RoutedEventArgs e)
        {
            AddSensorDialog     dialog = new AddSensorDialog();
            ContentDialogResult result = await dialog.ShowAsync();

            if (result == ContentDialogResult.Primary)
            {
                //_viewModel.AddSensor(dialog.SensorViewModel);
                _viewModel.IsSiteChanged = true;
            }
        }
示例#2
0
        private async void Button_NewSensorClick(object sender, RoutedEventArgs e)
        {
            AddSensorDialog dialog = new AddSensorDialog();
            var             result = await dialog.ShowAsync();

            if (result == ContentDialogResult.Primary)
            {
                if (_curDataset != null)
                {
                    double totalX    = floorplanImage.ActualWidth;
                    double totalY    = floorplanImage.ActualHeight;
                    Sensor sensor    = _curDataset.AddSensor(dialog.sensorName, dialog.sensorType, 0.0, 0.0, 23 / totalX, 15 / totalY);
                    int    typeIndex = GetSensorTypeIndex(dialog.sensorType);
                    SaveHome();
                    AddSeneorToCanvas(sensor);
                    if (typeIndex >= 0)
                    {
                        sensorListTypeSelect.SelectedIndex = -1;
                        sensorListTypeSelect.SelectedIndex = typeIndex;
                    }
                }
            }
        }