Exemplo n.º 1
0
        public UIElement GetDisplayElement()
        {
            ManageAnalyticsViewModel viewModel = new ManageAnalyticsViewModel(this, facade);
            ManageAnalyticsControl   control   = new ManageAnalyticsControl(viewModel);

            viewModel.AnalyticEdit    += (s, e) => Edit(e.Analytic);
            viewModel.AnalyticDeleted += (s, e) =>
            {
                using (IAnalyticService service = factory.CreateAnalyticService())
                {
                    AnalyticDisplayDTO deletedAnalytic = Mapper.Map <AnalyticDisplayModel, AnalyticDisplayDTO>(e.Analytic);
                    ServiceMessage     serviceMessage  = service.Delete(deletedAnalytic.Login);

                    RaiseReceivedMessageEvent(serviceMessage.IsSuccessful, serviceMessage.Message);

                    if (serviceMessage.IsSuccessful)
                    {
                        Notify();
                    }
                }
            };

            return(control);
        }
Exemplo n.º 2
0
 public ManageAnalyticsControl(ManageAnalyticsViewModel viewModel)
 {
     InitializeComponent();
     this.DataContext = viewModel;
 }