private void Edit(LinkedCommand command)
        {
            if (command == null)
            return;

              var dialog = new WpfCommandDialog (command, Page.Commands);
              dialog.ShowDialog ();
        }
Exemple #2
0
        private void Edit(LinkedCommand command)
        {
            if (command == null)
            {
                return;
            }

            var dialog = new WpfCommandDialog(command, Page.Commands);

            dialog.ShowDialog();
        }
Exemple #3
0
        public WpfCommandDialog(LinkedCommand command, Commands allCommands)
        {
            InitializeComponent();

            _timer          = new Timer();
            _timer.Interval = 200;
            _timer.Tick    += OnTick;

            Command  = command;
            Commands = from Command c in allCommands
                       where !String.IsNullOrEmpty(c.Name)
                       orderby c.Name
                       select c;

            before.IsChecked = command.ExecutionTime == ExecutionTime.Before;
            after.IsChecked  = command.ExecutionTime == ExecutionTime.After;

            Loaded += (s, e) =>
            {
                //reset the filter (without updating the view because the selected
                //item would scroll out of view again once the timer expires)
                search.TextChanged -= OnTextChanged;
                search.Text         = string.Empty;
                search.TextChanged += OnTextChanged;

                //refresh the view as it is still only displaying the last filtered result
                if (View != null)
                {
                    View.Refresh();
                }

                //select the currently attached command
                try
                {
                    var selected = allCommands.Item(command.Guid, command.Id);
                    if (selected != null)
                    {
                        commands.SelectedItem = selected;
                        commands.ScrollIntoView(selected);
                    }
                }
                catch (ArgumentException)
                {
                }
            };
        }
        public WpfCommandDialog(LinkedCommand command, Commands allCommands)
        {
            InitializeComponent ();

              _timer = new Timer();
              _timer.Interval = 200;
              _timer.Tick += OnTick;

              Command = command;
              Commands = from Command c in allCommands
                 where !String.IsNullOrEmpty (c.Name)
                 orderby c.Name
                 select c;

              before.IsChecked = command.ExecutionTime == ExecutionTime.Before;
              after.IsChecked = command.ExecutionTime == ExecutionTime.After;

              Loaded += (s, e) =>
              {
            //reset the filter (without updating the view because the selected
            //item would scroll out of view again once the timer expires)
            search.TextChanged -= OnTextChanged;
            search.Text = string.Empty;
            search.TextChanged += OnTextChanged;

            //refresh the view as it is still only displaying the last filtered result
            if (View != null)
              View.Refresh ();

            //select the currently attached command
            try
            {
              var selected = allCommands.Item (command.Guid, command.Id);
              if (selected != null)
              {
            commands.SelectedItem = selected;
            commands.ScrollIntoView (selected);
              }
            }
            catch (ArgumentException) { }
              };
        }