Esempio n. 1
0
        public ConfigMenu()
        {
            InitializeComponent();
            try
            {
                configgrid = new ConfigMenuRootPanel();
                grid.Children.Add(configgrid);

                btnFileConfig = new ConfigMenuButton(configgrid, null, "File Config");
                configgrid.Children.Add(btnFileConfig);
                configgrid.SubPanel.Children.Add(btnFileConfig.child);

                btnSamConfig = new ConfigMenuButton(configgrid, null, "Sam Config");
                configgrid.Children.Add(btnSamConfig);
                configgrid.SubPanel.Children.Add(btnSamConfig.child);

                btnTailConfig = new ConfigMenuButton(configgrid, null, "Tail Config");
                configgrid.Children.Add(btnTailConfig);
                configgrid.SubPanel.Children.Add(btnTailConfig.child);

                Refresh();
            }
            catch (Exception e)
            {
                Log.PrintError(e.Message, "UserControls.ConfigMenu");
            }
            if (configgrid?.btn_group != null && configgrid.btn_group.Count > 0)
            {
                configgrid.btn_group[0].IsChecked = true;
            }
        }
Esempio n. 2
0
        protected override void OnChecked(RoutedEventArgs e)
        {
            base.OnChecked(e);
            ConfigMenuRootPanel root_pan = (this.Parent as ConfigMenuPanel)?.Parent as ConfigMenuRootPanel;

            if (root_pan == null)
            {
                return;
            }

            int idx = root_pan.Children.IndexOf(this.Parent as ConfigMenuPanel);

            int i;

            for (i = 0; i < idx; i++)
            {
                ConfigMenuPanel pan = root_pan.Children[i] as ConfigMenuPanel;
                if (pan != null)
                {
                    pan.VerticalAlignment = VerticalAlignment.Top;
                }
                pan.IsChecked = false;
            }
            {
                ConfigMenuPanel pan = root_pan.Children[i++] as ConfigMenuPanel;
                if (pan != null)
                {
                    pan.VerticalAlignment = VerticalAlignment.Stretch;
                }
            }
            for (; i < root_pan.Children.Count; i++)
            {
                ConfigMenuPanel pan = root_pan.Children[i] as ConfigMenuPanel;
                if (pan != null)
                {
                    pan.VerticalAlignment = VerticalAlignment.Bottom;
                }
                pan.IsChecked = false;
            }

            ConfigMenuTreeView detailView = (this.Parent as ConfigMenuPanel)?.DetailView;

            if (detailView != null)
            {
                //if(root_pan != null)
                //{
                //	detailView.Margin = new Thickness(0, HEIGHT * (idx + 1), 0, HEIGHT * (root_pan.Children.Count - (idx + 1)));
                //}
                detailView.Visibility = Visibility.Visible;
            }
        }