AyudaNoticiasPantalla.cs
1 using sage.ew.functions;
4 using System;
5 using System.Drawing;
6 using System.Windows.Forms;
7 using static sage.ew.formul.FormBase;
8 
9 namespace sage.ew.formul.ButtonsPanelSage
10 {
14  public partial class AyudaNoticiasPantalla
16  {
17  private oResultadoAyuda _oResultadoAyuda = new oResultadoAyuda();
18 
19  private UserPagesOnBoarding _oUserPagesOnBoarding = null;
20 
24  public override string _Tooltip => "Ver panel Sage 50";
25 
29  public override Bitmap _Icon => images.Properties.Resources.informacion_pantalla;
30 
34  protected override void OnCreateControl()
35  {
36  base.OnCreateControl();
37 
38  CambiarBotonAyudaMensaje();
39  }
40 
45  protected override bool DoClick(object sender)
46  {
47  IOnBoardingController loOnBoardingController = FUNCTIONS._OnBoardingController();
48 
49 
50  if (_oUserPagesOnBoarding == null)
51  {
52  _oUserPagesOnBoarding = new UserPagesOnBoarding(_Form._Pantalla, loOnBoardingController, _oResultadoAyuda._AyudaContextual);
53  _oUserPagesOnBoarding._Collapse += _oUserPagesOnBoarding__Collapse;
54  _oUserPagesOnBoarding._RefreshNoticiasPendientes += _oUserPagesOnBoarding__RefreshNoticiasPendientes; ;
55  _oUserPagesOnBoarding._Load();
56  }
57 
58  _Parent._Expand(_oUserPagesOnBoarding, 400);
59  _oUserPagesOnBoarding._Expand();
60 
61  return true;
62  }
63 
64 
65  private void CambiarBotonAyudaMensaje()
66  {
67  if (_oResultadoAyuda._AyudaContextual != null && !_Form.IsDisposed)
68  {
69  int lnNum = _oResultadoAyuda._AyudaContextual._NoticiasPendientesLeer;
70 
71  if (lnNum > 0)
72  {
73  ewNum.Top = 5;
74  ewNum.Left = 14;
75  ewNum.BringToFront();
76  ewNum.Text = $"{(lnNum < 100 ? lnNum.ToString() : "99+")}";
77  ewNum.AutoSize = true;
78 
79  Size = new Size(30, 34);
80 
81  _Image.BackgroundImage = sage.ew.images.Properties.Resources.noticias_pantalla;
82  }
83  else
84  {
85  Size = new Size(26, 26);
86  ewNum.Text = "";
87 
88  _Image.BackgroundImage = sage.ew.images.Properties.Resources.informacion_pantalla;
89 
90  }
91 
92  _oToolTip.SetToolTip(_Image, _GetToolTip(lnNum));
93  _Image.BackgroundImageLayout = ImageLayout.Center;
94  }
95  }
96 
97  private string _GetToolTip(int tnNum)
98  {
99  return tnNum > 0 ? $"{(tnNum < 100 ? tnNum.ToString() : "99+")} Noticia{(tnNum > 1 ? "s" : "")}" : _Tooltip;
100  }
101 
102  private void _oUserPagesOnBoarding__RefreshNoticiasPendientes()
103  {
104  CambiarBotonAyudaMensaje();
105  }
106 
107  private void _oUserPagesOnBoarding__Collapse(bool tlCollapse, bool tlUserAction)
108  {
109  _Parent._Collapse();
110  }
111 
112 
116  private void FormAyuda__RefreshNoticiasPendientes()
117  {
118  CambiarBotonAyudaMensaje();
119  }
120 
124  public AyudaNoticiasPantalla(FormBase toForm, oResultadoAyuda toResultadoAyuda)
125  : base(toForm)
126  {
127  InitializeComponent();
128  _oResultadoAyuda = toResultadoAyuda;
129  }
130 
135  : base()
136  {
137  InitializeComponent();
138  }
139 
144  {
145  _Form = null;
146  _Parent = null;
147  _oToolTip = null;
148 
149  if (_oUserPagesOnBoarding is UserPagesOnBoarding)
150  {
151  _oUserPagesOnBoarding._Collapse -= _oUserPagesOnBoarding__Collapse;
152  _oUserPagesOnBoarding._RefreshNoticiasPendientes -= _oUserPagesOnBoarding__RefreshNoticiasPendientes; ;
153  _oUserPagesOnBoarding.Dispose();
154  _oUserPagesOnBoarding = null;
155  }
156  }
157  }
158 }
static System.Drawing.Bitmap informacion_pantalla
Busca un recurso adaptado de tipo System.Drawing.Bitmap.
static System.Drawing.Bitmap noticias_pantalla
Busca un recurso adaptado de tipo System.Drawing.Bitmap.
void _Expand()
En formato no widget necesitamos saber cuando expandimos y el comportamiento es diferente a cuando es...
Clase de recurso fuertemente tipado, para buscar cadenas traducidas, etc.
UserControl base para los botones del panel sage
override void Dispose(bool disposing)
Limpiar los recursos que se estén usando.
override bool DoClick(object sender)
Acción al hacer click
AyudaNoticiasPantalla(FormBase toForm, oResultadoAyuda toResultadoAyuda)
Contructor
Formulario base de Eurowin
Definition: clsFormul.cs:400
override void OnCreateControl()
Revisar si hay que poner el icono de noticias
void _Load()
Cargamos la página activa desde el formulario de FormAyuda
_CollapserOnBoarding_Handler _Collapse
Desencadena el evento del Collapse - Abrir/Contraer el panel de ayuda
_RefreshNoticiasPendientes_Handler _RefreshNoticiasPendientes
Desencadena el evento de la noticias pendientes