Пример #1
0
 public void HandleRenameRequested(Devices.Device device, FrameworkElement container)
 {
     ShowRenameFlyout(container, device.Caption, (name) =>
     {
         if (!string.IsNullOrEmpty(name))
         {
             _deviceProvider.RenameDevice(device, name);
         }
     });
 }
Пример #2
0
        public void HandleMoveRequested(Devices.Device device, FrameworkElement targetElement)
        {
            MenuFlyout flyout = new MenuFlyout();

            foreach (var room in _deviceProvider.Rooms)
            {
                if (room.Id != device.Room.Id)
                {
                    MenuFlyoutItem roomItem = new MenuFlyoutItem();
                    roomItem.Text   = room.Caption;
                    roomItem.Tag    = new Tuple <Devices.Device, Devices.Room>(device, room);
                    roomItem.Click += OnMoveDeviceToRoom;
                    flyout.Items.Add(roomItem);
                }
            }

            flyout.ShowAt(targetElement);
        }
Пример #3
0
        public void HandleDeviceContextRequested(Devices.Device device, UIElement targetElement, Point point)
        {
            _deviceProvider.SelectDevices(new Devices.Device[] { device });

            MenuFlyout flyout = new MenuFlyout();

            MenuFlyoutItem renameItem = new MenuFlyoutItem();

            renameItem.Text   = _stringProvider.GetString("DeviceContextMenuItemRename");
            renameItem.Tag    = new Tuple <Devices.Device, UIElement>(device, targetElement);
            renameItem.Icon   = new SymbolIcon(Symbol.Rename);
            renameItem.Click += RenameItem_Click;
            flyout.Items.Add(renameItem);

            MenuFlyoutItem deleteItem = new MenuFlyoutItem();

            deleteItem.Text   = _stringProvider.GetString("DeviceContextMenuItemRemove");
            deleteItem.Tag    = new Tuple <Devices.Device, UIElement>(device, targetElement);
            deleteItem.Icon   = new SymbolIcon(Symbol.Remove);
            deleteItem.Click += DeleteItem_Click;
            flyout.Items.Add(deleteItem);

            MenuFlyoutSubItem moveItem = new MenuFlyoutSubItem();

            moveItem.Text = _stringProvider.GetString("DeviceContextMenuItemMove");
            moveItem.Icon = new SymbolIcon(Symbol.MoveToFolder);
            flyout.Items.Add(moveItem);

            foreach (var room in _deviceProvider.Rooms)
            {
                if (room.Id != device.Room.Id)
                {
                    MenuFlyoutItem roomItem = new MenuFlyoutItem();
                    roomItem.Text   = room.Caption;
                    roomItem.Tag    = new Tuple <Devices.Device, Devices.Room>(device, room);
                    roomItem.Click += OnMoveDeviceToRoom;
                    moveItem.Items.Add(roomItem);
                }
            }

            flyout.ShowAt(targetElement, point);
        }
Пример #4
0
 public void HandleDeleteRequested(Devices.Device device)
 {
     _deviceProvider.RemoveDevice(device);
 }