예제 #1
0
        public override void RaiseAutomationPropertyChangedEvent(System.Windows.Automation.AutomationPropertyChangedEventArgs e)
        {
            if (e.Property.Id != ExpandCollapsePatternIdentifiers.ExpandCollapseStateProperty.Id)
            {
                base.RaiseAutomationPropertyChangedEvent(e);
                return;
            }

            ExpandCollapseState newState = (ExpandCollapseState)e.NewValue;

            if (newState == ExpandCollapseState.Expanded)
            {
                if (fakeWindow == null)
                {
                    fakeWindow = new DropDownWindow();
                    fakeWindow.AddOneChild((Adapter)RefAccessibleChild(0));
                }
                TopLevelRootItem.Instance.AddOneChild(fakeWindow);
                TopLevelRootItem.Instance.CheckAndHandleNewActiveWindow(fakeWindow);
            }
            else if (newState == ExpandCollapseState.Collapsed)
            {
                Atk.Object realWindow = this;
                while (realWindow != null && !(realWindow is Window))
                {
                    realWindow = realWindow.Parent;
                }
                if (realWindow != null)
                {
                    TopLevelRootItem.Instance.CheckAndHandleNewActiveWindow(fakeWindow, (Window)realWindow);
                }
                TopLevelRootItem.Instance.RemoveChild(fakeWindow, false);
            }
            InnerMenu.RaiseExpandedCollapsed();
        }
        public void Create()
        {
            InnerMenu    inMain = (InnerMenu)m_MainMenu.InnerMenu;
            InnerMenu    versionAndCapitalsMenu    = new InnerMenu("Version and Capitals");
            MethodOption countCapitalsMethodOption = new MethodOption("Count Capitals");
            MethodOption showVersionMethodOption   = new MethodOption("Show Version");

            countCapitalsMethodOption.OptionChosen += new CountCapital().Action;
            showVersionMethodOption.OptionChosen   += new ShowVersion().Action;
            InnerMenu    showDateOrTimeMenu   = new InnerMenu("Show Date/Time");
            MethodOption showTimeMethodOption = new MethodOption("Show Time");
            MethodOption showDateMethodOption = new MethodOption("Show Date");

            showTimeMethodOption.OptionChosen += new ShowTimeOrDate(TimeTypes.eTypeOfTime.Time).Action;
            showDateMethodOption.OptionChosen += new ShowTimeOrDate(TimeTypes.eTypeOfTime.Date).Action;
            versionAndCapitalsMenu.AddToMenu(countCapitalsMethodOption);
            versionAndCapitalsMenu.AddToMenu(showVersionMethodOption);
            showDateOrTimeMenu.AddToMenu(showTimeMethodOption);
            showDateOrTimeMenu.AddToMenu(showDateMethodOption);
            inMain.AddToMenu(versionAndCapitalsMenu);
            inMain.AddToMenu(showDateOrTimeMenu);
            m_MainMenu.Show();
        }