Esempio n. 1
0
        static void Main(string[] args)
        {
            Aspose.Words.License Wlicense = new Aspose.Words.License();
            Wlicense.SetLicense("CoolTool.Aspose.Total.lic");
            Aspose.Cells.License XLlicense = new Aspose.Cells.License();
            XLlicense.SetLicense("CoolTool.Aspose.Total.lic");
            Aspose.Pdf.License Plicense = new Aspose.Pdf.License();
            Plicense.SetLicense("CoolTool.Aspose.Total.lic");

            if (client == Client.Edimart)
            {
                grids.Add("Vendor grid", new int[] { 15, 15, 5, 15, 30, 70, 100, 100, 100 });
                grids.Add("Ügyfél grid", new int[] { 30, 30, 20, 30, 50, 70, 100, 100, 100 });
            }
            else if (client == Client.Afford)
            {
                grids.Add("Vendor grid", new int[] { 0, 10, 10, 10, 25, 40, 65, 100, 100 });
                grids.Add("Ügyfél grid", new int[] { 0, 30, 30, 30, 45, 45, 75, 100, 100 });
            }

            LanguageHelper.Initialize();

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            mainWindow = new MainWindow();

            Application.Run(mainWindow);
        }
Esempio n. 2
0
        private void getMergeTMlist()
        {
            LanguageHelper.Initialize();

            TMListResponse[] TMlist = RAPI_Session.generateTMlist();
            Dictionary <string[], ClientTMs> TMGroups       = new Dictionary <string[], ClientTMs>();
            Dictionary <string[], ClientTMs> sortedTMGroups = new Dictionary <string[], ClientTMs>();

            Program.mainWindow.updateProgress(25);

            foreach (TMListResponse tm in TMlist)
            {
                if (tm.Client.Length > 0 && (client == "***All***" || tm.Client == client))
                {
                    string[] newid   = new string[] { tm.Client, tm.SourceLangCode, tm.TargetLangCode };
                    string[] existID = null;

                    foreach (string[] id in TMGroups.Keys)
                    {
                        if (tm.Client == TMGroups[id].client && tm.SourceLangCode == TMGroups[id].sLang && tm.TargetLangCode == TMGroups[id].tLang)
                        {
                            existID = id;
                        }
                    }

                    if (existID == null)
                    {
                        ClientTMs newGroup = new ClientTMs(newid);
                        TMGroups.Add(newid, newGroup);
                        TMGroups[newid].TMlist.Add(tm);
                    }
                    else
                    {
                        TMGroups[existID].TMlist.Add(tm);
                    }
                }
            }

            Program.mainWindow.updateProgress(50);

            IOrderedEnumerable <KeyValuePair <string[], ClientTMs> > linqGroups = from clientTMgroup in TMGroups
                                                                                  orderby clientTMgroup.Key[0], clientTMgroup.Key[1], clientTMgroup.Key[2] ascending
            select clientTMgroup;


            Worksheet ws;
            Workbook  wb = new Workbook();
            string    wsName = "TM list";

            if (wb.Worksheets.Count == 0)
            {
                ws = wb.Worksheets.Add(wsName);
            }
            else
            {
                ws      = wb.Worksheets[0];
                ws.Name = wsName;
            }

            WriteHeader(ref ws);

            int rowCount = 0;

            Program.mainWindow.updateProgress(75);

            foreach (KeyValuePair <string[], ClientTMs> kvp in linqGroups)
            {
                sortedTMGroups.Add(kvp.Key, kvp.Value);
            }

            foreach (string[] id in sortedTMGroups.Keys)
            {
                if (sortedTMGroups[id].TMlist.Count > 0)
                {
                    rowCount++;
                    Cell c = ws.Cells[rowCount, 0];
                    c.Value = sortedTMGroups[id].client + " (" + sortedTMGroups[id].sLang + " > " + sortedTMGroups[id].tLang + ")";
                    Helper.AddFontColor(c, Color.Purple);

                    rowCount++;

                    sortedTMGroups[id].findMasterTM();

                    TMListResponse tm = sortedTMGroups[id].getMasterTM();
                    WriteTM(tm, ref ws, rowCount);
                    FormatLine(tm, rowCount, ref ws);

                    rowCount++;

                    TMListResponse[] resultList = sortedTMGroups[id].getOtherTM();
                    foreach (TMListResponse tmn in resultList)
                    {
                        WriteTM(tmn, ref ws, rowCount);
                        FormatLine(tmn, rowCount, ref ws);
                        rowCount++;
                    }
                }
            }

            Helper.autoFitColumns(ref ws);
            wb.Save(exportFile);
            Program.mainWindow.updateProgress(100);
        }