Example #1
0
 /// <summary>Konstruktor</summary>
 /// <param name="language"></param>
 /// <param name="cuMeasures"></param>
 public frmChangeID(ref ClassLanguage language, ref ClassCADdyMessdaten cuMeasures)
 {
     this.language   = language;
     this.cuMeasures = cuMeasures;
     InitializeComponent();
     setLanguage();
 }
Example #2
0
 /// <summary>Konstruktor</summary>
 /// <param name="language"></param>
 /// <param name="points"></param>
 public frmTranslateCoord(ref ClassLanguage language, ref ClassCADdyPunkte points)
 {
     this.language = language;
     this.points   = points;
     InitializeComponent();
     setLanguage();
 }
Example #3
0
 /// <summary>Konstruktor</summary>
 /// <param name="language"></param>
 /// <param name="points"></param>
 /// <param name="stpks"></param>
 public frmChangeCode(ref ClassLanguage language, ref ClassCADdyPunkte points, ref ClassCADdyMessdaten stpks)
 {
     this.language = language;
     this.points   = points;
     this.stpks    = stpks;
     InitializeComponent();
     setLanguage();
 }
Example #4
0
 /// <summary>Konstruktor</summary>
 /// <param name="language"></param>
 /// <param name="points"></param>
 public frmCompareCoord(ref ClassLanguage language)
 {
     this.language             = language;
     this.displayComparePoints = new BindingSource();
     InitializeComponent();
     setLanguage();
     dgvCompare.DataSource = displayComparePoints;
 }
Example #5
0
 /// <summary>Konstruktor</summary>
 /// <param name="language"></param>
 /// <param name="points"></param>
 public frmTransformCoord(ref ClassLanguage language)
 {
     this.language = language;
     this.displayTransformPoints = new BindingSource();
     InitializeComponent();
     setLanguage();
     dgvTransformation.DataSource          = displayTransformPoints;
     dgvTransformation.AutoGenerateColumns = false;
 }
Example #6
0
        /// <summary>
        /// Parses the final XDocument down into a usable class for automation
        /// </summary>
        /// <param name="xDoc">The XDocument containing all of the prepped data for generation</param>
        /// <param name="lang">The .NET class to output the class as</param>
        private void CreateClass(XDocument xDoc, ClassLanguage lang)
        {
            //determine the filename for the new class file
            string filename = xDoc.Root.Attribute("class").Value;
            //determine where to save the class after creation
            string folderName = CreateFolder(filename);
            //determine which helper class to use with generation
            IClassBuilder classHelper;
            string        extension = string.Empty;

            switch (lang)
            {
            case ClassLanguage.VB:
                classHelper = new VBClassBuilder();
                extension   = ".vb";
                break;

            case ClassLanguage.CSharp:
                classHelper = new CSClassBuilder();
                extension   = ".cs";
                break;

            default:
                classHelper = null;
                extension   = null;
                break;
            }
            //generate the header
            StringBuilder classBuilder = new StringBuilder(classHelper.GenerateHeader(filename, xDoc.Root.Attribute("template").Value));

            //iterate through all the elements and generate their class accessors
            foreach (XElement element in xDoc.Root.Descendants())
            {
                ElementTypes type = (ElementTypes)Enum.Parse(typeof(ElementTypes), (TryGetElementAttribute(element, "type")));
                switch (type)
                {
                case ElementTypes.Click:
                    classBuilder.AppendLine(classHelper.GenerateClick(TryGetElementAttribute(element, "jQuery"), element.Name.LocalName));
                    break;

                case ElementTypes.Select:
                    classBuilder.AppendLine(classHelper.GenerateSelect(TryGetElementAttribute(element, "jQuery"), element.Name.LocalName));
                    break;

                case ElementTypes.Type:
                    classBuilder.AppendLine(classHelper.GenerateType(TryGetElementAttribute(element, "jQuery"), element.Name.LocalName));
                    break;
                }
            }

            //generate the footer
            classBuilder.AppendLine(classHelper.GenerateFooter());

            //output the class file
            File.WriteAllText(String.Concat(folderName, filename, extension), classBuilder.ToString());
        }
