private bool HandleEventLocomotive(IItem item, ListEntry listEntry)
        {
            Locomotive e = item as Locomotive;

            if (e == null)
            {
                return(false);
            }

            var itemLocomotive = GetObjectBy(e.ObjectId) as Locomotive;

            if (itemLocomotive != null)
            {
                itemLocomotive.Parse(listEntry.Arguments);
                itemLocomotive.UpdateTitle();
                itemLocomotive.UpdateSubTitle();
            }

            return(true);
        }
        public bool LoadObjects(string targetPath)
        {
            try
            {
                if (!File.Exists(targetPath))
                {
                    return(false);
                }

                var     cnt = File.ReadAllText(targetPath, Encoding.UTF8);
                JObject o   = JObject.Parse(cnt);
                if (o == null)
                {
                    return(false);
                }

                if (o["locomotives"] != null)
                {
                    JArray ar = o["locomotives"] as JArray;
                    if (ar != null)
                    {
                        foreach (var arItem in ar)
                        {
                            if (arItem == null)
                            {
                                continue;
                            }

                            var e = new Locomotive();
                            e.ParseJson(arItem as JObject);
                            e.CommandsReady += CommandsReady;
                            _objects.Add(e);
                            DataChanged?.Invoke(this);
                        }
                    }
                }

                if (o["switches"] != null)
                {
                    JArray ar = o["switches"] as JArray;
                    if (ar != null)
                    {
                        foreach (var arItem in ar)
                        {
                            if (arItem == null)
                            {
                                continue;
                            }

                            var e = new Switch();
                            e.ParseJson(arItem as JObject);
                            e.CommandsReady += CommandsReady;
                            _objects.Add(e);
                            DataChanged?.Invoke(this);
                        }
                    }
                }

                if (o["routes"] != null)
                {
                    JArray ar = o["routes"] as JArray;
                    if (ar != null)
                    {
                        foreach (var arItem in ar)
                        {
                            if (arItem == null)
                            {
                                continue;
                            }

                            var e = new Route();
                            e.ParseJson(arItem as JObject);
                            e.CommandsReady += CommandsReady;
                            _objects.Add(e);
                            DataChanged?.Invoke(this);
                        }
                    }
                }

                if (o["s88"] != null)
                {
                    JArray ar = o["s88"] as JArray;
                    if (ar != null)
                    {
                        foreach (var arItem in ar)
                        {
                            if (arItem == null)
                            {
                                continue;
                            }

                            var e = new S88();
                            e.ParseJson(arItem as JObject);
                            e.CommandsReady += CommandsReady;
                            _objects.Add(e);
                            DataChanged?.Invoke(this);
                        }
                    }
                }

                return(true);
            }
            catch (Exception ex)
            {
                Trace.WriteLine("<DataProvider> " + ex.Message);
                return(false);
            }
        }