コード例 #1
0
        //Save the Previous mode layout and loads the current mode layout
        private void Switch(VisualStudioMode mode)
        {
            string currentLayoutPath;
            string defaultLayoutPath;

            if (mode == VisualStudioMode.EditMode)
            {
                currentLayoutPath = currentEditLayout;
                defaultLayoutPath = defaultEditLayout;
            }
            else
            {
                currentLayoutPath = currentRunLayout;
                defaultLayoutPath = defaultRunLayout;
            }

            XmlDocument document = new XmlDocument();

            document.Load(currentLayoutPath);

            if (document.ChildNodes[1].ChildNodes.Count < 1)
            {
                //Load the default layout
                Load(defaultLayoutPath);

                //Save the default layout as current layout
                Save(currentLayoutPath);
            }
            else
            {
                //Load currently saved layout
                Load(currentLayoutPath);
            }
        }
コード例 #2
0
        //Based on the mode, set the save and load current layout file path
        private void OnRunButtonClicked(object sender, RoutedEventArgs e)
        {
            string layout_Header = (sender as MenuItem).Header.ToString();

            //Saving the current Edit mode layout and loading the Run mode layout
            if (layout_Header == "Run")
            {
                (sender as MenuItem).Header = "Stop";
                CurrentMode = VisualStudioMode.RunMode;
                Save(currentEditLayout);
                Switch(CurrentMode);
            }

            //Saving the current Run mode layout and loading the Edit mode layout
            else if (layout_Header == "Stop")
            {
                (sender as MenuItem).Header = "Run";
                CurrentMode = VisualStudioMode.EditMode;
                Save(currentRunLayout);
                Switch(CurrentMode);
            }
        }