Esempio n. 1
0
        private void OnCellClick(HtmlEvent args)
        {
            Utility.CancelEventUtility(args, false, true);
            if (!Enabled)
            {
                return;
            }

            HtmlElement element = args.TargetElement;

            HtmlElement cell = Utility.GetNearestContainingParentElementOfType(element, "td");

            ColorPickerResult           result = GetColorPickerResultFromSelectedCell(cell);
            Dictionary <string, string> dict   = new Dictionary <string, string>();

            dict[ColorPickerCommandProperties.Color] = result.Color;
            dict[ColorPickerCommandProperties.Style] = result.Style;

            // We don't want to send a preview revert command since the user has picked one
            // by clicking.
            CancelClickPreviewRevert();
            DisplayedComponent.RaiseCommandEvent(Properties.Command,
                                                 CommandType.General,
                                                 dict);
        }
Esempio n. 2
0
        private ColorPickerResult GetColorPickerResultFromSelectedCell(HtmlElement cell)
        {
            ColorStyle style = (ColorStyle)((JSObject)(object)cell).GetField <object>(ColorInformation);

            ColorPickerResult result = new ColorPickerResult();

            result.Color = cell.GetAttribute(ColorInformation + "Color");
            result.Style = cell.GetAttribute(ColorInformation + "Style");
            return(result);
        }
Esempio n. 3
0
        private void SendClickPreviewCommand(HtmlElement cell)
        {
            if (!string.IsNullOrEmpty(Properties.CommandPreview))
            {
                // Store the fact that we sent out a live preview command
                // and its coordinates
                previewClickCommandSent = true;

                ColorPickerResult           result = GetColorPickerResultFromSelectedCell(cell);
                Dictionary <string, string> dict   = new Dictionary <string, string>();
                dict[ColorPickerCommandProperties.Color] = result.Color;
                dict[ColorPickerCommandProperties.Style] = result.Style;

                previewPickerResult = result;

                DisplayedComponent.RaiseCommandEvent(Properties.CommandPreview,
                                                     CommandType.Preview,
                                                     dict);
            }
        }
Esempio n. 4
0
 private void CancelClickPreviewRevert()
 {
     previewClickCommandSent = false;
     previewPickerResult     = null;
 }
Esempio n. 5
0
        private void SendClickPreviewCommand(HtmlElement cell)
        {
            if (!string.IsNullOrEmpty(Properties.CommandPreview))
            {
                // Store the fact that we sent out a live preview command
                // and its coordinates
                previewClickCommandSent = true;

                ColorPickerResult result = GetColorPickerResultFromSelectedCell(cell);
                Dictionary<string, string> dict = new Dictionary<string, string>();
                dict[ColorPickerCommandProperties.Color] = result.Color;
                dict[ColorPickerCommandProperties.Style] = result.Style;

                previewPickerResult = result;

                DisplayedComponent.RaiseCommandEvent(Properties.CommandPreview,
                                                     CommandType.Preview,
                                                     dict);
            }
        }
Esempio n. 6
0
 private void CancelClickPreviewRevert()
 {
     previewClickCommandSent = false;
     previewPickerResult = null;
 }
Esempio n. 7
0
        private ColorPickerResult GetColorPickerResultFromSelectedCell(HtmlElement cell)
        {
            ColorStyle style = (ColorStyle)((JSObject)(object)cell).GetField<object>(ColorInformation);

            ColorPickerResult result = new ColorPickerResult();
            result.Color = cell.GetAttribute(ColorInformation + "Color");
            result.Style = cell.GetAttribute(ColorInformation + "Style");
            return result;
        }