/// <summary> /// Método invocado cuando se presiona el botón Editar /// </summary> /// <param name="sender">El objeto que genera al evento</param> /// <param name="e">Contiene infomación adicional acerca del evento</param> protected override void OnEditSelected(object sender, EventArgs e) { CampaignEditor addCampaign = (CampaignEditor)Editor; CampaignEntity campaign; Mode = EditionMode.Edit; if ((campaign = (CampaignEntity)Selected) == null) { Util.ShowErrorDialog(UtnEmall.ServerManager.Properties.Resources.NoCampaignSelected); return; } addCampaign.Campaign = campaign; if (campaign == null) { Util.ShowErrorDialog(UtnEmall.ServerManager.Properties.Resources.NoCampaignSelected); return; } Control.HideLastShown(); addCampaign.Visibility = Visibility.Visible; Control.LastElementShown = addCampaign; }
/// <summary> /// Constructor de clase /// </summary> /// <param name="control">Una referencia al control que contiene a este componente</param> /// <param name="manager">El componente que muestra un listado de entidades</param> /// <param name="editor">El componente que permite agregar o editar una entidad</param> /// <param name="firstElement">El componente que debe ser seleccionado cuando se muestra el editor</param> public CampaignController(UserControl1 control, CampaignManager manager, CampaignEditor editor, FrameworkElement firstElement, EditServices editServices) : base(control, manager, editor, firstElement, new LoadList(CampaignManager.Load), new SaveEntity(CampaignManager.Save), new RemoveEntity(CampaignManager.Delete)) { CampaignManager campaignManager = (CampaignManager)manager; CampaignEditor addCampaign = (CampaignEditor)editor; this.editServices = editServices; addCampaign.OkSelected += OnOkSelected; addCampaign.CancelSelected += OnCancelSelected; campaignManager.ItemList.NewButtonSelected += OnNewSelected; campaignManager.ItemList.EditButtonSelected += OnEditSelected; campaignManager.ItemList.DeleteButtonSelected += OnDeleteSelected; campaignManager.ItemList.ExtraButtonSelected += OnExtraSelected; editServices.OkSelected += new EventHandler(OnEditServicesOkSelected); editServices.CancelSelected += new EventHandler(OnEditServicesCancelSelected); }