コード例 #1
0
        /// <summary>
        /// Method builds a C# file RibbonItems.Designer.cs
        /// </summary>
        /// <param name="path">RibbonMarkup.xml with path</param>
        public void Execute(string path, RibbonParser parser)
        {
            //string @namespace = System.Reflection.Assembly.GetEntryAssembly().EntryPoint.DeclaringType.Namespace;
            if (File.Exists(path))
            {
                string directory = Path.GetDirectoryName(path);

                string xmlFileName = Path.GetFileNameWithoutExtension(path);
                char   last        = xmlFileName[xmlFileName.Length - 1];
                if (Char.IsNumber(last))
                {
                    ribbonItemsClass = RibbonItems + last.ToString();
                }
                else
                {
                    ribbonItemsClass = RibbonItems;
                }


                RibbonParser.ParseResult results = parser.Results;
#if OldCode
                pair1List         = (results.Pair1List);
                pair2List         = (results.Pair2List);
                pair3List         = (results.Pair3List);
                popupCommandNames = (results.PopupCommandNames);
#else
                popupCommandNames = new List <string>();
#endif
                ribbonItems = results.RibbonItems;
                hasHFile    = results.HasHFile;

                SetStreamWriter(directory);
                WriteCodeFile();
            }
        }
コード例 #2
0
 public ParseResult(RibbonParser parser)
 {
     Pair1List           = parser.pair1List.AsReadOnly();
     Pair2List           = parser.pair2List.AsReadOnly();
     Pair3List           = parser.pair3List.AsReadOnly();
     PopupCommandNames   = parser.popupCommandNames.AsReadOnly();
     HasHFile            = parser.hasHFile;
     AllApplicationModes = parser.allApplicationModes;
     RibbonItems         = parser.ribbonItems.AsReadOnly();
 }
コード例 #3
0
 private static void CodeWrapperBuilder(string path, RibbonParser parser)
 {
     if (Settings.Instance.BuildCSharpWrapper)
     {
         new CSharpCodeBuilder().Execute(path, parser);
     }
     if (Settings.Instance.BuildVBWrapper)
     {
         new VBCodeBuilder().Execute(path, parser);
     }
 }
コード例 #4
0
        public void ShowPreviewDialog(Form form)
        {
            if (Parser == null)
            {
                Parser = new RibbonParser(XmlRibbonFile);
            }
            SetPreviewUiCulture();
            PreviewForm dialog = new PreviewForm();

            dialog.ShowDialog(form);
            ResetPreviewUiCulture();
        }
コード例 #5
0
        private bool CheckRibbonResource(string path)
        {
            bool   previewEnabled         = false;
            string ribbonResourceFileName = Path.ChangeExtension(path, "ribbon");

            if (File.Exists(ribbonResourceFileName))
            {
                SetRibbonResourceName(ribbonResourceFileName);
                previewEnabled = true;
                if (Parser == null)
                {
                    Parser = new RibbonParser(path);
                }
            }
            return(previewEnabled);
        }