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); }
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); }
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); } }
private void CancelClickPreviewRevert() { previewClickCommandSent = false; previewPickerResult = null; }
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); } }
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; }