Пример #1
0
        /// <summary>
        /// Sensor-Tile position changed
        /// </summary>
        /// <param name="args"></param>
        private void SensorTileAddedEventHandler(SensorTileAddedEventArgs args)
        {
            // Get grid element
            var dt = this.MainGrid.Children.OfType<TileViewDropTarget>().FirstOrDefault();

            if (dt != null)
            {
                // Get grid position
                int gridRow = Convert.ToInt32(dt.GetValue(Grid.RowProperty));
                int gridColumn = Convert.ToInt32(dt.GetValue(Grid.ColumnProperty));

                // Add to dialog
                this.AddSensorTile(args.Sensor, gridRow, gridColumn, args.SensorCategory.ToString());

                // Add to config
                this.configurationFile.InsertTileConfig(args.SensorCategory.ToString(), args.Sensor.Name, args.Sensor.SensorType.ToString(), gridRow, gridColumn);
            }
        }
Пример #2
0
        /// <summary>
        /// Execute AddNewTileCommand
        /// </summary>
        private void OnAddNewTileCommandExecute(Window popupWindow)
        {
            // Fire event
            SensorTileAddedEventArgs args = new SensorTileAddedEventArgs(this.SelectedSensorCategory.Value, this.SelectedSensor);
            DependencyFactory.Resolve<IEventAggregator>(GeneralConstants.EventAggregator).GetEvent<SensorTileAddedEvent>().Publish(args);

            // Close dialog
            if (popupWindow != null && popupWindow is Window)
            {
                popupWindow.Close();
            }
        }