Esempio n. 1
0
        private ObservableCollection <TreeSource> InitializeMenuTreeViewItems()
        {
            TreeSource createTargetSubset(
                string parentText,
                object viewModel = null,
                Page parentView  = null,
                IEnumerable <TreeSource> additionalChildren = null)
            {
                var general = parentView != null ?
                              parentView :
                              new BlankView();

                var name     = new TargetNameConfigView();
                var hp       = new TargetHPConfigView();
                var action   = new TargetActionConfigView();
                var distance = new TargetDistanceConfigView();

                if (viewModel != null)
                {
                    general.DataContext = new ConfigViewModel();

                    name.DataContext     = viewModel;
                    hp.DataContext       = viewModel;
                    action.DataContext   = viewModel;
                    distance.DataContext = viewModel;

                    if (additionalChildren != null)
                    {
                        foreach (var c in additionalChildren)
                        {
                            c.Content.DataContext = viewModel;
                        }
                    }
                }

                var parent = new TreeSource(parentText)
                {
                    Content = general
                };

                var children = new ObservableCollection <TreeSource>()
                {
                    new TreeSource("Name", parent)
                    {
                        Content = name
                    },

                    new TreeSource("HP", parent)
                    {
                        Content = hp
                    },

                    new TreeSource("Action", parent)
                    {
                        Content = action
                    },

                    new TreeSource("Distance", parent)
                    {
                        Content = distance
                    },
                };

                if (additionalChildren != null)
                {
                    foreach (var c in additionalChildren)
                    {
                        c.Parent = parent;
                    }

                    children.AddRange(additionalChildren);
                }

                parent.Child = children;

                return(parent);
            }

            var enmityView = new TreeSource("Enmity")
            {
                Content = new EnmityConfigView()
            };

            var ffLogsView = new TreeSource("FFLogs")
            {
                Content = new FFLogsConfigView()
            };

            menuTreeViewItems = new ObservableCollection <TreeSource>()
            {
                new TreeSource("General")
                {
                    Content = new GeneralConfigView()
                    {
                        DataContext = new ConfigViewModel()
                    },
                    IsSelected = true,
                },

                createTargetSubset("Target", new TargetConfigViewModel(), new TargetGeneralConfigView(), new[] { enmityView, ffLogsView }),
                createTargetSubset("Focus Target", new FTConfigViewModel()),
                createTargetSubset("Target of Target", new ToTConfigViewModel()),
                createTargetSubset("BOSS", new BossConfigViewModel(), new BossGeneralConfigView()),

                new TreeSource("ME")
                {
                    Content = new BlankView()
                    {
                        DataContext = new ConfigViewModel()
                    },

                    Child = new ObservableCollection <TreeSource>()
                    {
                        new TreeSource("Action")
                        {
                            Content = new TargetActionConfigView()
                            {
                                DataContext = new MeConfigViewModel()
                            }
                        },

                        new TreeSource("MP Ticker")
                        {
                            Content = new MPTickerConfigView()
                            {
                                DataContext = new MPTickerConfigViewModel()
                            }
                        },
                    },
                },

                new TreeSource("Mob")
                {
                    Content = new MobListConfigView()
                    {
                        DataContext = new MobListConfigViewModel()
                    },

                    Child = new ObservableCollection <TreeSource>()
                    {
                        new TreeSource("Combatants")
                        {
                            Content = new CombatantsView()
                            {
                                DataContext = new CombatantsViewModel()
                            }
                        }
                    }
                }
            };

            return(menuTreeViewItems);
        }
Esempio n. 2
0
        private ObservableCollection <TreeSource> InitializeMenuTreeViewItems()
        {
            TreeSource createTargetSubset(
                string parentText,
                object viewModell = null,
                Page parentView   = null)
            {
                var general = parentView != null ?
                              parentView :
                              new BlankView();

                var name     = new TargetNameConfigView();
                var hp       = new TargetHPConfigView();
                var action   = new TargetActionConfigView();
                var distance = new TargetDistanceConfigView();

                if (viewModell != null)
                {
                    general.DataContext = new ConfigViewModel();

                    name.DataContext     = viewModell;
                    hp.DataContext       = viewModell;
                    action.DataContext   = viewModell;
                    distance.DataContext = viewModell;
                }

                var parent = new TreeSource(parentText)
                {
                    Content = general
                };

                parent.Child = new ObservableCollection <TreeSource>()
                {
                    new TreeSource("Name", parent)
                    {
                        Content = name
                    },

                    new TreeSource("HP", parent)
                    {
                        Content = hp
                    },

                    new TreeSource("Action", parent)
                    {
                        Content = action
                    },

                    new TreeSource("Distance", parent)
                    {
                        Content = distance
                    },
                };

                return(parent);
            }

            menuTreeViewItems = new ObservableCollection <TreeSource>()
            {
                new TreeSource("General")
                {
                    Content = new GeneralConfigView()
                    {
                        DataContext = new ConfigViewModel()
                    },
                    IsSelected = true,
                },

                createTargetSubset("Target", new TargetConfigViewModel(), new TargetGeneralConfigView()),
                createTargetSubset("Focus Target", new FTConfigViewModel()),
                createTargetSubset("Target of Target", new ToTConfigViewModel()),
                createTargetSubset("BOSS", new BossConfigViewModel(), new BossGeneralConfigView()),

                new TreeSource("ME")
                {
                    Content = new BlankView()
                    {
                        DataContext = new ConfigViewModel()
                    },

                    Child = new ObservableCollection <TreeSource>()
                    {
                        new TreeSource("Action")
                        {
                            Content = new TargetActionConfigView()
                            {
                                DataContext = new MeConfigViewModel()
                            }
                        },

                        new TreeSource("MP Ticker")
                        {
                            Content = new MPTickerConfigView()
                            {
                                DataContext = new MPTickerConfigViewModel()
                            }
                        },
                    },
                },

                new TreeSource("Mob")
                {
                    Content = new MobListConfigView()
                    {
                        DataContext = new MobListConfigViewModel()
                    },

                    Child = new ObservableCollection <TreeSource>()
                    {
                        new TreeSource("Combatants")
                        {
                            Content = new CombatantsView()
                            {
                                DataContext = new CombatantsViewModel()
                            }
                        }
                    }
                }
            };

            return(menuTreeViewItems);
        }