internal void ConfigSysGui() { RegisterEditFormSystemMessages(); StartDbHandler(); _editForm = new FormEditConfig(EditFormMode.EditSystem); _editForm.StartPosition = FormStartPosition.CenterScreen; Application.Run(_editForm); }
internal void AddClientGui() { RegisterEditFormNewClientMessages(); StartDbHandler(); // crear form _editForm = new FormEditConfig(EditFormMode.CreateClient); _editForm.StartPosition = FormStartPosition.CenterScreen; Application.Run(_editForm); }
internal void DelClientGui() { RegisterEditFormDelClientMessages(); StartDbHandler(); if (CheckNoClients()) { Builder.Output("No hay clientes registrados."); return; } _editForm = new FormEditConfig(EditFormMode.DeleteClient); _editForm.StartPosition = FormStartPosition.CenterScreen; Application.Run(_editForm); }
static internal void Inicio() { Log.WriteStart(); // Comprobar y cargar datos. _dbHandler = new DbHandler(); bool ret = _dbHandler.OpenDatabase(); if (!ret) { _dbHandler = null; return; } Log.WriteEntry(ClassName, "Inicio", TraceEventType.Verbose, "DbHandler OK, Config Database OK"); // Crear formulario. _theForm = new FormEditConfig(EditFormMode.Supervisor); // Registrar solicitudes del estado de la conexion. MessageBus.Register <FormConnected>(_theForm.ReceiveConnection); MessageBus.Register <RequestConnect>(RealizarConexion); // Iniciar conexion a servidor Zyan. RealizarConexion(_dbHandler.ServerUrl); Log.WriteStartOK(); // Iniciar form Application.Run(_theForm); // Limpieza final. Log.WriteEnd(); try { _theForm = null; _dbHandler.CloseDatabase(); _dbHandler = null; _zyanConn.Dispose(); _proxy = null; Log.WriteEndOK(); } catch (Exception) { } }
static private void Wizard_System() { Builder.Output("Ejecutando asistente de configuración."); // configurando formulario EditFormMode efm = EditFormMode.Wizard; _editForm = new FormEditConfig(efm); _editForm.StartPosition = FormStartPosition.CenterScreen; // Config system MessageBus.Register <SendSystemConfig>(_editForm.ReceiveSystemConfig); MessageBus.Send(new SendSystemConfig(_dbHandler.SystemData)); // Config client MessageBus.Register <SendClientConfig>(_editForm.ReceiveClientConfig); MessageBus.Send(new SendClientConfig(_dbHandler.ClientList)); MessageBus.Register <FormEndEdit>(EndWizard); MessageBus.Register <RequestSaveConfig>(_dbHandler.Save); Application.Run(_editForm); }
internal void DetenerServicio() { Builder.Output("Stopping Monitor"); StopModules(); // Going down anyway try { _clientManager = null; _dbHandler = null; _zyanServer = null; _notifier = null; _editForm = null; } catch (Exception) { // ignorar excepciones en terminacion } }
private static void CargarFormulario(string arg) { string modo = "Default"; // determinando modo form EditFormMode efm = EditFormMode.Default; switch (arg) { case cla_add: case cla_a: efm = EditFormMode.CreateClient; modo = "Crear cliente."; break; case cla_edit: case cla_e: efm = EditFormMode.EditClient; modo = "Editar cliente."; break; case cla_del: case cla_d: efm = EditFormMode.DeleteClient; modo = "Eliminar cliente."; break; case cla_sys: case cla_s: efm = EditFormMode.EditSystem; modo = "Configurar sistema."; break; default: break; } Builder.Output("Cargando formulario de configuracion en modo: " + modo); // Chequeando condiciones extremas // Si no hay clientes registrados, no ejecutar Delete ni Edit if (_dbHandler.ClientList.Count == 0) { switch (arg) { case cla_edit: case cla_e: case cla_del: case cla_d: MessageBox.Show("No existen clientes registrados."); return; } } _editForm = new FormEditConfig(efm); _editForm.StartPosition = FormStartPosition.CenterScreen; // Pasando datos al formulario switch (arg) { case cla_add: case cla_a: case cla_edit: case cla_e: case cla_del: case cla_d: MessageBus.Register <SendClientConfig>(_editForm.ReceiveClientConfig); MessageBus.Send(new SendClientConfig(_dbHandler.ClientList)); break; case cla_sys: case cla_s: MessageBus.Register <SendSystemConfig>(_editForm.ReceiveSystemConfig); MessageBus.Send(new SendSystemConfig(_dbHandler.SystemData)); break; } MessageBus.Register <FormEndEdit>(DoFormEnd); MessageBus.Register <RequestSaveConfig>(_dbHandler.Save); Application.Run(_editForm); // Fin de accion del formulario Builder.Output("Formulario de configuracion terminado."); }
private void EndEdit() { StopDbHandler(); _editForm.Close(); _editForm = null; }