Exemplo n.º 1
0
 static XrmTimeEditor()
 {
     TimeEditor = delegate(EditorArguments args)
     {
         XrmTimeEditor editor = new XrmTimeEditor(args);
         return(editor);
     };
 }
Exemplo n.º 2
0
 static XrmTimeEditor()
 {
     TimeEditor = delegate(EditorArguments args)
     {
         XrmTimeEditor editor = new XrmTimeEditor(args);
         return editor;
     };
 }
Exemplo n.º 3
0
        public XrmTimeEditor(EditorArguments args) : base(args)
        {
            bool justSelected = false;

            XrmTimeEditor self = this;

            if (OrganizationServiceProxy.UserSettings != null)
            {
                _formatString = OrganizationServiceProxy.UserSettings.TimeFormatString;
            }


            _container = jQuery.FromHtml("<div ><table class='inline-edit-container' cellspacing='0' cellpadding='0'><tr><td><INPUT type=text class='sparkle-input-inline' /></td><td class='lookup-button-td'><input type=button class='autocompleteButton' /></td></tr></table></div>");

            _container.AppendTo(_args.Container);

            jQueryObject inputField = _container.Find(".sparkle-input-inline");

            _input = inputField;
            _input.Focus().Select();
            string timeFormatString     = _formatString;
            AutoCompleteOptions options = GetTimePickerAutoCompleteOptions(timeFormatString);

            options.Select = delegate(jQueryEvent e, AutoCompleteSelectEvent uiEvent)
            {
                justSelected = true;
            };
            options.Open = delegate(jQueryEvent e, jQueryObject o)
            {
                self._searchOpen = true;
            };

            options.Close = delegate(jQueryEvent e, jQueryObject o)
            {
                self._searchOpen = false;
            };

            inputField = inputField.Plugin <AutoCompleteObject>().AutoComplete(options);
            jQueryObject selectButton = _container.Find(".autocompleteButton");

            // Add the click binding to show the drop down
            selectButton.Click(delegate(jQueryEvent e)
            {
                inputField.Plugin <AutoCompleteObject>().AutoComplete(AutoCompleteMethod.Search, "");
            });

            // Bind return to searching

            _input.Keydown(delegate(jQueryEvent e)
            {
                if (self._searchOpen)
                {
                    switch (e.Which)
                    {
                    case 13:     // Return
                    case 38:     // Up - don't navigate - but use the dropdown to select search results
                    case 40:     // Down - don't navigate - but use the dropdown to select search results
                        e.PreventDefault();
                        e.StopPropagation();
                        break;
                    }
                }

                justSelected = false;
            });
        }