private void HandlePatrolClick(MessageTypeSOPModel sopItem) { if (sopItem.UserControlModel != null) { if (sopItem.UserControlModel.Count > 0) { var model = sopItem.UserControlModel[0]; if (model as PatrolsListViewModel != null) { var pModel = model as PatrolsListViewModel; pModel.HandleClick(); } } } }
public void Go(WantedCarLocationChanged message) { //ScaleSOP(); var vm = this.DataContext as SOPViewModel; MessageTypeSOPParentModel obj = null; MessageTypeSOPModel SOPItem = null; if (vm != null && vm.SopList.Count > 0) { var currentMessage = vm.GetCurrentMessageObject(); if (currentMessage != null && (currentMessage as SOPGeneralMessage).OriginalObject != null) { WantedCarToSOPMessage wantedcar = ((SOPGeneralMessage)currentMessage).OriginalObject as WantedCarToSOPMessage; if (wantedcar != null && wantedcar.VehiclePlateNumber == message.PlateNumber) { wantedcar.Latitude = message.Lat.Value; wantedcar.Longitude = message.Lon.Value; } else return; foreach (var item in vm.SopList.Where(x => x.SOPItems.Any(y => y.UserControlModel != null && y.UserControlModel.Any() && y.UserControlModel.FirstOrDefault() is PatrolsListViewModel)).ToList()) { var patrolListVM = item.SOPItems.FirstOrDefault().UserControlModel.FirstOrDefault(); Utility.CallMethodUsingReflector(patrolListVM, "ProcessMessage", new WantedCarModel { Latitude = wantedcar.Latitude, Longitude = wantedcar.Longitude, TowerId = wantedcar.TowerId, VehiclePlateNumber = wantedcar.VehiclePlateNumber, PlateKind = wantedcar.VehiclePlateKind, PlateType = wantedcar.VehiclePlateType, PlateSource = wantedcar.VehiclePlateSource, PlateColor = wantedcar.VehiclePlateColor }); //if (item.SOPItems.Count > 0) //{ // MessageTypeSOPModel m = item.SOPItems.FirstOrDefault(x => x.ListUserControlMessageType == "PatrolsListViewModel"); // if(m != null) // { // Utility.CallMethodUsingReflector(m, "ProcessMessage", new WantedCarModel { Latitude = wantedcar.Latitude,Longitude = wantedcar.Longitude,TowerId = wantedcar.TowerId,VehiclePlateNumber = wantedcar.VehiclePlateNumber}); // return; // } // //MessageTypeSOPModel m = item.SOPItems.Where(x => x.UserControlDetailsControl == "CamerasListActionPanelUserControl").FirstOrDefault(); // //if (m != null) // //{ // // obj = item; // // SOPItem = m; // // break; // //} //} } if (obj != null) { OpenDetails(obj); //PopupCanvas.Children.Clear(); //if (SOPItem.UserControlDetailsControl != null) //{ // var usrCnt = sopViewModel.GetUserControl(SOPItem.UserControlDetailsControl, SOPItem.DetailsUserControlMessageType, SOPItem.DetailsMessageXSLT) as UserControl; // if (usrCnt != null) // { // Utility.CallMethodUsingReflector(usrCnt, "UpdateCameras", message); // } //} } } } }