示例#1
0
        // opens a add new channel with the information previously stored in the button.
        // deletes the old one when save is pressed.
        private void channelButtonEditPressed(object sender, EventArgs e)
        {
          List<RemoteButton> blist = ((App)(CPRemoteApp.App.Current)).deviceController.channelController.buttonScanner.getButtons();
          int ch_tag = (sender as ChannelList).tag;
          AddNewChannelPopup popup_content = new AddNewChannelPopup(ch_tag, blist[ch_tag].getName(), blist[ch_tag].getChannelNumber(), blist[ch_tag].getImgUri());
          Border border = new Border
          {
            Child = popup_content,
            Width = 840,
            Height = 280,
            Background = new SolidColorBrush(Colors.LightBlue),
            BorderBrush = new SolidColorBrush(Colors.Black),
            BorderThickness = new Thickness(4),
            Padding = new Thickness(20, 10, 20, 0)
          };

          popup_control = new Popup
          {
            Child = border,
            IsLightDismissEnabled = true
          };

          popup_control.Closed += add_channel_popup_Closed;

          border.Loaded += (loadedSender, loadedArgs) =>
          {
            popup_control.HorizontalOffset = (Window.Current.Bounds.Width - border.ActualWidth) / 2;
            popup_control.VerticalOffset = 100;
          };
          popup_content.setParentPopup(ref popup_control);
          popup_control.IsOpen = true;

          popup_content.savePressed += delegate
          {
            // if save is pressed, also delete the button currently being edited to save the new one.
            channelButtonSaveEdit(popup_content, EventArgs.Empty);
          };
          
        }
示例#2
0
        private void populateChannelList()
        {
          channels.Clear();

          List<RemoteButton> blist = ((App)(CPRemoteApp.App.Current)).deviceController.channelController.buttonScanner.getButtons();

          ListBoxItem item;
          ChannelList content;
          for (int i = 0; i < blist.Count; i++)
          {
            item = new ListBoxItem();
            content = new ChannelList(blist[i].getName(), i);
            content.deletePressed += channelButtonDeletePressed;
            content.editPressed += channelButtonEditPressed;
            item.Content = content;
            channels.Add(item);
          }
          item = new ListBoxItem();
          content = new ChannelList("Add New Channel", -1);
          item.Content = content;

          content.Changed += delegate
          {

            AddNewChannelPopup popup_content = new AddNewChannelPopup();
            Border border = new Border
            {
              Child = popup_content,
              Width = 840,
              Height = 280,
              Background = new SolidColorBrush(Colors.LightBlue),
              BorderBrush = new SolidColorBrush(Colors.Black),
              BorderThickness = new Thickness(4),
              Padding = new Thickness(20, 10, 20, 0)
            };

            popup_control = new Popup
            {
              Child = border,
              IsLightDismissEnabled = true
            };

            popup_control.Closed += add_channel_popup_Closed;

            border.Loaded += (loadedSender, loadedArgs) =>
            {
              popup_control.HorizontalOffset = (Window.Current.Bounds.Width - border.ActualWidth) / 2;
              popup_control.VerticalOffset = 100;
            };
            popup_content.setParentPopup(ref popup_control);
            popup_control.IsOpen = true;
          };

          channels.Add(item);
        }