Exemplo n.º 1
0
        private void ConnectToPresentationSource(PresentationSource presentationSource)
        {
            if (presentationSource == null)
            {
                throw new ArgumentNullException("presentationSource");
            }

            _presentationSource = presentationSource;

            if (Application.Current != null && Application.Current.MainWindow != null)
            {
                _rootDependencyObject = Application.Current.MainWindow as DependencyObject;
            }
            else
            {
                _rootDependencyObject = _presentationSource.RootVisual as DependencyObject;
            }

            _rootInputElement = _rootDependencyObject as IInputElement;

            if (_rootDependencyObject != null && _rootInputElement != null)
            {
                foreach (string accessKey in _renameAccessKeys)
                {
                    AccessKeyManager.Register(accessKey, _rootInputElement);
                }

                AccessKeyManager.AddAccessKeyPressedHandler(_rootDependencyObject, OnAccessKeyPressed);
            }
        }
Exemplo n.º 2
0
        public bool TryHighlightSearchString(string searchTerm)
        {
            var index = _content.IndexOf(searchTerm, StringComparison.CurrentCultureIgnoreCase);

            if (index == -1 || string.IsNullOrWhiteSpace(searchTerm))
            {
                if (_accessKeyIndex != -1)
                {
                    // Unregister and let the content control handle access keys
                    AccessKeyManager.Unregister(_content[_accessKeyIndex].ToString(), _control);
                }

                _control.Content = _originalContent;
                return(false);
            }

            if (_accessKeyIndex != -1)
            {
                // Because we are overriding the content entirely, we have to handle access keys
                AccessKeyManager.Register(_content[_accessKeyIndex].ToString(), _control);
            }

            _control.Content = CreateHighlightingTextRun(index, searchTerm.Length);
            return(true);
        }
Exemplo n.º 3
0
        public Error(Window Owner, Exception exc)
        {
            InitializeComponent();

            MaxHeight = SystemParameters.WorkArea.Height;

            this.Owner = Owner;

            if (Owner == null)
            {
                ShowAsGlobal();
            }

            AccessKeyManager.Register(" ", okButton);

            if (!Settings.JoinedCEIP)
            {
                detailsExpander.Header              = "More _Options";
                stackTraceScroller.Margin           = new Thickness(2, 15, 25, 5);
                stackTraceScroller.IsHitTestVisible = false;
            }
            else
            {
                stackTrace.Text = exc.ToString();
            }
        }
Exemplo n.º 4
0
        // Token: 0x06004283 RID: 17027 RVA: 0x00130C64 File Offset: 0x0012EE64
        private static void OnIsCancelChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            Button element = d as Button;

            if ((bool)e.NewValue)
            {
                AccessKeyManager.Register("\u001b", element);
                return;
            }
            AccessKeyManager.Unregister("\u001b", element);
        }
Exemplo n.º 5
0
 protected virtual void OnIsDefaultChanged(bool oldValue, bool newValue)
 {
     if (newValue)
     {
         AccessKeyManager.Register("\r", this);
     }
     else
     {
         AccessKeyManager.Unregister("\r", this);
     }
 }
Exemplo n.º 6
0
        private static void OnIsCancelChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            Button b = d as Button;

            if ((bool)e.NewValue)
            {
                AccessKeyManager.Register("\x001B", b);
            }
            else
            {
                AccessKeyManager.Unregister("\x001B", b);
            }
        }
Exemplo n.º 7
0
        public EditSelector()
        {
            InitializeComponent();

            // initialize member variables
            // used in Split
            delimiters = new char[] { DEFAULT_DELIMITER };
            // used to recreate the delimited text (offset by space for readability)
            delimiterString = DEFAULT_DELIMITER + " ";
            // register default access key
            AccessKeyManager.Register(DEFAULT_PLUS_ACCESSKEY, PlusButton);
            // create select window instance
            selectWindow = new SelectWindow();
        }
Exemplo n.º 8
0
        private void RegisterAccessKey()
        {
            if (_currentlyRegistered != null)
            {
                AccessKeyManager.Unregister(_currentlyRegistered, this);
                _currentlyRegistered = null;
            }
            string key = _accessKey.Text;

            if (!string.IsNullOrEmpty(key))
            {
                AccessKeyManager.Register(key, this);
                _currentlyRegistered = key;
            }
        }
Exemplo n.º 9
0
        // Token: 0x06004214 RID: 16916 RVA: 0x0012E4D4 File Offset: 0x0012C6D4
        private void RegisterAccessKey()
        {
            if (this._currentlyRegistered != null)
            {
                AccessKeyManager.Unregister(this._currentlyRegistered, this);
                this._currentlyRegistered = null;
            }
            string text = this._accessKey.Text;

            if (!string.IsNullOrEmpty(text))
            {
                AccessKeyManager.Register(text, this);
                this._currentlyRegistered = text;
            }
        }
        public EventRecurrenceSkip(DateTime[] skip)
        {
            InitializeComponent();

            if (skip != null && skip.Length > 0)
            {
                statusText.Visibility = Visibility.Collapsed;

                foreach (object each in skip)
                {
                    listBox.Items.Add(each);
                }
            }

            AccessKeyManager.Register(" ", okButton);
        }
Exemplo n.º 11
0
        private void RegisterAccessKey()
        {
            if (_registeredAccessKey != null)
            {
                AccessKeyManager.Unregister(_registeredAccessKey, this);
                _registeredAccessKey = null;
            }

            var accessKey = GetAccessKey();

            if (string.IsNullOrEmpty(accessKey))
            {
                return;
            }

            AccessKeyManager.Register(accessKey, this);
            _registeredAccessKey = accessKey;
        }
