2 using System.Collections.Generic;
3 using System.ComponentModel;
11 using System.Text.RegularExpressions;
12 using System.Globalization;
14 namespace sage.ew.objetos
21 #region Propiedades privadas 22 private string _cHtmlTexto =
string.Empty;
23 private bool _lReadOnly =
false;
24 private bool _lLoading =
true;
25 private bool? _lNavigatingComplete = null;
33 StringBuilder loSql =
new StringBuilder();
35 loSql.Append($
@"<!DOCTYPE html> 43 <div class='ck-content'> 49 return loSql.ToString();
51 #endregion Propiedades privadas 53 #region Propiedades públicas 54 [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
60 public string _HtmlTexto
79 [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
90 _ReadOnlyEditor(_lReadOnly);
99 [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
109 FUNCTIONS._RemoveWorkingImage(
this);
118 public string _Styles
122 return FUNCTIONS._GetStylesCKEditor();
131 [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
140 #endregion Propiedades públicas 148 InitializeComponent();
152 _AutoRefreshDocument =
true;
153 _ResponseReceived =
true;
154 SuscripcionEventos();
157 #endregion Constructor 159 #region Métodos privados 160 private void NavigateCKEditor()
167 string lcHtmlTexto = _cHtmlTexto.Replace(Environment.NewLine,
"").Replace(
"'",
"'");
169 _lNavigatingComplete =
false;
171 NavigateToEditor(FUNCTIONS._URLCKEditor(), lcHtmlTexto);
177 private void SuscripcionEventos()
179 _EndGetHTML += CKEditorHMTL__EndGetHTML;
180 _KeyPress += CKEditorHMTL__KeyPress;
181 _MouseDown += CKEditorHMTL__MouseDown;
182 _MouseUp += CKEditorHMTL__MouseUp;
183 _MouseLeave += CKEditorHMTL__MouseLeave;
184 _NavigationCompleted += CKEditorHMTL__NavigationCompleted;
185 VisibleChanged += CKEditorHMTL_VisibleChanged;
193 private void CKEditorHMTL_VisibleChanged(
object sender, EventArgs e)
195 if (Visible && !IsDisposed && !Disposing && _lNavigatingComplete == null)
196 FUNCTIONS._SetWorkingImage(
this, images.Properties.Resources.offline_process);
206 private void CKEditorHMTL__NavigationCompleted(
string tcUrl,
bool tlIsSuccess)
208 FUNCTIONS._RemoveWorkingImage(
this);
210 _lNavigatingComplete =
true;
216 private void CancelarSuscripcionEventos()
218 _EndGetHTML -= CKEditorHMTL__EndGetHTML;
219 _KeyPress -= CKEditorHMTL__KeyPress;
220 _MouseDown -= CKEditorHMTL__MouseDown;
221 _MouseUp -= CKEditorHMTL__MouseUp;
222 _MouseLeave -= CKEditorHMTL__MouseLeave;
223 _NavigationCompleted -= CKEditorHMTL__NavigationCompleted;
224 VisibleChanged -= CKEditorHMTL_VisibleChanged;
230 private void GetHtml()
241 private void CKEditorHMTL_Leave(
object sender, EventArgs e)
251 private void CKEditorHMTL__MouseDown(
string tcTipo,
string tcValue)
262 private void CKEditorHMTL__MouseUp(
string tcTipo,
string tcValue,
string tcId)
264 if (!_lReadOnly && tcTipo ==
"HTML")
273 private void CKEditorHMTL__MouseLeave()
282 private void CKEditorHMTL__KeyPress(KeyPressEventArgs e)
291 private void CKEditorHMTL__EndGetHTML(
string tcHtml)
294 _cHtmlTexto = Regex.Unescape(tcHtml);
296 if (_cHtmlTexto.StartsWith(
"\"") && _cHtmlTexto.Length >= 2)
297 _cHtmlTexto = _cHtmlTexto.Substring(1, _cHtmlTexto.Length - 2);
305 private string ConvertUnicodeToASCII(
string value)
307 return Regex.Replace(
309 @"\\u(?<Value>[a-zA-Z0-9]{4})",
311 return ((
char)
int.Parse(m.Groups[
"Value"].Value, NumberStyles.HexNumber)).ToString();
318 private void RefreshHtml()
321 System.Threading.Thread.Sleep(300);
322 Application.DoEvents();
325 #endregion Métodos privados 327 #region Métodos públicos 345 _PutDataEditor(tcData);
348 #endregion Métodos públicos
void _PutData(string tcData)
Añade un texto en una posición actual del curso dentro del CkEditor
Clase EW_GLOBAL para gestionar las variables públicas de Eurowin, variables de empresa, variables de anchuras de campo, variables de mascaras, etc.
Control de usuario WebView que reemplaza al WebBrowser
Control de usuario CHKEditor