protected async override void OnNavigatedTo(NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);

            this.button = (RemoteButton)e.Parameter;
            this.remote = await RemotesManager.Instance.GetActiveRemote();

            this.DataContext = this.button;

            if (null == this.button.Address)
            {
                this.textBoxAddress.Text = this.remote.Address.ToString();
            }

            if (null == this.button.Type)
            {
                this.comboBoxProtocol.SelectedIndex = (int)this.remote.Type;
                this.webView.ShowPage(this.remote.Type);
            }
            else
            {
                this.comboBoxProtocol.SelectedIndex = (int)this.button.Type;
                this.webView.ShowPage((IrProtocol)this.button.Type);
            }
        }
Beispiel #2
0
        private async void AddButtonClick(object sender, RoutedEventArgs e)
        {
            var pos = 100.0f * RemotesManager.Instance.GetScale();

            var button = new RemoteButton(pos, pos, pos, pos, "new b", false, 0);

            var grid = (Canvas)((PivotItem)this.rootPivot.SelectedItem).Content;

            Button controllButton = new Button();

            controllButton.Content = button.Title;

            SetLayout(controllButton, button);

            controllButton.Tag = button;

            controllButton.Click += this.RemoteButtonClick;

            grid.Children.Add(controllButton);

            var remote = await RemotesManager.Instance.GetActiveRemote();

            remote.Buttons.Add(button);
            await remote.Save();
        }
Beispiel #3
0
        private void SetLayout(Button button, RemoteButton remoteButton)
        {
            button.Width  = remoteButton.Width;
            button.Height = remoteButton.Height;

            Canvas.SetLeft(button, remoteButton.X);
            Canvas.SetTop(button, remoteButton.Y);
        }
Beispiel #4
0
        private void MoveButtonRightClick(object sender, RoutedEventArgs e)
        {
            if (null != this.activeButton)
            {
                RemoteButton button = (RemoteButton)this.activeButton.Tag;

                button.X++;

                SetLayout(this.activeButton, button);
            }
        }