Exemplo n.º 12
0
        public TaskDialog(Window Owner, string Title, string Details, MessageType MessageIcon)
        {
            InitializeComponent();

            this.Owner = Owner;
            this.Title = Title;

            detailsText.Text = Details;

            _icon = MessageIcon;

            AccessKeyManager.Register(" ", okButton);

            if (Owner == null)
            {
                ShowAsGlobal();
            }
        }
Exemplo n.º 13
0
        // initialize the plus button access key
        private static void PlusButtonAccessKeyPropertyChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            string       source  = e.NewValue as string;
            string       old     = e.OldValue as string;
            EditSelector control = sender as EditSelector;

            if (source == null || control == null)
            {
                return;
            }
            // set the access key for the plus button
            AccessKeyManager.Register(source, control.PlusButton);
            // unregister the old access key if present
            if (old != null)
            {
                AccessKeyManager.Unregister(old, control.PlusButton);
            }
        }
Exemplo n.º 14
0
        public EditRecurring(Window Owner, EditingType editType)
        {
            InitializeComponent();
            this.Owner = Owner;
            EditType   = editType;

            switch (EditType)
            {
            case EditingType.Delete:
                Title            = "Delete Recurring Item";
                detailsText.Text = "What do you want to delete?";
                break;

            case EditingType.Open:
                break;
            }

            AccessKeyManager.Register(" ", okButton);
        }
Exemplo n.º 15
0
        public EventRecurrence(Appointment appointment)
        {
            InitializeComponent();
            _appointment = appointment;

            // Initialize display to defaults
            InitializeNewDisplay();

            if (_appointment.IsRepeating)
            {
                InitializeRepeatDisplay();
            }

            Loaded += EventRecurrence_Loaded;

            AccessKeyManager.Register(" ", okButton);

            ShadowController c = new ShadowController(this);
        }
Exemplo n.º 16
0
        private void AddButton(string text, bool isDefault, bool isCancel)
        {
            Button button = new Button();

            button.Width     = 75;
            button.Height    = 25;
            button.Margin    = new Thickness(10, 0, 0, 0);
            button.Content   = text;
            button.IsDefault = isDefault;
            button.IsCancel  = isCancel;

            if (isDefault)
            {
                AccessKeyManager.Register(" ", button);
            }

            button.Click += button_Click;

            btns.Children.Add(button);
        }
Exemplo n.º 17
0
        // Token: 0x0600427F RID: 17023 RVA: 0x00130B8C File Offset: 0x0012ED8C
        private static void OnIsDefaultChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            Button button = d as Button;
            KeyboardFocusChangedEventHandler keyboardFocusChangedEventHandler = Button.FocusChangedEventHandlerField.GetValue(button);

            if (keyboardFocusChangedEventHandler == null)
            {
                keyboardFocusChangedEventHandler = new KeyboardFocusChangedEventHandler(button.OnFocusChanged);
                Button.FocusChangedEventHandlerField.SetValue(button, keyboardFocusChangedEventHandler);
            }
            if ((bool)e.NewValue)
            {
                AccessKeyManager.Register("\r", button);
                KeyboardNavigation.Current.FocusChanged += keyboardFocusChangedEventHandler;
                button.UpdateIsDefaulted(Keyboard.FocusedElement);
                return;
            }
            AccessKeyManager.Unregister("\r", button);
            KeyboardNavigation.Current.FocusChanged -= keyboardFocusChangedEventHandler;
            button.UpdateIsDefaulted(null);
        }
Exemplo n.º 18
0
        public TaskDialog(Window Owner, string Title, string Details, MessageType MessageIcon, string OKText, string CancelText)
        {
            InitializeComponent();

            this.Owner = Owner;

            this.Title       = Title;
            detailsText.Text = Details;

            _icon = MessageIcon;

            okButton.Content        = OKText;
            cancelButton.Content    = CancelText;
            cancelButton.Visibility = Visibility.Visible;

            AccessKeyManager.Register(" ", okButton);

            if (Owner == null)
            {
                ShowAsGlobal();
            }
        }
Exemplo n.º 19
0
        private static void OnIsDefaultChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            Button b = d as Button;
            KeyboardFocusChangedEventHandler focusChangedEventHandler = FocusChangedEventHandlerField.GetValue(b);

            if (focusChangedEventHandler == null)
            {
                focusChangedEventHandler = new KeyboardFocusChangedEventHandler(b.OnFocusChanged);
                FocusChangedEventHandlerField.SetValue(b, focusChangedEventHandler);
            }

            if ((bool)e.NewValue)
            {
                AccessKeyManager.Register("\x000D", b);
                KeyboardNavigation.Current.FocusChanged += focusChangedEventHandler;
                b.UpdateIsDefaulted(Keyboard.FocusedElement);
            }
            else
            {
                AccessKeyManager.Unregister("\x000D", b);
                KeyboardNavigation.Current.FocusChanged -= focusChangedEventHandler;
                b.UpdateIsDefaulted(null);
            }
        }
Exemplo n.º 20
0
        public SubscriptionExpired()
        {
            InitializeComponent();

            AccessKeyManager.Register(" ", okButton);
        }
Exemplo n.º 21
0
        //------------------------------------------------------
        //
        //  Internal Methods
        //
        //------------------------------------------------------

        #region Internal Methods

        #region ActiveX Related

        /// This method needs to be called by the user of ActiveXHost for each
        /// hosted ActiveX control that has a mnemonic bound to it
        internal void RegisterAccessKey(char key)
        {
            AccessKeyManager.Register(key.ToString(), this);
        }