private void lbProfiles_ItemTap(object sender, ListBoxItemTapEventArgs e)
        {
            curProfile = e.Item.AssociatedDataItem.Value as Profile;

            App.EcosModel.Connect(curProfile.IPAddress, curProfile.Port);



            // for test only!!!
            //EcosModel_Connected(null, null);

            //if (App.EcosModel.LocomotivesManager.Items.Count == 0)
            //{
            //    for (int i = 1; i < 50; i++)
            //        App.EcosModel.LocomotivesManager.Items.Add(new Locomotive(i, i, i.ToString("d2") + "__Locomotive ", i % 2 == 0 ? "DCC28" : "DCC128")
            //        {
            //            IsMyFavorite = i % 2 == 0,
            //        });

            //    //for (int i = 1; i < 50; i++)
            //    //    App.EcosModel.LocomotivesManager.Items.Add(new Locomotive(i, i, "Consist " + i, "DCC28"));
            //}

            //if (App.EcosModel.AccessoriesManager.Items.Count == 0)
            //{
            //    for (int i = 1; i < 50; i++)
            //        App.EcosModel.AccessoriesManager.Items.Add(new Accessory(i, i.ToString("d2") + "__Accessory ", "", i.ToString(), "", i % 2 == 0 ? "MM" : "DCC")
            //        {
            //            IsMyFavorite = i % 2 == 0,
            //        });
            //}
        }
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);

            curProfile = null;
            AppManager.ProfilesManager.SelectedItem = null;

            AppManager.EcosModel.Disconnect();
        }
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            (ApplicationBar.Buttons[1] as ucApplicationBarIconButton).IsEnabled = !App.IsTrial; // BackUp

            if (e.IsNavigationInitiator)
            {
                curProfile = null;
                App.ProfilesManager.SelectedItem = null;
                
                App.EcosModel.Disconnect();
            }
        }
Example #4
0
        public void From(Profile profile)
        {
            if (profile != null)
            {
                Name = profile.Name;
                IPAddress = profile.IPAddress;
                Port = profile.Port;

                //Collections.Clear();
                //foreach (var c in profile.Collections)
                //    Collections.Add(c);
            }
        }
        private void gvProfiles_ItemClick(object sender, ItemClickEventArgs e)
        {
            curProfile = e.ClickedItem as Profile;

            AppManager.EcosModel.Connect(curProfile.IPAddress, curProfile.Port);


            // for test only!!!
            //EcosModel_Connected(null, null);

            //if (App.EcosModel.LocomotiveManager.Items.Count == 0)
            //{
            //    for (int i = 1; i < 50; i++)
            //        App.EcosModel.LocomotiveManager.Items.Add(new Ecos.Items.Locomotive(i, i, i.ToString("d2") + "__Locomotive ", i % 2 == 0 ? "DCC28" : "DCC128")
            //        {
            //            IsMyFavorite = i % 2 == 0,
            //        });

            //    //for (int i = 1; i < 50; i++)
            //    //    App.EcosModel.LocomotiveManager.Items.Add(new Locomotive(i, i, "Consist " + i, "DCC28"));
            //}

            //if (App.EcosModel.AccessoryManager.Items.Count == 0)
            //{
            //    for (int i = 1; i < 50; i++)
            //        App.EcosModel.AccessoryManager.Items.Add(new Ecos.Items.Accessory(i, i.ToString("d2") + "__Accessory ", "", i.ToString(), "", i % 2 == 0 ? "MM" : "DCC")
            //        {
            //            IsMyFavorite = i % 2 == 0,
            //        });
            //}

            //if (App.EcosModel.FeedbackManager.Items.Count == 0)
            //{
            //    for (int i = 1; i < 50; i++)
            //        App.EcosModel.FeedbackManager.Items.Add(new Ecos.Items.FeedbackModule(i, 8));
            //    for (int i = 50; i < 100; i++)
            //        App.EcosModel.FeedbackManager.Items.Add(new Ecos.Items.FeedbackModule(i, 16));
            //}
        }
Example #6
0
 public Profile(Profile profile)
 {
     From(profile);
 }