/// <summary> /// Create sent route config from route. /// </summary> /// <param name="route">Route.</param> /// <returns>Sent route config.</returns> private SentRouteConfig _CreateSendedRouteConfig(Route route) { var sendedRouteConfig = new SentRouteConfig(route); var mobileDevice = route.Driver.MobileDevice; if (mobileDevice == null) { mobileDevice = route.Vehicle.MobileDevice; } sendedRouteConfig.RouteName = route.Name; if (mobileDevice != null && mobileDevice.SyncType != SyncType.None) { switch (mobileDevice.SyncType) { case SyncType.ActiveSync: sendedRouteConfig.SendMethod = string.Format((string) Properties.Resources.SyncingToFormat, mobileDevice.ActiveSyncProfileName); break; case SyncType.EMail: sendedRouteConfig.SendMethod = string.Format((string) Properties.Resources.MailToFormat, mobileDevice.EmailAddress); break; case SyncType.Folder: sendedRouteConfig.SendMethod = string.Format( Properties.Resources.SaveToFormat, mobileDevice.SyncFolder); break; default: sendedRouteConfig.SendMethod = Properties.Resources.SyncTypeIsNotSupported;; break; } sendedRouteConfig.IsChecked = true; } else { sendedRouteConfig.IsChecked = false; if (mobileDevice == null) { sendedRouteConfig.SendMethod = Properties.Resources.MobileDeviceEmpty; } else { if (mobileDevice == route.Driver.MobileDevice) { sendedRouteConfig.SendMethod = Properties.Resources.SyncTypeNotSelectedForDriverDevice; } else { sendedRouteConfig.SendMethod = Properties.Resources.SyncTypeNotSelectedForVehicleDevice; } } } return(sendedRouteConfig); }
/// <summary> /// Init sent routes collection. /// </summary> private void _InitRoutesCollection() { _routesConfigs.Clear(); IDataObjectCollection <Schedule> schedules = (IDataObjectCollection <Schedule>) _app.Project.Schedules.Search(_app.CurrentDate); if (schedules.Count > 0) { Schedule currentSchedule = schedules[0]; foreach (Route route in currentSchedule.Routes) { if (route.Driver == null || route.Stops.Count == 0) { continue; // ignore not builded routes } SentRouteConfig sentRouteConfig = _CreateSendedRouteConfig(route); _routesConfigs.Add(sentRouteConfig); } } _SetSendButtonEnabled(); }