Пример #1
0
        public MainPanelEditor()
        {
            InitializeComponent();

            if (DesignerProperties.GetIsInDesignMode(this))
            {
                return;
            }

            BlockNavigator.AddNavigationExitHandler(FunctionButtonList, FunctionButtonList_NavigationExit);
            BlockNavigator.AddNavigationEnterHandler(FunctionButtonList, FunctionButtonList_NavigationEnter);
            BlockNavigator.AddNavigationExitHandler(DialAreaControl, DialAreaControl_NavigationExit);
            BlockNavigator.AddNavigationEnterHandler(DialAreaControl, DialAreaControl_NavigationEnter);
            BlockNavigator.AddConfirmClickHandler(DialAreaControl, DialAreaControl.DialArea_ConfirmClick);
            DialAreaControl.ItemPicked      += DialArea_ItemPicked;
            FunctionButtonList.ItemSelected += FunctionButtonList_ItemSelected;

            var ctx = new SaveData.SaveData();

            FunctionButtonList.LoadList(ctx.Functions.ToList());
            Profiles_ComboBox.ItemsSource = ctx.Profiles.Select(p => new ComboBoxItemContainer {
                Text        = p.Name,
                DataContext = p
            }).ToList();
            var profile      = ctx.Profiles.First();
            var panelButtons = ctx.PanelButtons.Where(p => p.Profile.Id == profile.Id);
            var formData     = new EditorFormData {
                Profile      = profile,
                PanelButtons = panelButtons
            };

            LoadProfile(formData);
        }
Пример #2
0
        private void DialArea_ItemPicked(FrameworkElement sender, FunctionViewModel obj)
        {
            if (_formState == FormState.DialAreaMode)
            {
                _dialAreaSelection = DialAreaControl.Selection;
                DialAreaControl.Disable();
                BlockNavigator.SetFocus(sender, FunctionButtonList.GetFirstItemElement());
            }

            else if (_formState == FormState.FunctionButtonsMode)
            {
                DialAreaControl.ReplaceSelectedItem(_functionsSelection);
                DialAreaControl.Reset();
                DialAreaControl.Disable();
                BlockNavigator.SetFocus(sender, FunctionButtonList.GetFirstItemElement());
            }
        }