Example #7
0
 public ClassTransformation(ClassCADdyPunkte srcPoints, ClassCADdyPunkte dstPoints, ref ClassLanguage language, Int32 decimalsCoord, Int32 decimalsRiwi)
 {
     matchPoints          = new List <ClassTransformPointPair>();
     transfPoints         = new ClassCADdyPunkte(ref language);
     this.decimalsCoord   = decimalsCoord;
     this.decimalsRiwi    = decimalsRiwi;
     this.language        = language;
     this.srcPoints       = srcPoints;
     this.dstPoints       = dstPoints;
     this.usedMatchPoints = new List <String>();
     prepare();
     calcResiduen();
 }
Example #8
0
        internal static void CommandMenuInit()
        {
            StringBuilder sbIniFilePath = new StringBuilder(Win32.MAX_PATH);

            Win32.SendMessage(PluginBase.nppData._nppHandle, (uint)NppMsg.NPPM_GETPLUGINSCONFIGDIR, Win32.MAX_PATH, sbIniFilePath);
            iniFilePath = sbIniFilePath.ToString();
            if (!Directory.Exists(iniFilePath))
            {
                Directory.CreateDirectory(iniFilePath);
            }
            String settingsFilePath = Path.Combine(iniFilePath, PluginName + ".ini");

            Win32.SendMessage(PluginBase.nppData._nppHandle, (uint)NppMsg.NPPM_GETNPPDIRECTORY, Win32.MAX_PATH, sbIniFilePath);
            iniFilePath = sbIniFilePath.ToString();
            String languageFilePath = Path.Combine(iniFilePath, @"plugins\" + PluginName + @"\" + PluginName + "_Lang.ini");

            pluginSettings = new Settings(settingsFilePath);
            pluginSettings.load();
            pluginLanguage = new ClassLanguage(languageFilePath);

            cADdyPoints    = new ClassCADdyPunkte(ref pluginLanguage);
            cADdyMessdaten = new ClassCADdyMessdaten(ref pluginLanguage);


            PluginBase.SetCommand((int)CADdyToolsMenuId.Menue_Coord, pluginLanguage.getLanguageText("Menue_Coord"), dummy);
            PluginBase.SetCommand((int)CADdyToolsMenuId.Menue_Coord_FormCADdy, pluginLanguage.getLanguageText("Menue_Coord_FormCADdy"), formatCADdyKoord, new ShortcutKey(false, false, false, Keys.None));
            PluginBase.SetCommand((int)CADdyToolsMenuId.Menue_Coord_FormExcel, pluginLanguage.getLanguageText("Menue_Coord_FormExcel"), formatExcelKoord, new ShortcutKey(false, false, false, Keys.None));
            PluginBase.SetCommand((int)CADdyToolsMenuId.Menue_Coord_Sort, pluginLanguage.getLanguageText("Menue_Coord_Sort"), dummy);
            PluginBase.SetCommand((int)CADdyToolsMenuId.Menue_Coord_SortCol1, pluginLanguage.getLanguageText("Menue_Coord_SortCol1"), sortByNumber, new ShortcutKey(false, false, false, Keys.None));
            PluginBase.SetCommand((int)CADdyToolsMenuId.Menue_Coord_SortCol2, pluginLanguage.getLanguageText("Menue_Coord_SortCol2"), sortByEast, new ShortcutKey(false, false, false, Keys.None));
            PluginBase.SetCommand((int)CADdyToolsMenuId.Menue_Coord_SortCol3, pluginLanguage.getLanguageText("Menue_Coord_SortCol3"), sortByNorth, new ShortcutKey(false, false, false, Keys.None));
            PluginBase.SetCommand((int)CADdyToolsMenuId.Menue_Coord_SortCol4, pluginLanguage.getLanguageText("Menue_Coord_SortCol4"), sortByElev, new ShortcutKey(false, false, false, Keys.None));
            PluginBase.SetCommand((int)CADdyToolsMenuId.Menue_Coord_SortCol5, pluginLanguage.getLanguageText("Menue_Coord_SortCol5"), sortByCode, new ShortcutKey(false, false, false, Keys.None));
            PluginBase.SetCommand((int)CADdyToolsMenuId.Menue_Coord_Rotation, pluginLanguage.getLanguageText("Menue_Coord_Rotation"), rotateCoordDialog, new ShortcutKey(false, false, false, Keys.None));
            PluginBase.SetCommand((int)CADdyToolsMenuId.Menue_Coord_Translation, pluginLanguage.getLanguageText("Menue_Coord_Translation"), translateCoordDialog, new ShortcutKey(false, false, false, Keys.None));
            PluginBase.SetCommand((int)CADdyToolsMenuId.Menue_Coord_Transformation, pluginLanguage.getLanguageText("Menue_Coord_Transformation"), transformationCoordDialog, new ShortcutKey(false, false, false, Keys.None));
            PluginBase.SetCommand((int)CADdyToolsMenuId.Menue_Coord_Polar, pluginLanguage.getLanguageText("Menue_Coord_Polar"), polarCoordDialog, new ShortcutKey(false, false, false, Keys.None));
            PluginBase.SetCommand((int)CADdyToolsMenuId.Menue_Coord_Compare, pluginLanguage.getLanguageText("Menue_Coord_Compare"), compareCoordDialog, new ShortcutKey(false, false, false, Keys.None));
            PluginBase.SetCommand((int)CADdyToolsMenuId.Menue_Dummy_1, "----", null);
            PluginBase.SetCommand((int)CADdyToolsMenuId.Menue_Measure, pluginLanguage.getLanguageText("Menue_Measure"), dummy);
            PluginBase.SetCommand((int)CADdyToolsMenuId.Menue_Measure_FormCADdy, pluginLanguage.getLanguageText("Menue_Measure_FormCADdy"), formatCADdyMessaten, new ShortcutKey(false, false, false, Keys.None));
            PluginBase.SetCommand((int)CADdyToolsMenuId.Menue_Measure_FormExcel, pluginLanguage.getLanguageText("Menue_Measure_FormExcel"), formatExcelMessaten, new ShortcutKey(false, false, false, Keys.None));
            PluginBase.SetCommand((int)CADdyToolsMenuId.Menue_Measure_FormCAPLAN, pluginLanguage.getLanguageText("Menue_Measure_FormCAPLAN"), formatCAPLANMessaten, new ShortcutKey(false, false, false, Keys.None));
            PluginBase.SetCommand((int)CADdyToolsMenuId.Menue_Measure_SetID, pluginLanguage.getLanguageText("Menue_Measure_SetID"), changeIDDialog);
            PluginBase.SetCommand((int)CADdyToolsMenuId.Menue_Dummy_2, "----", null);
            PluginBase.SetCommand((int)CADdyToolsMenuId.Menue_MeasCode, pluginLanguage.getLanguageText("Menue_MeasCode"), dummy);
            PluginBase.SetCommand((int)CADdyToolsMenuId.Menue_ChangeCode, pluginLanguage.getLanguageText("Menue_ChangeCode"), changeCodeDialog);
            PluginBase.SetCommand((int)CADdyToolsMenuId.Menue_Dummy_3, "----", null);
            PluginBase.SetCommand((int)CADdyToolsMenuId.Menue_Settings, pluginLanguage.getLanguageText("Menue_Settings"), settingsDialog);
            PluginBase.SetCommand((int)CADdyToolsMenuId.About, "About ...", aboutDialog);
        }
Example #9
0
        public void Update(ClassDTO classDTO)
        {
            ClassEntity   classEntity   = _classRepository.Read().Include(x => x.Languages).FirstOrDefault(x => x.Id == classDTO.Id);
            ClassLanguage classLanguage = _classLanguageRepository.Read().FirstOrDefault(x => x.ClassId == classDTO.Id);


            classEntity   = _mapper.Map <ClassEntity>(classDTO);
            classLanguage = _mapper.Map <ClassLanguage>(classDTO);

            _unitOfWork.BeginTransaction();
            _classRepository.Update(classEntity, classEntity.Id);
            _classLanguageRepository.Update(classLanguage, classLanguage.Id);
            _unitOfWork.SaveChanges();
            _unitOfWork.Commit();
        }
Example #10
0
        public void Add(ClassDTO classDTO)
        {
            ClassEntity   classEntity   = new ClassEntity();
            ClassLanguage classLanguage = new ClassLanguage();

            classEntity   = _mapper.Map <ClassEntity>(classDTO);
            classLanguage = _mapper.Map <ClassLanguage>(classDTO);

            classEntity.Languages.Add(classLanguage);

            _unitOfWork.BeginTransaction();
            _classRepository.Create(classEntity);

            _unitOfWork.SaveChanges();
            _unitOfWork.Commit();
        }
Example #11
0
        /// <summary>
        /// Does the heavy lifting and goes through the entire keyword class generation process
        /// from web-site to file creation
        /// </summary>
        /// <param name="className">The className to use for the generated file</param>
        /// <param name="language">The language type to generate the class as</param>
        public void Generate(string className, ClassLanguage language)
        {
            //ensure the driver has been created
            if (_driver == null)
            {
                throw new NullReferenceException("The Driver instance is null.  Please use Initialize first");
            }
            XDocument xDoc = new XDocument();

            //inject the htmlasxml script and fetch the returned xml-compatible string
            IJavaScriptExecutor js = (IJavaScriptExecutor)_driver;

            js.ExecuteScript(Properties.Resources.HtmlToXml);
            //give the script a second to load
            System.Threading.Thread.Sleep(1000);
            xDoc = XDocument.Parse((string)js.ExecuteScript("return HtmlAsXml.toXmlString();"));

            //return a filtered list of elements to process with their respective type
            Dictionary <IEnumerable <XElement>, ElementTypes> filteredElements = FilterUsableElements(xDoc);

            //parse the elements into usable info
            xDoc = new XDocument();
            xDoc.AddFirst(new XElement("root"));
            xDoc.Root.SetAttributeValue("class", className);
            //finalXDoc.Root.SetAttributeValue("template", "NOT YET IMPLEMENTED");
            xDoc.Root.SetAttributeValue("template", "");
            foreach (KeyValuePair <IEnumerable <XElement>, ElementTypes> entry in filteredElements)
            {
                ParseElements(entry.Key, entry.Value);
            }
            //iterate on our final collection of items and wrap the jQuery selector for printing
            foreach (KeyValuePair <Tuple <string, string>, XElement> kvp in _itemDict)
            {
                XElement element = kvp.Value;
                element.SetAttributeValue("jQuery", WrapJquery(element.Attribute("jQuery").Value));
                xDoc.Root.Add(element);
            }

            //create the class file
            CreateClass(xDoc, language);
        }
Example #12
0
 /// <summary>Constructor</summary>
 /// <param name="language"></param>
 public ClassCADdyPunkte(ref ClassLanguage language)
 {
     this.language = language;
     punkte        = new List <ClassCADdyPunkt>();
 }
Example #13
0
 public ClassCADdyMessdaten(ref ClassLanguage language)
 {
     this.language = language;
     standpunkte   = new List <ClassCADdyStandpunkt>();
 }
Example #14
0
 /// <summary>Konstruktor</summary>
 /// <param name="language"></param>
 public frmCADdyToolsSettings(ref ClassLanguage language)
 {
     this.language = language;
     InitializeComponent();
     setLanguage();
 }