Пример #1
0
        protected override ContextMenuStrip CreateMenu()
        {
            var directoryFilePath = Path.Combine(FolderPath, Env.CommandFileName);
            var globalSettingPath = Path.Combine(Reg.GetAppFolder(), Env.GlobalSettingFileName);

            return(MenuCreator.Create(FolderPath, directoryFilePath, globalSettingPath));
        }
Пример #2
0
        public static void AddParseGlobalCommandInto(this List <ToolStripItem> result, string path, string workingDir)
        {
            try
            {
                var config = Yaml.LoadYaml <GlobalConfig>(path);
                foreach (var entry in config.GlobalCommands)
                {
                    var item = entry.ToMenuItem(workingDir);
                    if (item is ToolStripSeparator)
                    {
                        AddSeparator(result);
                    }
                    else
                    {
                        if (item.Enabled)
                        {
                            result.Add(item);
                        }
                    }
                }
                AddSeparator(result);

                if (config.Functions.CopyPath)
                {
                    result.Add(MenuCreator.GetCopyPathMenuItem(workingDir));
                }
                if (config.Functions.EditGlobal)
                {
                    result.Add(MenuCreator.GetOpenGlobalSettingMenuItem());
                }
            }
            catch (Exception ex)
            {
                Logger.LogException(ex);
                throw;
            }
        }